From d9ffd2f54435d92dca3d7b689f2b18a19acb6a4c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 8 Mar 2004 11:28:14 +0000 Subject: don't use 'register' make strtol() returns get stored in long variables don't mix size_t with int --- lib/mprintf.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/mprintf.c b/lib/mprintf.c index 60584b4e6..3b06ab5ab 100644 --- a/lib/mprintf.c +++ b/lib/mprintf.c @@ -152,7 +152,7 @@ struct asprintf { int curl_msprintf(char *buffer, const char *format, ...); -static int dprintf_DollarString(char *input, char **end) +static long dprintf_DollarString(char *input, char **end) { int number=0; while(isdigit((int)*input)) { @@ -285,12 +285,12 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a { char *fmt = format; int param_num = 0; - int this_param; - int width; - int precision; + long this_param; + long width; + long precision; int flags; - int max_param=0; - int i; + long max_param=0; + long i; while (*fmt) { if (*fmt++ == '%') { @@ -461,13 +461,21 @@ static int dprintf_Pass1(char *format, va_stack_t *vto, char **endpos, va_list a case 'f': vto[i].type = FORMAT_DOUBLE; break; - case 'e': case 'E': + case 'e': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATE; + break; + case 'E': vto[i].type = FORMAT_DOUBLE; - flags |= FLAGS_FLOATE| (('E' == *fmt)?FLAGS_UPPER:0); + flags |= FLAGS_FLOATE|FLAGS_UPPER; break; - case 'g': case 'G': + case 'g': + vto[i].type = FORMAT_DOUBLE; + flags |= FLAGS_FLOATG; + break; + case 'G': vto[i].type = FORMAT_DOUBLE; - flags |= FLAGS_FLOATG| (('G' == *fmt)?FLAGS_UPPER:0); + flags |= FLAGS_FLOATG|FLAGS_UPPER; break; default: vto[i].type = FORMAT_UNKNOWN; @@ -580,7 +588,7 @@ static int dprintf_formatf( char *f; /* Number of characters written. */ - register size_t done = 0; + int done = 0; long param; /* current parameter to read */ long param_num=0; /* parameter counter */ @@ -734,7 +742,7 @@ static int dprintf_formatf( /* Number of base BASE. */ { char *workend = &work[sizeof(work) - 1]; - register char *w; + char *w; /* Supply a default precision if none was given. */ if (prec == -1) @@ -863,7 +871,7 @@ static int dprintf_formatf( else { /* Write "(nil)" for a nil pointer. */ static char strnil[] = "(nil)"; - register char *point; + char *point; width -= sizeof(strnil) - 1; if (p->flags & FLAGS_LEFT) -- cgit v1.2.3