summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-09-12 00:11:29 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-09-12 00:11:29 -0400
commit51b6b93201b1e955fe0310b569ded0514c50b0d5 (patch)
tree15b5c3a3f63ef52cc0d85dbc5b06a0d27f0a9d4c /gpsdecode.c
parent3748ed40b6784b1905492e70b33b5d7ce296fa08 (diff)
downloadgpsd-51b6b93201b1e955fe0310b569ded0514c50b0d5.tar.gz
Magic-number elimination. All regression tests pass.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index 02558ab0..507d7ba4 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -12,6 +12,7 @@
#endif /* S_SPLINT_S */
#include "gpsd.h"
+#include "bits.h"
#include "gps_json.h"
static int verbose = 0;
@@ -124,7 +125,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type6.bitcount,
gpsd_hexdump(scratchbuf, sizeof(scratchbuf),
ais->type6.bitdata,
- (ais->type6.bitcount + 7) / 8));
+ BITS_TO_BYTES(ais->type6.bitcount)));
break;
case 7: /* Binary Acknowledge */
case 13: /* Safety Related Acknowledge */
@@ -232,7 +233,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type8.bitcount,
gpsd_hexdump(scratchbuf, sizeof(scratchbuf),
ais->type8.bitdata,
- (ais->type8.bitcount + 7) / 8));
+ BITS_TO_BYTES(ais->type8.bitcount)));
break;
case 9:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
@@ -291,7 +292,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type17.bitcount,
gpsd_hexdump(scratchbuf, sizeof(scratchbuf),
ais->type17.bitdata,
- (ais->type17.bitcount + 7) / 8));
+ BITS_TO_BYTES(ais->type17.bitcount)));
break;
case 18:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
@@ -447,7 +448,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type25.bitcount,
gpsd_hexdump(scratchbuf, sizeof(scratchbuf),
ais->type25.bitdata,
- (ais->type25.bitcount + 7) / 8));
+ BITS_TO_BYTES(ais->type25.bitcount)));
break;
case 26: /* Binary Message, Multiple Slot */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
@@ -459,7 +460,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
ais->type26.bitcount,
gpsd_hexdump(scratchbuf, sizeof(scratchbuf),
ais->type26.bitdata,
- (ais->type26.bitcount + 7) / 8),
+ BITS_TO_BYTES(ais->type26.bitcount)),
ais->type26.radio);
break;
case 27: /* Long Range AIS Broadcast message */