diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-01-31 12:20:55 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-01-31 12:20:55 +0000 |
commit | 424b076f627856a217bf37f4f3bf43e3831749a1 (patch) | |
tree | ec4f39c9649d737193817ea39c5de109c05d775c /driver_aivdm.c | |
parent | 3459533e9d8178881de8045f4f9a73842c7a72f4 (diff) | |
download | gpsd-424b076f627856a217bf37f4f3bf43e3831749a1.tar.gz |
Correct handling of pad field.
Diffstat (limited to 'driver_aivdm.c')
-rw-r--r-- | driver_aivdm.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/driver_aivdm.c b/driver_aivdm.c index eaf53a2b..10522b78 100644 --- a/driver_aivdm.c +++ b/driver_aivdm.c @@ -80,7 +80,7 @@ bool aivdm_decode(const char *buf, size_t buflen, #endif /* __UNUSED_DEBUG__ */ int nfields = 0; unsigned char *data, *cp = ais_context->fieldcopy; - unsigned char ch; + unsigned char ch, pad; int i; if (buflen == 0) @@ -102,6 +102,7 @@ bool aivdm_decode(const char *buf, size_t buflen, ais_context->await = atoi((char *)ais_context->field[1]); ais_context->part = atoi((char *)ais_context->field[2]); data = ais_context->field[5]; + pad = ais_context->field[6][0]; gpsd_report(LOG_PROG, "await=%d, part=%d, data=%s\n", ais_context->await, ais_context->part, @@ -132,6 +133,8 @@ bool aivdm_decode(const char *buf, size_t buflen, } /*@ +shiftnegative @*/ } + if (isdigit(pad)) + ais_context->bitlen += (pad - '0'); /* ASCII assumption */ /*@ -charint @*/ /* time to pass buffered-up data to where it's actually processed? */ |