summaryrefslogtreecommitdiff
path: root/gpsd_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-12-02 16:45:32 -0500
committerEric S. Raymond <esr@thyrsus.com>2010-12-02 16:45:32 -0500
commit6866018023f86ee09a872c858d3bbf0dc1bb9178 (patch)
tree3886039bc6ac3327acd8de52afbb11e141f7485a /gpsd_json.c
parente40548c0081d2309cfbc91fb7e6e60ff16bce965 (diff)
downloadgpsd-6866018023f86ee09a872c858d3bbf0dc1bb9178.tar.gz
Address bug #17510 gpsdecode reports AIVDM Type 9 aircraft height,speed wrong.
Sadly, it appears we don't have a rgression test for this case. Type 9 packets are rare.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r--gpsd_json.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gpsd_json.c b/gpsd_json.c
index 5055e3b5..2f910e9d 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -886,8 +886,8 @@ void aivdm_json_dump(const struct ais_t *ais, bool scaled,
else if (ais->type9.alt == AIS_ALT_HIGH)
(void)strlcpy(altlegend, "\"high\"", sizeof(altlegend));
else
- (void)snprintf(altlegend, sizeof(altlegend),
- "%.1f", ais->type9.alt / 10.0);
+ (void)snprintf(altlegend, sizeof(altlegend),
+ "%u", ais->type9.alt);
/*
* Express speed as nan if not available,
@@ -899,7 +899,7 @@ void aivdm_json_dump(const struct ais_t *ais, bool scaled,
(void)strlcpy(speedlegend, "\"fast\"", sizeof(speedlegend));
else
(void)snprintf(speedlegend, sizeof(speedlegend),
- "%.1f", ais->type1.speed / 10.0);
+ "%u", ais->type1.speed);
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"\"alt\":%s,\"speed\":%s,\"accuracy\":%s,"