summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gps2udp.c38
-rw-r--r--gpsd.c2
-rw-r--r--gpsd_json.c2
-rw-r--r--libgpsd_core.c6
4 files changed, 28 insertions, 20 deletions
diff --git a/gps2udp.c b/gps2udp.c
index 22228b56..3bdd62a7 100644
--- a/gps2udp.c
+++ b/gps2udp.c
@@ -83,7 +83,6 @@ static int send_udp (char *nmeastring, size_t ind)
char message [255];
char *buffer;
int channel;
- ssize_t status;
/* if string length is unknow make a copy and compute it */
if (ind == 0) {
@@ -109,12 +108,12 @@ static int send_udp (char *nmeastring, size_t ind)
/* send message on udp channel */
/*@-type@*/
for (channel=0; channel < udpchannel; channel ++) {
- status = sendto(sock[channel],
- buffer,
- ind,
- 0,
- &remote[channel],
- (int)sizeof(remote));
+ ssize_t status = sendto(sock[channel],
+ buffer,
+ ind,
+ 0,
+ &remote[channel],
+ (int)sizeof(remote));
if (status < (ssize_t)ind) {
(void)fprintf(stderr, "gps2udp: failed to send [%s] \n", nmeastring);
return -1;
@@ -128,13 +127,15 @@ static int send_udp (char *nmeastring, size_t ind)
static int open_udp(char **hostport)
/* Open and bind udp socket to host */
{
- struct hostent *hp;
- char *hostname = NULL;
- char *portname = NULL;
- int portnum, channel;
+ int channel;
for (channel=0; channel <udpchannel; channel ++)
{
+ char *hostname = NULL;
+ char *portname = NULL;
+ int portnum;
+ struct hostent *hp;
+
/* parse argument */
/*@-unrecog@*/
hostname = strsep(&hostport[channel], ":");
@@ -191,7 +192,6 @@ static void usage(void)
static void connect2gpsd(bool restart)
/* loop until we connect with gpsd */
{
- int status;
unsigned int delay;
if (restart) {
@@ -204,7 +204,7 @@ static void connect2gpsd(bool restart)
/* loop until we reach GPSd */
for (delay = 10; ; delay = delay*2) {
- status = gps_open(gpsd_source.server, gpsd_source.port, &gpsdata);
+ int status = gps_open(gpsd_source.server, gpsd_source.port, &gpsdata);
if (status != 0) {
(void)fprintf(stderr,
"gps2udp [%s] connection failed at %s:%s\n",
@@ -228,7 +228,7 @@ static ssize_t read_gpsd(char *message, size_t len)
{
struct timeval tv;
fd_set fds,master;
- int result, ind;
+ int ind;
char c;
int retry=0;
@@ -238,6 +238,7 @@ static ssize_t read_gpsd(char *message, size_t len)
/* loop until we get some data or an error */
for (ind = 0; ind < (int)len;) {
+ int result;
/* prepare for a blocking read with a 10s timeout */
tv.tv_sec = 10;
tv.tv_usec = 0;
@@ -291,8 +292,10 @@ static ssize_t read_gpsd(char *message, size_t len)
connect2gpsd(true);
retry = 0;
}
+ /*@-sefparams@*/
if (debug > 0)
ignore_return(write (1, ".", 1));
+ /*@+sefparams@*/
break;
default: /* we lost connection with gpsd */
@@ -332,10 +335,11 @@ static unsigned int AISGetInt(unsigned char *bitbytes, unsigned int sp, unsigned
{
unsigned int acc = 0;
unsigned int s0p = sp-1; // to zero base
- unsigned int cp, cx, c0, i;
+ unsigned int i;
for(i=0 ; i<len ; i++)
{
+ unsigned int cp, cx, c0;
acc = acc << 1;
cp = (s0p + i) / 6;
cx = (unsigned int)bitbytes[cp]; // what if cp >= byte_length?
@@ -351,7 +355,7 @@ int main(int argc, char **argv)
{
bool daemonize = false;
long count = -1;
- int option, status;
+ int option;
char *udphostport[MAX_UDP_DEST];
flags = WATCH_ENABLE;
@@ -418,7 +422,7 @@ int main(int argc, char **argv)
/* Open UDP port */
if (udpchannel > 0) {
- status = open_udp(udphostport);
+ int status = open_udp(udphostport);
if (status !=0) exit (1);
}
diff --git a/gpsd.c b/gpsd.c
index d7fce5f8..22fe14f9 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -2047,10 +2047,12 @@ int main(int argc, char *argv[])
* of any compromises in the code. It requires that all GPS
* devices have their group read/write permissions set.
*/
+ /*@-nullpass@*/
if (setgroups(0, NULL) != 0)
gpsd_report(context.debug, LOG_ERROR,
"setgroups() failed, errno %s\n",
strerror(errno));
+ /*@+nullpass@*/
/*@-type@*/
#ifdef GPSD_GROUP
{
diff --git a/gpsd_json.c b/gpsd_json.c
index e923f832..4eb8bc15 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -215,10 +215,12 @@ void json_tpv_dump(const struct gps_device_t *session,
#ifdef TIMING_ENABLE
if (policy->timing) {
#ifdef PPS_ENABLE
+ /*@-type -formattype@*/ /* splint is confused about struct timespec */
if (session->ppscount)
(void)snprintf(reply + strlen(reply), replylen - strlen(reply),
"\"pps\":%.9f,",
session->ppslast.clock.tv_sec + session->ppslast.clock.tv_nsec / 1e9);
+ /*@+type +formattype@*/
#endif /* PPS_ENABLE */
(void)snprintf(reply + strlen(reply), replylen - strlen(reply),
"\"sor\":%.9f,\"chars\":%lu,\"sats\":%2d,\"rtime\":%.9f,\"week\":%u,\"tow\":%.3f,\"rollovers\":%d",
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a445dc6f..ef22c7b7 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1143,9 +1143,9 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
timestamp_t now = timestamp();
if (session->device_type != NULL && session->packet.start_time > 0) {
#ifdef RECONFIGURE_ENABLE
- const time_t min_cycle = session->device_type->min_cycle;
+ const double min_cycle = session->device_type->min_cycle;
#else
- const time_t min_cycle = 1;
+ const double min_cycle = 1;
#endif /* RECONFIGURE_ENABLE */
double quiet_time = (MINIMUM_QUIET_TIME * min_cycle);
double gap = now - session->packet.start_time;
@@ -1387,7 +1387,7 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
gps_merge_fix(&session->gpsdata.fix,
session->gpsdata.set, &session->newdata);
#ifdef CHEAPFLOATS_ENABLE
- gpsd_error_model(session, &session->gpsdata.fix, &session->oldfix);
+ /*@i1@*/gpsd_error_model(session, &session->gpsdata.fix, &session->oldfix);
#endif /* CHEAPFLOATS_ENABLE */
/*@+nullderef -nullpass@*/