[Pidgin] #7794: purple_url_encode does not work if called more than once in a given thread
Pidgin
trac at pidgin.im
Mon Dec 15 10:24:46 EST 2008
#7794: purple_url_encode does not work if called more than once in a given thread
--------------------+-------------------------------------------------------
Reporter: pgillis | Type: defect
Status: new | Component: libpurple
Version: 2.5.2 | Keywords: purple_url_encode
--------------------+-------------------------------------------------------
When you make a call to purple_url_encode, the first time everything works
fine. If you make a subsequent call, you get back the same value as the
first call, regardless of the string passed in. In looking at the source,
this is because it is using a static char array that is only getting set
once. I can think of two solutions:
1. Change the signature to accept a char array as a parameter to store the
result. The caller handles the allocation.
2. Behave similar to purple_base64_encode, allocate a new char array and
make the caller take care of it's disposal.
Either one works for me, I personally like number 2 because it doesn't
"break" the API, just causes memory to leak.
I am not an expert in C, so I don't have a preference to either of these,
just need the function to work on multiple calls. Thanks...
Pete
--
Ticket URL: <http://developer.pidgin.im/ticket/7794>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list