From 1b6b651d327efc7210a82ea6d7b48af7acb26c0d Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 11 Feb 2015 18:11:45 -0500 Subject: BSD compiler waening and splint cleanup. --- gpsctl.c | 2 +- gpsd.c | 2 +- gpsmon.c | 2 +- gpspipe.c | 6 ++++-- libgps_shm.c | 2 ++ libgpsd_core.c | 8 ++++---- shmexport.c | 2 ++ 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gpsctl.c b/gpsctl.c index 1e62cb27..b0d78c34 100644 --- a/gpsctl.c +++ b/gpsctl.c @@ -296,7 +296,7 @@ int main(int argc, char **argv) case 'R': /* remove the SHM export segment */ #ifdef SHM_EXPORT_ENABLE /*@-nullpass@*/ - status = shmget(getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY, 0, 0); + status = shmget(getenv("GPSD_SHM_KEY") ? (key_t)atoi(getenv("GPSD_SHM_KEY")) : (key_t)GPSD_KEY, 0, 0); if (status == -1) { gpsd_report(&context.errout, LOG_WARN, "GPSD SHM segment does not exist.\n"); diff --git a/gpsd.c b/gpsd.c index 1084ceae..e8d02e3e 100644 --- a/gpsd.c +++ b/gpsd.c @@ -2243,7 +2243,7 @@ int main(int argc, char *argv[]) } /* read any commands that came in over the control socket */ - for (cfd = 0; cfd < FD_SETSIZE; cfd++) + for (cfd = 0; cfd < (int)FD_SETSIZE; cfd++) if (FD_ISSET(cfd, &control_fds)) { char buf[BUFSIZ]; ssize_t rd; diff --git a/gpsmon.c b/gpsmon.c index de29f005..7fb80b38 100644 --- a/gpsmon.c +++ b/gpsmon.c @@ -746,7 +746,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED) #ifdef NTPSHM_ENABLE /* Update the last fix time seen for PPS if we've actually seen one. */ - if (!isnan(device->newdata.time)) + if (isnan(device->newdata.time)==0) ntpshm_latch(device, &td); #endif /* NTPSHM_ENABLE */ } diff --git a/gpspipe.c b/gpspipe.c index 64cc39e1..69939522 100644 --- a/gpspipe.c +++ b/gpspipe.c @@ -346,11 +346,13 @@ int main(int argc, char **argv) switch( option_u ) { case 2: (void)snprintf(tmstr_u, sizeof(tmstr_u), - " %ld.%06ld", now.tv_sec, now.tv_usec); + " %ld.%06ld", + (long)now.tv_sec, + (long)now.tv_usec); break; case 1: (void)snprintf(tmstr_u, sizeof(tmstr_u), - ".%06ld", now.tv_usec); + ".%06ld", (long)now.tv_usec); break; default: *tmstr_u = '\0'; diff --git a/libgps_shm.c b/libgps_shm.c index 5d37f628..e8dd30f4 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -41,7 +41,9 @@ struct privdata_t int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata) /* open a shared-memory connection to the daemon */ { + /*@-nullpass@*/ int shmid = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY; + /*@+nullpass@*/ libgps_debug_trace((DEBUG_CALLS, "gps_shm_open()\n")); diff --git a/libgpsd_core.c b/libgpsd_core.c index b7316282..a7c5664d 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -1030,7 +1030,7 @@ int gpsd_await_data(/*@out@*/fd_set *rfds, return AWAIT_NOT_READY; else if (errno == EBADF) { int fd; - for (fd = 0; fd < FD_SETSIZE; fd++) + for (fd = 0; fd < (int)FD_SETSIZE; fd++) /* * All we care about here is a cheap, fast, uninterruptible * way to check if a file descriptor is valid. @@ -1051,12 +1051,12 @@ int gpsd_await_data(/*@out@*/fd_set *rfds, int i; char dbuf[BUFSIZ]; dbuf[0] = '\0'; - for (i = 0; i < FD_SETSIZE; i++) + for (i = 0; i < (int)FD_SETSIZE; i++) if (FD_ISSET(i, all_fds)) str_appendf(dbuf, sizeof(dbuf), "%d ", i); str_rstrip_char(dbuf, ' '); (void)strlcat(dbuf, "} -> {", sizeof(dbuf)); - for (i = 0; i < FD_SETSIZE; i++) + for (i = 0; i < (int)FD_SETSIZE; i++) if (FD_ISSET(i, rfds)) str_appendf(dbuf, sizeof(dbuf), " %d ", i); gpsd_report(errout, LOG_SPIN, @@ -1651,7 +1651,7 @@ void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td) double fix_time, integral, fractional; /* this should be an invariant of the way this function is called */ - assert(!isnan(device->newdata.time)); + assert(isnan(device->newdata.time)==0); #ifdef HAVE_CLOCK_GETTIME /*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &td->clock); diff --git a/shmexport.c b/shmexport.c index d4dcf01d..c9fe87b1 100644 --- a/shmexport.c +++ b/shmexport.c @@ -34,7 +34,9 @@ PERMISSIONS bool shm_acquire(struct gps_context_t *context) /* initialize the shared-memory segment to be used for export */ { + /*@-nullpass@*/ int shmid = getenv("GPSD_SHM_KEY") ? atoi(getenv("GPSD_SHM_KEY")) : GPSD_KEY; + /*@+nullpass@*/ shmid = shmget((key_t)shmid, sizeof(struct gps_data_t), (int)(IPC_CREAT|0666)); if (shmid == -1) { -- cgit v1.2.1