Try to fix ctype issues by always calling these functions as
authorMartin Pool <mbp@samba.org>
Thu, 11 Apr 2002 02:25:53 +0000 (02:25 +0000)
committerMartin Pool <mbp@samba.org>
Thu, 11 Apr 2002 02:25:53 +0000 (02:25 +0000)
if (!isdigit(* (unsigned char *) p)) {

so that the argument is always in the range of unsigned char when
coerced to an int.

(See digit 1.)

access.c
clientserver.c
exclude.c
loadparm.c
params.c
socket.c
util.c

index 050e8cc4f5b68905262527faad249aa4e70e359f..ff357480c2910462e6f527660c67cff6ceac973c 100644 (file)
--- a/access.c
+++ b/access.c
@@ -38,7 +38,7 @@ static int match_address(char *addr, char *tok)
 
        if (!addr || !*addr) return 0;
 
-       if (!isdigit(tok[0])) return 0;
+       if (!isdigit(* (unsigned char *) tok)) return 0;
 
        p = strchr(tok,'/');
        if (p) *p = 0;
index 2babcffc167760866c13a0964feb5fefad3b0a3f..4a857e33c34b4602e4869323df1f7ad28e1b3c5e 100644 (file)
@@ -246,7 +246,7 @@ static int rsync_module(int fd, int i)
        if (am_root) {
                p = lp_uid(i);
                if (!name_to_uid(p, &uid)) {
-                       if (!isdigit(*p)) {
+                       if (!isdigit(* (unsigned char *) p)) {
                                rprintf(FERROR,"Invalid uid %s\n", p);
                                io_printf(fd,"@ERROR: invalid uid %s\n", p);
                                return -1;
@@ -256,7 +256,7 @@ static int rsync_module(int fd, int i)
 
                p = lp_gid(i);
                if (!name_to_gid(p, &gid)) {
-                       if (!isdigit(*p)) {
+                       if (!isdigit(* (unsigned char *) p)) {
                                rprintf(FERROR,"Invalid gid %s\n", p);
                                io_printf(fd,"@ERROR: invalid gid %s\n", p);
                                return -1;
index 27dd303b733a994f183dae50448eeca45d54c23d..dc469e18058f5b578881981ac516939f66bd3536 100644 (file)
--- a/exclude.c
+++ b/exclude.c
@@ -335,7 +335,7 @@ char *get_exclude_tok(char *p)
                return(NULL);
 
        /* Skip over any initial spaces */
-       while(isspace((int) *s))
+       while (isspace(* (unsigned char *) s))
                s++;
 
        /* Are we at the end of the string? */
@@ -348,7 +348,7 @@ char *get_exclude_tok(char *p)
                        s+=2;
        
                /* Skip to the next space or the end of the string */
-               while(!isspace((int) *s) && *s != '\0')
+               while (!isspace(* (unsigned char *) s) && *s != '\0')
                        s++;
        } else {
                t=NULL;
index 7bd4483cc222afed6850d5dfe35d216856c43987..d559b1175f45b6650f35b91807a656482e22e72d 100644 (file)
@@ -479,11 +479,11 @@ static int strwicmp(char *psz1, char *psz2)
    /* sync the strings on first non-whitespace */
    while (1)
    {
-      while (isspace((int) *psz1))
+      while (isspace(* (unsigned char *) psz1))
          psz1++;
-      while (isspace((int) *psz2))
+      while (isspace(* (unsigned char *) psz2))
          psz2++;
-      if (toupper((int) *psz1) != toupper((int) *psz2)
+      if (toupper(* (unsigned char *) psz1) != toupper(* (unsigned char *) psz2)
          || *psz1 == '\0' || *psz2 == '\0')
          break;
       psz1++;
index 6d02053e876a271b9ddd9c3b505ca4e2371618e4..323d20baac41c9537aabf91a93028428dba909da 100644 (file)
--- a/params.c
+++ b/params.c
@@ -164,7 +164,7 @@ static int Continuation( char *line, int pos )
    */
   {
   pos--;
-  while( (pos >= 0) && isspace((int) line[pos]) )
+  while( (pos >= 0) && isspace(((unsigned char *)line)[pos]) )
      pos--;
 
   return( ((pos >= 0) && ('\\' == line[pos])) ? pos : -1 );
@@ -386,7 +386,7 @@ static BOOL Parameter( FILE *InFile, BOOL (*pfunc)(char *, char *), int c )
           c = 0;
         else
           {
-          for( end = i; (end >= 0) && isspace((int) bufr[end]); end-- )
+          for( end = i; (end >= 0) && isspace(((unsigned char *) bufr)[end]); end-- )
             ;
           c = getc( InFile );
           }
index 6a13b04a200b93804385e523be925e05d9a2d01e..bb7acc06d88414c9d8b707c57b8f1b2343064ae0 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -70,7 +70,7 @@ static int establish_proxy_connection(int fd, char *host, int port)
                        buffer);
                return -1;
        }
-       for (cp = &buffer[5]; isdigit((int) *cp) || (*cp == '.'); cp++)
+       for (cp = &buffer[5]; isdigit(* (unsigned char *) cp) || (*cp == '.'); cp++)
                ;
        while (*cp == ' ')
                cp++;
diff --git a/util.c b/util.c
index bdde8b452487c66075965adf5f03906a8a5deb77..63af7dabbe52f8ea13da19d0ccbda163dc3e2fbb 100644 (file)
--- a/util.c
+++ b/util.c
@@ -532,8 +532,8 @@ void glob_expand(char *base1, char **argv, int *argc, int maxargs)
 void strlower(char *s)
 {
        while (*s) {
-               if (isupper((int) *s))
-                       *s = tolower((int) *s);
+               if (isupper(* (unsigned char *) s))
+                       *s = tolower(* (unsigned char *) s);
                s++;
        }
 }