Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/ntp/dist/libntp fix bogus ctype casts



details:   https://anonhg.NetBSD.org/src/rev/d63e15bf90e2
branches:  trunk
changeset: 749972:d63e15bf90e2
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 14 00:38:48 2009 +0000

description:
fix bogus ctype casts

diffstat:

 external/bsd/ntp/dist/libntp/atoint.c   |   4 ++--
 external/bsd/ntp/dist/libntp/atolfp.c   |  12 ++++++------
 external/bsd/ntp/dist/libntp/atouint.c  |   4 ++--
 external/bsd/ntp/dist/libntp/audio.c    |  16 ++++++++--------
 external/bsd/ntp/dist/libntp/hextolfp.c |   6 +++---
 external/bsd/ntp/dist/libntp/mstolfp.c  |  12 ++++++------
 external/bsd/ntp/dist/libntp/octtoint.c |   4 ++--
 7 files changed, 29 insertions(+), 29 deletions(-)

diffs (230 lines):

diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/atoint.c
--- a/external/bsd/ntp/dist/libntp/atoint.c     Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/atoint.c     Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atoint.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $    */
+/*     $NetBSD: atoint.c,v 1.2 2009/12/14 00:38:48 christos Exp $      */
 
 /*
  * atoint - convert an ascii string to a signed long, with error checking
@@ -36,7 +36,7 @@
 
        u = 0;
        while (*cp != '\0') {
-               if (!isdigit((int)*cp))
+               if (!isdigit((unsigned char)*cp))
                    return 0;
                if (u > 214748364 || (u == 214748364 && *cp > oflow_digit))
                    return 0;   /* overflow */
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/atolfp.c
--- a/external/bsd/ntp/dist/libntp/atolfp.c     Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/atolfp.c     Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atolfp.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $    */
+/*     $NetBSD: atolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $      */
 
 /*
  * atolfp - convert an ascii string to an l_fp number
@@ -53,7 +53,7 @@
         *
         * [spaces][-|+][digits][.][digits][spaces|\n|\0]
         */
-       while (isspace((int)*cp))
+       while (isspace((unsigned char)*cp))
            cp++;
        
        if (*cp == '-') {
@@ -64,7 +64,7 @@
        if (*cp == '+')
            cp++;
 
-       if (*cp != '.' && !isdigit((int)*cp))
+       if (*cp != '.' && !isdigit((unsigned char)*cp))
            return 0;
 
        while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) {
@@ -73,7 +73,7 @@
                cp++;
        }
 
-       if (*cp != '\0' && !isspace((int)*cp)) {
+       if (*cp != '\0' && !isspace((unsigned char)*cp)) {
                if (*cp++ != '.')
                    return 0;
        
@@ -85,10 +85,10 @@
                        cp++;
                }
 
-               while (isdigit((int)*cp))
+               while (isdigit((unsigned char)*cp))
                    cp++;
                
-               if (*cp != '\0' && !isspace((int)*cp))
+               if (*cp != '\0' && !isspace((unsigned char)*cp))
                    return 0;
        }
 
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/atouint.c
--- a/external/bsd/ntp/dist/libntp/atouint.c    Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/atouint.c    Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atouint.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $   */
+/*     $NetBSD: atouint.c,v 1.2 2009/12/14 00:38:48 christos Exp $     */
 
 /*
  * atouint - convert an ascii string to an unsigned long, with error checking
@@ -24,7 +24,7 @@
 
        u = 0;
        while (*cp != '\0') {
-               if (!isdigit((int)*cp))
+               if (!isdigit((unsigned char)*cp))
                    return 0;
                if (u > 429496729 || (u == 429496729 && *cp >= '6'))
                    return 0;   /* overflow */
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/audio.c
--- a/external/bsd/ntp/dist/libntp/audio.c      Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/audio.c      Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $     */
+/*     $NetBSD: audio.c,v 1.2 2009/12/14 00:38:48 christos Exp $       */
 
 /*
  * audio.c - audio interface for reference clock audio drivers
@@ -147,12 +147,12 @@
 
                /* Remove any trailing spaces */
                for (i = strlen(line);
-                    i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]);
+                    i > 0 && isascii((unsigned char)line[i - 1]) && isspace((unsigned char)line[i - 1]);
                        )
                        line[--i] = '\0';
 
                /* Remove leading space */
-               for (cc = line; *cc && isascii((int)*cc) && isspace((int)*cc); cc++)
+               for (cc = line; *cc && isascii((unsigned char)*cc) && isspace((unsigned char)*cc); cc++)
                        continue;
 
                /* Stop if nothing left */
