diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-28 06:32:37 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-28 06:32:37 -0400 |
commit | 6b2e8ab641522c61fa520ca47b3008dc65a8aabb (patch) | |
tree | c3c5c40a50cc39c0744cde2a8c84a0cf0190ad58 | |
parent | 5e24bd130a5456d2f5b3b1c6bb2d7222b9613180 (diff) | |
download | gpsd-6b2e8ab641522c61fa520ca47b3008dc65a8aabb.tar.gz |
splint cleanup. Fixes for minor but real issues...
...no attempt to address the weird cross-platfprm variability we've seen lately.
All regression tests pass.
-rw-r--r-- | .splintrc | 2 | ||||
-rw-r--r-- | driver_evermore.c | 4 | ||||
-rw-r--r-- | driver_tsip.c | 2 | ||||
-rw-r--r-- | driver_ubx.c | 8 | ||||
-rw-r--r-- | drivers.c | 2 | ||||
-rw-r--r-- | ntpshmmon.c | 2 | ||||
-rw-r--r-- | ntpshmread.c | 2 | ||||
-rw-r--r-- | serial.c | 2 |
8 files changed, 14 insertions, 10 deletions
@@ -14,10 +14,12 @@ -Ddbus_uint32_t=uint -Disgps30bits_t=uint -DFD_SETSIZE=31 +-DB230400=010000 -DB57600=010001 -DB115200=0010011 -DCRTSCTS=0x00020000 -DONLCR=0x00000002 +-DINET6_ADDRSTRLEN=48 -D__gnuc_va_list=va_list -D__signed__=signed -D__pid_t=int diff --git a/driver_evermore.c b/driver_evermore.c index c8bc090d..0a26ff96 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -451,7 +451,7 @@ static ssize_t evermore_control_send(struct gps_device_t *session, char *buf, static bool evermore_protocol(struct gps_device_t *session, int protocol) { - /*@ +charint */ + /*@ +charint @*/ char tmp8; char evrm_protocol_config[] = { (char)0x84, /* 0: msg ID, Protocol Configuration */ @@ -459,7 +459,7 @@ static bool evermore_protocol(struct gps_device_t *session, int protocol) (char)0x00, /* 2: reserved */ (char)0x00, /* 3: reserved */ }; - /*@ -charint */ + /*@ -charint @*/ gpsd_log(&session->context->errout, LOG_PROG, "evermore_protocol(%d)\n", protocol); tmp8 = (protocol != 0) ? 1 : 0; diff --git a/driver_tsip.c b/driver_tsip.c index 97cb4514..5fbecd16 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -716,7 +716,7 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) if ((session->newdata.track = atan2(d1, d2) * RAD_2_DEG) < 0) session->newdata.track += 360.0; session->newdata.latitude = (double)sl1 * SEMI_2_DEG; - session->newdata.longitude = ul2 * SEMI_2_DEG; + session->newdata.longitude = (double)ul2 * SEMI_2_DEG; if (session->newdata.longitude > 180.0) session->newdata.longitude -= 360.0; session->gpsdata.separation = diff --git a/driver_ubx.c b/driver_ubx.c index 13eeca8c..bcb7c941 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -90,8 +90,8 @@ static void ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, size_t data_len) { - unsigned int n = 0; /* extended info counter */ - char obuf[128]; /* temp version string buffer */ + size_t n = 0; /* extended info counter */ + char obuf[128]; /* temp version string buffer */ if ( 44 > data_len ) { /* incomplete message */ @@ -106,7 +106,7 @@ ubx_msg_mon_ver(struct gps_device_t *session, unsigned char *buf, /* get n number of Extended info strings. what is max n? */ for ( n = 0; ; n++ ) { - unsigned int start_of_str = UBX_MESSAGE_DATA_OFFSET + 40 + (30 * n); + size_t start_of_str = UBX_MESSAGE_DATA_OFFSET + 40 + (30 * n); if ( (start_of_str + 2 ) > data_len ) { /* last one can be shorter than 30 */ @@ -945,7 +945,7 @@ static void ubx_cfg_prt(struct gps_device_t *session, * for example, the UBX_MON_VER fails here, but works in other * contexts */ - unsigned char msg[3]; + unsigned char msg[3] = {0, 0, 0}; /* request SW and HW Versions */ (void)ubx_write(session, UBX_CLASS_MON, 0x04, msg, 0); @@ -1115,7 +1115,7 @@ static bool mtk3301_rate_switcher(struct gps_device_t *session, double rate) { char buf[78]; - unsigned int milliseconds = 1000 * rate; + unsigned int milliseconds = (unsigned int)(1000 * rate); if (rate > 1) milliseconds = 1000; else if (rate < 0.2) diff --git a/ntpshmmon.c b/ntpshmmon.c index 756d5a2b..0e545169 100644 --- a/ntpshmmon.c +++ b/ntpshmmon.c @@ -137,7 +137,7 @@ int main(int argc, char **argv) * we're ignoring duplicates via timestamp, polling * at interval < 1 sec shouldn't be a problem. */ - (void)usleep(cycle * 1000); + (void)usleep((useconds_t)(cycle * 1000)); } while (nsamples != 0 && time(NULL) - starttime < timeout); diff --git a/ntpshmread.c b/ntpshmread.c index 3abe984e..c8ebec00 100644 --- a/ntpshmread.c +++ b/ntpshmread.c @@ -52,7 +52,7 @@ char *ntp_name(const int unit) { static char name[5] = "NTP\0"; - name[3] = '0' + (char)unit; + name[3] = (char)('0' + unit); return name; } @@ -242,7 +242,9 @@ int gpsd_get_stopbits(const struct gps_device_t *dev) bool gpsd_set_raw(struct gps_device_t * session) { +#ifndef S_SPLINT_S (void)cfmakeraw(&session->ttyset); +#endif /* S_SPLINT_S */ if (tcsetattr(session->gpsdata.gps_fd, TCIOFLUSH, &session->ttyset) == -1) { gpsd_log(&session->context->errout, LOG_ERROR, "error changing port attributes: %s\n", strerror(errno)); |