curl-library
Re: external access to the curl base64 functions
Date: Fri, 27 Sep 2002 11:00:04 +0200 (MET DST)
On Fri, 27 Sep 2002, Andrew Francis wrote:
> The functions Curl_base64_encode and Curl_base64_decode (lib/base64.c) are
> not declared in curl.h. They are also not exported from the Windows DLL
> (see lib/libcurl.def).
Right, and in the internal curl naming convention this can be seen by the
fact that they use uppercase 'C' in the names.
> I think that these are useful routines, and AFAIK they are always in the
> library, regardless of configuration options.
They are, yes.
> I think it would be a good idea to make them available to the application
> using libcurl.
Well, it would of course mean a very little extra cost for libcurl, since
they're already present.
But... exporting them to others will require a sensible API that people like
and understands. The current one really has more or less ended up as it is by
accident, as can be seen by how they work right now:
int Curl_base64_encode(char *orig, int origlength, char **resulptr)
Returns the length, with the encoded string being allocated and pointed to
by *resultptr. Orig and origlength sets what to encode and how long.
This requires that the caller free()s the memory after use.
int Curl_base64_decode(char *orig, char *result)
Returns the lenght of the resulting decoded data. Converts the 'orig'
string and writes the result to the 'result' buffer that needs to be big
ennough to fit it.
They don't seem really fit to throw on the innocent public in this state.
Any suggestions?
-- Daniel Stenberg -- curl related mails on curl related mailing lists please ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sfReceived on 2002-09-27