diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-08-27 13:48:16 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-08-27 13:48:16 +0000 |
commit | e5025d231a68d3f6ece0706a673ad0b6bcc16cef (patch) | |
tree | e9e4b241174e646b0ef667bf51c74559c97b4e83 /driver_rtcm2.c | |
parent | c9bbc90053093222192f1f9982e990907e9e54ac (diff) | |
download | gpsd-e5025d231a68d3f6ece0706a673ad0b6bcc16cef.tar.gz |
Don'tr report list lengths, the parser can count.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r-- | driver_rtcm2.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c index fa7f691d..b7438b41 100644 --- a/driver_rtcm2.c +++ b/driver_rtcm2.c @@ -570,8 +570,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen) switch (rtcm->type) { case 1: case 9: - (void)snprintf(buf + strlen(buf), buflen - strlen(buf), - "\"reported\":%u,\"satellites\":[", rtcm->ranges.nentries); + (void)strlcat(buf, "\"satellites\":[", buflen); for (n = 0; n < rtcm->ranges.nentries; n++) { struct rangesat_t *rsp = &rtcm->ranges.sat[n]; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), @@ -611,9 +610,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen) break; case 5: - (void)snprintf(buf + strlen(buf), buflen - strlen(buf), - "\"reported\":%u,\"satellites\":[", - rtcm->conhealth.nentries); + (void)strlcat(buf, "\"satellites\":[", buflen); for (n = 0; n < rtcm->conhealth.nentries; n++) { struct consat_t *csp = &rtcm->conhealth.sat[n]; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), @@ -636,8 +633,7 @@ void rtcm2_json_dump(struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen) break; case 7: - (void)snprintf(buf + strlen(buf), buflen - strlen(buf), - "\"reported\":%u,\"satellites\":[", rtcm->almanac.nentries); + (void)strlcat(buf, "\"satellites\":[", buflen); for (n = 0; n < rtcm->almanac.nentries; n++) { struct station_t *ssp = &rtcm->almanac.station[n]; (void)snprintf(buf + strlen(buf), buflen - strlen(buf), |