summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ais_json.c3
-rw-r--r--driver_rtcm2.c2
-rw-r--r--driver_sirf.c1
-rw-r--r--driver_superstar2.c2
-rw-r--r--gpsd.c8
-rw-r--r--gpsd.h-tail2
-rw-r--r--gpsd_json.c6
-rw-r--r--gpsdecode.c8
-rw-r--r--gpsmon.c2
-rw-r--r--json.c4
-rw-r--r--json.h2
-rw-r--r--libgps.c2
-rw-r--r--netlib.c14
-rw-r--r--serial.c2
-rw-r--r--subframe.c2
-rw-r--r--xgps.c2
-rw-r--r--xgpsspeed.c2
17 files changed, 33 insertions, 31 deletions
diff --git a/ais_json.c b/ais_json.c
index 106d0ab7..9396c794 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -27,7 +27,7 @@ static void lenhex_unpack(const char *from,
*plen = (unsigned)atoi(from);
if (colon != NULL)
- gpsd_hexpack(colon+1, to, maxlen);
+ (void)gpsd_hexpack(colon+1, to, maxlen);
}
int json_ais_read(const char *buf,
@@ -46,7 +46,6 @@ int json_ais_read(const char *buf,
int status;
-
#include "ais_json.i" /* JSON parser template structures */
#undef AIS_HEADER
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index b7d2ddff..7b3ae7e3 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -183,7 +183,7 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
csp->iodl = m->issue_of_data_link!=0;
csp->health = m->data_health;
/*@i@*/csp->snr = (m->cn0?(m->cn0+CNR_OFFSET):SNR_BAD);
- csp->health_en = m->health_enable;
+ csp->health_en = m->health_enable!=0;
csp->new_data = m->new_nav_data!=0;
csp->los_warning = m->loss_warn!=0;
csp->tou = m->time_unhealthy*TU_SCALE;
diff --git a/driver_sirf.c b/driver_sirf.c
index d73e8113..b9322c80 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -865,6 +865,7 @@ gps_mask_t sirf_parse(struct gps_device_t *session, unsigned char *buf, size_t l
case 0x29: /* Geodetic Navigation Information */
gpsd_report(LOG_PROG, "GND 0x29: %s\n",
gpsd_hexdump_wrapper(buf, len, LOG_PROG));
+ return 0;
case 0x32: /* SBAS corrections */
return 0;
diff --git a/driver_superstar2.c b/driver_superstar2.c
index c09bb3a9..6dd79441 100644
--- a/driver_superstar2.c
+++ b/driver_superstar2.c
@@ -416,7 +416,7 @@ static ssize_t
superstar2_write(struct gps_device_t *session, char *msg, size_t msglen)
{
unsigned short c = 0;
- size_t i;
+ ssize_t i;
for (i = 0; i < msglen - 2; i++)
c += (unsigned short)msg[i];
diff --git a/gpsd.c b/gpsd.c
index 5eb9914e..f9139da5 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -849,11 +849,11 @@ static struct channel_t *assign_channel(struct subscriber_t *user,
*/
if (!newstyle(user) && user->policy.watcher && !user->tied) {
/*@ -sefparams @*/
- throttled_write(user, "GPSD,F=", 7);
- throttled_write(user,
+ (void)throttled_write(user, "GPSD,F=", 7);
+ (void)throttled_write(user,
channel->device->gpsdata.dev.path,
strlen(channel->device->gpsdata.dev.path));
- throttled_write(user, "\r\n", 2);
+ (void)throttled_write(user, "\r\n", 2);
/*@ +sefparams @*/
}
#endif /* OLDSTYLE_ENABLE */
@@ -2246,7 +2246,7 @@ int main(int argc, char *argv[])
/* watch all channels */
for (channel = channels; channel < channels + NITEMS(channels); channel++) {
- struct subscriber_t *sub = channel->subscriber;
+ sub = channel->subscriber;
/* some listeners may be in watcher mode */
if (sub != NULL && sub->policy.watcher) {
char buf2[BUFSIZ];
diff --git a/gpsd.h-tail b/gpsd.h-tail
index e0e7aa1f..eaf381b4 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -500,7 +500,7 @@ extern void ubx_catch_model(struct gps_device_t *,
#endif /* UBX_ENABLE */
#ifdef AIVDM_ENABLE
extern bool aivdm_decode(char *, size_t, struct aivdm_context_t *, struct ais_t *);
-extern void aivdm_json_dump(struct ais_t *, bool, char *, size_t);
+extern void aivdm_json_dump(struct ais_t *, bool, /*@out@*/char *, size_t);
#endif /* AIVDM_ENABLE */
#ifdef MKT3301_ENABLE
extern gps_mask_t processMKT3301(int c UNUSED, char *field[], struct gps_device_t *session);
diff --git a/gpsd_json.c b/gpsd_json.c
index 1f65a1e9..739d68be 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -475,7 +475,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
#if defined(AIVDM_ENABLE)
-void aivdm_json_dump(struct ais_t *ais, bool scaled, char *buf, size_t buflen)
+void aivdm_json_dump(struct ais_t *ais, bool scaled, /*@out@*/char *buf, size_t buflen)
{
char buf1[JSON_VAL_MAX*2+1];
char buf2[JSON_VAL_MAX*2+1];
@@ -937,7 +937,7 @@ void aivdm_json_dump(struct ais_t *ais, bool scaled, char *buf, size_t buflen)
case 17:
if (scaled) {
(void)snprintf(buf+strlen(buf), buflen-strlen(buf),
- "\"lon\":%.1f,\"lat\":%.1f,\"data\":\"%d:%s\"}\r\n",
+ "\"lon\":%.1f,\"lat\":%.1f,\"data\":\"%u:%s\"}\r\n",
ais->type17.lon / AIS_GNSS_LATLON_SCALE,
ais->type17.lat / AIS_GNSS_LATLON_SCALE,
ais->type17.bitcount,
@@ -945,7 +945,7 @@ void aivdm_json_dump(struct ais_t *ais, bool scaled, char *buf, size_t buflen)
(ais->type17.bitcount+7)/8));
} else {
(void)snprintf(buf+strlen(buf), buflen-strlen(buf),
- "\"lon\":%d,\"lat\":%d,\"data\":\"%d:%s\"}\r\n",
+ "\"lon\":%d,\"lat\":%d,\"data\":\"%u:%s\"}\r\n",
ais->type17.lon,
ais->type17.lat,
ais->type17.bitcount,
diff --git a/gpsdecode.c b/gpsdecode.c
index 97881b53..fd0320a5 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -48,7 +48,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
case 2:
case 3:
(void)snprintf(buf+strlen(buf), buflen-strlen(buf),
- "%u,%d,%u,%u,%d,%d,%u,%d,%u,0x%x,%d,0x%x",
+ "%u,%d,%u,%u,%d,%d,%u,%u,%u,0x%x,%u,0x%x",
ais->type1.status,
ais->type1.turn,
ais->type1.speed,
@@ -59,7 +59,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type1.heading,
ais->type1.second,
ais->type1.maneuver,
- ais->type1.raim,
+ (uint)ais->type1.raim,
ais->type1.radio);
break;
case 4: /* Base Station Report */
@@ -76,7 +76,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type4.lon,
ais->type4.lat,
ais->type4.epfd,
- ais->type4.raim,
+ (uint)ais->type4.raim,
ais->type4.radio);
break;
case 5: /* Ship static and voyage related data */
@@ -185,7 +185,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 17:
(void)snprintf(buf+strlen(buf), buflen-strlen(buf),
- "%d,%d,%d:%s",
+ "%d,%d,%u:%s",
ais->type17.lon,
ais->type17.lat,
ais->type17.bitcount,
diff --git a/gpsmon.c b/gpsmon.c
index 5df36f6c..3eadc690 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -763,7 +763,7 @@ int main (int argc, char **argv)
else if (serial) {
speed_t speed;
char parity = (char)session.gpsdata.dev.parity;
- unsigned int stopbits = session.gpsdata.dev.stopbits;
+ unsigned int stopbits = (unsigned int)session.gpsdata.dev.stopbits;
char *modespec;
modespec = strchr(arg, ':');
diff --git a/json.c b/json.c
index dc8fd392..e802b025 100644
--- a/json.c
+++ b/json.c
@@ -312,7 +312,7 @@ static int json_internal_read_object(const char *cp, const struct json_attr_t *a
*((int *)lptr) = atoi(valbuf);
break;
case uinteger:
- *((int *)lptr) = (unsigned)atoi(valbuf);
+ *((unsigned int *)lptr) = (unsigned)atoi(valbuf);
break;
case real:
*((double *)lptr) = atof(valbuf);
@@ -453,7 +453,7 @@ int json_read_object(const char *cp, const struct json_attr_t *attrs, const char
return json_internal_read_object(cp, attrs, NULL, 0, end);
}
-const char *json_error_string(int err)
+const /*@observer@*/char *json_error_string(int err)
{
const char *errors[] = {
"unknown error while parsing JSON",
diff --git a/json.h b/json.h
index 430ba0c5..8ba5c1a2 100644
--- a/json.h
+++ b/json.h
@@ -62,7 +62,7 @@ struct json_attr_t {
int json_read_object(const char *, const struct json_attr_t *, const char **);
int json_read_array(const char *, const struct json_array_t *, const char **);
-const char *json_error_string(int);
+const /*@observer@*/char *json_error_string(int);
#define JSON_ERR_OBSTART 1 /* non-WS when expecting object start */
#define JSON_ERR_ATTRSTART 2 /* non-WS when expecting attrib start */
diff --git a/libgps.c b/libgps.c
index 139b071a..1a12f84d 100644
--- a/libgps.c
+++ b/libgps.c
@@ -134,7 +134,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
if (sp[2] == '?') {
gpsdata->dev.baudrate = gpsdata->dev.stopbits = 0;
} else
- (void)sscanf(sp, "B=%u %*d %*s %u",
+ (void)sscanf(sp, "B=%d %*d %*s %u",
&gpsdata->dev.baudrate, &gpsdata->dev.stopbits);
break;
case 'C':
diff --git a/netlib.c b/netlib.c
index 5d97ebea..6705fadf 100644
--- a/netlib.c
+++ b/netlib.c
@@ -90,13 +90,13 @@ int netlib_connectsock(const char *host, const char *service, const char *protoc
char /*@observer@*/ *netlib_errstr(const int err)
{
switch (err) {
- case NL_NOSERVICE: return "can't get service entry"; break;
- case NL_NOHOST: return "can't get host entry"; break;
- case NL_NOPROTO: return "can't get protocol entry"; break;
- case NL_NOSOCK: return "can't create socket"; break;
- case NL_NOSOCKOPT: return "error SETSOCKOPT SO_REUSEADDR"; break;
- case NL_NOCONNECT: return "can't connect to host/port pair"; break;
- default: return "unknown error"; break;
+ case NL_NOSERVICE: return "can't get service entry";
+ case NL_NOHOST: return "can't get host entry";
+ case NL_NOPROTO: return "can't get protocol entry";
+ case NL_NOSOCK: return "can't create socket";
+ case NL_NOSOCKOPT: return "error SETSOCKOPT SO_REUSEADDR";
+ case NL_NOCONNECT: return "can't connect to host/port pair";
+ default: return "unknown error";
}
}
diff --git a/serial.c b/serial.c
index b99198ed..5c3004db 100644
--- a/serial.c
+++ b/serial.c
@@ -227,7 +227,7 @@ int gpsd_open(struct gps_device_t *session)
session->gpsdata.dev.baudrate = 57600;
session->gpsdata.dev.parity = 'N';
session->gpsdata.dev.stopbits = 1;
- session->context->readonly = 1;
+ session->context->readonly = true;
return session->gpsdata.gps_fd;
}
/*@ -boolops -type @*/
diff --git a/subframe.c b/subframe.c
index c8149325..8a01542a 100644
--- a/subframe.c
+++ b/subframe.c
@@ -67,6 +67,7 @@ void gpsd_interpret_subframe(struct gps_device_t *session,unsigned int words[])
{
char str[24];
int j = 0;
+ /*@ -type @*/
str[j++] = (words[2] >> 8) & 0xff;
str[j++] = (words[2]) & 0xff;
@@ -97,6 +98,7 @@ void gpsd_interpret_subframe(struct gps_device_t *session,unsigned int words[])
str[j++] = (words[9] >> 16) & 0xff;
str[j++] = (words[9] >> 8) & 0xff;
str[j++] = '\0';
+ /*@ +type @*/
gpsd_report(LOG_INF, "gps system message is %s\n", str);
}
break;
diff --git a/xgps.c b/xgps.c
index f4b4ddab..d2aacf00 100644
--- a/xgps.c
+++ b/xgps.c
@@ -882,7 +882,7 @@ update_panel(struct gps_data_t *gpsdata, char *message,
char s[128], *latlon, *sp;
/* this is where we implement source-device filtering */
- if (gpsdata->dev.path[0] && source.device!=NULL && strcmp(source.device, gpsdata->dev.path) != 0)
+ if (gpsdata->dev.path[0]!='\0' && source.device!=NULL && strcmp(source.device, gpsdata->dev.path) != 0)
return;
/* the raw data sisplay */
diff --git a/xgpsspeed.c b/xgpsspeed.c
index a9489e1c..61c38f0c 100644
--- a/xgpsspeed.c
+++ b/xgpsspeed.c
@@ -42,7 +42,7 @@ static void update_display(struct gps_data_t *gpsdata,
char *buf UNUSED, size_t len UNUSED, int level UNUSED)
{
/* this is where we implement source-device filtering */
- if (gpsdata->dev.path[0] && source.device!=NULL && strcmp(source.device, gpsdata->dev.path) != 0)
+ if (gpsdata->dev.path[0]!='\0' && source.device!=NULL && strcmp(source.device, gpsdata->dev.path) != 0)
return;
else {
int temp_int = (int)rint(gpsdata->fix.speed * speedfactor);