diff --git a/lib/base64.c b/lib/base64.c index 852e62bd3..54b53982e 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -98,7 +98,8 @@ static void base64Decode(unsigned char *dest, char *src, int *rawLength) } decodeQuantum(lastQuantum, src); - for(i = 0; i < 3 - equalsTerm; i++) dest[i] = lastQuantum[i]; + for(i = 0; i < 3 - equalsTerm; i++) + dest[i] = lastQuantum[i]; } @@ -198,20 +199,21 @@ int Curl_base64_decode(const char *str, void *data) #define TEST_NEED_SUCK void *suck(int *); -int main(int argc, char **argv, char **envp) { - char *base64; - int base64Len; - unsigned char *data; - int dataLen; +int main(int argc, char **argv, char **envp) +{ + char *base64; + int base64Len; + unsigned char *data; + int dataLen; - data = (unsigned char *)suck(&dataLen); - base64Len = Curl_base64_encode(data, dataLen, &base64); + data = (unsigned char *)suck(&dataLen); + base64Len = Curl_base64_encode(data, dataLen, &base64); - fprintf(stderr, "%d\n", base64Len); - fprintf(stdout, "%s", base64); - - free(base64); free(data); - return 0; + fprintf(stderr, "%d\n", base64Len); + fprintf(stdout, "%s", base64); + + free(base64); free(data); + return 0; } #endif @@ -224,47 +226,47 @@ int main(int argc, char **argv, char **envp) { #define TEST_NEED_SUCK void *suck(int *); -int main(int argc, char **argv, char **envp) { - char *base64; - int base64Len; - unsigned char *data; - int dataLen; +int main(int argc, char **argv, char **envp) +{ + char *base64; + int base64Len; + unsigned char *data; + int dataLen; - base64 = (char *)suck(&base64Len); - data = (unsigned char *)malloc(base64Len * 3/4 + 8); - dataLen = Curl_base64_decode(base64, data); - - fprintf(stderr, "%d\n", dataLen); - fwrite(data,1,dataLen,stdout); - - - free(base64); free(data); - return 0; + base64 = (char *)suck(&base64Len); + data = (unsigned char *)malloc(base64Len * 3/4 + 8); + dataLen = Curl_base64_decode(base64, data); + + fprintf(stderr, "%d\n", dataLen); + fwrite(data,1,dataLen,stdout); + + free(base64); free(data); + return 0; } #endif #ifdef TEST_NEED_SUCK /* this function 'sucks' in as much as possible from stdin */ -void *suck(int *lenptr) { - int cursize = 8192; - unsigned char *buf = NULL; - int lastread; - int len = 0; +void *suck(int *lenptr) +{ + int cursize = 8192; + unsigned char *buf = NULL; + int lastread; + int len = 0; - do { - cursize *= 2; - buf = (unsigned char *)realloc(buf, cursize); - memset(buf + len, 0, cursize - len); - lastread = fread(buf + len, 1, cursize - len, stdin); - len += lastread; - } while(!feof(stdin)); - - lenptr[0] = len; - return (void *)buf; + do { + cursize *= 2; + buf = (unsigned char *)realloc(buf, cursize); + memset(buf + len, 0, cursize - len); + lastread = fread(buf + len, 1, cursize - len, stdin); + len += lastread; + } while(!feof(stdin)); + + lenptr[0] = len; + return (void *)buf; } #endif - /* * local variables: * eval: (load-file "../curl-mode.el")