]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Bug 2821: minor build issues: fixed refclock_gpsdjson.c
authorJuergen Perlinger <perlinger@ntp.org>
Wed, 29 Jul 2015 20:50:29 +0000 (22:50 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Wed, 29 Jul 2015 20:50:29 +0000 (22:50 +0200)
bk: 55b93c95IB8w7bTLY86rAuenB1BBng

ChangeLog
ntpd/refclock_gpsdjson.c

index 34e062abae313afd91a13a5585dad85281af341b..e33fbd4e2a5d472330f5e32e0181704b994de766 100644 (file)
--- 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.
index 0a88cece4d24a2f8291ce536ac71a3372bac890d..c2bf09a805e8ddc82dcd9c5c4d71a0c911718f55 100644 (file)
@@ -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);