Mon Dec 14 00:38:48 2009 UTC ()
fix bogus ctype casts


(christos)
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atoint.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atolfp.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atouint.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/audio.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/hextolfp.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/mstolfp.c
diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/octtoint.c

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atoint.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/atoint.c 2009/12/13 16:55:01 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/atoint.c 2009/12/14 00:38:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atoint.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $ */ 1/* $NetBSD: atoint.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * atoint - convert an ascii string to a signed long, with error checking 4 * atoint - convert an ascii string to a signed long, with error checking
5 */ 5 */
6#include <sys/types.h> 6#include <sys/types.h>
7#include <ctype.h> 7#include <ctype.h>
8 8
9#include "ntp_types.h" 9#include "ntp_types.h"
10#include "ntp_stdlib.h" 10#include "ntp_stdlib.h"
11 11
12int 12int
13atoint( 13atoint(
14 const char *str, 14 const char *str,
@@ -26,27 +26,27 @@ atoint( @@ -26,27 +26,27 @@ atoint(
26 cp++; 26 cp++;
27 isneg = 1; 27 isneg = 1;
28 oflow_digit = '8'; 28 oflow_digit = '8';
29 } else { 29 } else {
30 isneg = 0; 30 isneg = 0;
31 oflow_digit = '7'; 31 oflow_digit = '7';
32 } 32 }
33 33
34 if (*cp == '\0') 34 if (*cp == '\0')
35 return 0; 35 return 0;
36 36
37 u = 0; 37 u = 0;
38 while (*cp != '\0') { 38 while (*cp != '\0') {
39 if (!isdigit((int)*cp)) 39 if (!isdigit((unsigned char)*cp))
40 return 0; 40 return 0;
41 if (u > 214748364 || (u == 214748364 && *cp > oflow_digit)) 41 if (u > 214748364 || (u == 214748364 && *cp > oflow_digit))
42 return 0; /* overflow */ 42 return 0; /* overflow */
43 u = (u << 3) + (u << 1); 43 u = (u << 3) + (u << 1);
44 u += *cp++ - '0'; /* ascii dependent */ 44 u += *cp++ - '0'; /* ascii dependent */
45 } 45 }
46 46
47 if (isneg) 47 if (isneg)
48 *ival = -u; 48 *ival = -u;
49 else  49 else
50 *ival = u; 50 *ival = u;
51 return 1; 51 return 1;
52} 52}

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atolfp.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/atolfp.c 2009/12/13 16:55:01 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/atolfp.c 2009/12/14 00:38:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: atolfp.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $ */ 1/* $NetBSD: atolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * atolfp - convert an ascii string to an l_fp number 4 * atolfp - convert an ascii string to an l_fp number
5 */ 5 */
6#include <stdio.h> 6#include <stdio.h>
7#include <ctype.h> 7#include <ctype.h>
8 8
9#include "ntp_fp.h" 9#include "ntp_fp.h"
10#include "ntp_string.h" 10#include "ntp_string.h"
11#include "ntp_assert.h" 11#include "ntp_assert.h"
12 12
13/* 13/*
14 * Powers of 10 14 * Powers of 10
@@ -43,62 +43,62 @@ atolfp( @@ -43,62 +43,62 @@ atolfp(
43 43
44 NTP_REQUIRE(str != NULL); 44 NTP_REQUIRE(str != NULL);
45 45
46 isneg = 0; 46 isneg = 0;
47 dec_i = dec_f = 0; 47 dec_i = dec_f = 0;
48 ndec = 0; 48 ndec = 0;
49 cp = str; 49 cp = str;
50 50
51 /* 51 /*
52 * We understand numbers of the form: 52 * We understand numbers of the form:
53 * 53 *
54 * [spaces][-|+][digits][.][digits][spaces|\n|\0] 54 * [spaces][-|+][digits][.][digits][spaces|\n|\0]
55 */ 55 */
56 while (isspace((int)*cp)) 56 while (isspace((unsigned char)*cp))
57 cp++; 57 cp++;
58  58
59 if (*cp == '-') { 59 if (*cp == '-') {
60 cp++; 60 cp++;
61 isneg = 1; 61 isneg = 1;
62 } 62 }
63  63
64 if (*cp == '+') 64 if (*cp == '+')
65 cp++; 65 cp++;
66 66
67 if (*cp != '.' && !isdigit((int)*cp)) 67 if (*cp != '.' && !isdigit((unsigned char)*cp))
68 return 0; 68 return 0;
69 69
70 while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) { 70 while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) {
71 dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */ 71 dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */
72 dec_i += (ind - digits); 72 dec_i += (ind - digits);
73 cp++; 73 cp++;
74 } 74 }
75 75
76 if (*cp != '\0' && !isspace((int)*cp)) { 76 if (*cp != '\0' && !isspace((unsigned char)*cp)) {
77 if (*cp++ != '.') 77 if (*cp++ != '.')
78 return 0; 78 return 0;
79  79
80 while (ndec < 9 && *cp != '\0' 80 while (ndec < 9 && *cp != '\0'
81 && (ind = strchr(digits, *cp)) != NULL) { 81 && (ind = strchr(digits, *cp)) != NULL) {
82 ndec++; 82 ndec++;
83 dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */ 83 dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */
84 dec_f += (ind - digits); 84 dec_f += (ind - digits);
85 cp++; 85 cp++;
86 } 86 }
87 87
88 while (isdigit((int)*cp)) 88 while (isdigit((unsigned char)*cp))
89 cp++; 89 cp++;
90  90
91 if (*cp != '\0' && !isspace((int)*cp)) 91 if (*cp != '\0' && !isspace((unsigned char)*cp))
92 return 0; 92 return 0;
93 } 93 }
94 94
95 if (ndec > 0) { 95 if (ndec > 0) {
96 register u_long tmp; 96 register u_long tmp;
97 register u_long bit; 97 register u_long bit;
98 register u_long ten_fact; 98 register u_long ten_fact;
99 99
100 ten_fact = ten_to_the_n[ndec]; 100 ten_fact = ten_to_the_n[ndec];
101 101
102 tmp = 0; 102 tmp = 0;
103 bit = 0x80000000; 103 bit = 0x80000000;
104 while (bit != 0) { 104 while (bit != 0) {

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/atouint.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/atouint.c 2009/12/13 16:55:01 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/atouint.c 2009/12/14 00:38:48 1.2
@@ -1,37 +1,37 @@ @@ -1,37 +1,37 @@
1/* $NetBSD: atouint.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $ */ 1/* $NetBSD: atouint.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * atouint - convert an ascii string to an unsigned long, with error checking 4 * atouint - convert an ascii string to an unsigned long, with error checking
5 */ 5 */
6#include <sys/types.h> 6#include <sys/types.h>
7#include <ctype.h> 7#include <ctype.h>
8 8
9#include "ntp_types.h" 9#include "ntp_types.h"
10#include "ntp_stdlib.h" 10#include "ntp_stdlib.h"
11 11
12int 12int
13atouint( 13atouint(
14 const char *str, 14 const char *str,
15 u_long *uval 15 u_long *uval
16 ) 16 )
17{ 17{
18 register u_long u; 18 register u_long u;
19 register const char *cp; 19 register const char *cp;
20 20
21 cp = str; 21 cp = str;
22 if (*cp == '\0') 22 if (*cp == '\0')
23 return 0; 23 return 0;
24 24
25 u = 0; 25 u = 0;
26 while (*cp != '\0') { 26 while (*cp != '\0') {
27 if (!isdigit((int)*cp)) 27 if (!isdigit((unsigned char)*cp))
28 return 0; 28 return 0;
29 if (u > 429496729 || (u == 429496729 && *cp >= '6')) 29 if (u > 429496729 || (u == 429496729 && *cp >= '6'))
30 return 0; /* overflow */ 30 return 0; /* overflow */
31 u = (u << 3) + (u << 1); 31 u = (u << 3) + (u << 1);
32 u += *cp++ - '0'; /* ascii dependent */ 32 u += *cp++ - '0'; /* ascii dependent */
33 } 33 }
34 34
35 *uval = u; 35 *uval = u;
36 return 1; 36 return 1;
37} 37}

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/audio.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/audio.c 2009/12/13 16:55:01 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/audio.c 2009/12/14 00:38:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: audio.c,v 1.1.1.1 2009/12/13 16:55:01 kardel Exp $ */ 1/* $NetBSD: audio.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * audio.c - audio interface for reference clock audio drivers 4 * audio.c - audio interface for reference clock audio drivers
5 */ 5 */
6#ifdef HAVE_CONFIG_H 6#ifdef HAVE_CONFIG_H
7# include <config.h> 7# include <config.h>
8#endif 8#endif
9 9
10#if defined(HAVE_SYS_AUDIOIO_H) || defined(HAVE_SUN_AUDIOIO_H) || \ 10#if defined(HAVE_SYS_AUDIOIO_H) || defined(HAVE_SUN_AUDIOIO_H) || \
11 defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H) 11 defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H)
12 12
13#include "audio.h" 13#include "audio.h"
14#include "ntp_stdlib.h" 14#include "ntp_stdlib.h"
@@ -137,50 +137,50 @@ audio_config_read( @@ -137,50 +137,50 @@ audio_config_read(
137 } 137 }
138 } 138 }
139 printf("audio_config_read: reading <%s>\n", device); 139 printf("audio_config_read: reading <%s>\n", device);
140 while (fgets(line, sizeof line, fd)) { 140 while (fgets(line, sizeof line, fd)) {
141 char *cp, *cc, *ca; 141 char *cp, *cc, *ca;
142 int i; 142 int i;
143 143
144 /* Remove comments */ 144 /* Remove comments */
145 if ((cp = strchr(line, '#'))) 145 if ((cp = strchr(line, '#')))
146 *cp = '\0'; 146 *cp = '\0';
147 147
148 /* Remove any trailing spaces */ 148 /* Remove any trailing spaces */
149 for (i = strlen(line); 149 for (i = strlen(line);
150 i > 0 && isascii((int)line[i - 1]) && isspace((int)line[i - 1]); 150 i > 0 && isascii((unsigned char)line[i - 1]) && isspace((unsigned char)line[i - 1]);
151 ) 151 )
152 line[--i] = '\0'; 152 line[--i] = '\0';
153 153
154 /* Remove leading space */ 154 /* Remove leading space */
155 for (cc = line; *cc && isascii((int)*cc) && isspace((int)*cc); cc++) 155 for (cc = line; *cc && isascii((unsigned char)*cc) && isspace((unsigned char)*cc); cc++)
156 continue; 156 continue;
157 157
158 /* Stop if nothing left */ 158 /* Stop if nothing left */
159 if (!*cc) 159 if (!*cc)
160 continue; 160 continue;
161 161
162 /* Uppercase the command and find the arg */ 162 /* Uppercase the command and find the arg */
163 for (ca = cc; *ca; ca++) { 163 for (ca = cc; *ca; ca++) {
164 if (isascii((int)*ca)) { 164 if (isascii((unsigned char)*ca)) {
165 if (islower((int)*ca)) { 165 if (islower((unsigned char)*ca)) {
166 *ca = toupper(*ca); 166 *ca = toupper((unsigned char)*ca);
167 } else if (isspace((int)*ca) || (*ca == '=')) 167 } else if (isspace((unsigned char)*ca) || (*ca == '='))
168 break; 168 break;
169 } 169 }
170 } 170 }
171 171
172 /* Remove space (and possible =) leading the arg */ 172 /* Remove space (and possible =) leading the arg */
173 for (; *ca && isascii((int)*ca) && (isspace((int)*ca) || (*ca == '=')); ca++) 173 for (; *ca && isascii((unsigned char)*ca) && (isspace((unsigned char)*ca) || (*ca == '=')); ca++)
174 continue; 174 continue;
175 175
176 if (!strncmp(cc, "IDEV", (size_t) 4)) { 176 if (!strncmp(cc, "IDEV", (size_t) 4)) {
177 sscanf(ca, "%s", ab); 177 sscanf(ca, "%s", ab);
178 strcpy(cf_i_dev, ab); 178 strcpy(cf_i_dev, ab);
179 printf("idev <%s>\n", ab); 179 printf("idev <%s>\n", ab);
180 } else if (!strncmp(cc, "CDEV", (size_t) 4)) { 180 } else if (!strncmp(cc, "CDEV", (size_t) 4)) {
181 sscanf(ca, "%s", ab); 181 sscanf(ca, "%s", ab);
182 strcpy(cf_c_dev, ab); 182 strcpy(cf_c_dev, ab);
183 printf("cdev <%s>\n", ab); 183 printf("cdev <%s>\n", ab);
184 } else if (!strncmp(cc, "AGC", (size_t) 3)) { 184 } else if (!strncmp(cc, "AGC", (size_t) 3)) {
185 sscanf(ca, "%s", ab); 185 sscanf(ca, "%s", ab);
186 strcpy(cf_agc, ab); 186 strcpy(cf_agc, ab);

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/hextolfp.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/hextolfp.c 2009/12/13 16:55:03 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/hextolfp.c 2009/12/14 00:38:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hextolfp.c,v 1.1.1.1 2009/12/13 16:55:03 kardel Exp $ */ 1/* $NetBSD: hextolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * hextolfp - convert an ascii hex string to an l_fp number 4 * hextolfp - convert an ascii hex string to an l_fp number
5 */ 5 */
6#include <stdio.h> 6#include <stdio.h>
7#include <ctype.h> 7#include <ctype.h>
8 8
9#include "ntp_fp.h" 9#include "ntp_fp.h"
10#include "ntp_string.h" 10#include "ntp_string.h"
11#include "ntp_stdlib.h" 11#include "ntp_stdlib.h"
12 12
13int 13int
14hextolfp( 14hextolfp(
@@ -21,27 +21,27 @@ hextolfp( @@ -21,27 +21,27 @@ hextolfp(
21 register u_long dec_i; 21 register u_long dec_i;
22 register u_long dec_f; 22 register u_long dec_f;
23 char *ind = NULL; 23 char *ind = NULL;
24 static const char *digits = "0123456789abcdefABCDEF"; 24 static const char *digits = "0123456789abcdefABCDEF";
25 25
26 dec_i = dec_f = 0; 26 dec_i = dec_f = 0;
27 cp = str; 27 cp = str;
28 28
29 /* 29 /*
30 * We understand numbers of the form: 30 * We understand numbers of the form:
31 * 31 *
32 * [spaces]8_hex_digits[.]8_hex_digits[spaces|\n|\0] 32 * [spaces]8_hex_digits[.]8_hex_digits[spaces|\n|\0]
33 */ 33 */
34 while (isspace((int)*cp)) 34 while (isspace((unsigned char)*cp))
35 cp++; 35 cp++;
36  36
37 cpstart = cp; 37 cpstart = cp;
38 while (*cp != '\0' && (cp - cpstart) < 8 && 38 while (*cp != '\0' && (cp - cpstart) < 8 &&
39 (ind = strchr(digits, *cp)) != NULL) { 39 (ind = strchr(digits, *cp)) != NULL) {
40 dec_i = dec_i << 4; /* multiply by 16 */ 40 dec_i = dec_i << 4; /* multiply by 16 */
41 dec_i += ((ind - digits) > 15) ? (ind - digits) - 6 41 dec_i += ((ind - digits) > 15) ? (ind - digits) - 6
42 : (ind - digits); 42 : (ind - digits);
43 cp++; 43 cp++;
44 } 44 }
45 45
46 if ((cp - cpstart) < 8 || ind == NULL) 46 if ((cp - cpstart) < 8 || ind == NULL)
47 return 0; 47 return 0;
@@ -50,20 +50,20 @@ hextolfp( @@ -50,20 +50,20 @@ hextolfp(
50 50
51 cpstart = cp; 51 cpstart = cp;
52 while (*cp != '\0' && (cp - cpstart) < 8 && 52 while (*cp != '\0' && (cp - cpstart) < 8 &&
53 (ind = strchr(digits, *cp)) != NULL) { 53 (ind = strchr(digits, *cp)) != NULL) {
54 dec_f = dec_f << 4; /* multiply by 16 */ 54 dec_f = dec_f << 4; /* multiply by 16 */
55 dec_f += ((ind - digits) > 15) ? (ind - digits) - 6 55 dec_f += ((ind - digits) > 15) ? (ind - digits) - 6
56 : (ind - digits); 56 : (ind - digits);
57 cp++; 57 cp++;
58 } 58 }
59 59
60 if ((cp - cpstart) < 8 || ind == NULL) 60 if ((cp - cpstart) < 8 || ind == NULL)
61 return 0; 61 return 0;
62  62
63 if (*cp != '\0' && !isspace((int)*cp)) 63 if (*cp != '\0' && !isspace((unsigned char)*cp))
64 return 0; 64 return 0;
65 65
66 lfp->l_ui = dec_i; 66 lfp->l_ui = dec_i;
67 lfp->l_uf = dec_f; 67 lfp->l_uf = dec_f;
68 return 1; 68 return 1;
69} 69}

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/mstolfp.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/mstolfp.c 2009/12/13 16:55:04 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/mstolfp.c 2009/12/14 00:38:48 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mstolfp.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $ */ 1/* $NetBSD: mstolfp.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * mstolfp - convert an ascii string in milliseconds to an l_fp number 4 * mstolfp - convert an ascii string in milliseconds to an l_fp number
5 */ 5 */
6#include <stdio.h> 6#include <stdio.h>
7#include <ctype.h> 7#include <ctype.h>
8 8
9#include "ntp_fp.h" 9#include "ntp_fp.h"
10#include "ntp_stdlib.h" 10#include "ntp_stdlib.h"
11 11
12int 12int
13mstolfp( 13mstolfp(
14 const char *str, 14 const char *str,
@@ -23,43 +23,43 @@ mstolfp( @@ -23,43 +23,43 @@ mstolfp(
23 /* 23 /*
24 * We understand numbers of the form: 24 * We understand numbers of the form:
25 * 25 *
26 * [spaces][-][digits][.][digits][spaces|\n|\0] 26 * [spaces][-][digits][.][digits][spaces|\n|\0]
27 * 27 *
28 * This is one enormous hack. Since I didn't feel like 28 * This is one enormous hack. Since I didn't feel like
29 * rewriting the decoding routine for milliseconds, what 29 * rewriting the decoding routine for milliseconds, what
30 * is essentially done here is to make a copy of the string 30 * is essentially done here is to make a copy of the string
31 * with the decimal moved over three places so the seconds 31 * with the decimal moved over three places so the seconds
32 * decoding routine can be used. 32 * decoding routine can be used.
33 */ 33 */
34 bp = buf; 34 bp = buf;
35 cp = str; 35 cp = str;
36 while (isspace((int)*cp)) 36 while (isspace((unsigned char)*cp))
37 cp++; 37 cp++;
38  38
39 if (*cp == '-') { 39 if (*cp == '-') {
40 *bp++ = '-'; 40 *bp++ = '-';
41 cp++; 41 cp++;
42 } 42 }
43 43
44 if (*cp != '.' && !isdigit((int)*cp)) 44 if (*cp != '.' && !isdigit((unsigned char)*cp))
45 return 0; 45 return 0;
46 46
47 47
48 /* 48 /*
49 * Search forward for the decimal point or the end of the string. 49 * Search forward for the decimal point or the end of the string.
50 */ 50 */
51 cpdec = cp; 51 cpdec = cp;
52 while (isdigit((int)*cpdec)) 52 while (isdigit((unsigned char)*cpdec))
53 cpdec++; 53 cpdec++;
54 54
55 /* 55 /*
56 * Found something. If we have more than three digits copy the 56 * Found something. If we have more than three digits copy the
57 * excess over, else insert a leading 0. 57 * excess over, else insert a leading 0.
58 */ 58 */
59 if ((cpdec - cp) > 3) { 59 if ((cpdec - cp) > 3) {
60 do { 60 do {
61 *bp++ = (char)*cp++; 61 *bp++ = (char)*cp++;
62 } while ((cpdec - cp) > 3); 62 } while ((cpdec - cp) > 3);
63 } else { 63 } else {
64 *bp++ = '0'; 64 *bp++ = '0';
65 } 65 }
@@ -77,26 +77,26 @@ mstolfp( @@ -77,26 +77,26 @@ mstolfp(
77 *bp++ = '0'; 77 *bp++ = '0';
78 } while (--i > 0); 78 } while (--i > 0);
79 } 79 }
80 80
81 /* 81 /*
82 * Copy the remainder up to the millisecond decimal. If cpdec 82 * Copy the remainder up to the millisecond decimal. If cpdec
83 * is pointing at a decimal point, copy in the trailing number too. 83 * is pointing at a decimal point, copy in the trailing number too.
84 */ 84 */
85 while (cp < cpdec) 85 while (cp < cpdec)
86 *bp++ = (char)*cp++; 86 *bp++ = (char)*cp++;
87  87
88 if (*cp == '.') { 88 if (*cp == '.') {
89 cp++; 89 cp++;
90 while (isdigit((int)*cp)) 90 while (isdigit((unsigned char)*cp))
91 *bp++ = (char)*cp++; 91 *bp++ = (char)*cp++;
92 } 92 }
93 *bp = '\0'; 93 *bp = '\0';
94 94
95 /* 95 /*
96 * Check to make sure the string is properly terminated. If 96 * Check to make sure the string is properly terminated. If
97 * so, give the buffer to the decoding routine. 97 * so, give the buffer to the decoding routine.
98 */ 98 */
99 if (*cp != '\0' && !isspace((int)*cp)) 99 if (*cp != '\0' && !isspace((unsigned char)*cp))
100 return 0; 100 return 0;
101 return atolfp(buf, lfp); 101 return atolfp(buf, lfp);
102} 102}

cvs diff -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/libntp/octtoint.c (expand / switch to unified diff)

--- src/external/bsd/ntp/dist/libntp/octtoint.c 2009/12/13 16:55:04 1.1.1.1
+++ src/external/bsd/ntp/dist/libntp/octtoint.c 2009/12/14 00:38:48 1.2
@@ -1,37 +1,37 @@ @@ -1,37 +1,37 @@
1/* $NetBSD: octtoint.c,v 1.1.1.1 2009/12/13 16:55:04 kardel Exp $ */ 1/* $NetBSD: octtoint.c,v 1.2 2009/12/14 00:38:48 christos Exp $ */
2 2
3/* 3/*
4 * octtoint - convert an ascii string in octal to an unsigned 4 * octtoint - convert an ascii string in octal to an unsigned
5 * long, with error checking 5 * long, with error checking
6 */ 6 */
7#include <stdio.h> 7#include <stdio.h>
8#include <ctype.h> 8#include <ctype.h>
9 9
10#include "ntp_stdlib.h" 10#include "ntp_stdlib.h"
11 11
12int 12int
13octtoint( 13octtoint(
14 const char *str, 14 const char *str,
15 u_long *ival 15 u_long *ival
16 ) 16 )
17{ 17{
18 register u_long u; 18 register u_long u;
19 register const char *cp; 19 register const char *cp;
20 20
21 cp = str; 21 cp = str;
22 22
23 if (*cp == '\0') 23 if (*cp == '\0')
24 return 0; 24 return 0;
25 25
26 u = 0; 26 u = 0;
27 while (*cp != '\0') { 27 while (*cp != '\0') {
28 if (!isdigit((int)*cp) || *cp == '8' || *cp == '9') 28 if (!isdigit((unsigned char)*cp) || *cp == '8' || *cp == '9')
29 return 0; 29 return 0;
30 if (u >= 0x20000000) 30 if (u >= 0x20000000)
31 return 0; /* overflow */ 31 return 0; /* overflow */
32 u <<= 3; 32 u <<= 3;
33 u += *cp++ - '0'; /* ascii dependent */ 33 u += *cp++ - '0'; /* ascii dependent */
34 } 34 }
35 *ival = u; 35 *ival = u;
36 return 1; 36 return 1;
37} 37}