[Git][NTPsec/ntpsec][master] 28 commits: remove extraneous ; found by clang -Wextra.
Gary E. Miller
gitlab at mg.gitlab.com
Tue Feb 14 04:48:17 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
ca955a27 by Gary E. Miller at 2017-02-13T16:56:10-08:00
remove extraneous ; found by clang -Wextra.
- - - - -
50d6061c by Gary E. Miller at 2017-02-13T16:58:31-08:00
fix unitialized variable found by clang -Wextra
- - - - -
7ae30ab1 by Gary E. Miller at 2017-02-13T17:03:15-08:00
fix implict conversion found by clang
- - - - -
df9ac62d by Gary E. Miller at 2017-02-13T17:03:29-08:00
fix a bad typo by yours truly.
- - - - -
0eec99ff by Gary E. Miller at 2017-02-13T17:10:05-08:00
add missing extern found by clang -Weverything
- - - - -
89a67984 by Gary E. Miller at 2017-02-13T17:13:31-08:00
unitialized vars found by gcc -Wmaybe-uninitialized
- - - - -
d5134f8c by Gary E. Miller at 2017-02-13T18:59:21-08:00
cant assume _XOPEN exists. fix clang complaint
- - - - -
7e91ffc6 by Gary E. Miller at 2017-02-13T19:01:28-08:00
makrk statics. found by clang
- - - - -
195352f8 by Gary E. Miller at 2017-02-13T19:03:04-08:00
remove unused vars. replace const with #define, found by clang
- - - - -
9ba46f39 by Gary E. Miller at 2017-02-13T19:03:56-08:00
mark statics found by clang
- - - - -
91c3875d by Gary E. Miller at 2017-02-13T19:04:40-08:00
fix clag nits
- - - - -
db8690ba by Gary E. Miller at 2017-02-13T20:24:08-08:00
misleading #if, found by clang
- - - - -
a3c52844 by Gary E. Miller at 2017-02-13T20:24:43-08:00
missing header file, found by clang
- - - - -
602b8c28 by Gary E. Miller at 2017-02-13T20:25:15-08:00
two clang nits
- - - - -
865643fe by Gary E. Miller at 2017-02-13T20:25:47-08:00
clang found unused and static vars, plus a cast
- - - - -
191d3ff4 by Gary E. Miller at 2017-02-13T20:26:17-08:00
clang found a bad cast
- - - - -
ae330d56 by Gary E. Miller at 2017-02-13T20:26:37-08:00
clang found a const * being freed!
- - - - -
0028c077 by Gary E. Miller at 2017-02-13T20:27:08-08:00
misleading #if found by clang
- - - - -
9a10c0fd by Gary E. Miller at 2017-02-13T20:27:31-08:00
bad extern found by clang
- - - - -
bf424ee8 by Gary E. Miller at 2017-02-13T20:27:52-08:00
missing cast found by clang
- - - - -
4d0db770 by Gary E. Miller at 2017-02-13T20:28:13-08:00
one cast to fix dozens found by clang
- - - - -
db3dadcb by Gary E. Miller at 2017-02-13T20:29:03-08:00
missing casts found by clang.
- - - - -
9e51738b by Gary E. Miller at 2017-02-13T20:29:27-08:00
misleading ifdef found by clang
- - - - -
13fedef1 by Gary E. Miller at 2017-02-13T20:30:08-08:00
missing casts found by clang
- - - - -
45953b8a by Gary E. Miller at 2017-02-13T20:30:32-08:00
missing cast found by clang
- - - - -
f94e53d2 by Gary E. Miller at 2017-02-13T20:39:46-08:00
unused and static vars found by clang
- - - - -
b004d970 by Gary E. Miller at 2017-02-13T20:47:08-08:00
missing externs found by clang
- - - - -
16345cf2 by Gary E. Miller at 2017-02-13T20:47:26-08:00
(potentially) missing initializer found by clang
- - - - -
28 changed files:
- include/ntp.h
- include/ntp_refclock.h
- include/ntp_stdlib.h
- include/ntpd.h
- include/parse.h
- include/refclock_pps.h
- libisc/ifiter_getifaddrs.c
- libisc/interfaceiter.c
- libntp/authkeys.c
- libntp/getopt.c
- libntp/msyslog.c
- libntp/ntp_intres.c
- libntp/ntp_random.c
- ntpd/ntp_control.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_packetstamp.c
- ntpd/ntp_sandbox.c
- ntpd/ntp_util.c
- ntpd/ntpd.c
- ntpd/refclock_arbiter.c
- ntpd/refclock_generic.c
- ntpd/refclock_gpsd.c
- ntpd/refclock_jjy.c
- ntpd/refclock_magnavox.c
- ntpd/refclock_modem.c
- ntpd/refclock_neoclock.c
- ntpd/refclock_nmea.c
- ntpd/refclock_shm.c
Changes:
=====================================
include/ntp.h
=====================================
--- a/include/ntp.h
+++ b/include/ntp.h
@@ -9,7 +9,8 @@
#include <stddef.h>
#include <math.h>
-#if (_XOPEN_SOURCE >= 600) || (__STDC_VERSION__ >= 199901L)
+#if ( defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)) \
+ || (__STDC_VERSION__ >= 199901L)
/*
* Supply GCCisms that stop being visible if we tell it we need the
* prototype for strptime(3). Note that this conditionalization is
=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -192,6 +192,12 @@ extern size_t refclock_gtraw (struct recvbuf *, char *, size_t, l_fp *);
extern bool indicate_refclock_packet(struct refclockio *,
struct recvbuf *);
extern void process_refclock_packet(struct recvbuf *);
+extern struct refclock refclock_gpsdjson;
+extern struct refclock refclock_hpgps;
+extern struct refclock refclock_jjy;
+extern struct refclock refclock_neoclock4x;
+extern struct refclock refclock_nmea;
+extern struct refclock refclock_parse;
#endif /* REFCLOCK */
#endif /* GUARD_NTP_REFCLOCK_H */
=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -227,4 +227,7 @@ extern bool trunc_os_clock; /* sys_tick > measured_tick */
#define COMPARE_EQUAL 0
#define COMPARE_LESSTHAN -1
+extern bool sandbox(const bool droproot, char *user, const char *group,
+ const char *chrootdir, bool want_dynamic_interface_tracking);
+
#endif /* GUARD_NTP_STDLIB_H */
=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -468,7 +468,7 @@ extern double wander_threshold;
extern bool initializing; /* initializing flag */
#ifdef ENABLE_DROPROOT
extern bool droproot; /* flag: try to drop root privileges after startup */
-extern bool root_dropped; /* root has been dropped */
+/* extern bool root_dropped; * root has been dropped UNUSED */
extern char *user; /* user to switch to */
extern char *group; /* group to switch to */
extern const char *chrootdir; /* directory to chroot() to */
=====================================
include/parse.h
=====================================
--- a/include/parse.h
+++ b/include/parse.h
@@ -265,6 +265,20 @@ struct clockformat
typedef struct clockformat clockformat_t;
+extern clockformat_t *clockformats[];
+extern clockformat_t clock_computime;
+extern clockformat_t clock_meinberg[];
+extern clockformat_t clock_rawdcf;
+extern clockformat_t clock_rcc8000;
+extern clockformat_t clock_schmid;
+extern clockformat_t clock_sel240x;
+extern clockformat_t clock_trimtaip;
+extern clockformat_t clock_varitext;
+extern clockformat_t clock_wharton_400a;
+extern unsigned short nformats;
+
+
+
/*
* parse interface
*/
=====================================
include/refclock_pps.h
=====================================
--- a/include/refclock_pps.h
+++ b/include/refclock_pps.h
@@ -18,5 +18,5 @@ typedef enum {
extern bool refclock_ppsapi(int, struct refclock_ppsctl *);
extern bool refclock_params(int, struct refclock_ppsctl *);
-extern pps_status refclock_catcher(struct peer *, struct refclock_ppsctl *, int);
-
+extern pps_status refclock_catcher(struct peer *, struct refclock_ppsctl *, int);
+extern struct refclock refclock_shm;
=====================================
libisc/ifiter_getifaddrs.c
=====================================
--- a/libisc/ifiter_getifaddrs.c
+++ b/libisc/ifiter_getifaddrs.c
@@ -45,7 +45,7 @@ isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
isc_interfaceiter_t *iter;
isc_result_t result;
char strbuf[BUFSIZ];
- int trys, ret;
+ int trys, ret = 0;
REQUIRE(mctx != NULL);
REQUIRE(iterp != NULL);
@@ -174,7 +174,7 @@ internal_current(isc_interfaceiter_t *iter) {
memset(&iter->current, 0, sizeof(iter->current));
- namelen = strlen(ifa->ifa_name);
+ namelen = (unsigned int)strlen(ifa->ifa_name);
if (namelen > sizeof(iter->current.name) - 1)
namelen = sizeof(iter->current.name) - 1;
=====================================
libisc/interfaceiter.c
=====================================
--- a/libisc/interfaceiter.c
+++ b/libisc/interfaceiter.c
@@ -135,23 +135,23 @@ static void linux_if_inet6_first(isc_interfaceiter_t *iter);
bool
isc_interfaceiter_next_bool(isc_interfaceiter_t *iter) {
return (ISC_R_SUCCESS == isc_interfaceiter_next(iter));
-};
+}
bool
isc_interfaceiter_create_bool(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
return (ISC_R_SUCCESS == isc_interfaceiter_create(mctx, iterp));
-};
+}
bool
isc_interfaceiter_first_bool(isc_interfaceiter_t *iter) {
return (ISC_R_SUCCESS == isc_interfaceiter_first(iter));
-};
+}
bool
isc_interfaceiter_current_bool(isc_interfaceiter_t *iter,
isc_interface_t *ifdata) {
return (ISC_R_SUCCESS == isc_interfaceiter_current(iter, ifdata));
-};
+}
#if HAVE_IFADDRS_H
=====================================
libntp/authkeys.c
=====================================
--- a/libntp/authkeys.c
+++ b/libntp/authkeys.c
@@ -54,22 +54,22 @@ static void freesymkey(symkey *, symkey **);
static void free_auth_mem(void);
#endif
-symkey key_listhead; /* list of all in-use keys */
+static symkey key_listhead; /* list of all in-use keys */
/*
* The hash table. This is indexed by the low order bits of the
* keyid. This gets updated in auth_resize_hashtable
*/
#define KEYHASH(keyid) ((keyid) & authhashmask)
#define INIT_AUTHHASHSIZE 64
-unsigned short authhashbuckets = INIT_AUTHHASHSIZE;
-unsigned short authhashmask = INIT_AUTHHASHSIZE - 1;
-symkey **key_hash;
+static unsigned short authhashbuckets = INIT_AUTHHASHSIZE;
+static unsigned short authhashmask = INIT_AUTHHASHSIZE - 1;
+static symkey **key_hash;
unsigned int authkeynotfound; /* keys not found */
unsigned int authkeylookups; /* calls to lookup keys */
unsigned int authnumkeys; /* number of active keys */
unsigned int authkeyuncached; /* cache misses */
-unsigned int authnokey; /* calls to encrypt with no key */
+static unsigned int authnokey; /* calls to encrypt with no key */
unsigned int authencryptions; /* calls to encrypt */
unsigned int authdecryptions; /* calls to decrypt */
@@ -77,7 +77,7 @@ unsigned int authdecryptions; /* calls to decrypt */
* Storage for free symkey structures. We malloc() such things but
* never free them.
*/
-symkey *authfreekeys;
+static symkey *authfreekeys;
int authnumfreekeys;
#define MEMINC 16 /* number of new free ones to get */
=====================================
libntp/getopt.c
=====================================
--- a/libntp/getopt.c
+++ b/libntp/getopt.c
@@ -7,9 +7,9 @@
#include "ntp_io.h"
#include "ntp_stdlib.h"
-const int no_argument = 0;
-const int required_argument = 1;
-const int optional_argument = 2;
+#define no_argument 0
+#define required_argument 1
+/* const int optional_argument = 2; UNUSED */
char* ntp_optarg;
int ntp_optopt;
=====================================
libntp/msyslog.c
=====================================
--- a/libntp/msyslog.c
+++ b/libntp/msyslog.c
@@ -141,7 +141,7 @@ addto_syslog(
else
if (syslog_file != NULL)
log_to_file = true;
-#if DEBUG
+#if defined(DEBUG) && DEBUG
if (debug > 0)
log_to_term = true;
#endif
=====================================
libntp/ntp_intres.c
=====================================
--- a/libntp/ntp_intres.c
+++ b/libntp/ntp_intres.c
@@ -146,10 +146,10 @@ typedef struct dnsworker_ctx_tag {
/* === variables === */
-dnschild_ctx ** dnschild_contexts; /* parent */
-u_int dnschild_contexts_alloc;
-dnsworker_ctx ** dnsworker_contexts; /* child */
-u_int dnsworker_contexts_alloc;
+static dnschild_ctx ** dnschild_contexts; /* parent */
+static u_int dnschild_contexts_alloc;
+static dnsworker_ctx ** dnsworker_contexts; /* child */
+static u_int dnsworker_contexts_alloc;
#ifdef HAVE_RES_INIT
static time_t next_res_init;
=====================================
libntp/ntp_random.c
=====================================
--- a/libntp/ntp_random.c
+++ b/libntp/ntp_random.c
@@ -10,6 +10,7 @@
#include <openssl/rand.h>
#include "ntp_endian.h"
+#include "ntp_random.h"
int32_t
ntp_random(void)
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -2082,9 +2082,9 @@ ctl_putpeer(
strlen(p->hostname));
#ifdef REFCLOCK
if (p->procptr != NULL) {
- char buf[NI_MAXHOST];
- strlcpy(buf, refclock_name(p), sizeof(buf));
- ctl_putstr(peer_var[id].text, buf, strlen(buf));
+ char buf1[NI_MAXHOST];
+ strlcpy(buf1, refclock_name(p), sizeof(buf1));
+ ctl_putstr(peer_var[id].text, buf1, strlen(buf1));
}
#endif /* REFCLOCK */
break;
@@ -4200,7 +4200,7 @@ report_event(
msyslog(LOG_INFO, "%s", statstr);
}
record_proto_stats(statstr);
-#if DEBUG
+#if defined(DEBUG) && DEBUG
if (debug)
printf("event at %lu %s\n", current_time, statstr);
#endif
=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -158,13 +158,13 @@ bool pll_control = false; /* kernel support available */
bool kern_enable = true; /* kernel support enabled */
bool hardpps_enable; /* kernel PPS discipline enabled */
bool ext_enable; /* external clock enabled */
-int pps_stratum; /* pps stratum */
-int kernel_status; /* from ntp_adjtime */
+/* static int pps_stratum; * pps stratum UNUSED */
+static int kernel_status; /* from ntp_adjtime */
bool allow_panic = false; /* allow panic correction (-g) */
bool force_step_once = false; /* always step time once at startup (-G) */
bool mode_ntpdate = false; /* exit on first clock set (-q) */
int freq_cnt; /* initial frequency clamp */
-int freq_set; /* initial set frequency switch */
+static int freq_set; /* initial set frequency switch */
/*
* Clock state machine variables
@@ -1323,7 +1323,7 @@ loop_config(
freq = HUFFPUFF;
sys_hufflen = (int)(freq / HUFFPUFF);
sys_huffpuff = emalloc(sizeof(sys_huffpuff[0]) *
- sys_hufflen);
+ (unsigned long)sys_hufflen);
for (i = 0; i < sys_hufflen; i++)
sys_huffpuff[i] = 1e9;
sys_mindly = 1e9;
=====================================
ntpd/ntp_packetstamp.c
=====================================
--- a/ntpd/ntp_packetstamp.c
+++ b/ntpd/ntp_packetstamp.c
@@ -62,7 +62,7 @@ enable_packetstamps(
#ifdef USE_SCM_TIMESTAMP
{
if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP,
- (char*)&on, sizeof(on)))
+ (const char*)&on, sizeof(on)))
msyslog(LOG_DEBUG,
"setsockopt SO_TIMESTAMP on fails on address %s: %m",
socktoa(addr));
@@ -122,7 +122,7 @@ fetch_packetstamp(
unsigned long ticks;
double fuzz;
l_fp lfpfuzz;
- l_fp nts;
+ l_fp nts = 0;
#ifdef ENABLE_DEBUG_TIMING
l_fp dts;
#endif
=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -37,12 +37,12 @@ static priv_set_t *highprivs = NULL;
#endif /* HAVE_SECCOMP_H */
#ifdef ENABLE_DROPROOT
-bool root_dropped;
-uid_t sw_uid;
-gid_t sw_gid;
-char *endp;
-struct group *gr;
-struct passwd *pw;
+static bool root_dropped;
+static uid_t sw_uid;
+static gid_t sw_gid;
+static char *endp;
+static struct group *gr;
+static struct passwd *pw;
#endif /* ENABLE_DROPROOT */
#include "ntp_syslog.h"
@@ -55,7 +55,7 @@ static void catchTrap(int sig);
#endif
bool sandbox(const bool droproot,
- const char *user, const char *group,
+ char *user, const char *group,
const char *chrootdir,
bool want_dynamic_interface_tracking)
{
@@ -85,7 +85,7 @@ bool sandbox(const bool droproot,
msyslog( LOG_ERR, "prctl( PR_SET_KEEPCAPS, 1L ) failed: %m" );
exit(-1);
}
-# elif HAVE_SOLARIS_PRIVS
+# elif defined(HAVE_SOLARIS_PRIVS)
/* Nothing to do here */
# else
/* we need a user to switch to */
@@ -174,7 +174,7 @@ getgroup:
exit(-1);
}
# endif /* HAVE_SOLARIS_PRIVS */
- if (user && initgroups(user, sw_gid)) {
+ if (user && initgroups(user, (int)sw_gid)) {
msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user);
exit (-1);
}
@@ -193,7 +193,7 @@ getgroup:
}
}
else if (pw)
- if (0 != initgroups(pw->pw_name, pw->pw_gid)) {
+ if (0 != initgroups(pw->pw_name, (int)pw->pw_gid)) {
msyslog(LOG_ERR, "initgroups(<%s>, %d) filed: %m", pw->pw_name, pw->pw_gid);
exit (-1);
}
=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -819,7 +819,7 @@ rereadkeys(void)
}
-#if __UNUSED__
+#ifdef __UNUSED__
/*
* ntp_exit - document explicitly that ntpd has exited
*/
=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -33,11 +33,6 @@
#include "version.h"
-extern bool sandbox(const bool droproot,
- const char *user, const char *group,
- const char *chrootdir,
- bool want_dynamic_interface_tracking);
-
void catchQuit (int sig);
static volatile int signo = 0;
/* In an ideal world, 'finish_safe()' would declared as noreturn... */
=====================================
ntpd/refclock_arbiter.c
=====================================
--- a/ntpd/refclock_arbiter.c
+++ b/ntpd/refclock_arbiter.c
@@ -335,7 +335,7 @@ arb_receive(
strlcpy(pp->a_lastcode, tbuf, sizeof(pp->a_lastcode));
pp->a_lastcode[LENARB - 2] = up->qualchar;
strlcat(pp->a_lastcode, up->status, sizeof(pp->a_lastcode));
- pp->lencode = strlen(pp->a_lastcode);
+ pp->lencode = (int)strlen(pp->a_lastcode);
syncchar = ' ';
if (sscanf(pp->a_lastcode, "%c%2d %3d %2d:%2d:%2d",
&syncchar, &pp->year, &pp->day, &pp->hour,
=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -3232,7 +3232,7 @@ parse_process(
parsetime_t *parsetime
)
{
- l_fp off, rectime, reftime;
+ l_fp off, rectime = 0, reftime = 0;
double fudge;
/* silence warning: integral part may be used uninitialized in this function */
@@ -4828,7 +4828,7 @@ trimbletsip_event(
* to avoid floating point operations at all!
*/
-static float
+static double
getflt(
uint8_t *bp
)
@@ -4846,7 +4846,7 @@ getflt(
uval.bd[1] = *bp++;
uval.bd[0] = *bp;
#endif /* ! WORDS_BIGENDIAN */
- return uval.fv;
+ return (double)uval.fv;
}
static double
=====================================
ntpd/refclock_gpsd.c
=====================================
--- a/ntpd/refclock_gpsd.c
+++ b/ntpd/refclock_gpsd.c
@@ -666,7 +666,7 @@ gpsd_receive(
--pdst;
*pdst = '\0';
/* process data and reset buffer */
- up->buflen = pdst - up->buffer;
+ up->buflen = (int)(pdst - up->buffer);
gpsd_parse(peer, &rbufp->recv_time);
pdst = up->buffer;
} else if (pdst != edst) {
@@ -675,7 +675,7 @@ gpsd_receive(
*pdst++ = ch;
}
}
- up->buflen = pdst - up->buffer;
+ up->buflen = (int)(pdst - up->buffer);
up->tickover = TICKOVER_LOW;
}
@@ -827,7 +827,7 @@ timer_primary(
DPRINTF(2, ("%s: timer livecheck: '%s'\n",
up->logname, s_req_version));
log_data(peer, "send", s_req_version, rlen);
- rc = write(pp->io.fd, s_req_version, rlen);
+ rc = write(pp->io.fd, s_req_version, (int)rlen);
(void)rc;
} else if (-1 != up->fdt) {
gpsd_test_socket(peer);
@@ -956,7 +956,7 @@ eval_strict(
if (up->fl_ibt && up->fl_pps) {
/* use TPV reference time + PPS receive time */
add_clock_sample(peer, pp, up->ibt_stamp, up->pps_recvt);
- peer->precision = up->pps_prec;
+ peer->precision = (int8_t)up->pps_prec;
/* both packets consumed now... */
up->fl_pps = 0;
up->fl_ibt = 0;
@@ -979,7 +979,7 @@ eval_pps_secondary(
if (up->fl_pps2) {
/* feed data */
add_clock_sample(peer, pp, up->pps_stamp2, up->pps_recvt2);
- peer->precision = up->pps_prec;
+ peer->precision = (int8_t)up->pps_prec;
/* PPS peer flag logic */
up->ppscount2 = min(PPS2_MAXCOUNT, (up->ppscount2 + 2));
if ((PPS2_MAXCOUNT == up->ppscount2) &&
@@ -1001,7 +1001,7 @@ eval_serial(
{
if (up->fl_ibt) {
add_clock_sample(peer, pp, up->ibt_stamp, up->ibt_recvt);
- peer->precision = up->ibt_prec;
+ peer->precision = (int8_t)up->ibt_prec;
/* mark time stamp as burned... */
up->fl_ibt = 0;
++up->tc_ibt_used;
@@ -1150,6 +1150,8 @@ json_token_skip(
tid = json_token_skip(ctx, tid);
break;
+ case JSMN_PRIMITIVE:
+ case JSMN_STRING:
default:
++tid;
break;
@@ -1441,7 +1443,7 @@ process_version(
clockprocT * const pp = peer->procptr;
gpsd_unitT * const up = (gpsd_unitT *)pp->unitptr;
- int len;
+ int len;
char * buf;
const char *revision;
const char *release;
@@ -1503,7 +1505,7 @@ process_version(
s_req_watch[up->pf_toff != 0], up->device);
buf = up->buffer;
len = strlen(buf);
- log_data(peer, "send", buf, len);
+ log_data(peer, "send", buf, (size_t)len);
if (len != write(pp->io.fd, buf, len) && (syslogok(pp, up))) {
/* Note: if the server fails to read our request, the
* resulting data timeout will take care of the
@@ -1640,7 +1642,7 @@ process_pps(
/* Try to read the precision field from the PPS record. If it's
* not there, take the precision from the serial data.
*/
- xlog2 = json_object_lookup_int_default(
+ xlog2 = (int)json_object_lookup_int_default(
jctx, 0, "precision", up->ibt_prec);
up->pps_prec = clamped_precision(xlog2);
@@ -1738,7 +1740,8 @@ gpsd_parse(
/* See if we can grab anything potentially useful. JSMN does not
* need a trailing NUL, but it needs the number of bytes to
* process. */
- if (!json_parse_record(&up->json_parse, up->buffer, up->buflen)) {
+ if (!json_parse_record(&up->json_parse, up->buffer,
+ (size_t)up->buflen)) {
++up->tc_breply;
return;
}
=====================================
ntpd/refclock_jjy.c
=====================================
--- a/ntpd/refclock_jjy.c
+++ b/ntpd/refclock_jjy.c
@@ -4467,7 +4467,7 @@ jjy_write_clockstats ( struct peer *peer, int iMark, const char *pData )
strlcpy( sLog, pMark, sizeof( sLog )) ;
printableString( sLog+iMarkLen, sizeof(sLog)-iMarkLen, pData, iDataLen ) ;
-#ifdef DEBUG
+#if defined(DEBUG) && DEBUG
if ( debug ) {
printf( "refclock_jjy.c : clockstats : %s\n", sLog ) ;
}
=====================================
ntpd/refclock_magnavox.c
=====================================
--- a/ntpd/refclock_magnavox.c
+++ b/ntpd/refclock_magnavox.c
@@ -1562,7 +1562,6 @@ mx4200_send(struct peer *peer, char *fmt, ...)
{
struct refclockproc *pp;
- register char *cp;
register int n, m;
va_list ap;
char buf1[1024];
@@ -1575,9 +1574,9 @@ mx4200_send(struct peer *peer, char *fmt, ...)
vsnprintf(buf1, sizeof(buf1) - 1, fmt, ap);
buf1[sizeof(buf1) - 1 ] = '\0';
- ck = mx4200_cksum(cp, strlen(buf1));
+ ck = mx4200_cksum(buf1, strlen(buf1));
/* buf can never overrun */
- n = snprintf(buf, sizeof(buf) - 1, "$%1024s*%02X\r\n", cp, ck);
+ n = snprintf(buf, sizeof(buf) - 1, "$%1024s*%02X\r\n", buf1, ck);
m = write(pp->io.fd, buf, (unsigned)n);
if (m < 0)
=====================================
ntpd/refclock_modem.c
=====================================
--- a/ntpd/refclock_modem.c
+++ b/ntpd/refclock_modem.c
@@ -909,7 +909,7 @@ modem_timecode(
return;
strlcpy(pp->a_lastcode, str, sizeof(pp->a_lastcode));
- pp->lencode = strlen(pp->a_lastcode);
+ pp->lencode = (int)strlen(pp->a_lastcode);
if (!refclock_process(pp)) {
refclock_report(peer, CEVNT_BADTIME);
return;
=====================================
ntpd/refclock_neoclock.c
=====================================
--- a/ntpd/refclock_neoclock.c
+++ b/ntpd/refclock_neoclock.c
@@ -254,7 +254,7 @@ neoclock4x_start(int unit,
peer->sstclktype = CTL_SST_TS_UHF;
up->leap_status = 0;
- up->unit = unit;
+ up->unit = (short)unit;
strlcpy(up->firmware, "?", sizeof(up->firmware));
up->firmwaretag = '?';
strlcpy(up->serial, "?", sizeof(up->serial));
@@ -565,7 +565,7 @@ neoclock4x_receive(struct recvbuf *rbufp)
up->utc_hour = pp->hour;
up->utc_minute = pp->minute;
up->utc_second = pp->second;
- up->utc_msec = pp->nsec/NSEC_TO_MILLI;
+ up->utc_msec = (int)pp->nsec/NSEC_TO_MILLI;
if(!refclock_process(pp))
{
@@ -918,7 +918,7 @@ neol_query_firmware(int fd,
tmpbuf[len++] = ' ';
tmpbuf[len++] = '/';
tmpbuf[len++] = ' ';
- lastsearch = len;
+ lastsearch = (int)len;
}
last_c_was_crlf = true;
}
=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -1858,7 +1858,7 @@ eval_gps_time(
/* - check if we should log a GPS epoch warp */
weeks = (adj_day - gps_day) / 7;
if (weeks != up->epoch_warp) {
- up->epoch_warp = weeks;
+ up->epoch_warp = (short)weeks;
LOGIF(CLOCKINFO, (LOG_INFO,
"%s Changed GPS epoch warp to %d weeks",
refclock_name(peer), weeks));
=====================================
ntpd/refclock_shm.c
=====================================
--- a/ntpd/refclock_shm.c
+++ b/ntpd/refclock_shm.c
@@ -176,7 +176,7 @@ shm_start(
if (up->shm != 0) {
pp->unitptr = up;
up->shm->precision = PRECISION;
- peer->precision = up->shm->precision;
+ peer->precision = (int8_t)up->shm->precision;
up->shm->valid = 0;
up->shm->nsamples = NSAMPLES;
pp->clockname = NAME;
@@ -554,8 +554,8 @@ shm_timer(
DPRINTF(2, ("%s: SHM(%d) feeding data\n", refclock_name(peer), unit));
tsrcv = tspec_stamp_to_lfp(shm_stat.tvr);
tsref = tspec_stamp_to_lfp(shm_stat.tvt);
- pp->leap = shm_stat.leap;
- peer->precision = shm_stat.precision;
+ pp->leap = (uint8_t)shm_stat.leap;
+ peer->precision = (int8_t)shm_stat.precision;
refclock_process_offset(pp, tsref, tsrcv, pp->fudgetime1);
up->good++;
}
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/926f05e0151136d6df681f3aa8f62f80352ef2a2...16345cf25087b6bf45156ea5e75b122db832fb5f
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170214/2ca1a3fa/attachment.html>
More information about the vc
mailing list