diff options
| author | Jakob Kaivo <jkk@ung.org> | 2019-02-28 21:10:57 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2019-02-28 21:10:57 -0500 |
| commit | 08d8fd2767733d893380ebf5c8a4743dd371528d (patch) | |
| tree | b3aff9fe38cd3cd94d99ca51b76e3de0f34037f2 /src/nonstd | |
| parent | b4409255ad7f446ad0a3386dc3669bbf270bb327 (diff) | |
fix ctype functions in the C/POSIX locale
Diffstat (limited to 'src/nonstd')
| -rw-r--r-- | src/nonstd/_locale.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/nonstd/_locale.h b/src/nonstd/_locale.h index 036fd836..79904e1f 100644 --- a/src/nonstd/_locale.h +++ b/src/nonstd/_locale.h @@ -18,7 +18,7 @@ #define setall(_map, _input, _mask) do { \ size_t _i; \ - for (_i = 0; _i < sizeof(_input); _i++) { \ + for (_i = 0; _i < sizeof(_input) - 1; _i++) { \ _map[(int)_input[_i]] |= _mask; \ } \ } while (0) @@ -61,7 +61,7 @@ static char * (__load_locale)(struct __locale_t *loc, int mask, const char *name char blank[] = " \t"; size_t i; - memset(loc->lc_ctype.ctattr, 0, CHAR_MAX); + memset(loc->lc_ctype.ctattr, 0, sizeof(loc->lc_ctype.ctattr)); for (i = 0; i < 32; i++) { loc->lc_ctype.ctattr[i] = CT_CNTRL; @@ -89,7 +89,7 @@ static char * (__load_locale)(struct __locale_t *loc, int mask, const char *name loc->lc_ctype.ctattr[' '] |= CT_PRINT; - for (i = 0; i < CHAR_MAX; i++) { + for (i = 0; i < UCHAR_MAX; i++) { loc->lc_ctype.ctoupper[i] = i; loc->lc_ctype.ctolower[i] = i; } |
