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/ntpd fix bogus ctype casts
details: https://anonhg.NetBSD.org/src/rev/815d886a48d1
branches: trunk
changeset: 749986:815d886a48d1
user: christos <christos%NetBSD.org@localhost>
date: Mon Dec 14 00:46:21 2009 +0000
description:
fix bogus ctype casts
diffstat:
external/bsd/ntp/dist/ntpd/ntp_refclock.c | 2 +-
external/bsd/ntp/dist/ntpd/ntp_request.c | 15 ++++-----------
external/bsd/ntp/dist/ntpd/refclock_arc.c | 8 ++++----
external/bsd/ntp/dist/ntpd/refclock_heath.c | 4 ++--
external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c | 8 ++++----
external/bsd/ntp/dist/ntpd/refclock_nmea.c | 21 +++++++++++----------
external/bsd/ntp/dist/ntpd/refclock_oncore.c | 22 +++++++++++-----------
external/bsd/ntp/dist/ntpd/refclock_parse.c | 4 ++--
8 files changed, 39 insertions(+), 45 deletions(-)
diffs (271 lines):
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/ntp_refclock.c
--- a/external/bsd/ntp/dist/ntpd/ntp_refclock.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_refclock.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_refclock.c,v 1.1.1.1 2009/12/13 16:55:38 kardel Exp $ */
+/* $NetBSD: ntp_refclock.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* ntp_refclock - processing support for reference clocks
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/ntp_request.c
--- a/external/bsd/ntp/dist/ntpd/ntp_request.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/ntp_request.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ntp_request.c,v 1.1.1.1 2009/12/13 16:55:40 kardel Exp $ */
+/* $NetBSD: ntp_request.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* ntp_request.c - respond to information requests
@@ -411,7 +411,6 @@
int mod_okay
)
{
- static u_long quiet_until;
struct req_pkt *inpkt;
struct req_pkt_tail *tailinpkt;
sockaddr_u *srcadr;
@@ -450,14 +449,8 @@
|| (++ec, INFO_MBZ(inpkt->mbz_itemsize) != 0)
|| (++ec, rbufp->recv_length < REQ_LEN_HDR)
) {
- NLOG(NLOG_SYSEVENT)
- if (current_time >= quiet_until) {
- msyslog(LOG_ERR,
- "process_private: drop test %d"
- " failed, pkt from %s",
- ec, stoa(srcadr));
- quiet_until = current_time + 60;
- }
+ msyslog(LOG_ERR, "process_private: INFO_ERR_FMT: test %d failed, pkt from %s", ec, stoa(srcadr));
+ req_ack(srcadr, inter, inpkt, INFO_ERR_FMT);
return;
}
@@ -1183,7 +1176,7 @@
/*
* Importations from the peer module
*/
- extern int peer_hash_count[NTP_HASH_SIZE];
+ extern int peer_hash_count[];
extern int peer_free_count;
extern u_long peer_timereset;
extern u_long findpeer_calls;
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_arc.c
--- a/external/bsd/ntp/dist/ntpd/refclock_arc.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_arc.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_arc.c,v 1.1.1.1 2009/12/13 16:55:44 kardel Exp $ */
+/* $NetBSD: refclock_arc.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* refclock_arc - clock driver for ARCRON MSF/DCF/WWVB receivers
@@ -831,7 +831,7 @@
static int
get2(char *p, int *val)
{
- if (!isdigit((int)p[0]) || !isdigit((int)p[1])) return 0;
+ if (!isdigit((unsigned char)p[0]) || !isdigit((unsigned char)p[1])) return 0;
*val = (p[0] - '0') * 10 + p[1] - '0';
return 1;
}
@@ -839,7 +839,7 @@
static int
get1(char *p, int *val)
{
- if (!isdigit((int)p[0])) return 0;
+ if (!isdigit((unsigned char)p[0])) return 0;
*val = p[0] - '0';
return 1;
}
@@ -931,7 +931,7 @@
#ifdef DEBUG
if(debug) { /* Show \r as `R', other non-printing char as `?'. */
printf("arc: stamp -->%c<-- (%d chars rcvd)\n",
- ((c == '\r') ? 'R' : (isgraph((int)c) ? c : '?')),
+ ((c == '\r') ? 'R' : (isgraph((unsigned char)c) ? c : '?')),
rbufp->recv_length);
}
#endif
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_heath.c
--- a/external/bsd/ntp/dist/ntpd/refclock_heath.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_heath.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_heath.c,v 1.1.1.1 2009/12/13 16:55:48 kardel Exp $ */
+/* $NetBSD: refclock_heath.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* refclock_heath - clock driver for Heath GC-1000
@@ -379,7 +379,7 @@
/*
* Determine synchronization and last update
*/
- if (!isdigit((int)dsec))
+ if (!isdigit((unsigned char)dsec))
pp->leap = LEAP_NOTINSYNC;
else {
pp->nsec = (dsec - '0') * 100000000;
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c
--- a/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_neoclock4x.c,v 1.1.1.1 2009/12/13 16:55:46 kardel Exp $ */
+/* $NetBSD: refclock_neoclock4x.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
*
@@ -794,9 +794,9 @@
int i;
int n = 0;
- for(i=0; isxdigit((int)str[i]) && i < maxlen; i++)
+ for(i=0; isxdigit((unsigned char)str[i]) && i < maxlen; i++)
{
- hexdigit = isdigit((int)str[i]) ? toupper(str[i]) - '0' : toupper(str[i]) - 'A' + 10;
+ hexdigit = isdigit((unsigned char)str[i]) ? toupper((unsigned char)str[i]) - '0' : toupper((unsigned char)str[i]) - 'A' + 10;
n = 16 * n + hexdigit;
}
*result = n;
@@ -812,7 +812,7 @@
int i;
int n = 0;
- for(i=0; isdigit((int)str[i]) && i < maxlen; i++)
+ for(i=0; isdigit((unsigned char)str[i]) && i < maxlen; i++)
{
digit = str[i] - '0';
n = 10 * n + digit;
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_nmea.c
--- a/external/bsd/ntp/dist/ntpd/refclock_nmea.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_nmea.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_nmea.c,v 1.1.1.1 2009/12/13 16:55:55 kardel Exp $ */
+/* $NetBSD: refclock_nmea.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* refclock_nmea.c - clock driver for an NMEA GPS CLOCK
@@ -26,6 +26,7 @@
#include <sys/stat.h>
#include <stdio.h>
#include <ctype.h>
+#include <sys/socket.h>
#include "ntpd.h"
#include "ntp_io.h"
@@ -643,12 +644,12 @@
/*
* Check time code format of NMEA
*/
- if (!isdigit((int)dp[0]) ||
- !isdigit((int)dp[1]) ||
- !isdigit((int)dp[2]) ||
- !isdigit((int)dp[3]) ||
- !isdigit((int)dp[4]) ||
- !isdigit((int)dp[5])) {
+ if (!isdigit((unsigned char)dp[0]) ||
+ !isdigit((unsigned char)dp[1]) ||
+ !isdigit((unsigned char)dp[2]) ||
+ !isdigit((unsigned char)dp[3]) ||
+ !isdigit((unsigned char)dp[4]) ||
+ !isdigit((unsigned char)dp[5])) {
DPRINTF(1, ("NMEA time code %c%c%c%c%c%c non-numeric",
dp[0], dp[1], dp[2], dp[3], dp[4], dp[5]));
@@ -668,11 +669,11 @@
*/
pp->nsec = 0;
if (dp[6] == '.') {
- if (isdigit((int)dp[7])) {
+ if (isdigit((unsigned char)dp[7])) {
pp->nsec = (dp[7] - '0') * 100000000;
- if (isdigit((int)dp[8])) {
+ if (isdigit((unsigned char)dp[8])) {
pp->nsec += (dp[8] - '0') * 10000000;
- if (isdigit((int)dp[9])) {
+ if (isdigit((unsigned char)dp[9])) {
pp->nsec += (dp[9] - '0') * 1000000;
}
}
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_oncore.c
--- a/external/bsd/ntp/dist/ntpd/refclock_oncore.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_oncore.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_oncore.c,v 1.1.1.1 2009/12/13 16:55:54 kardel Exp $ */
+/* $NetBSD: refclock_oncore.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -1233,12 +1233,12 @@
/* Remove trailing space */
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 */
@@ -1247,16 +1247,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, "STATUS", (size_t) 6) || !strncmp(cc, "SHMEM", (size_t) 5)) {
@@ -1266,8 +1266,8 @@
/* Uppercase argument as well */
for (cp = ca; *cp; cp++)
- if (isascii((int)*cp) && islower((int)*cp))
- *cp = toupper(*cp);
+ if (isascii((unsigned char)*cp) && islower((unsigned char)*cp))
+ *cp = toupper((unsigned char)*cp);
if (!strncmp(cc, "LAT", (size_t) 3)) {
f1 = f2 = f3 = 0;
@@ -2897,7 +2897,7 @@
;
cp1 = cp;
cp2 = Model;
- for (; !isspace((int)*cp) && cp-cp1 < 20; cp++, cp2++)
+ for (; !isspace((unsigned char)*cp) && cp-cp1 < 20; cp++, cp2++)
*cp2 = *cp;
*cp2 = '\0';
diff -r 27064c6eec10 -r 815d886a48d1 external/bsd/ntp/dist/ntpd/refclock_parse.c
--- a/external/bsd/ntp/dist/ntpd/refclock_parse.c Mon Dec 14 00:45:59 2009 +0000
+++ b/external/bsd/ntp/dist/ntpd/refclock_parse.c Mon Dec 14 00:46:21 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refclock_parse.c,v 1.1.1.1 2009/12/13 16:56:00 kardel Exp $ */
+/* $NetBSD: refclock_parse.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */
/*
* /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A
@@ -1490,7 +1490,7 @@
if (!hex && /* no binary only */
(*src != '\\') && /* no plain \ */
(*src != '"') && /* no " */
- isprint((int)*src)) /* only printables */
+ isprint((unsigned char)*src)) /* only printables */
{ /* they are easy... */
*buffer++ = *src++;
blen--;
Home |
Main Index |
Thread Index |
Old Index