diff options
author | Yang Tse <yangsita@gmail.com> | 2011-08-24 08:07:36 +0200 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2011-08-24 08:10:30 +0200 |
commit | fd00b382b2d33ef90c6f5c840a32b66c8ceb1662 (patch) | |
tree | e95c73f96e5b4e67059326823e68ce78fc6f300b /lib/warnless.c | |
parent | cce6508242ab73cca896788ad9f968b89e5f9f3a (diff) | |
download | curl-fd00b382b2d33ef90c6f5c840a32b66c8ceb1662.tar.gz |
base64: fix Curl_base64_encode and Curl_base64_decode interfaces
Previous interfaces for these libcurl internal functions did not allow to tell
apart a legitimate zero size result from an error condition. These functions
now return a CURLcode indicating function success or otherwise specific error.
Output size is returned using a pointer argument.
All usage of these two functions, and others closely related, has been adapted
to the new interfaces. Relative error and OOM handling adapted or added where
missing. Unit test 1302 also adapted.
Diffstat (limited to 'lib/warnless.c')
-rw-r--r-- | lib/warnless.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/warnless.c b/lib/warnless.c index 37d15ce87..0f5fb5f4d 100644 --- a/lib/warnless.c +++ b/lib/warnless.c @@ -268,6 +268,25 @@ size_t curlx_sotouz(curl_off_t sonum) #endif } +/* +** signed int to unsigned size_t +*/ + +size_t curlx_sitouz(int sinum) +{ +#ifdef __INTEL_COMPILER +# pragma warning(push) +# pragma warning(disable:810) /* conversion may lose significant bits */ +#endif + + DEBUGASSERT(sinum >= 0); + return (size_t) sinum; + +#ifdef __INTEL_COMPILER +# pragma warning(pop) +#endif +} + #if defined(__INTEL_COMPILER) && defined(__unix__) int curlx_FD_ISSET(int fd, fd_set *fdset) |