Cast the argument of <ctype.h> functions to 'unsigned char'.
authorBruno Haible <bruno@clisp.org>
Sat, 24 Mar 2007 11:23:08 +0000 (11:23 +0000)
committerBruno Haible <bruno@clisp.org>
Sat, 24 Mar 2007 11:23:08 +0000 (11:23 +0000)
ChangeLog
lib/argp-help.c

index 74a4800..804e381 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-24  Bruno Haible  <bruno@clisp.org>
+
+       * lib/argp-help.c (fill_in_uparams, canon_doc_option): Cast the
+       arguments of isspace, isalpha, isalnum, isdigit to 'unsigned char'.
+
 2007-03-22  Bruno Haible  <bruno@clisp.org>
 
        * lib/strptime.c (__strptime_internal): Use ANSI C syntax.
index e7baaf9..7321480 100644 (file)
@@ -1,5 +1,5 @@
 /* Hierarchial argument parsing help output
-   Copyright (C) 1995-2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Miles Bader <miles@gnu.ai.mit.edu>.
 
@@ -162,7 +162,7 @@ fill_in_uparams (const struct argp_state *state)
   const char *var = getenv ("ARGP_HELP_FMT");
   struct uparams new_params = uparams;
   
-#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
+#define SKIPWS(p) do { while (isspace ((unsigned char) *p)) p++; } while (0);
 
   if (var)
     {
@@ -171,14 +171,14 @@ fill_in_uparams (const struct argp_state *state)
        {
          SKIPWS (var);
          
-         if (isalpha (*var))
+         if (isalpha ((unsigned char) *var))
            {
              size_t var_len;
              const struct uparam_name *un;
              int unspec = 0, val = 0;
              const char *arg = var;
 
-             while (isalnum (*arg) || *arg == '-' || *arg == '_')
+             while (isalnum ((unsigned char) *arg) || *arg == '-' || *arg == '_')
                arg++;
              var_len = arg - var;
              
@@ -203,10 +203,10 @@ fill_in_uparams (const struct argp_state *state)
                  else
                    val = 1;
                }
-             else if (isdigit (*arg))
+             else if (isdigit ((unsigned char) *arg))
                {
                  val = atoi (arg);
-                 while (isdigit (*arg))
+                 while (isdigit ((unsigned char) *arg))
                    arg++;
                  SKIPWS (arg);
                }
@@ -720,12 +720,12 @@ canon_doc_option (const char **name)
   else
     {
       /* Skip initial whitespace.  */
-      while (isspace (**name))
+      while (isspace ((unsigned char) **name))
        (*name)++;
       /* Decide whether this looks like an option (leading `-') or not.  */
       non_opt = (**name != '-');
       /* Skip until part of name used for sorting.  */
-      while (**name && !isalnum (**name))
+      while (**name && !isalnum ((unsigned char) **name))
        (*name)++;
     }
   return non_opt;