cast fixes for isFOO
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 14 Sep 2005 14:14:37 +0000 (14:14 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 14 Sep 2005 14:14:37 +0000 (14:14 +0000)
ChangeLog
amd/info_file.c
libamu/strutil.c
mk-amd-map/mk-amd-map.c

index 51277dd361bdca29d29d94ae41230abb2e1ee901..c4f89771f6517f4e37d2c0304ea83089b7749df2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,8 +4,8 @@
        (strsplit), libamu/hasmntopt.c (nextmntopt), amd/sun_map.c
        (sun_entry2amd), amd/sun2amd.c (sun2amd_convert_convert),
        amd/mapc.c (mapc_add_kv), amd/info_file.c (file_search_or_reload),
-       amd/info_exec.c (exec_parse_qanswer): cast isspace() arg to
-       unsigned char, which is safer as per Christos.
+       amd/info_exec.c (exec_parse_qanswer): cast isspace() and isascii()
+       arg to unsigned char, which is safer as per Christos.
 
        * amd/sun_map.c (sun_entry2amd): isspace takes an int, not a char.
 
index 0acd09b8eeebdccf4667f9c28e86789661502c7f..1af24156fb12f2823fbb1fb975e7eefbf551c315 100644 (file)
@@ -79,7 +79,7 @@ file_read_line(char *buf, int size, FILE *fp)
         * Skip leading white space on next line
         */
        while ((ch = getc(fp)) != EOF &&
-              isascii(ch) && isspace(ch)) ;
+              isascii((unsigned char)ch) && isspace((unsigned char)ch)) ;
        (void) ungetc(ch, fp);
       } else {
        return done;
@@ -133,7 +133,7 @@ file_search_or_reload(mnt_map *m,
     /*
      * Find start of key
      */
-    for (kp = key_val; *kp && isascii(*kp) && isspace((unsigned char)*kp); kp++) ;
+    for (kp = key_val; *kp && isascii((unsigned char)*kp) && isspace((unsigned char)*kp); kp++) ;
 
     /*
      * Ignore blank lines
@@ -144,7 +144,7 @@ file_search_or_reload(mnt_map *m,
     /*
      * Find end of key
      */
-    for (cp = kp; *cp && (!isascii(*cp) || !isspace((unsigned char)*cp)); cp++) ;
+    for (cp = kp; *cp && (!isascii((unsigned char)*cp) || !isspace((unsigned char)*cp)); cp++) ;
 
     /*
      * Check whether key matches
@@ -153,7 +153,7 @@ file_search_or_reload(mnt_map *m,
       *cp++ = '\0';
 
     if (fn || (*key == *kp && STREQ(key, kp))) {
-      while (*cp && isascii(*cp) && isspace((unsigned char)*cp))
+      while (*cp && isascii((unsigned char)*cp) && isspace((unsigned char)*cp))
        cp++;
       if (*cp) {
        /*
index 5e93ee31a829eb88a5fe22ef8321770a1af6bb16..8f2c4ee94c02d5a6e72e2276b23e36f1c3cd3daf 100644 (file)
@@ -139,7 +139,7 @@ strsplit(char *s, int ch, int qc)
     /*
      * skip to split char
      */
-    while (*s && (ch == ' ' ? (isascii(*s) && isspace((unsigned char)*s)) : *s == ch))
+    while (*s && (ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch))
       *s++ = '\0';
 
     /*
@@ -156,7 +156,7 @@ strsplit(char *s, int ch, int qc)
     /*
      * skip to split char
      */
-    while (*s && !(ch == ' ' ? (isascii(*s) && isspace((unsigned char)*s)) : *s == ch)) {
+    while (*s && !(ch == ' ' ? (isascii((unsigned char)*s) && isspace((unsigned char)*s)) : *s == ch)) {
       if (*s++ == qc) {
        /*
         * Skip past string.
index 9119cbe7942005a1099e57bc3eb7a2481291d6a1..740f8e07f65111314467a7e5d4925ba6498afeda 100644 (file)
@@ -93,7 +93,7 @@ read_line(char *buf, int size, FILE *fp)
        /*
         * Skip leading white space on next line
         */
-       while ((ch = getc(fp)) != EOF && isascii(ch) && isspace(ch)) ;
+       while ((ch = getc(fp)) != EOF && isascii((unsigned char)ch) && isspace((unsigned char)ch)) ;
        (void) ungetc(ch, fp);
       } else {
        return done;
@@ -144,7 +144,7 @@ read_file(FILE *fp, char *map, voidp db)
     /*
      * Find start of key
      */
-    for (kp = key_val; *kp && isascii(*kp) && isspace((unsigned char)*kp); kp++) ;
+    for (kp = key_val; *kp && isascii((unsigned char)*kp) && isspace((unsigned char)*kp); kp++) ;
 
     /*
      * Ignore blank lines
@@ -155,7 +155,7 @@ read_file(FILE *fp, char *map, voidp db)
     /*
      * Find end of key
      */
-    for (cp = kp; *cp && (!isascii(*cp) || !isspace((unsigned char)*cp)); cp++) ;
+    for (cp = kp; *cp && (!isascii((unsigned char)*cp) || !isspace((unsigned char)*cp)); cp++) ;
 
     /*
      * Check whether key matches, or whether
@@ -163,7 +163,7 @@ read_file(FILE *fp, char *map, voidp db)
      */
     if (*cp)
       *cp++ = '\0';
-    while (*cp && isascii(*cp) && isspace((unsigned char)*cp))
+    while (*cp && isascii((unsigned char)*cp) && isspace((unsigned char)*cp))
       cp++;
     if (*kp == '+') {
       fprintf(stderr, "Can't interpolate %s\n", kp);