aboutsummaryrefslogtreecommitdiffstats
path: root/snprintf.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-08-07 23:05:43 +0000
committerGuy Harris <guy@alum.mit.edu>2000-08-07 23:05:43 +0000
commitd9b5291990b5ba2ba45aa546cc2a1435d5926ade (patch)
tree28a6896fe3974a7553cea11744bff871cabc745a /snprintf.c
parent7b4e1a3742232f05961b39bfffd4e2a26354fc09 (diff)
Cast arguments to "isxdigit()", "isdigit()", and "isflag()" to "unsigned
char" so that if it has the 8th bit set it won't get sign-extended; this squelches a GCC complaint. svn path=/trunk/; revision=2223
Diffstat (limited to 'snprintf.c')
-rw-r--r--snprintf.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/snprintf.c b/snprintf.c
index 13cc4a3047..0bd8aa95ac 100644
--- a/snprintf.c
+++ b/snprintf.c
@@ -201,7 +201,7 @@ char ** fract;
fp = integral(number, &ip);
ch = (int)((fp + PRECISION)*base); /* force to round */
integral_part[i] = (ch <= 9) ? ch + '0' : ch + 'a' - 10;
- if (! isxdigit(integral_part[i])) /* bail out overflow !! */
+ if (! isxdigit((unsigned char)integral_part[i])) /* bail out overflow !! */
break;
number = ip;
}
@@ -225,7 +225,7 @@ char ** fract;
/* the fractionnal part */
for (i=0, fp=fraction; precision > 0 && i < MAX_FRACT ; i++, precision-- ) {
fraction_part[i] = (int)((fp + PRECISION)*10. + '0');
- if (! isdigit(fraction_part[i])) /* underflow ? */
+ if (! isdigit((unsigned char)fraction_part[i])) /* underflow ? */
break;
fp = (fp*10.0) - (double)(long)((fp + PRECISION)*10.);
}
@@ -474,7 +474,7 @@ struct DATA * p;
case '1': case '2': case '3':
case '4': case '5': case '6':
case '7': case '8': case '9': /* gob all the digits */
- for (i = 0; isdigit(*s); i++, s++)
+ for (i = 0; isdigit((unsigned char)*s); i++, s++)
if (i < MAX_FIELD/2 - 1)
number[i] = *s;
number[i] = '\0';
@@ -621,7 +621,7 @@ va_list args;
case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
/* initialize width and precision */
- for (i = 0; isflag(*data.pf); i++, data.pf++)
+ for (i = 0; isflag((unsigned char)*data.pf); i++, data.pf++)
if (i < MAX_FIELD - 1)
conv_field[i] = *data.pf;
conv_field[i] = '\0';