diff options
-rw-r--r-- | intl/ChangeLog | 9 | ||||
-rw-r--r-- | intl/l10nflist.c | 10 | ||||
-rw-r--r-- | intl/loadmsgcat.c | 2 | ||||
-rw-r--r-- | intl/localealias.c | 8 | ||||
-rw-r--r-- | lib/ChangeLog | 6 | ||||
-rw-r--r-- | lib/printf-parse.h | 20 | ||||
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/po-lex.c | 9 | ||||
-rw-r--r-- | src/xgettext.c | 2 |
9 files changed, 49 insertions, 23 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog index b70893b..cbe031f 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,12 @@ +2001-07-28 Bruno Haible <haible@clisp.cons.org> + + * l10nflist.c (_nl_normalize_codeset): Cast isalnum, isalpha, isdigit, + tolower argument to 'unsigned char'. + * loadmsgcat.c (_nl_load_domain): Cast isspace argument to + 'unsigned char'. + * localealias.c (read_alias_file): Cast isspace argument to + 'unsigned char'. + 2001-07-23 Bruno Haible <haible@clisp.cons.org> * gettext.h: Assume <limits.h> exists. diff --git a/intl/l10nflist.c b/intl/l10nflist.c index 557253e..291a742 100644 --- a/intl/l10nflist.c +++ b/intl/l10nflist.c @@ -355,11 +355,11 @@ _nl_normalize_codeset (codeset, name_len) size_t cnt; for (cnt = 0; cnt < name_len; ++cnt) - if (isalnum (codeset[cnt])) + if (isalnum ((unsigned char) codeset[cnt])) { ++len; - if (isalpha (codeset[cnt])) + if (isalpha ((unsigned char) codeset[cnt])) only_digit = 0; } @@ -373,9 +373,9 @@ _nl_normalize_codeset (codeset, name_len) wp = retval; for (cnt = 0; cnt < name_len; ++cnt) - if (isalpha (codeset[cnt])) - *wp++ = tolower (codeset[cnt]); - else if (isdigit (codeset[cnt])) + if (isalpha ((unsigned char) codeset[cnt])) + *wp++ = tolower ((unsigned char) codeset[cnt]); + else if (isdigit ((unsigned char) codeset[cnt])) *wp++ = codeset[cnt]; *wp = '\0'; diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index d589243..fd73bd9 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -507,7 +507,7 @@ _nl_load_domain (domain_file, domainbinding) struct parse_args args; nplurals += 9; - while (*nplurals != '\0' && isspace (*nplurals)) + while (*nplurals != '\0' && isspace ((unsigned char) *nplurals)) ++nplurals; #if defined HAVE_STRTOUL || defined _LIBC n = strtoul (nplurals, &endp, 10); diff --git a/intl/localealias.c b/intl/localealias.c index 76f19a9..76d99fc 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -243,21 +243,21 @@ read_alias_file (fname, fname_len) cp = buf; /* Ignore leading white space. */ - while (isspace (cp[0])) + while (isspace ((unsigned char) cp[0])) ++cp; /* A leading '#' signals a comment line. */ if (cp[0] != '\0' && cp[0] != '#') { alias = cp++; - while (cp[0] != '\0' && !isspace (cp[0])) + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) ++cp; /* Terminate alias name. */ if (cp[0] != '\0') *cp++ = '\0'; /* Now look for the beginning of the value. */ - while (isspace (cp[0])) + while (isspace ((unsigned char) cp[0])) ++cp; if (cp[0] != '\0') @@ -266,7 +266,7 @@ read_alias_file (fname, fname_len) size_t value_len; value = cp++; - while (cp[0] != '\0' && !isspace (cp[0])) + while (cp[0] != '\0' && !isspace ((unsigned char) cp[0])) ++cp; /* Terminate value. */ if (cp[0] == '\n') diff --git a/lib/ChangeLog b/lib/ChangeLog index 858c606..7091b26 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2001-07-28 Bruno Haible <haible@clisp.cons.org> + + * printf-parse.h: Don't include <ctype.h>. + (ISDIGIT): New macro. + (read_int, parse_one_spec): Use ISDIGIT instead of isdigit. + 2001-08-05 Bruno Haible <haible@clisp.cons.org> * stdbool.h.in (_Bool): Define differently in C++ mode. diff --git a/lib/printf-parse.h b/lib/printf-parse.h index 899323a..d363ead 100644 --- a/lib/printf-parse.h +++ b/lib/printf-parse.h @@ -1,5 +1,5 @@ /* Internal header for parsing printf format strings. - Copyright (C) 1995, 1996, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 1998, 2000, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,7 +18,6 @@ /* We use some extension so define this here. */ #define _GNU_SOURCE 1 -#include <ctype.h> #include <printf.h> #if HAVE_STDDEF_H # include <stddef.h> @@ -69,6 +68,11 @@ # endif #endif +/* Locale independent test for a decimal digit. + Argument can be 'char' or 'unsigned char'. (Whereas the argument of + isdigit must be an 'unsigned char'.) */ +#define ISDIGIT(c) ((unsigned int) ((c) - '0') < 10) + struct printf_spec { /* Information parsed from the format spec. */ @@ -126,7 +130,7 @@ read_int (pstr) { unsigned int retval = **pstr - '0'; - while (isdigit (*++(*pstr))) + while (ISDIGIT (*++(*pstr))) { retval *= 10; retval += **pstr - '0'; @@ -177,7 +181,7 @@ parse_one_spec (format, posn, spec, max_ref_arg) spec->info.pad = ' '; /* Test for positional argument. */ - if (isdigit (*format)) + if (ISDIGIT (*format)) { const char *begin = format; @@ -240,7 +244,7 @@ parse_one_spec (format, posn, spec, max_ref_arg) A negative field width indicates left justification. */ const char *begin = ++format; - if (isdigit (*format)) + if (ISDIGIT (*format)) { /* The width argument might be found in a positional parameter. */ n = read_int (&format); @@ -261,7 +265,7 @@ parse_one_spec (format, posn, spec, max_ref_arg) format = begin; /* Step back and reread. */ } } - else if (isdigit (*format)) + else if (ISDIGIT (*format)) /* Constant width specification. */ spec->info.width = read_int (&format); @@ -277,7 +281,7 @@ parse_one_spec (format, posn, spec, max_ref_arg) /* The precision is given in an argument. */ const char *begin = ++format; - if (isdigit (*format)) + if (ISDIGIT (*format)) { n = read_int (&format); @@ -297,7 +301,7 @@ parse_one_spec (format, posn, spec, max_ref_arg) format = begin; } } - else if (isdigit (*format)) + else if (ISDIGIT (*format)) spec->info.prec = read_int (&format); else /* "%.?" is treated like "%.0?". */ diff --git a/src/ChangeLog b/src/ChangeLog index 6f49395..ea5dc0c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2001-07-28 Bruno Haible <haible@clisp.cons.org> + * po-lex.c: Include c-ctype.h instead of <ctype.h>. + (control_sequence): Use C locale character classifications. + * xgettext.c (main): Cast isspace argument to 'unsigned char'. + +2001-07-28 Bruno Haible <haible@clisp.cons.org> + * po-lex.h (lex_start, lex_end): New declarations. * po-lex.c (lex_start): New function. (lex_end): New function. diff --git a/src/po-lex.c b/src/po-lex.c index 7437c11..6d456b0 100644 --- a/src/po-lex.c +++ b/src/po-lex.c @@ -23,7 +23,6 @@ # include "config.h" #endif -#include <ctype.h> #include <errno.h> #include <limits.h> #include <stdio.h> @@ -35,6 +34,7 @@ # include <iconv.h> #endif +#include "c-ctype.h" #include "linebreak.h" #include "libgettext.h" #define _(str) gettext(str) @@ -883,7 +883,8 @@ control_sequence () case 'x': lex_getc (mbc); - if (mb_iseof (mbc) || mb_len (mbc) != 1 || !isxdigit (mb_ptr (mbc) [0])) + if (mb_iseof (mbc) || mb_len (mbc) != 1 + || !c_isxdigit (mb_ptr (mbc) [0])) break; val = 0; @@ -891,10 +892,10 @@ control_sequence () { char c = mb_ptr (mbc) [0]; val *= 16; - if (isdigit (c)) + if (c_isdigit (c)) /* Warning: not portable, can't depend on '0'..'9' ordering */ val += c - '0'; - else if (isupper (c)) + else if (c_isupper (c)) /* Warning: not portable, can't depend on 'A'..'F' ordering */ val += c - 'A' + 10; else diff --git a/src/xgettext.c b/src/xgettext.c index 415951b..3dc8003 100644 --- a/src/xgettext.c +++ b/src/xgettext.c @@ -228,7 +228,7 @@ main (argc, argv) add_all_comments = false; comment_tag = optarg; /* We ignore leading white space. */ - while (isspace (*comment_tag)) + while (isspace ((unsigned char) *comment_tag)) ++comment_tag; } break; |