From: Juergen Perlinger Date: Wed, 29 Jul 2015 20:50:29 +0000 (+0200) Subject: Bug 2821: minor build issues: fixed refclock_gpsdjson.c X-Git-Tag: NTP_4_3_69~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f7324fac8dc64529b3b69d34c1a35e7d754d471;p=thirdparty%2Fntp.git Bug 2821: minor build issues: fixed refclock_gpsdjson.c bk: 55b93c95IB8w7bTLY86rAuenB1BBng --- diff --git a/ChangeLog b/ChangeLog index 34e062aba..e33fbd4e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ be configured for the distribution targets. Harlan Stenn. * [Bug 2883] ntpd crashes on exit with empty driftfile. Miroslav Lichvar. * [Bug 2886] Mis-spelling: "outlyer" should be "outlier". dave@horsfall.org +* [Bug 2821] minor build issues: fixed refclock_gpsdjson.c. perlinger@ntp.org * libntp/emalloc.c: Remove explicit include of stdint.h. Harlan Stenn. * Put Unity CPPFLAGS items in unity_config.h. Harlan Stenn. * tests/ntpd/g_leapsec.cpp typo fix. Harlan Stenn. diff --git a/ntpd/refclock_gpsdjson.c b/ntpd/refclock_gpsdjson.c index 0a88cece4..c2bf09a80 100644 --- a/ntpd/refclock_gpsdjson.c +++ b/ntpd/refclock_gpsdjson.c @@ -1113,9 +1113,9 @@ strtojint( /* Now try to convert a sequence of digits. */ hold = cp; accu = 0; - while (isdigit(*(const unsigned char*)cp)) { + while (isdigit(*(const u_char*)cp)) { flags |= (accu > limit_lo); - accu = accu * 10 + (*(const unsigned char*)cp++ - '0'); + accu = accu * 10 + (*(const u_char*)cp++ - '0'); flags |= (accu > limit_hi); } /* Check for empty conversion (no digits seen). */ @@ -2086,8 +2086,8 @@ convert_ascii_time( return FALSE; /* could not parse the mandatory stuff! */ if (*ep == '.') { dw = 100000000u; - while (isdigit(*(unsigned char*)++ep)) { - ts.tv_nsec += (*(unsigned char*)ep - '0') * dw; + while (isdigit(*(u_char*)++ep)) { + ts.tv_nsec += (*(u_char*)ep - '0') * dw; dw /= 10u; } } @@ -2189,16 +2189,16 @@ log_data( char *dtop = s_lbuf + sizeof(s_lbuf) - 1; /* for NUL */ while (sptr != stop && dptr != dtop) { - if (*sptr == '\\') { + u_char uch = (u_char)*sptr++; + if (uch == '\\') { dptr = add_string(dptr, dtop, "\\\\"); - } else if (isprint(*sptr)) { - *dptr++ = *sptr; + } else if (isprint(uch)) { + *dptr++ = (char)uch; } else { char fbuf[6]; - snprintf(fbuf, sizeof(fbuf), "\\%03o", *(const u_char*)sptr); + snprintf(fbuf, sizeof(fbuf), "\\%03o", uch); dptr = add_string(dptr, dtop, fbuf); } - sptr++; } *dptr = '\0'; mprintf("%s[%s]: '%s'\n", up->logname, what, s_lbuf);