summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ais_json.c1
-rw-r--r--driver_aivdm.c6
-rw-r--r--driver_rtcm2.c8
-rw-r--r--driver_superstar2.c4
-rw-r--r--driver_tsip.c4
-rw-r--r--gps.h6
-rw-r--r--gps_json.h20
-rw-r--r--gpsctl.c5
-rw-r--r--gpsd.c20
-rw-r--r--gpsd.h-tail13
-rw-r--r--gpsd_json.c35
-rw-r--r--json.c7
-rw-r--r--json.h6
-rw-r--r--libgps_json.c10
-rw-r--r--serial.c2
15 files changed, 83 insertions, 64 deletions
diff --git a/ais_json.c b/ais_json.c
index ff32b665..79ead5aa 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -130,6 +130,7 @@ int json_ais_read(const char *buf,
} else if (strstr(buf, "\"type\":24,") != NULL) {
status = json_read_object(buf, json_ais24, endptr);
} else {
+ *endptr = NULL;
return JSON_ERR_MISC;
}
return status;
diff --git a/driver_aivdm.c b/driver_aivdm.c
index f4a91e12..8f90eaf4 100644
--- a/driver_aivdm.c
+++ b/driver_aivdm.c
@@ -53,7 +53,7 @@ static void from_sixbit(char *bitvec, uint start, int count, char *to)
}
/*@ +charint @*/
-bool aivdm_decode(char *buf, size_t buflen,
+bool aivdm_decode(const char *buf, size_t buflen,
struct aivdm_context_t *ais_context, struct ais_t *ais)
{
char *sixbits[64] = {
@@ -83,9 +83,7 @@ bool aivdm_decode(char *buf, size_t buflen,
gpsd_report(LOG_PROG, "AIVDM packet length %zd: %s", buflen, buf);
/* extract packet fields */
- (void)strlcpy((char *)ais_context->fieldcopy,
- (char*)buf,
- buflen);
+ (void)strlcpy((char *)ais_context->fieldcopy, buf, buflen);
ais_context->field[nfields++] = (unsigned char *)buf;
for (cp = ais_context->fieldcopy;
cp < ais_context->fieldcopy + buflen;
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index 459dddc3..70f3669c 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -453,7 +453,7 @@ enum isgpsstat_t rtcm2_decode(struct gps_packet_t *lexer, unsigned int c)
c);
}
-void rtcm2_sager_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
+void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
/* dump the contents of a parsed RTCM104 message */
{
unsigned int n;
@@ -470,7 +470,7 @@ void rtcm2_sager_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
case 1:
case 9:
for (n = 0; n < rtcm->ranges.nentries; n++) {
- struct rangesat_t *rsp = &rtcm->ranges.sat[n];
+ const struct rangesat_t *rsp = &rtcm->ranges.sat[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"S\t%u\t%u\t%u\t%0.1f\t%0.3f\t%0.3f\n",
rsp->ident,
@@ -507,7 +507,7 @@ void rtcm2_sager_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
case 5:
for (n = 0; n < rtcm->conhealth.nentries; n++) {
- struct consat_t *csp = &rtcm->conhealth.sat[n];
+ const struct consat_t *csp = &rtcm->conhealth.sat[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"C\t%2u\t%1u\t%1u\t%2d\t%1u\t%1u\t%1u\t%2u\n",
csp->ident,
@@ -527,7 +527,7 @@ void rtcm2_sager_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
case 7:
for (n = 0; n < rtcm->almanac.nentries; n++) {
- struct station_t *ssp = &rtcm->almanac.station[n];
+ const struct station_t *ssp = &rtcm->almanac.station[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"A\t%.4f\t%.4f\t%u\t%.1f\t%u\t%u\t%u\n",
ssp->latitude,
diff --git a/driver_superstar2.c b/driver_superstar2.c
index ee3f8a16..37a4e916 100644
--- a/driver_superstar2.c
+++ b/driver_superstar2.c
@@ -355,7 +355,7 @@ superstar2_msg_measurement(struct gps_device_t *session, unsigned char *buf, siz
t = getled(buf, 7); /* measurement time */
for(i = 0; i < n; i++){
session->gpsdata.raw.mtime[i] = t;
- session->gpsdata.PRN[i] = getub(buf, 11*i + 15) & 0x1f;
+ session->gpsdata.PRN[i] = (int)getub(buf, 11*i + 15) & 0x1f;
session->gpsdata.ss[i] = getub(buf, 11*i * 15 +1 )/4.0;
session->gpsdata.raw.codephase[i] = (double)getleul(buf, 11*i * 15 + 2);
ul = getleul(buf, 11*i * 15 + 6);
@@ -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 || stopbits!=session->gpsdata.dev.stopbits) {
+ if (parity!=(char)session->gpsdata.dev.parity || stopbits!=(int)session->gpsdata.dev.stopbits) {
return false;
} else {
/*@ +charint @*/
diff --git a/driver_tsip.c b/driver_tsip.c
index 2030b5b8..a8622447 100644
--- a/driver_tsip.c
+++ b/driver_tsip.c
@@ -376,9 +376,9 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
session->gpsdata.elevation[i] = (int)round(d1);
session->gpsdata.azimuth[i] = (int)round(d2);
} else {
- session->gpsdata.PRN[i] = 0;
- session->gpsdata.ss[i] = session->gpsdata.elevation[i]
+ session->gpsdata.PRN[i] = session->gpsdata.elevation[i]
= session->gpsdata.azimuth[i] = 0;
+ session->gpsdata.ss[i] = 0.0;
}
if (++i == session->gpsdata.satellites)
mask |= SATELLITE_SET; /* last of the series */
diff --git a/gps.h b/gps.h
index f818effc..47113e0a 100644
--- a/gps.h
+++ b/gps.h
@@ -836,9 +836,9 @@ struct devconfig_t {
char driver[64];
char subtype[64];
double activated;
- int baudrate, parity, stopbits; /* RS232 link parameters */
- double cycle, mincycle; /* refresh cycle time in seconds */
- int driver_mode; /* is driver in native mode or not? */
+ uint baudrate, parity, stopbits; /* RS232 link parameters */
+ double cycle, mincycle; /* refresh cycle time in seconds */
+ int driver_mode; /* is driver in native mode or not? */
};
struct policy_t {
diff --git a/gps_json.h b/gps_json.h
index 2f27900e..39c99da1 100644
--- a/gps_json.h
+++ b/gps_json.h
@@ -6,15 +6,19 @@
#define GPS_JSON_RESPONSE_MAX 1024
char *json_stringify(/*@out@*/char *, size_t, /*@in@*/const char *);
-int json_watch_read(const char *, struct policy_t *, /*@null@*/const char **);
-int json_device_read(const char *, struct devconfig_t *, /*@null@*/const char **);
+void json_tpv_dump(const struct gps_data_t *, struct gps_fix_t *, char *, size_t);
+void json_sky_dump(const struct gps_data_t *, char *, size_t);
+void json_device_dump(const struct gps_device_t *, char *, size_t);
+void json_watch_dump(const struct policy_t *, char *, size_t);
+int json_watch_read(const char *, /*@out@*/struct policy_t *,
+ /*@out null@*/const char **);
+int json_device_read(const char *, /*@out@*/struct devconfig_t *,
+ /*@out null@*/const char **);
void json_version_dump(/*@out@*/char *, size_t);
-void json_tpv_dump(struct gps_data_t *, struct gps_fix_t *, char *, size_t);
-void json_sky_dump(struct gps_data_t *, char *, size_t);
-void json_device_dump(struct gps_device_t *, char *, size_t);
-void json_watch_dump(struct policy_t *, char *, size_t);
-int json_rtcm2_read(const char *, char *, size_t, struct rtcm2_t *, /*@null@*/const char **);
-int json_ais_read(const char *, char *, size_t, struct ais_t *, /*@null@*/const char **);
+int json_rtcm2_read(const char *, char *, size_t, struct rtcm2_t *,
+ /*@out null@*/const char **);
+int json_ais_read(const char *, char *, size_t, struct ais_t *,
+ /*@out null@*/const char **);
int libgps_json_unpack(const char *, struct gps_data_t *);
/* gps_json.h ends here */
diff --git a/gpsctl.c b/gpsctl.c
index b11414c6..28aa687a 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -257,9 +257,10 @@ int main(int argc, char **argv)
}
gpsd_report(LOG_PROG,"%d device(s) found.\n",gpsdata->devices.ndevices);
- if (gpsdata->devices.ndevices == 1)
+ if (gpsdata->devices.ndevices == 1) {
devlistp = &gpsdata->devices.list[0];
- else {
+ device = devlistp->path;
+ } else {
int i;
assert(device != NULL);
for (i = 0; i < gpsdata->devices.ndevices; i++)
diff --git a/gpsd.c b/gpsd.c
index 24760217..c60ab06f 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -873,7 +873,7 @@ static /*@null@*/struct channel_t *assign_channel(struct subscriber_t *user,
timestamp(), gpsd_id(channel->device));
#endif /* OLDSTYLE_ENABLE */
/*@ -sefparams +matchanyintegral @*/
- if (buf[0])
+ if (buf[0]!='\0')
(void)throttled_write(user, buf, strlen(buf));
/*@ +sefparams -matchanyintegral @*/
}
@@ -1048,7 +1048,7 @@ static void set_serial(struct gps_device_t *device,
#endif /* ALLOW_RECONFIGURE */
#ifdef OLDSTYLE_ENABLE
-static struct channel_t *mandatory_assign_channel(struct subscriber_t *user,
+static /*null*/struct channel_t *mandatory_assign_channel(struct subscriber_t *user,
gnss_type type,
/*@null@*/struct gps_device_t *forcedev)
{
@@ -1071,6 +1071,15 @@ static bool handle_oldstyle(struct subscriber_t *sub, char *buf,
sub->new_style_responses = false;
#endif /* defined(OLDSTYLE_ENABLE) && defined(GPSDNG_ENABLE) */
+ /*
+ * After each channel assignment, it must be the case that eother the
+ * the turned channel pointer is null or points to a channel block with
+ * a nonzero device field. The dataflow analysis splint does is not
+ * quite good enough to catch this, alas, so we need to temporarily
+ * disable its null-dereference check.
+ */
+ /*@ -nullderef @*/
+
(void)strlcpy(reply, "GPSD", replylen);
replylen -= 4;
p = buf;
@@ -1298,7 +1307,7 @@ static bool handle_oldstyle(struct subscriber_t *sub, char *buf,
if (!channel || !channel->device)
(void)snprintf(phrase, sizeof(phrase), ",N=?");
else
- (void)snprintf(phrase, sizeof(phrase), ",N=%u", channel->device->gpsdata.dev.driver_mode);
+ (void)snprintf(phrase, sizeof(phrase), ",N=%d", channel->device->gpsdata.dev.driver_mode);
break;
case 'O':
if ((channel=mandatory_assign_channel(sub, GPS, NULL))== NULL || !have_fix(channel))
@@ -1612,6 +1621,7 @@ static bool handle_oldstyle(struct subscriber_t *sub, char *buf,
}
breakout:
(void)strlcat(reply, "\r\n", replylen);
+ /*@ +nullderef @*/
return true;
}
#endif /* OLDSTYLE_ENABLE */
@@ -1702,7 +1712,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
json_error_string(status));
goto bailout;
} else {
- if (devconf.path[0]) {
+ if (devconf.path[0]!='\0') {
/* user specified a path, try to assign it */
if ((channel = assign_channel(sub, ANY, find_device(devconf.path))) == NULL)
(void)snprintf(reply, replylen,
@@ -1758,7 +1768,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
for (channel = channels; channel < channels + NITEMS(channels); channel++)
if (channel->subscriber != sub)
continue;
- else if (devconf.path[0] != '\0' && channel->device && strcmp(channel->device->gpsdata.dev.path, devconf.path)!=0)
+ else if (devconf.path[0] != '\0' && channel->device!=NULL && strcmp(channel->device->gpsdata.dev.path, devconf.path)!=0)
continue;
else {
json_device_dump(channel->device,
diff --git a/gpsd.h-tail b/gpsd.h-tail
index e3d00825..8c38bbc9 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -104,15 +104,14 @@ enum isgpsstat_t isgps_decode(struct gps_packet_t *,
size_t,
unsigned int);
extern unsigned int isgps_parity(isgps30bits_t);
-extern void isgps_output_magnavox(isgps30bits_t *, unsigned int, FILE *);
+extern void isgps_output_magnavox(const isgps30bits_t *, unsigned int, FILE *);
extern enum isgpsstat_t rtcm2_decode(struct gps_packet_t *, unsigned int);
-extern void rtcm2_sager_dump(struct rtcm2_t *, /*@out@*/char[], size_t);
-extern void rtcm2_json_dump(struct rtcm2_t *, /*@out@*/char[], size_t);
+extern void rtcm2_sager_dump(const struct rtcm2_t *, /*@out@*/char[], size_t);
+extern void rtcm2_json_dump(const struct rtcm2_t *, /*@out@*/char[], size_t);
extern int rtcm2_undump(/*@out@*/struct rtcm2_t *, char *);
extern void rtcm2_unpack(/*@out@*/struct rtcm2_t *, char *);
extern bool rtcm2_repack(struct rtcm2_t *, isgps30bits_t *);
-extern void rtcm2_output_magnavox(isgps30bits_t *, FILE *);
extern void rtcm3_unpack(/*@out@*/struct rtcm3_t *, char *);
extern void rtcm3_dump(struct rtcm3_t *rtcm, FILE *);
@@ -441,7 +440,7 @@ extern ssize_t gpsd_write(struct gps_device_t *, void const *, size_t);
extern bool gpsd_next_hunt_setting(struct gps_device_t *);
extern int gpsd_switch_driver(struct gps_device_t *, char *);
extern void gpsd_set_speed(struct gps_device_t *, speed_t, unsigned char, unsigned int);
-extern speed_t gpsd_get_speed(struct termios *);
+extern speed_t gpsd_get_speed(const struct termios *);
extern void gpsd_assert_sync(struct gps_device_t *);
extern void gpsd_close(struct gps_device_t *);
@@ -499,8 +498,8 @@ extern void ubx_catch_model(struct gps_device_t *,
unsigned char *, size_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, /*@out@*/char *, size_t);
+extern bool aivdm_decode(const char *, size_t, struct aivdm_context_t *, struct ais_t *);
+extern void aivdm_json_dump(const 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 fdc4cbaa..965db3b8 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -31,7 +31,7 @@ char *json_stringify(/*@out@*/char *to, size_t len, /*@in@*/const char *from)
* each character to generate an up to 6-character Java-style
* escape
*/
- for (sp = from; *sp && tp - to < len-5; sp++) {
+ for (sp = from; *sp && tp - to < (int)len-5; sp++) {
if (iscntrl(*sp)) {
*tp++ = '\\';
switch (*sp) {
@@ -73,7 +73,7 @@ void json_version_dump(/*@out@*/char *reply, size_t replylen)
GPSD_API_MAJOR_VERSION, GPSD_API_MINOR_VERSION);
}
-void json_tpv_dump(struct gps_data_t *gpsdata, struct gps_fix_t *fixp,
+void json_tpv_dump(const struct gps_data_t *gpsdata, struct gps_fix_t *fixp,
char *reply, size_t replylen)
{
assert(replylen > 2);
@@ -163,7 +163,7 @@ void json_tpv_dump(struct gps_data_t *gpsdata, struct gps_fix_t *fixp,
(void)strlcat(reply, "}\r\n", sizeof(reply)-strlen(reply));
}
-void json_sky_dump(struct gps_data_t *datap, char *reply, size_t replylen)
+void json_sky_dump(const struct gps_data_t *datap, char *reply, size_t replylen)
{
int i, j, used, reported = 0;
assert(replylen > 2);
@@ -220,7 +220,8 @@ void json_sky_dump(struct gps_data_t *datap, char *reply, size_t replylen)
}
int json_device_read(const char *buf,
- struct devconfig_t *dev, const char **endptr)
+ /*@out@*/struct devconfig_t *dev,
+ /*@out null@*/const char **endptr)
{
char serialmode[4];
/*@ -fullinitblock @*/
@@ -237,12 +238,12 @@ int json_device_read(const char *buf,
.len = sizeof(dev->subtype)},
{"native", integer, .addr.integer = &dev->driver_mode,
.dflt.integer = -1},
- {"bps", integer, .addr.integer = &dev->baudrate,
- .dflt.integer = -1},
+ {"bps", uinteger, .addr.uinteger = &dev->baudrate,
+ .dflt.uinteger = 0},
{"parity", string, .addr.string=serialmode,
.len=sizeof(serialmode)},
- {"stopbits", integer, .addr.integer = &dev->stopbits,
- .dflt.integer = -1},
+ {"stopbits", uinteger, .addr.uinteger = &dev->stopbits,
+ .dflt.uinteger = 1},
{"cycle", real, .addr.real = &dev->cycle,
.dflt.real = NAN},
{"mincycle", real, .addr.real = &dev->mincycle,
@@ -259,7 +260,7 @@ int json_device_read(const char *buf,
return 0;
}
-void json_device_dump(struct gps_device_t *device,
+void json_device_dump(const struct gps_device_t *device,
char *reply, size_t replylen)
{
char buf1[JSON_VAL_MAX*2+1];
@@ -311,8 +312,8 @@ void json_device_dump(struct gps_device_t *device,
}
int json_watch_read(const char *buf,
- struct policy_t *ccp,
- const char **endptr)
+ /*@out@*/struct policy_t *ccp,
+ /*@out null@*/const char **endptr)
{
int intcasoc;
/*@ -fullinitblock @*/
@@ -337,7 +338,7 @@ int json_watch_read(const char *buf,
return status;
}
-void json_watch_dump(struct policy_t *ccp, char *reply, size_t replylen)
+void json_watch_dump(const struct policy_t *ccp, char *reply, size_t replylen)
{
(void)snprintf(reply+strlen(reply), replylen-strlen(reply),
"{\"class\":\"WATCH\",\"enable\":%s,\"raw\":%d,\"buffer_policy\":%d,\"scaled\":%s}\r\n",
@@ -348,7 +349,7 @@ void json_watch_dump(struct policy_t *ccp, char *reply, size_t replylen)
}
#if defined(RTCM104V2_ENABLE)
-void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
+void rtcm2_json_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
/* dump the contents of a parsed RTCM104 message as JSON */
{
char buf1[JSON_VAL_MAX*2+1];
@@ -374,7 +375,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
case 9:
(void)strlcat(buf, "\"satellites\":[", buflen);
for (n = 0; n < rtcm->ranges.nentries; n++) {
- struct rangesat_t *rsp = &rtcm->ranges.sat[n];
+ const struct rangesat_t *rsp = &rtcm->ranges.sat[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"{\"ident\":%u,\"udre\":%u,\"issuedata\":%u,\"rangerr\":%0.3f,\"rangerate\":%0.3f},",
rsp->ident,
@@ -416,7 +417,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
#define JSON_BOOL(x) ((x)?"true":"false")
(void)strlcat(buf, "\"satellites\":[", buflen);
for (n = 0; n < rtcm->conhealth.nentries; n++) {
- struct consat_t *csp = &rtcm->conhealth.sat[n];
+ const struct consat_t *csp = &rtcm->conhealth.sat[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"{\"ident\":%u,\"iodl\":%s,\"health\":%1u,\"snr\":%d,\"health_en\":%s,\"new_data\":%s,\"los_warning\":%s,\"tou\":%u},",
csp->ident,
@@ -440,7 +441,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
case 7:
(void)strlcat(buf, "\"satellites\":[", buflen);
for (n = 0; n < rtcm->almanac.nentries; n++) {
- struct station_t *ssp = &rtcm->almanac.station[n];
+ const struct station_t *ssp = &rtcm->almanac.station[n];
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"{\"lat\":%.4f,\"lon\":%.4f,\"range\":%u,\"frequency\":%.1f,\"health\":%u,\"station_id\":%u,\"bitrate\":%u},",
ssp->latitude,
@@ -479,7 +480,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, /*@out@*/char *buf, size_t buflen)
+void aivdm_json_dump(const 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];
diff --git a/json.c b/json.c
index 9ed51346..e819fa4b 100644
--- a/json.c
+++ b/json.c
@@ -95,7 +95,7 @@ static int json_internal_read_object(const char *cp,
const struct json_attr_t *attrs,
const struct json_array_t *parent,
int offset,
- /*@null@*/const char **end)
+ /*@out null@*/const char **end)
{
enum {init, await_attr, in_attr, await_value,
in_val_string, in_escape, in_val_token, post_val} state = 0;
@@ -373,6 +373,9 @@ int json_read_array(const char *cp, const struct json_array_t *arr, const char *
int substatus, offset;
char *tp;
+ if (end != NULL)
+ *end = NULL; /* give it a well-defined value on parse failure */
+
json_debug_trace(("Entered json_read_array()\n"));
while (isspace(*cp))
@@ -454,7 +457,7 @@ breakout:
int json_read_object(const char *cp,
const struct json_attr_t *attrs,
- /*@null@*/const char **end)
+ /*@out null@*/const char **end)
{
return json_internal_read_object(cp, attrs, NULL, 0, end);
}
diff --git a/json.h b/json.h
index 69d48d94..28e33afc 100644
--- a/json.h
+++ b/json.h
@@ -60,8 +60,10 @@ struct json_attr_t {
#define JSON_ATTR_MAX 31 /* max chars in JSON attribute name */
#define JSON_VAL_MAX 120 /* max chars in JSON value part */
-int json_read_object(const char *, const struct json_attr_t *, /*@null@*/const char **);
-int json_read_array(const char *, const struct json_array_t *, /*@null@*/const char **);
+int json_read_object(const char *, const struct json_attr_t *,
+ /*@out null@*/const char **);
+int json_read_array(const char *, const struct json_array_t *,
+ /*@out null@*/const char **);
const /*@observer@*/char *json_error_string(int);
#define JSON_ERR_OBSTART 1 /* non-WS when expecting object start */
diff --git a/libgps_json.c b/libgps_json.c
index 608a490b..23928398 100644
--- a/libgps_json.c
+++ b/libgps_json.c
@@ -21,7 +21,7 @@ representations to libgps structures.
static int json_tpv_read(const char *buf,
struct gps_data_t *gpsdata,
- /*@null@*/const char **endptr)
+ /*@out null@*/const char **endptr)
{
int status;
/*@ -fullinitblock @*/
@@ -104,7 +104,7 @@ static int json_tpv_read(const char *buf,
static int json_sky_read(const char *buf,
struct gps_data_t *gpsdata,
- /*@null@*/const char **endptr)
+ /*@out null@*/const char **endptr)
{
bool usedflags[MAXCHANNELS];
/*@ -fullinitblock @*/
@@ -152,7 +152,7 @@ static int json_sky_read(const char *buf,
static int json_devicelist_read(const char *buf,
struct gps_data_t *gpsdata,
- /*@null@*/const char **endptr)
+ /*@out null@*/const char **endptr)
{
/*@ -fullinitblock @*/
const struct json_attr_t json_attrs_subdevices[] = {
@@ -201,7 +201,7 @@ static int json_devicelist_read(const char *buf,
static int json_version_read(const char *buf,
struct gps_data_t *gpsdata,
- /*@null@*/const char **endptr)
+ /*@out null@*/const char **endptr)
{
/*@ -fullinitblock @*/
const struct json_attr_t json_attrs_version[] = {
@@ -228,7 +228,7 @@ static int json_version_read(const char *buf,
static int json_error_read(const char *buf,
struct gps_data_t *gpsdata,
- /*@null@*/const char **endptr)
+ /*@out null@*/const char **endptr)
{
/*@ -fullinitblock @*/
const struct json_attr_t json_attrs_error[] = {
diff --git a/serial.c b/serial.c
index 5c3004db..adcdb521 100644
--- a/serial.c
+++ b/serial.c
@@ -49,7 +49,7 @@ void cfmakeraw(struct termios *termios_p)
}
#endif /* defined(__CYGWIN__) */
-speed_t gpsd_get_speed(struct termios* ttyctl)
+speed_t gpsd_get_speed(const struct termios* ttyctl)
{
speed_t code = cfgetospeed(ttyctl);
switch (code) {