Skip to content

Commit 5892c36

Browse files
cast to (unsigned char) before calling ctype on char indexes.
1 parent 8793fd8 commit 5892c36

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

external/gpl3/gcc/dist/libquadmath/printf/printf_fphex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ __quadmath_printf_fphex (struct __quadmath_printf_file *fp,
366366
think about it! */
367367
break;
368368
}
369-
else if (tolower (ch) < 'f')
369+
else if (tolower ((unsigned char)ch) < 'f')
370370
{
371371
++numstr[cnt];
372372
++wnumstr[cnt];
@@ -385,7 +385,7 @@ __quadmath_printf_fphex (struct __quadmath_printf_file *fp,
385385
get an overflow. */
386386
if (leading == '9')
387387
leading = info->spec;
388-
else if (tolower (leading) < 'f')
388+
else if (tolower ((unsigned char)leading) < 'f')
389389
++leading;
390390
else
391391
{

external/gpl3/gcc/dist/libquadmath/printf/quadmath-printf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...)
189189
++format;
190190
info.width = va_arg (ap, int);
191191
}
192-
else if (isdigit (*format))
192+
else if (isdigit ((unsigned char)*format))
193193
/* Constant width specification. */
194194
info.width = read_int (&format);
195195

@@ -206,7 +206,7 @@ quadmath_snprintf (char *str, size_t size, const char *format, ...)
206206

207207
info.prec = va_arg (ap, int);
208208
}
209-
else if (isdigit (*format))
209+
else if (isdigit ((unsigned char)*format))
210210
info.prec = read_int (&format);
211211
else
212212
/* "%.?" is treated like "%.0?". */

external/gpl3/gcc/dist/libquadmath/strtod/strtod_l.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
# define STRING_TYPE char
5858
# define CHAR_TYPE char
5959
# define L_(Ch) Ch
60-
# define ISSPACE(Ch) isspace (Ch)
61-
# define ISDIGIT(Ch) isdigit (Ch)
62-
# define ISXDIGIT(Ch) isxdigit (Ch)
63-
# define TOLOWER(Ch) tolower (Ch)
60+
# define ISSPACE(Ch) isspace ((unsigned char)Ch)
61+
# define ISDIGIT(Ch) isdigit ((unsigned char)Ch)
62+
# define ISXDIGIT(Ch) isxdigit ((unsigned char)Ch)
63+
# define TOLOWER(Ch) tolower ((unsigned char)Ch)
6464
# define TOLOWER_C(Ch) \
6565
({__typeof(Ch) __tlc = (Ch); \
6666
(__tlc >= 'A' && __tlc <= 'Z') ? __tlc - 'A' + 'a' : __tlc; })
@@ -501,13 +501,13 @@ ____STRTOF_INTERNAL (nptr, endptr, group)
501501
/* Contains the last character read. */
502502
CHAR_TYPE c;
503503

504+
#ifdef USE_WIDE_CHAR
504505
/* We should get wint_t from <stddef.h>, but not all GCC versions define it
505506
there. So define it ourselves if it remains undefined. */
506507
#ifndef _WINT_T
507508
typedef unsigned int wint_t;
508509
#endif
509510
/* The radix character of the current locale. */
510-
#ifdef USE_WIDE_CHAR
511511
wchar_t decimal;
512512
#else
513513
const char *decimal;

0 commit comments

Comments
 (0)