diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-01-21 09:57:59 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-01-21 09:57:59 +0000 |
commit | 7925f0d0fcb3c98dc254ba1d18aef0c89c86b8c6 (patch) | |
tree | e3aefcf4260a9c8d3949e0a2b16941ceb7ff83de | |
parent | 9bafada0e09f12e2ad26b3452b2e6903ba11d3f5 (diff) | |
download | gpsd-7925f0d0fcb3c98dc254ba1d18aef0c89c86b8c6.tar.gz |
Splint cleanup.
-rw-r--r-- | gpsctl.c | 18 | ||||
-rw-r--r-- | gpsd.c | 4 | ||||
-rw-r--r-- | hex.c | 2 | ||||
-rw-r--r-- | navcom.c | 4 |
4 files changed, 18 insertions, 10 deletions
@@ -306,17 +306,18 @@ int main(int argc, char **argv) exit(1); } + /*@ -mustfreeonly -immediatetrans @*/ session.context = &context; gpsd_tty_init(&session); (void)strlcpy(session.gpsdata.gps_device, device, sizeof(session.gpsdata.gps_device)); session.device_type = forcetype; - gpsd_open(&session); - gpsd_set_raw(&session); - session.device_type->speed_switcher(&session, 4800); + (void)gpsd_open(&session); + (void)gpsd_set_raw(&session); + (void)session.device_type->speed_switcher(&session, 4800); (void)tcdrain(session.gpsdata.gps_fd); for(i = 0; i < (int)(sizeof(speeds) / sizeof(speeds[0])); i++) { - gpsd_set_speed(&session, speeds[i], 'N', 1); - session.device_type->speed_switcher(&session, 4800); + (void)gpsd_set_speed(&session, speeds[i], 'N', 1); + (void)session.device_type->speed_switcher(&session, 4800); (void)tcdrain(session.gpsdata.gps_fd); } gpsd_set_speed(&session, 4800, 'N', 1); @@ -325,10 +326,12 @@ int main(int argc, char **argv) session.device_type->mode_switcher(&session, MODE_NMEA); gpsd_wrap(&session); exit(0); + /*@ +mustfreeonly +immediatetrans @*/ } else { /* access to the daemon failed, use the low-level facilities */ static struct gps_context_t context; /* start it zeroed */ static struct gps_device_t session; /* zero this too */ + /*@ -mustfreeonly -immediatetrans @*/ session.context = &context; /* in case gps_init isn't called */ /* @@ -401,6 +404,7 @@ int main(int argc, char **argv) /* now perform the actual control function */ status = 0; + /*@ -nullderef @*/ if (to_nmea || to_binary) { if (session.device_type->mode_switcher == NULL) { (void)fprintf(stderr, @@ -455,6 +459,7 @@ int main(int argc, char **argv) * assumed by the driver interface. */ extern struct gps_type_t ubx_binary; + /*@ -usedef @*/ if (session.device_type == &ubx_binary) { if (!ubx_write(session.gpsdata.gps_fd, (unsigned)cooked[0], (unsigned)cooked[1], @@ -465,6 +470,7 @@ int main(int argc, char **argv) } } + /*@ +usedef @*/ else if (session.device_type->control_send == NULL) { (void)fprintf(stderr, "gpsctl: %s devices have no control sender.\n", @@ -491,5 +497,7 @@ int main(int argc, char **argv) gpsd_wrap(&session); } exit(status); + /*@ +nullderef @*/ + /*@ +mustfreeonly +immediatetrans @*/ } } @@ -450,7 +450,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf, ssize_t len) chunklen = strlen(chunk); chunkend = chunk + chunklen; } else - chunklen = chunkend - chunk + 1; + chunklen = (size_t)(chunkend - chunk + 1); if (debuglevel >= 3) { char *cp, chunk2[MAX_PACKET_LENGTH*3]; @@ -1297,7 +1297,7 @@ static void handle_control(int sfd, char *buf) if ((chp = find_device(stash)) != NULL) { gpsd_report(LOG_INF,"<= control(%d): writing fromhex(%s) to %s\n", sfd, eq, stash); /* NOTE: this destroys the original buffer contents */ - len = gpsd_hexpack(eq, eq, len); + len = (size_t)gpsd_hexpack(eq, eq, len); ignore_return(write(chp->gpsdata.gps_fd, eq, len)); ignore_return(write(sfd, "OK\n", 3)); } else { @@ -60,7 +60,7 @@ int gpsd_hexpack(char *src, char *dst, size_t len){ if ((l < 1) || ((size_t)l > len)) return -1; - bzero(dst, len); + bzero(dst, (int)len); for (i = 0; i < l; i++) if ((k = hex2bin(src+i*2)) != -1) dst[i] = (char)(k & 0xff); @@ -825,7 +825,7 @@ static gps_mask_t handle_0x86(struct gps_device_t *session) p2_snr = getub(buf, n+10); dgps_age = getleuw(buf, n+11); hw_channel = getub(buf, n+13); - s = 0; + s = (unsigned char)0; /*@ -predboolothers +charint @*/ /* NOTE - In theory, I think one would check for hw channel number to see if one is dealing with a GPS or other satellite, but the @@ -836,7 +836,7 @@ static gps_mask_t handle_0x86(struct gps_device_t *session) session->gpsdata.PRN[i] = (int)prn; session->gpsdata.elevation[i] = (int)ele; session->gpsdata.azimuth[i] = (int)azm; - s = session->gpsdata.ss[i++] = (p2_snr ? p2_snr : ca_snr) / 4; + /*@i1@*/s = session->gpsdata.ss[i++] = (p2_snr ? p2_snr : ca_snr) / 4; } gpsd_report(LOG_IO, "Navcom: prn = %3u, ele = %02u, azm = %03u, snr = %d (%s), " |