diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-24 10:35:07 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-24 10:35:07 -0400 |
commit | 1433efcba69fef54ed6d75b480ae222332ccb989 (patch) | |
tree | 705fbf37b51080188875440df5511f40d3aa34a4 /driver_tsip.c | |
parent | 0658c2fb8d15fbe78fdd4edd1be184559ab53c32 (diff) | |
download | gpsd-1433efcba69fef54ed6d75b480ae222332ccb989.tar.gz |
A lesson in why not to write code with easy-to-miss side effects.
In the Trimble driver, the id field of the sentence was extracted
inside a sprint we needed to remove to get rid of tag field uses.
All regressuin tests pass.
Diffstat (limited to 'driver_tsip.c')
-rw-r--r-- | driver_tsip.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/driver_tsip.c b/driver_tsip.c index d731f191..cb8b2696 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -162,9 +162,7 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) } /*@ -charint @*/ - (void)snprintf(session->tag, sizeof(session->tag), - "ID%02x", id = (unsigned)session->packet.outbuffer[1]); - + id = (unsigned)session->packet.outbuffer[1]; gpsd_report(session->context->debug, LOG_DATA, "TSIP packet id 0x%02x length %d: %s\n", id, len, buf2); @@ -196,9 +194,6 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) */ u1 = (uint8_t) getub(buf, 0); if (u1 == 0x81) { /* Software Version Information */ - (void)snprintf(session->tag + strlen(session->tag), - sizeof(session->tag) - - strlen(session->tag), "%02x", (uint) u1); u2 = getub(buf, 2); /* Major version */ u3 = getub(buf, 3); /* Minor version */ u4 = getub(buf, 4); /* Build number */ @@ -223,9 +218,6 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) mask |= DEVICEID_SET; } if (u1 == 0x83) { /* Hardware Version Information */ - (void)snprintf(session->tag + strlen(session->tag), - sizeof(session->tag) - - strlen(session->tag), "%02x", (uint) u1); ul1 = getbeu32(buf, 1); /* Serial number */ u2 = getub(buf, 5); /* Build day */ u3 = getub(buf, 6); /* Build month */ @@ -667,9 +659,6 @@ static gps_mask_t tsip_parse_input(struct gps_device_t *session) case 0x8f: /* Super Packet. Well... */ /*@ +charint @*/ u1 = (uint8_t) getub(buf, 0); - (void)snprintf(session->tag + strlen(session->tag), - sizeof(session->tag) - - strlen(session->tag), "%02x", (uint) u1); /*@ -charint @*/ switch (u1) { /* sub-packet ID */ case 0x15: /* Current Datum Values */ |