@@ -161,16 +161,16 @@
 
                /* Uppercase the command and find the arg */
                for (ca = cc; *ca; ca++) {
-                       if (isascii((int)*ca)) {
-                               if (islower((int)*ca)) {
-                                       *ca = toupper(*ca);
-                               } else if (isspace((int)*ca) || (*ca == '='))
+                       if (isascii((unsigned char)*ca)) {
+                               if (islower((unsigned char)*ca)) {
+                                       *ca = toupper((unsigned char)*ca);
+                               } else if (isspace((unsigned char)*ca) || (*ca == '='))
                                        break;
                        }
                }
 
                /* Remove space (and possible =) leading the arg */
-               for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++)
+               for (; *ca && isascii((unsigned char)*ca) && (isspace((unsigned char)*ca) || (*ca == '=')); ca++)
                        continue;
 
                if (!strncmp(cc, "IDEV", (size_t) 4)) {
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/hextolfp.c
--- a/external/bsd/ntp/dist/libntp/hextolfp.c   Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/hextolfp.c   Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hextolfp.c,v 1.1.1.1 2009/12/13 16:55:03 kardel Exp $  */
+/*     $NetBSD: hextolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $    */
 
 /*
  * hextolfp - convert an ascii hex string to an l_fp number
@@ -31,7 +31,7 @@
         *
         * [spaces]8_hex_digits[.]8_hex_digits[spaces|\n|\0]
         */
-       while (isspace((int)*cp))
+       while (isspace((unsigned char)*cp))
            cp++;
        
        cpstart = cp;
@@ -60,7 +60,7 @@
        if ((cp - cpstart) < 8 || ind == NULL)
            return 0;
        
-       if (*cp != '\0' && !isspace((int)*cp))
+       if (*cp != '\0' && !isspace((unsigned char)*cp))
            return 0;
 
        lfp->l_ui = dec_i;
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/mstolfp.c
--- a/external/bsd/ntp/dist/libntp/mstolfp.c    Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/mstolfp.c    Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mstolfp.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $   */
+/*     $NetBSD: mstolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $     */
 
 /*
  * mstolfp - convert an ascii string in milliseconds to an l_fp number
@@ -33,7 +33,7 @@
         */
        bp = buf;
        cp = str;
-       while (isspace((int)*cp))
+       while (isspace((unsigned char)*cp))
            cp++;
        
        if (*cp == '-') {
@@ -41,7 +41,7 @@
                cp++;
        }
 
-       if (*cp != '.' && !isdigit((int)*cp))
+       if (*cp != '.' && !isdigit((unsigned char)*cp))
            return 0;
 
 
@@ -49,7 +49,7 @@
         * Search forward for the decimal point or the end of the string.
         */
        cpdec = cp;
-       while (isdigit((int)*cpdec))
+       while (isdigit((unsigned char)*cpdec))
            cpdec++;
 
        /*
@@ -87,7 +87,7 @@
        
        if (*cp == '.') {
                cp++;
-               while (isdigit((int)*cp))
+               while (isdigit((unsigned char)*cp))
                    *bp++ = (char)*cp++;
        }
        *bp = '\0';
@@ -96,7 +96,7 @@
         * Check to make sure the string is properly terminated.  If
         * so, give the buffer to the decoding routine.
         */
-       if (*cp != '\0' && !isspace((int)*cp))
+       if (*cp != '\0' && !isspace((unsigned char)*cp))
            return 0;
        return atolfp(buf, lfp);
 }
diff -r 72f2f2f4033f -r d63e15bf90e2 external/bsd/ntp/dist/libntp/octtoint.c
--- a/external/bsd/ntp/dist/libntp/octtoint.c   Mon Dec 14 00:38:20 2009 +0000
+++ b/external/bsd/ntp/dist/libntp/octtoint.c   Mon Dec 14 00:38:48 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octtoint.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $  */
+/*     $NetBSD: octtoint.c,v 1.2 2009/12/14 00:38:48 christos Exp $    */
 
 /*
  * octtoint - convert an ascii string in octal to an unsigned
@@ -25,7 +25,7 @@
 
        u = 0;
        while (*cp != '\0') {
-               if (!isdigit((int)*cp) || *cp == '8' || *cp == '9')
+               if (!isdigit((unsigned char)*cp) || *cp == '8' || *cp == '9')
                    return 0;
                if (u >= 0x20000000)
                    return 0;   /* overflow */



Home | Main Index | Thread Index | Old Index