]> git.ipfire.org Git - thirdparty/make.git/commitdiff
[SV 57930] Cast char to unsigned char to call ctype functions
authorPaul Smith <psmith@gnu.org>
Sun, 3 May 2020 18:54:56 +0000 (14:54 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 3 May 2020 18:54:56 +0000 (14:54 -0400)
This cast was already done almost everywhere: fix some stragglers.

* src/load.c (load_file): Cast char to unsigned char.
* src/misc.c (strcasecmp, strncasecmp): [!POSIX] Ditto.
* src/dir.c (vms_hash): [VMS] Ditto.
* src/vms_progname.c (set_program_name): [VMS] Ditto.
* src/vms_jobs.c (posix_parse_dq): [VMS] Ditto.
(posix_parse_dollar): [VMS] Ditto.
(build_vms_cmd): [VMS] Ditto.
(child_execute_job): [VMS] Ditto.

src/dir.c
src/load.c
src/misc.c
src/vms_progname.c
src/vmsjobs.c

index 2b2abf33195d6532d9a5abf38257926b7e0d544b..a9c12ebdf785058fa408e72060e2afdd9b211381 100644 (file)
--- a/src/dir.c
+++ b/src/dir.c
@@ -175,7 +175,7 @@ vms_hash (const char *name)
 
   while (*name)
     {
-      unsigned char uc = *name;
+      unsigned char uc = (unsigned char) *name;
       int g;
 #ifdef HAVE_CASE_INSENSITIVE_FS
       h = (h << 4) + (isupper (uc) ? tolower (uc) : uc);
index 27f5899f820f15f917cbfb7ebfe2a0ad0f8cbc46..5d57b688ba7d651ca2b719d13662c660b57f1c3d 100644 (file)
@@ -195,7 +195,7 @@ load_file (const floc *flocp, const char **ldname, int noerror)
         fp = *ldname;
       else
         ++fp;
-      while (isalnum (*fp) || *fp == '_')
+      while (isalnum ((unsigned char) *fp) || *fp == '_')
         *(p++) = *(fp++);
       strcpy (p, SYMBOL_EXTENSION);
       symname = new;
index de19e37547c7e0db4fe11dba50b871f992ae1763..bc5060a38af529b38b9cecc6b73f5e211f271e3b 100644 (file)
@@ -535,8 +535,8 @@ strcasecmp (const char *s1, const char *s2)
 {
   while (1)
     {
-      int c1 = (int) *(s1++);
-      int c2 = (int) *(s2++);
+      int c1 = (unsigned char) *(s1++);
+      int c2 = (unsigned char) *(s2++);
 
       if (isalpha (c1))
         c1 = tolower (c1);
@@ -560,8 +560,8 @@ strncasecmp (const char *s1, const char *s2, int n)
 {
   while (n-- > 0)
     {
-      int c1 = (int) *(s1++);
-      int c2 = (int) *(s2++);
+      int c1 = (unsigned char) *(s1++);
+      int c2 = (unsigned char) *(s2++);
 
       if (isalpha (c1))
         c1 = tolower (c1);
index dcb25aafe4105801e2ed373352f17076e5e65fd3..fb5d5f2b0484bec4aefb20ea05da9c263834bc2b 100644 (file)
@@ -409,7 +409,7 @@ set_program_name (const char *argv0)
                 int i;
 
                 i = 1;
-                while (isdigit (lastdot[i])) {
+                while (isdigit ((unsigned char) lastdot[i])) {
                     i++;
                 }
                 if (lastdot[i] == 0) {
index 89dddf542941521fd065667844bb5ae2b76a0cb5..3588f4ad09971717d2bb19220e0e89504cbb926e 100644 (file)
@@ -367,7 +367,7 @@ posix_parse_dq (struct token_info *token)
             }
           INC_TOKEN_LEN_OR_BREAK;
         }
-      else if (*p == '$' && isalpha (p[1]))
+      else if (*p == '$' && isalpha ((unsigned char) p[1]))
         {
           /* A symbol we should be able to substitute */
           *q++ = '\'';
@@ -506,7 +506,7 @@ posix_parse_dollar (struct token_info *token)
   *q++ = '\'';
   INC_TOKEN_LEN_OR_RETURN (p);
 
-  while ((isalnum (*p)) || (*p == '_'))
+  while ((isalnum ((unsigned char) *p)) || (*p == '_'))
     {
       *q++ = *p++;
       INC_TOKEN_LEN_OR_BREAK;
@@ -707,7 +707,7 @@ build_vms_cmd (char **cmd_tokens,
             }
 
           /* Optional whitespace */
-          if (isspace (cmd_tokens[cmd_tkn_index][0]))
+          if (isspace ((unsigned char) cmd_tokens[cmd_tkn_index][0]))
             {
               strcpy (&cmd[cmd_len], cmd_tokens[cmd_tkn_index]);
               cmd_len += strlen (cmd_tokens[cmd_tkn_index]);
@@ -789,7 +789,7 @@ build_vms_cmd (char **cmd_tokens,
       if (cmd_tkn_index == append_token)
         {
           free (cmd_tokens[cmd_tkn_index++]);
-          if (isspace (cmd_tokens[cmd_tkn_index][0]))
+          if (isspace ((unsigned char) cmd_tokens[cmd_tkn_index][0]))
             free (cmd_tokens[cmd_tkn_index++]);
           free (cmd_tokens[cmd_tkn_index++]);
         }
@@ -987,7 +987,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
           /* TODO: Should we diagnose if paren_level goes negative? */
           break;
         case '&':
-          if (isalpha (p[1]) && !vms_unix_simulation)
+          if (isalpha ((unsigned char) p[1]) && !vms_unix_simulation)
             {
               /* VMS symbol substitution */
               p = parse_text (&token, 0);
@@ -1061,7 +1061,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
           UPDATE_TOKEN;
           break;
         case ':':
-          if ((p[1] == 0) || isspace (p[1]))
+          if ((p[1] == 0) || isspace ((unsigned char) p[1]))
             {
               /* Unix Null command - treat as comment until next command */
               unix_echo_cmd = 0;
@@ -1115,7 +1115,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
           break;
         default:
           /* Skip repetitive whitespace */
-          if (isspace (*p))
+          if (isspace ((unsigned char) *p))
             {
               p = parse_char (&token, 1);
 
@@ -1125,7 +1125,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
                 token_str[0] = ' ';
               UPDATE_TOKEN;
 
-              while (isspace (*p))
+              while (isspace ((unsigned char) *p))
                 p++;
               if (assignment_hack != 0)
                 assignment_hack++;
@@ -1176,7 +1176,7 @@ child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
       char * raw_append_file;
       file_token = append_token;
       file_token++;
-      if (isspace (cmd_tokens[file_token][0]))
+      if (isspace ((unsigned char) cmd_tokens[file_token][0]))
         file_token++;
       raw_append_file = vmsify (cmd_tokens[file_token], 0);
       /* VMS DCL needs a trailing dot if null file extension */