diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-03 22:06:39 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-03 22:06:39 +0000 |
commit | 6f7dfcf6f615ef4068493330edd12f20ff25cd03 (patch) | |
tree | 7c8db8a5e7c3fbdae9989ab8c743b6316d3ba34f /gpsdecode.c | |
parent | e2ee8609491bf6ce803183aa0c036460584ac404 (diff) | |
download | gpsd-6f7dfcf6f615ef4068493330edd12f20ff25cd03.tar.gz |
Use CYCLE_END condition for the 2-part mal-design of AIS message 24 properly.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r-- | gpsdecode.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/gpsdecode.c b/gpsdecode.c index 956175fa..1c084a42 100644 --- a/gpsdecode.c +++ b/gpsdecode.c @@ -292,34 +292,27 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen) break; case 24: /* Class B CS Static Data Report */ (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%u,", ais->type24.part); - if (ais->type24.part == 0) { - (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%s", - ais->type24.a.shipname); - } else if (ais->type24.part == 1) { + "%s,", + ais->type24.shipname); + (void)snprintf(buf+strlen(buf), buflen-strlen(buf), + "%u,", + ais->type24.shiptype); + (void)snprintf(buf+strlen(buf), buflen-strlen(buf), + "%s,%s,", + ais->type24.vendorid, + ais->type24.callsign); + if (AIS_AUXILIARY_MMSI(ais->mmsi)) { (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%u,", - ais->type24.b.shiptype); + "%u", + ais->type24.mothership_mmsi); + } else { (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%s,%s,", - ais->type24.b.vendorid, - ais->type24.b.callsign); - if (AIS_AUXILIARY_MMSI(ais->mmsi)) { - (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%u", - ais->type24.b.mothership_mmsi); - } else { - (void)snprintf(buf+strlen(buf), buflen-strlen(buf), - "%u,%u,%u,%u", - ais->type24.b.dim.to_bow, - ais->type24.b.dim.to_stern, - ais->type24.b.dim.to_port, - ais->type24.b.dim.to_starboard); - } - } else - (void)snprintf(buf+strlen(buf), - buflen-strlen(buf), "illegal part value %u", ais->type24.part); + "%u,%u,%u,%u", + ais->type24.dim.to_bow, + ais->type24.dim.to_stern, + ais->type24.dim.to_port, + ais->type24.dim.to_starboard); + } break; default: (void)snprintf(buf+strlen(buf), |