diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-07-16 13:43:22 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-07-16 13:43:22 +0000 |
commit | c914c2ddd46d397017baff585f8f71e2311e3cff (patch) | |
tree | c149807a6402cd632dab5af7a687deacf63af7e1 | |
parent | 5ac90117f32cd9c2d798b8f567269606aebb7033 (diff) | |
download | gpsd-c914c2ddd46d397017baff585f8f71e2311e3cff.tar.gz |
Do consistent naming and some splint cleaning.
-rw-r--r-- | Makefile.am | 14 | ||||
-rw-r--r-- | bits_test.c (renamed from bits.c) | 0 | ||||
-rw-r--r-- | gpsflash.c | 19 | ||||
-rw-r--r-- | packet.c | 6 | ||||
-rw-r--r-- | rtcm.c | 6 |
5 files changed, 24 insertions, 21 deletions
diff --git a/Makefile.am b/Makefile.am index e36211b3..36f5bff8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ endif bin_PROGRAMS = $(BUILD_PROGS) sirfmon rtcmdecode gpsflash bin_SCRIPTS = gpsprof gpsfake sbin_PROGRAMS = gpsd -check_PROGRAMS = bits gpsmm_test packet_test +check_PROGRAMS = bits_test gpsmm_test packet_test # # Build xgps @@ -107,10 +107,10 @@ gpsmm_test_SOURCES = gpsmm_test.cpp gpsmm_test_LDADD = $(LIBC) libgps.la -lm # -# Build bits tester +# Build bits_test tester # -bits_SOURCES = bits.c -bits_LDADD = $(LIBC) libgps.la +bits_test_SOURCES = bits.c +bits_test_LDADD = $(LIBC) libgps.la # # Build packets tester @@ -237,12 +237,14 @@ splint: -splint -exportlocal $(xgpsspeed_c_sources) @echo "Running splint on sirfmon..." -splint $(sirfmon_SOURCES) - @echo "Running splint on bits test harness..." - -splint $(bits_SOURCES) @echo "Running splint on rtcmdecode..." -splint -exportlocal rtcmdecode.c @echo "Running splint on gpsflash..." -splint $(gpsflash_SOURCES) + @echo "Running splint on bits_test test harness..." + -splint $(bits_test_SOURCES) + @echo "Running splint on packet_test test harness..." + -splint $(packet_test_SOURCES) # # Regression tests begin here @@ -171,7 +171,8 @@ r0: if((r = write(pfd, msg+nbx, nbs)) == -1){ int srecord_send(int pfd, char *data, size_t len){ - int l, r, i; + int r, i; + size_t tl; char sendbuf[85], recvbuf[8]; /* srecord loading is interactive. send line, get reply */ @@ -186,25 +187,25 @@ srecord_send(int pfd, char *data, size_t len){ if((r = sscanf(data, "%80s", sendbuf)) == EOF) return 0; - l = strlen(sendbuf); - if ((l < 1) || (l > 80)) + tl = strlen(sendbuf); + if ((tl < 1) || (tl > 80)) return -1; - data += l; - len -= l; + data += tl; + len -= tl; while((data[0] != 'S') && (data[0] != '\0')) data++; - sendbuf[l] = '\r'; - sendbuf[l+1] = '\n'; - l += 2; + sendbuf[tl] = '\r'; + sendbuf[tl+1] = '\n'; + tl += 2; if ((++i % 1000) == 0) printf ("%6d\n", i); (void)tcflush(pfd, TCIFLUSH); - if((r = (int)write(pfd, sendbuf, (size_t)(l+2))) != l+2) + if((r = (int)write(pfd, sendbuf, tl+2)) != tl+2) return -1; /* oops. bail out */ (void)tcdrain(pfd); @@ -925,16 +925,16 @@ ssize_t packet_parse(struct gps_device_t *session, size_t newdata) ssize_t packet_get(struct gps_device_t *session) /* grab a packet; returns ether BAD_PACKET or the length */ { - int newdata; + ssize_t newdata; /*@ -modobserver @*/ - newdata = (int)read(session->gpsdata.gps_fd, session->inbufptr, + newdata = read(session->gpsdata.gps_fd, session->inbufptr, sizeof(session->inbuffer)-(session->inbufptr-session->inbuffer)); /*@ +modobserver @*/ if (newdata < 0 && errno != EAGAIN) return BAD_PACKET; else if (newdata == 0 || (newdata < 0 && errno == EAGAIN)) return 0; - return packet_parse(session, newdata); + return packet_parse(session, (size_t)newdata); } void packet_reset(struct gps_device_t *session) @@ -303,14 +303,14 @@ static void unpack(struct rtcm_t *ctx) /* someday we'll do big-endian correction here */ msghdr = (struct rtcm_msghdr *)ctx->buf; ctx->type = msghdr->w1.msgtype; - ctx->length = (int)msghdr->w2.frmlen; + ctx->length = msghdr->w2.frmlen; ctx->zcount = msghdr->w2.zcnt * ZCOUNT_SCALE; ctx->refstaid = msghdr->w1.refstaid; ctx->seqnum = msghdr->w2.sqnum; ctx->stathlth = msghdr->w2.stathlth; memset(ctx->ranges, 0, sizeof(ctx->ranges)); - len = ctx->length; + len = (int)ctx->length; n = 0; switch (ctx->type) { case 1: @@ -362,7 +362,7 @@ static void unpack(struct rtcm_t *ctx) } /*@ -usereleased -compdef @*/ -/*@null@*//*@observer@*/ enum rtcmstat_t rtcm_decode(struct rtcm_t *ctx, unsigned int c) +enum rtcmstat_t rtcm_decode(struct rtcm_t *ctx, unsigned int c) { enum rtcmstat_t res; |