changeset 8506:04518e040836

Cast the argument of <ctype.h> functions to 'unsigned char'.
author Bruno Haible <bruno@clisp.org>
date Sat, 24 Mar 2007 11:23:08 +0000
parents 1166975a7fe6
children 2d9de99c11d9
files ChangeLog lib/argp-help.c
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/argp-help.c
+++ b/lib/argp-help.c
@@ -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 @@
   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 @@
 	{
 	  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 @@
 		  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 @@
   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;