summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bits.h4
-rw-r--r--driver_garmin.c2
-rw-r--r--driver_nmea.c2
-rw-r--r--driver_rtcm2.c6
-rw-r--r--driver_superstar2.c2
-rw-r--r--driver_tsip.c11
-rw-r--r--gpsd.c6
-rw-r--r--gpsd_json.c14
-rw-r--r--json.c2
-rw-r--r--libgps.c12
-rw-r--r--ntpshm.c2
-rw-r--r--test/synthetic-ais.json4
12 files changed, 34 insertions, 33 deletions
diff --git a/bits.h b/bits.h
index 7d4c4db1..8e8e0938 100644
--- a/bits.h
+++ b/bits.h
@@ -50,8 +50,8 @@ union long_double {
#define getlesl(buf, off) ((int32_t)(((u_int16_t)getleuw((buf), (off)+2) << 16) | (u_int16_t)getleuw((buf), (off))))
#define getleul(buf, off) ((u_int32_t)(((u_int16_t)getleuw((buf),(off)+2) << 16) | (u_int16_t)getleuw((buf), (off))))
-#define putleword(buf, off, w) do {putbyte(buf, (off)+1, (w) >> 8); putbyte(buf, (off), (w));} while (0)
-#define putlelong(buf, off, l) do {putleword(buf, (off)+2, (l) >> 16); putleword(buf, (off), (l));} while (0)
+#define putleword(buf, off, w) do {putbyte(buf, (off)+1, (uint)(w) >> 8); putbyte(buf, (off), (w));} while (0)
+#define putlelong(buf, off, l) do {putleword(buf, (off)+2, (uint)(l) >> 16); putleword(buf, (off), (l));} while (0)
#define getlesL(buf, off) ((int64_t)(((u_int64_t)getleul(buf, (off)+4) << 32) | getleul(buf, (off))))
#define getleuL(buf, off) ((u_int64_t)(((u_int64_t)getleul(buf, (off)+4) << 32) | getleul(buf, (off))))
diff --git a/driver_garmin.c b/driver_garmin.c
index 02961d23..e6074970 100644
--- a/driver_garmin.c
+++ b/driver_garmin.c
@@ -295,7 +295,7 @@ gps_mask_t PrintSERPacket(struct gps_device_t *session, unsigned char pkt_id
gpsd_report(LOG_IO, "PrintSERPacket(, %#02x, %#02x, )\n", pkt_id, pkt_len);
session->cycle_state = CYCLE_END_RELIABLE;
- if (pkt_id == GARMIN_PKTID_PVT_DATA)
+ if ((int)pkt_id == GARMIN_PKTID_PVT_DATA)
session->cycle_state |= (CYCLE_START | CYCLE_END);
switch( pkt_id ) {
diff --git a/driver_nmea.c b/driver_nmea.c
index 769212a1..51bc1c69 100644
--- a/driver_nmea.c
+++ b/driver_nmea.c
@@ -759,7 +759,7 @@ static gps_mask_t processPASHR(int c UNUSED, char *field[], struct gps_device_t
session->gpsdata.PRN[i] = p = atoi(field[3+i*5+0]);
session->gpsdata.azimuth[i] = atoi(field[3+i*5+1]);
session->gpsdata.elevation[i] = atoi(field[3+i*5+2]);
- session->gpsdata.ss[i] = atoi(field[3+i*5+3]);
+ session->gpsdata.ss[i] = atof(field[3+i*5+3]);
if (field[3+i*5+4][0] == 'U')
session->gpsdata.used[u++] = p;
}
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index 7b3ae7e3..459dddc3 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -182,7 +182,7 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
csp->ident = m->sat_id;
csp->iodl = m->issue_of_data_link!=0;
csp->health = m->data_health;
- /*@i@*/csp->snr = (m->cn0?(m->cn0+CNR_OFFSET):SNR_BAD);
+ /*@i@*/csp->snr = (uint)(m->cn0?(m->cn0+CNR_OFFSET):SNR_BAD);
csp->health_en = m->health_enable!=0;
csp->new_data = m->new_nav_data!=0;
csp->los_warning = m->loss_warn!=0;
@@ -324,7 +324,7 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
if (tp->reference.valid) {
struct rtcm2_msg4 *m = &msg->msg_type.type4;
- m->w3.dgnss = tp->reference.system;
+ m->w3.dgnss = (unsigned)tp->reference.system;
m->w3.dat = (unsigned)(tp->reference.sense == SENSE_GLOBAL);
/*@ -predboolothers -type @*/
if (tp->reference.datum[0])
@@ -366,7 +366,7 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
m->issue_of_data_link = (unsigned)csp->iodl;
m->data_health = csp->health;
m->cn0 = (csp->snr == SNR_BAD) ? 0 : (unsigned)csp->snr-CNR_OFFSET;
- m->health_enable = csp->health_en;
+ m->health_enable = (unsigned)csp->health_en;
m->new_nav_data = (unsigned)csp->new_data;
m->loss_warn = (unsigned)csp->los_warning;
m->time_unhealthy = (unsigned)(csp->tou / TU_SCALE);
diff --git a/driver_superstar2.c b/driver_superstar2.c
index a91752a3..ee3f8a16 100644
--- a/driver_superstar2.c
+++ b/driver_superstar2.c
@@ -594,7 +594,7 @@ static bool superstar2_set_speed(struct gps_device_t *session,
speed_t speed, char parity, int stopbits)
{
/* parity and stopbit switching aren't available on this chip */
- if (parity!=(char)session->gpsdata.dev.parity || (unsigned int)stopbits!=session->gpsdata.dev.stopbits) {
+ if (parity!=(char)session->gpsdata.dev.parity || stopbits!=session->gpsdata.dev.stopbits) {
return false;
} else {
/*@ +charint @*/
diff --git a/driver_tsip.c b/driver_tsip.c
index 465e6508..2030b5b8 100644
--- a/driver_tsip.c
+++ b/driver_tsip.c
@@ -59,8 +59,8 @@ static void tsip_probe_subtype(struct gps_device_t *session, unsigned int seq)
/* XXX Thunderbolts and Copernicus use 8N1... which isn't exactly a */
/* XXX good idea due to the fragile wire format. We must divine a */
/* XXX clever heuristic to decide if the parity change is required. */
- session->driver.tsip.parity = session->gpsdata.dev.parity;
- session->driver.tsip.stopbits = session->gpsdata.dev.stopbits;
+ session->driver.tsip.parity = (uint)session->gpsdata.dev.parity;
+ session->driver.tsip.stopbits = (uint)session->gpsdata.dev.stopbits;
gpsd_set_speed(session, session->gpsdata.dev.baudrate, 'O', 1);
break;
@@ -372,12 +372,13 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
if (i < TSIP_CHANNELS) {
if (d1 >= 0.0) {
session->gpsdata.PRN[i] = (int)u1;
- session->gpsdata.ss[i] = (int)round(f1);
+ session->gpsdata.ss[i] = f1;
session->gpsdata.elevation[i] = (int)round(d1);
session->gpsdata.azimuth[i] = (int)round(d2);
} else {
- session->gpsdata.PRN[i] = session->gpsdata.ss[i] =
- session->gpsdata.elevation[i] = session->gpsdata.azimuth[i] = 0;
+ session->gpsdata.PRN[i] = 0;
+ session->gpsdata.ss[i] = session->gpsdata.elevation[i]
+ = session->gpsdata.azimuth[i] = 0;
}
if (++i == session->gpsdata.satellites)
mask |= SATELLITE_SET; /* last of the series */
diff --git a/gpsd.c b/gpsd.c
index b4c9d274..24760217 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -787,7 +787,7 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user,
/* if subscriber has no device... */
if (was_unassigned) {
- if (forcedev != NULL ) {
+ if (forcedev != NULL) {
channel->device = forcedev;
} else {
double most_recent = 0;
@@ -874,7 +874,7 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user,
#endif /* OLDSTYLE_ENABLE */
/*@ -sefparams +matchanyintegral @*/
if (buf[0])
- throttled_write(user, buf, strlen(buf));
+ (void)throttled_write(user, buf, strlen(buf));
/*@ +sefparams -matchanyintegral @*/
}
@@ -1805,7 +1805,7 @@ static int handle_gpsd_request(struct subscriber_t *sub, const char *buf)
return -1;
#endif /* OLDSTYLE_ENABLE */
- return (int)throttled_write(sub, reply, (ssize_t)strlen(reply));
+ return (int)throttled_write(sub, reply, strlen(reply));
}
/*@ -mustfreefresh @*/
diff --git a/gpsd_json.c b/gpsd_json.c
index fe22835b..fdc4cbaa 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -52,7 +52,7 @@ char *json_stringify(/*@out@*/char *to, size_t len, /*@in@*/const char *from)
break;
default:
/* ugh, we'd prefer a C-style escape here, but this is JSON */
- (void)snprintf(tp, 5, "%u04x", *sp);
+ (void)snprintf(tp, 5, "%u04x", (uint)*sp);
tp += strlen(tp);
}
} else {
@@ -832,14 +832,14 @@ void aivdm_json_dump(struct ais_t *ais, bool scaled, /*@out@*/char *buf, size_t
case 6: /* Binary Message */
(void)snprintf(buf+strlen(buf), buflen-strlen(buf),
"\"seqno\":%u,\"dest_mmsi\":%u,"
- "\"retransmit\":%u,\"app_id\":%u,"
+ "\"retransmit\":%s,\"app_id\":%u,"
"\"data\":\"%zd:%s\"}\r\n",
ais->type6.seqno,
- ais->type6.dest_mmsi,
- ais->type6.retransmit,
- ais->type6.app_id,
- ais->type6.bitcount,
- gpsd_hexdump(ais->type6.bitdata,
+ ais->type6.dest_mmsi,
+ JSON_BOOL(ais->type6.retransmit),
+ ais->type6.app_id,
+ ais->type6.bitcount,
+ gpsd_hexdump(ais->type6.bitdata,
(ais->type6.bitcount+7)/8));
break;
case 7: /* Binary Acknowledge */
diff --git a/json.c b/json.c
index 923ddd05..9ed51346 100644
--- a/json.c
+++ b/json.c
@@ -62,7 +62,7 @@ has to be inline in the struct.
# define json_debug_trace(args) /*@i1@*/do { } while (0)
#endif /* JSONDEBUG */
-static char *json_target_address(const struct json_attr_t *cursor,
+static /*@null@*/char *json_target_address(const struct json_attr_t *cursor,
/*@null@*/const struct json_array_t *parent,
int offset)
{
diff --git a/libgps.c b/libgps.c
index 1a12f84d..e1b96bf4 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=%d %*d %*s %u",
+ (void)sscanf(sp, "B=%d %*d %*s %d",
&gpsdata->dev.baudrate, &gpsdata->dev.stopbits);
break;
case 'C':
@@ -200,7 +200,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
char *ns2 = ns;
memset(&gpsdata->devices, '\0', sizeof(gpsdata->devices));
gpsdata->devices.ndevices = (int)strtol(sp2+2, &sp2, 10);
- strlcpy(gpsdata->devices.list[i=0].path,
+ (void)strlcpy(gpsdata->devices.list[i=0].path,
strtok_r(sp2+1," \r\n", &ns2),
sizeof(gpsdata->devices.list[i=0].path));
while ((sp2 = strtok_r(NULL, " \r\n", &ns2)))
@@ -496,13 +496,13 @@ int gps_stream(struct gps_data_t *gpsdata, unsigned int flags)
if ((flags & WATCH_ENABLE) != 0) {
#ifdef OLDSTYLE_ENABLE
(void)strlcpy(buf, "w+x", sizeof(buf));
- if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW))
+ if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0)
(void)strlcat(buf, "r+", sizeof(buf));
if (flags & WATCH_NOJITTER)
(void)strlcat(buf, "j+", sizeof(buf));
#else
(void)strlcpy(buf, "?WATCH={", sizeof(buf));
- if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW))
+ if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0)
(void)strlcat(buf, "\"raw\":1", sizeof(buf));
if (flags & WATCH_NOJITTER)
(void)strlcat(buf, "\"buffer_policy\"=1", sizeof(buf));
@@ -514,13 +514,13 @@ int gps_stream(struct gps_data_t *gpsdata, unsigned int flags)
} else if ((flags & WATCH_DISABLE) != 0) {
#ifdef OLDSTYLE_ENABLE
(void)strlcpy(buf, "w-", sizeof(buf));
- if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW))
+ if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0)
(void)strlcat(buf, "r-", sizeof(buf));
if (flags & WATCH_NOJITTER)
(void)strlcat(buf, "j-", sizeof(buf));
#else
(void)strlcpy(buf, "?WATCH={\"enable\":false,", sizeof(buf));
- if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW))
+ if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0)
(void)strlcat(buf, "\"raw\":1,", sizeof(buf));
if (flags & WATCH_NOJITTER)
(void)strlcat(buf, "\"buffer_policy\"=1,", sizeof(buf));
diff --git a/ntpshm.c b/ntpshm.c
index 76bd1bfb..855e5b33 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -178,7 +178,7 @@ int ntpshm_pps(struct gps_device_t *session, struct timeval *tv, int rate)
}
usecs = shmTime->clockTimeStampUSec + 1000000 / rate;
- seconds = shmTime->clockTimeStampSec + usecs / 1000000;;
+ seconds = shmTime->clockTimeStampSec + usecs / 1000000;
usecs %= 1000000;
offset = tv->tv_sec - seconds + (tv->tv_usec - usecs) / 1e6;
diff --git a/test/synthetic-ais.json b/test/synthetic-ais.json
index a8cf3d4b..f53a3481 100644
--- a/test/synthetic-ais.json
+++ b/test/synthetic-ais.json
@@ -6,9 +6,9 @@
{"class":"AIS","type":1,"repeat":0,"mmsi":440348000,"status":0,"turn":-128,"speed":0,"accuracy":false,"lon":-42454920,"lat":25848090,"course":934,"heading":511,"second":13,"maneuver":0,"raim":false,"radio":66548}
{"class":"AIS","type":2,"repeat":0,"mmsi":356302000,"status":0,"turn":127,"speed":139,"accuracy":false,"lon":-42975686,"lat":24235415,"course":877,"heading":91,"second":41,"maneuver":0,"raim":false,"radio":98316}
{"class":"AIS","type":3,"repeat":0,"mmsi":563808000,"status":5,"turn":0,"speed":0,"accuracy":true,"lon":-45796520,"lat":22146000,"course":2520,"heading":352,"second":35,"maneuver":0,"raim":false,"radio":0}
-{"class":"AIS","type":4,"repeat":0,"mmsi":3669702,"timestamp":"2007-05-14T19:57:39Z","accuracy":true,"lon":-45811417,"lat":22130260,"epfd":7,"raim":false,"radio":67039}
+{"class":"AIS","type":4,"repeat":0,"mmsi":3669702,"timestamp":"2007-05-14T19:57:39Z","accuracy":true,"lon":-45811417,"lat":22130260,"epfd":7,"raim":false,"radio":67039}
{"class":"AIS","type":5,"repeat":0,"mmsi":351759000,"imo":9134270,"ais_version":0,"callsign":"3FOF8","shipname":"EVER DIADEM","shiptype":70,"to_bow":225,"to_stern":70,"to_port":1,"to_starboard":31,"epfd":1,"eta":"05-15T14:00Z","draught":122,"destination":"NEW YORK","dte":0}
-{"class":"AIS","type":6,"repeat":1,"mmsi":150834090,"seqno":3,"dest_mmsi":313240222,"retransmit":0,"app_id":42827,"data":"50:eb2f118f7ff100"}
+{"class":"AIS","type":6,"repeat":1,"mmsi":150834090,"seqno":3,"dest_mmsi":313240222,"retransmit":false,"app_id":42827,"data":"50:eb2f118f7ff100"}
{"class":"AIS","type":7,"repeat":1,"mmsi":655901842,"mmsi1":158483613,"mmsi2":321823389,"mmsi3":836359488,"mmsi4":0}
{"class":"AIS","type":8,"repeat":0,"mmsi":366999712,"app_id":23480,"data":"256:3a53dbb7be4a773137f87d7b0445f040dea05d93f593783194ae9b9d9dbe05fb"}
{"class":"AIS","type":9,"repeat":3,"mmsi":1069287948,"alt":4032,"speed":932,"accuracy":true,"lon":106380055,"lat":63811893,"course":2562,"second":48,"regional":91,"dte":1,"raim":false,"radio":424211}