KWSys 2014-12-23 (5a15cb3b)

Extract upstream KWSys using the following shell commands.

$ git archive --prefix=upstream-kwsys/ 5a15cb3b | tar x
$ git shortlog --no-merges --abbrev=8 --format='%h %s' 87c65319..5a15cb3b
Brad King (1):
      5a15cb3b Base64: Use size_t for lenghts in API

Change-Id: I09a2c5d6b67280f96d580c7b26bf8b2aa0bdb709
This commit is contained in:
KWSys Robot 2014-12-23 04:22:43 -05:00 committed by Brad King
parent 1f7de54346
commit 6ed23ff4e9
2 changed files with 22 additions and 20 deletions

View File

@ -115,10 +115,10 @@ void kwsysBase64_Encode1(const unsigned char *src, unsigned char *dest)
actually knowing how much data to expect (if the input is not a multiple of actually knowing how much data to expect (if the input is not a multiple of
3 bytes then the extra padding needed to complete the encode 4 bytes will 3 bytes then the extra padding needed to complete the encode 4 bytes will
stop the decoding anyway). */ stop the decoding anyway). */
unsigned long kwsysBase64_Encode(const unsigned char *input, size_t kwsysBase64_Encode(const unsigned char *input,
unsigned long length, size_t length,
unsigned char *output, unsigned char *output,
int mark_end) int mark_end)
{ {
const unsigned char *ptr = input; const unsigned char *ptr = input;
const unsigned char *end = input + length; const unsigned char *end = input + length;
@ -157,7 +157,7 @@ unsigned long kwsysBase64_Encode(const unsigned char *input,
optr += 4; optr += 4;
} }
return (unsigned long)(optr - output); return (size_t)(optr - output);
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -207,10 +207,10 @@ int kwsysBase64_Decode3(const unsigned char *src, unsigned char *dest)
'length' parameter is ignored. This enables the caller to decode a stream 'length' parameter is ignored. This enables the caller to decode a stream
without actually knowing how much decoded data to expect (of course, the without actually knowing how much decoded data to expect (of course, the
buffer must be large enough). */ buffer must be large enough). */
unsigned long kwsysBase64_Decode(const unsigned char *input, size_t kwsysBase64_Decode(const unsigned char *input,
unsigned long length, size_t length,
unsigned char *output, unsigned char *output,
unsigned long max_input_length) size_t max_input_length)
{ {
const unsigned char *ptr = input; const unsigned char *ptr = input;
unsigned char *optr = output; unsigned char *optr = output;
@ -226,7 +226,7 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
optr += len; optr += len;
if(len < 3) if(len < 3)
{ {
return (unsigned long)(optr - output); return (size_t)(optr - output);
} }
ptr += 4; ptr += 4;
} }
@ -240,7 +240,7 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
optr += len; optr += len;
if(len < 3) if(len < 3)
{ {
return (unsigned long)(optr - output); return (size_t)(optr - output);
} }
ptr += 4; ptr += 4;
} }
@ -275,5 +275,5 @@ unsigned long kwsysBase64_Decode(const unsigned char *input,
} }
} }
return (unsigned long)(optr - output); return (size_t)(optr - output);
} }

View File

@ -14,6 +14,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <stddef.h> /* size_t */
/* Redefine all public interface symbol names to be in the proper /* Redefine all public interface symbol names to be in the proper
namespace. These macros are used internally to kwsys only, and are namespace. These macros are used internally to kwsys only, and are
not visible to user code. Use kwsysHeaderDump.pl to reproduce not visible to user code. Use kwsysHeaderDump.pl to reproduce
@ -68,10 +70,10 @@ kwsysEXPORT void kwsysBase64_Encode1(const unsigned char *src,
* the extra padding needed to complete the encode 4 bytes will stop * the extra padding needed to complete the encode 4 bytes will stop
* the decoding anyway). * the decoding anyway).
*/ */
kwsysEXPORT unsigned long kwsysBase64_Encode(const unsigned char *input, kwsysEXPORT size_t kwsysBase64_Encode(const unsigned char *input,
unsigned long length, size_t length,
unsigned char *output, unsigned char *output,
int mark_end); int mark_end);
/** /**
* Decode 4 bytes into a 3 byte string. Returns the number of bytes * Decode 4 bytes into a 3 byte string. Returns the number of bytes
@ -92,10 +94,10 @@ kwsysEXPORT int kwsysBase64_Decode3(const unsigned char *src,
* much decoded data to expect (of course, the buffer must be large * much decoded data to expect (of course, the buffer must be large
* enough). * enough).
*/ */
kwsysEXPORT unsigned long kwsysBase64_Decode(const unsigned char *input, kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char *input,
unsigned long length, size_t length,
unsigned char *output, unsigned char *output,
unsigned long max_input_length); size_t max_input_length);
#if defined(__cplusplus) #if defined(__cplusplus)
} /* extern "C" */ } /* extern "C" */