diff options
Diffstat (limited to 'Utilities/cmcurl/lib/mprintf.c')
-rw-r--r-- | Utilities/cmcurl/lib/mprintf.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/Utilities/cmcurl/lib/mprintf.c b/Utilities/cmcurl/lib/mprintf.c index eb7ee0c..d2d91d7 100644 --- a/Utilities/cmcurl/lib/mprintf.c +++ b/Utilities/cmcurl/lib/mprintf.c @@ -46,10 +46,6 @@ * If SIZEOF_SIZE_T has not been defined, default to the size of long. */ -#ifndef SIZEOF_SIZE_T -# define SIZEOF_SIZE_T CURL_SIZEOF_LONG -#endif - #ifdef HAVE_LONGLONG # define LONG_LONG_TYPE long long # define HAVE_LONG_LONG_TYPE @@ -111,7 +107,7 @@ static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } WHILE_FALSE /* Data type to read from the arglist */ -typedef enum { +typedef enum { FORMAT_UNKNOWN = 0, FORMAT_STRING, FORMAT_PTR, @@ -181,7 +177,7 @@ struct asprintf { static long dprintf_DollarString(char *input, char **end) { - int number=0; + int number = 0; while(ISDIGIT(*input)) { number *= 10; number += *input-'0'; @@ -237,7 +233,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, long width; long precision; int flags; - long max_param=0; + long max_param = 0; long i; while(*fmt) { @@ -326,7 +322,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, break; #if defined(MP_HAVE_INT_EXTENSIONS) case 'I': -#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG) flags |= FLAGS_LONGLONG; #else flags |= FLAGS_LONG; @@ -348,14 +344,14 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, case 'z': /* the code below generates a warning if -Wunreachable-code is used */ -#if (SIZEOF_SIZE_T > CURL_SIZEOF_LONG) +#if (SIZEOF_SIZE_T > SIZEOF_LONG) flags |= FLAGS_LONGLONG; #else flags |= FLAGS_LONG; #endif break; case 'O': -#if (CURL_SIZEOF_CURL_OFF_T > CURL_SIZEOF_LONG) +#if (SIZEOF_CURL_OFF_T > SIZEOF_LONG) flags |= FLAGS_LONGLONG; #else flags |= FLAGS_LONG; @@ -380,7 +376,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, else width = param_num; if(width > max_param) - max_param=width; + max_param = width; break; default: break; @@ -486,7 +482,7 @@ static int dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos, } /* Read the arg list parameters into our data list */ - for(i=0; i<max_param; i++) { + for(i = 0; i<max_param; i++) { /* Width/precision arguments must be read before the main argument they are attached to */ if(vto[i].flags & FLAGS_WIDTHPARAM) { @@ -573,7 +569,7 @@ static int dprintf_formatf( int done = 0; long param; /* current parameter to read */ - long param_num=0; /* parameter counter */ + long param_num = 0; /* parameter counter */ va_stack_t vto[MAX_PARAMETERS]; char *endpos[MAX_PARAMETERS]; @@ -643,7 +639,7 @@ static int dprintf_formatf( /* If this is a positional parameter, the position must follow immediately after the %, thus create a %<num>$ sequence */ - param=dprintf_DollarString(f, &f); + param = dprintf_DollarString(f, &f); if(!param) param = param_num; @@ -952,7 +948,7 @@ static int dprintf_formatf( output characters */ (sprintf)(work, formatbuf, p->data.dnum); DEBUGASSERT(strlen(work) <= sizeof(work)); - for(fptr=work; *fptr; fptr++) + for(fptr = work; *fptr; fptr++) OUTCHAR(*fptr); } break; @@ -984,7 +980,7 @@ static int dprintf_formatf( /* fputc() look-alike */ static int addbyter(int output, FILE *data) { - struct nsprintf *infop=(struct nsprintf *)data; + struct nsprintf *infop = (struct nsprintf *)data; unsigned char outc = (unsigned char)output; if(infop->length < infop->max) { @@ -1032,7 +1028,7 @@ int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...) /* fputc() look-alike */ static int alloc_addbyter(int output, FILE *data) { - struct asprintf *infop=(struct asprintf *)data; + struct asprintf *infop = (struct asprintf *)data; unsigned char outc = (unsigned char)output; if(!infop->buffer) { @@ -1042,9 +1038,9 @@ static int alloc_addbyter(int output, FILE *data) return -1; /* fail */ } infop->alloc = 32; - infop->len =0; + infop->len = 0; } - else if(infop->len+1 >= infop->alloc) { + else if(infop->len + 1 >= infop->alloc) { char *newptr = NULL; size_t newsize = infop->alloc*2; @@ -1133,7 +1129,7 @@ int curl_msprintf(char *buffer, const char *format, ...) va_start(ap_save, format); retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); va_end(ap_save); - *buffer=0; /* we terminate this with a zero byte */ + *buffer = 0; /* we terminate this with a zero byte */ return retcode; } @@ -1162,7 +1158,7 @@ int curl_mvsprintf(char *buffer, const char *format, va_list ap_save) { int retcode; retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); - *buffer=0; /* we terminate this with a zero byte */ + *buffer = 0; /* we terminate this with a zero byte */ return retcode; } |