2010-10-27 Maurice Baijens <maurice.baijens@ellips.nl>

* libc/stdlib/strtol.c: Make sure signed characters are not
        sign-extended when converted to int and passed to ctype macros.
        * libc/stdlib/strtoul.c: Ditto.
        * libc/stdlib/strtoll_r.c: Ditto.
        * libc/stdlib/strtoull_r.c: Ditto.
This commit is contained in:
Jeff Johnston 2010-10-27 19:06:10 +00:00
parent 3e38e8abf7
commit 9ef039777b
5 changed files with 16 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2010-10-27 Maurice Baijens <maurice.baijens@ellips.nl>
* libc/stdlib/strtol.c: Make sure signed characters are not
sign-extended when converted to int and passed to ctype macros.
* libc/stdlib/strtoul.c: Ditto.
* libc/stdlib/strtoll_r.c: Ditto.
* libc/stdlib/strtoull_r.c: Ditto.
2010-10-18 Marco Atzeri <marco_atzeri@yahoo.it> 2010-10-18 Marco Atzeri <marco_atzeri@yahoo.it>
* libm/Makefile.am: added complex functions documentation * libm/Makefile.am: added complex functions documentation

View File

@ -137,7 +137,7 @@ _DEFUN (_strtol_r, (rptr, nptr, endptr, base),
char **endptr _AND char **endptr _AND
int base) int base)
{ {
register const char *s = nptr; register const unsigned char *s = (const unsigned char *)nptr;
register unsigned long acc; register unsigned long acc;
register int c; register int c;
register unsigned long cutoff; register unsigned long cutoff;
@ -208,7 +208,7 @@ _DEFUN (_strtol_r, (rptr, nptr, endptr, base),
} else if (neg) } else if (neg)
acc = -acc; acc = -acc;
if (endptr != 0) if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr); *endptr = (char *) (any ? (char *)s - 1 : nptr);
return (acc); return (acc);
} }

View File

@ -62,7 +62,7 @@ _DEFUN (_strtoll_r, (rptr, nptr, endptr, base),
char **endptr _AND char **endptr _AND
int base) int base)
{ {
register const char *s = nptr; register const unsigned char *s = (const unsigned char *)nptr;
register unsigned long long acc; register unsigned long long acc;
register int c; register int c;
register unsigned long long cutoff; register unsigned long long cutoff;
@ -133,7 +133,7 @@ _DEFUN (_strtoll_r, (rptr, nptr, endptr, base),
} else if (neg) } else if (neg)
acc = -acc; acc = -acc;
if (endptr != 0) if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr); *endptr = (char *) (any ? (char *)s - 1 : nptr);
return (acc); return (acc);
} }

View File

@ -138,7 +138,7 @@ _DEFUN (_strtoul_r, (rptr, nptr, endptr, base),
char **endptr _AND char **endptr _AND
int base) int base)
{ {
register const char *s = nptr; register const unsigned char *s = (const unsigned char *)nptr;
register unsigned long acc; register unsigned long acc;
register int c; register int c;
register unsigned long cutoff; register unsigned long cutoff;
@ -188,7 +188,7 @@ _DEFUN (_strtoul_r, (rptr, nptr, endptr, base),
} else if (neg) } else if (neg)
acc = -acc; acc = -acc;
if (endptr != 0) if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr); *endptr = (char *) (any ? (char *)s - 1 : nptr);
return (acc); return (acc);
} }

View File

@ -63,7 +63,7 @@ _DEFUN (_strtoull_r, (rptr, nptr, endptr, base),
char **endptr _AND char **endptr _AND
int base) int base)
{ {
register const char *s = nptr; register const unsigned char *s = (const unsigned char *)nptr;
register unsigned long long acc; register unsigned long long acc;
register int c; register int c;
register unsigned long long cutoff; register unsigned long long cutoff;
@ -113,7 +113,7 @@ _DEFUN (_strtoull_r, (rptr, nptr, endptr, base),
} else if (neg) } else if (neg)
acc = -acc; acc = -acc;
if (endptr != 0) if (endptr != 0)
*endptr = (char *) (any ? s - 1 : nptr); *endptr = (char *) (any ? (char *)s - 1 : nptr);
return (acc); return (acc);
} }