diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-05-26 18:15:13 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-05-26 18:15:13 +0000 |
commit | 75cd79019c3f262746f8d7ca102e33495e0a6af5 (patch) | |
tree | 1cfdb9550d605839f09c9d5f5a27cdbfa2f6b180 | |
parent | 5e380a5c01662426e45034848dc1443571783585 (diff) | |
download | gpsd-75cd79019c3f262746f8d7ca102e33495e0a6af5.tar.gz |
Make a start at cleaning up splint warnings.
-rw-r--r-- | .splintrc | 9 | ||||
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | display.c | 28 | ||||
-rw-r--r-- | drivers.c | 42 | ||||
-rw-r--r-- | garmin.c | 4 | ||||
-rw-r--r-- | gpsd.c | 136 | ||||
-rw-r--r-- | gpsd.h | 23 | ||||
-rw-r--r-- | libgps.c | 2 | ||||
-rw-r--r-- | libgpsd_core.c | 2 | ||||
-rw-r--r-- | netlib.c | 8 | ||||
-rw-r--r-- | nmea_parse.c | 4 | ||||
-rw-r--r-- | serial.c | 2 | ||||
-rw-r--r-- | sirf.c | 16 | ||||
-rw-r--r-- | sirfmon.c | 430 | ||||
-rw-r--r-- | xgps.c | 8 | ||||
-rw-r--r-- | zodiac.c | 4 |
16 files changed, 370 insertions, 352 deletions
diff --git a/.splintrc b/.splintrc new file mode 100644 index 00000000..77d58316 --- /dev/null +++ b/.splintrc @@ -0,0 +1,9 @@ +-I. ++posixlib +-Dfd_set=int +-Dpthread_t=int +-Dsocklen_t=ssize_t +-Din_addr_t=int +-Du_int16_t=short +-Du_int8_t=short +-Dcaddr_t=short diff --git a/Makefile.am b/Makefile.am index 4f70cdd8..dd0122b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -169,3 +169,7 @@ EXTRA_DIST = \ # This is not distributed libgps: libgps.c .libs/libgps.a $(CC) -o libgps -lm -DTESTMAIN -g libgps.c .libs/libgps.a + +# Run splint on all sources +splint: + splint *.c @@ -22,14 +22,14 @@ static void set_color(String color) Colormap cmap = DefaultColormapOfScreen(XtScreen(draww)); XColor col, unused; - if (!XAllocNamedColor(dpy, cmap, color, &col, &unused)) { + if (XAllocNamedColor(dpy, cmap, color, &col, &unused)==0) { char buf[32]; - snprintf(buf, sizeof(buf), "Can't alloc %s", color); + (void)snprintf(buf, sizeof(buf), "Can't alloc %s", color); XtWarning(buf); return; } - XSetForeground(dpy, drawGC, col.pixel); + (void)XSetForeground(dpy, drawGC, col.pixel); } void register_canvas(Widget w, GC gc) @@ -40,9 +40,9 @@ void register_canvas(Widget w, GC gc) XtVaGetValues(w, XmNwidth, &width, XmNheight, &height, NULL); pixmap = XCreatePixmap(XtDisplay(w), RootWindowOfScreen(XtScreen(w)), width, height, - DefaultDepthOfScreen(XtScreen(w))); + (unsigned int)DefaultDepthOfScreen(XtScreen(w))); set_color("White"); - XFillRectangle(XtDisplay(draww), pixmap, drawGC, 0, 0, width, height); + (void)XFillRectangle(XtDisplay(draww), pixmap, drawGC, 0,0, width,height); diameter = min(width, height) - RM; } @@ -58,9 +58,9 @@ static void pol2cart(double azimuth, double elevation, int *xout, int *yout) *yout = (int)((height/2) - cos(azimuth) * elevation * (diameter/2)); } -static void draw_arc(int x, int y, int diam) +static void draw_arc(int x, int y, unsigned int diam) { - XDrawArc(XtDisplay(draww), pixmap, drawGC, + (void)XDrawArc(XtDisplay(draww), pixmap, drawGC, x - diam / 2, y - diam / 2, /* x,y */ diam, diam, /* width, height */ 0, 360 * 64); /* angle1, angle2 */ @@ -71,11 +71,11 @@ void draw_graphics(struct gps_data_t *gpsdata) int i, x, y; char buf[20]; - if (gpsdata->satellites) { + if (gpsdata->satellites != 0) { i = min(width, height); set_color("White"); - XFillRectangle(XtDisplay(draww), pixmap, drawGC, 0, 0, width, height); + (void)XFillRectangle(XtDisplay(draww),pixmap,drawGC,0,0,width,height); /* draw something in the center */ set_color("Grey"); @@ -93,16 +93,16 @@ void draw_graphics(struct gps_data_t *gpsdata) pol2cart(0, 0, &x, &y); set_color("Black"); - XDrawString(XtDisplay(draww),pixmap, drawGC, x, y, "N", 1); + (void)XDrawString(XtDisplay(draww),pixmap, drawGC, x, y, "N", 1); pol2cart(90, 0, &x, &y); set_color("Black"); - XDrawString(XtDisplay(draww),pixmap, drawGC, x+2, y, "E", 1); + (void)XDrawString(XtDisplay(draww),pixmap, drawGC, x+2, y, "E", 1); pol2cart(180, 0, &x, &y); set_color("Black"); - XDrawString(XtDisplay(draww),pixmap, drawGC, x, y+10, "S", 1); + (void)XDrawString(XtDisplay(draww),pixmap, drawGC, x, y+10, "S", 1); pol2cart(270, 0, &x, &y); set_color("Black"); - XDrawString(XtDisplay(draww),pixmap, drawGC, x-5,y, "W", 1); + (void)XDrawString(XtDisplay(draww),pixmap, drawGC, x-5,y, "W", 1); /* Now draw the satellites... */ for (i = 0; i < gpsdata->satellites; i++) { @@ -121,7 +121,7 @@ void draw_graphics(struct gps_data_t *gpsdata) ); snprintf(buf, sizeof(buf), "%02d", gpsdata->PRN[i]); set_color("Blue"); - XDrawString(XtDisplay(draww), pixmap, drawGC, x, y + 17, buf, 2); + (void)XDrawString(XtDisplay(draww), pixmap, drawGC, x, y + 17, buf, 2); if (gpsdata->ss[i]) { set_color("Black"); XDrawPoint(XtDisplay(draww), pixmap, drawGC, x, y); @@ -32,9 +32,9 @@ static int nmea_parse_input(struct gps_device_t *session) for (dp = gpsd_drivers; *dp; dp++) { char *trigger = (*dp)->trigger; - if (trigger && !strncmp(session->outbuffer, trigger, strlen(trigger)) && isatty(session->gpsdata.gps_fd)) { + if (trigger && strncmp(session->outbuffer, trigger, strlen(trigger))==0 && isatty(session->gpsdata.gps_fd)) { gpsd_report(1, "found %s.\n", trigger); - gpsd_switch_driver(session, (*dp)->typename); + (void)gpsd_switch_driver(session, (*dp)->typename); return 1; } } @@ -42,9 +42,9 @@ static int nmea_parse_input(struct gps_device_t *session) gpsd_report(1, "unknown sentence: \"%s\"\n", session->outbuffer); } #ifdef NTPSHM_ENABLE - if (st & TIME_SET) + if ((st & TIME_SET) != 0) /* this magic number is derived from observation */ - ntpshm_put(session, session->gpsdata.fix.time + 0.675); + (void)ntpshm_put(session, session->gpsdata.fix.time + 0.675); #endif /* NTPSHM_ENABLE */ /* also copy the sentence up to clients in raw mode */ @@ -66,16 +66,16 @@ static void nmea_initializer(struct gps_device_t *session) * Suppress GLL and VTG. Enable ZDA so dates will be accurate for replay. */ #define FV18_PROBE "$PFEC,GPint,GSA01,DTM00,ZDA01,RMC01,GLL00,VTG00,GSV05" - nmea_send(session->gpsdata.gps_fd, FV18_PROBE); + (void)nmea_send(session->gpsdata.gps_fd, FV18_PROBE); /* enable GPZDA on a Motorola Oncore GT+ */ - nmea_send(session->gpsdata.gps_fd, "$PMOTG,ZDA,1"); + (void)nmea_send(session->gpsdata.gps_fd, "$PMOTG,ZDA,1"); /* enable GPGSA on Garmin serial GPS */ - nmea_send(session->gpsdata.gps_fd, "$PGRM0,GSA,1"); + (void)nmea_send(session->gpsdata.gps_fd, "$PGRM0,GSA,1"); /* probe for SiRF-II */ - nmea_send(session->gpsdata.gps_fd, "$PSRF105,1"); + (void)nmea_send(session->gpsdata.gps_fd, "$PSRF105,1"); } -struct gps_type_t nmea = { +static struct gps_type_t nmea = { "Generic NMEA", /* full name of type */ NULL, /* no recognition string, it's the default */ NULL, /* no probe */ @@ -96,7 +96,7 @@ struct gps_type_t nmea = { * **************************************************************************/ -struct gps_type_t fv18 = { +static struct gps_type_t fv18 = { "San Jose Navigation FV18", /* full name of type */ FV18_PROBE, /* this device should echo the probe string */ NULL, /* no probe */ @@ -123,10 +123,10 @@ struct gps_type_t fv18 = { static void sirf_initializer(struct gps_device_t *session) { - /* nmea_send(session->gpsdata.gps_fd, "$PSRF105,0"); */ - nmea_send(session->gpsdata.gps_fd, "$PSRF105,0"); - nmea_send(session->gpsdata.gps_fd, "$PSRF103,05,00,00,01"); /* no VTG */ - nmea_send(session->gpsdata.gps_fd, "$PSRF103,01,00,00,01"); /* no GLL */ + /* (void)nmea_send(session->gpsdata.gps_fd, "$PSRF105,0"); */ + (void)nmea_send(session->gpsdata.gps_fd, "$PSRF105,0"); + (void)nmea_send(session->gpsdata.gps_fd, "$PSRF103,05,00,00,01"); /* no VTG */ + (void)nmea_send(session->gpsdata.gps_fd, "$PSRF103,01,00,00,01"); /* no GLL */ } static int sirf_switcher(struct gps_device_t *session, int nmea, int speed) @@ -147,13 +147,13 @@ static void sirf_mode(struct gps_device_t *session, int mode) /* change mode to SiRF binary, speed unchanged */ { if (mode == 1) { - gpsd_switch_driver(session, "SiRF-II binary"); + (void)gpsd_switch_driver(session, "SiRF-II binary"); session->gpsdata.driver_mode = sirf_switcher(session, 0, session->gpsdata.baudrate); } else session->gpsdata.driver_mode = 0; } -struct gps_type_t sirfII_nmea = { +static struct gps_type_t sirfII_nmea = { "SiRF-II NMEA", /* full name of type */ #ifndef SIRFII_ENABLE "$Ack Input105.", /* expected response to SiRF PSRF105 */ @@ -189,12 +189,12 @@ struct gps_type_t sirfII_nmea = { static void tripmate_initializer(struct gps_device_t *session) { /* TripMate requires this response to the ASTRAL it sends at boot time */ - nmea_send(session->gpsdata.gps_fd, "$IIGPQ,ASTRAL"); + (void)nmea_send(session->gpsdata.gps_fd, "$IIGPQ,ASTRAL"); /* stop it sending PRWIZCH */ - nmea_send(session->gpsdata.gps_fd, "$PRWIILOG,ZCH,V,,"); + (void)nmea_send(session->gpsdata.gps_fd, "$PRWIILOG,ZCH,V,,"); } -struct gps_type_t tripmate = { +static struct gps_type_t tripmate = { "Delorme TripMate", /* full name of type */ "ASTRAL", /* tells us to switch */ NULL, /* no probe */ @@ -232,14 +232,14 @@ static void earthmate_close(struct gps_device_t *session) static void earthmate_initializer(struct gps_device_t *session) { - write(session->gpsdata.gps_fd, "EARTHA\r\n", 8); + (void)write(session->gpsdata.gps_fd, "EARTHA\r\n", 8); usleep(10000); session->device_type = &zodiac_binary; zodiac_binary.wrapup = earthmate_close; if (zodiac_binary.initializer) zodiac_binary.initializer(session); } -struct gps_type_t earthmate = { +static struct gps_type_t earthmate = { "Delorme EarthMate (pre-2003, Zodiac chipset)", /* full name of type */ "EARTHA", /* tells us to switch to Earthmate */ NULL, /* no probe */ @@ -470,8 +470,8 @@ static int PrintPacket(struct gps_device_t *session, Packet_t *pkt) // send a packet in GarminUSB format static void SendPacket (struct gps_device_t *session, Packet_t *aPacket ) { - long theBytesToWrite = 12 + aPacket->mDataSize; - long theBytesReturned = 0; + ssize_t theBytesToWrite = 12 + aPacket->mDataSize; + ssize_t theBytesReturned = 0; gpsd_report(4, "SendPacket(), writing %d bytes\n", theBytesToWrite); PrintPacket ( session, aPacket); @@ -55,6 +55,7 @@ static fd_set all_fds; static int debuglevel, in_background = 0; static jmp_buf restartbuf; +/*@ -initallelements @*/ static struct gps_context_t context = {0, LEAP_SECONDS, CENTURY_BASE, #ifdef NTPSHM_ENABLE {0}, @@ -64,6 +65,7 @@ static struct gps_context_t context = {0, LEAP_SECONDS, CENTURY_BASE, # endif /* PPS_ENABLE */ #endif /* NTPSHM_ENABLE */ }; +/*@ +initallelements @*/ static void onsig(int sig) { @@ -86,13 +88,13 @@ static int daemonize(void) if (setsid() == -1) return -1; - chdir("/"); + (void)chdir("/"); if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); + (void)dup2(fd, STDIN_FILENO); + (void)dup2(fd, STDOUT_FILENO); + (void)dup2(fd, STDERR_FILENO); if (fd > 2) - close(fd); + (void)close(fd); } in_background = 1; return 0; @@ -110,19 +112,19 @@ void gpsd_report(int errlevel, const char *fmt, ... ) va_list ap; #if defined(PPS_ENABLE) - pthread_mutex_lock(&report_mutex); + (void)pthread_mutex_lock(&report_mutex); #endif /* PPS_ENABLE */ strcpy(buf, "gpsd: "); va_start(ap, fmt) ; - vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); + (void)(void)vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); va_end(ap); if (in_background) syslog((errlevel == 0) ? LOG_ERR : LOG_NOTICE, "%s", buf); else - fputs(buf, stderr); + (void)fputs(buf, stderr); #if defined(PPS_ENABLE) - pthread_mutex_unlock(&report_mutex); + (void)pthread_mutex_unlock(&report_mutex); #endif /* PPS_ENABLE */ } } @@ -174,8 +176,8 @@ static int passivesock(char *service, char *protocol, int qlen) sin.sin_addr.s_addr = INADDR_ANY; if ( (pse = getservbyname(service, protocol)) ) - sin.sin_port = htons(ntohs((u_short) pse->s_port)); - else if ((sin.sin_port = htons((u_short) atoi(service))) == 0) { + sin.sin_port = htons(ntohs((unsigned short) pse->s_port)); + else if ((sin.sin_port = htons((unsigned short) atoi(service))) == 0) { gpsd_report(0, "Can't get \"%s\" service entry.\n", service); return -1; } @@ -234,7 +236,7 @@ static int filesock(char *filename) */ #define MAXDEVICES FD_SETSIZE -struct gps_device_t *channels[MAXDEVICES]; +static struct gps_device_t *channels[MAXDEVICES]; static struct subscriber_t { int active; /* is this a subscriber? */ @@ -246,7 +248,7 @@ static struct subscriber_t { static void detach_client(int cfd) { - close(cfd); + (void)close(cfd); FD_CLR(cfd, &all_fds); subscribers[cfd].raw = 0; subscribers[cfd].watcher = 0; @@ -291,7 +293,7 @@ static void notify_watchers(struct gps_device_t *device, char *sentence, ...) char buf[BUFSIZ]; va_start(ap, sentence) ; - vsnprintf(buf, sizeof(buf), sentence, ap); + (void)vsnprintf(buf, sizeof(buf), sentence, ap); va_end(ap); for (cfd = 0; cfd < FD_SETSIZE; cfd++) @@ -389,11 +391,11 @@ static int assign_channel(struct subscriber_t *user) else { FD_SET(user->device->gpsdata.gps_fd, &all_fds); if (user->watcher && !user->tied) { - write(user-subscribers, "F=", 2); - write(user-subscribers, + (void)write(user-subscribers, "F=", 2); + (void)write(user-subscribers, user->device->gpsdata.gps_device, strlen(user->device->gpsdata.gps_device)); - write(user-subscribers, "\r\n", 2); + (void)write(user-subscribers, "\r\n", 2); } notify_watchers(user->device, "GPSD,X=%f\r\n", timestamp()); } @@ -419,7 +421,7 @@ static int handle_request(int cfd, char *buf, int buflen) if (assign_channel(whoami) && have_fix(whoami->device) && whoami->device->gpsdata.fix.mode == MODE_3D) - sprintf(phrase, ",A=%.3f", + (void)snprintf(phrase, sizeof(phrase), ",A=%.3f", whoami->device->gpsdata.fix.altitude); else strcpy(phrase, ",A=?"); @@ -453,7 +455,7 @@ static int handle_request(int cfd, char *buf, int buflen) } } if (whoami->device) - sprintf(phrase, ",B=%d %d %c %d", + (void)snprintf(phrase, sizeof(phrase), ",B=%d %d %c %d", gpsd_get_speed(&whoami->device->ttyset), 9 - whoami->device->gpsdata.stopbits, whoami->device->gpsdata.parity, @@ -463,7 +465,7 @@ static int handle_request(int cfd, char *buf, int buflen) break; case 'C': if (assign_channel(whoami)) - sprintf(phrase, ",C=%d", + (void)snprintf(phrase, sizeof(phrase), ",C=%d", whoami->device->device_type->cycle); else strcpy(phrase, ",C=?"); @@ -479,12 +481,12 @@ static int handle_request(int cfd, char *buf, int buflen) if (assign_channel(whoami) && have_fix(whoami->device)) { if (whoami->device->gpsdata.fix.eph || whoami->device->gpsdata.fix.epv) - sprintf(phrase, ",E=%.2f %.2f %.2f", + (void)snprintf(phrase, sizeof(phrase), ",E=%.2f %.2f %.2f", whoami->device->gpsdata.epe, whoami->device->gpsdata.fix.eph, whoami->device->gpsdata.fix.epv); else if (whoami->device->gpsdata.pdop || whoami->device->gpsdata.hdop || whoami->device->gpsdata.vdop) - sprintf(phrase, ",E=%.2f %.2f %.2f", + (void)snprintf(phrase, sizeof(phrase), ",E=%.2f %.2f %.2f", whoami->device->gpsdata.pdop * UERE(whoami->device), whoami->device->gpsdata.hdop * UERE(whoami->device), whoami->device->gpsdata.vdop * UERE(whoami->device)); @@ -502,14 +504,14 @@ static int handle_request(int cfd, char *buf, int buflen) free(stash); } if (whoami->device) - snprintf(phrase, sizeof(phrase), ",F=%s", + (void)snprintf(phrase, sizeof(phrase), ",F=%s", whoami->device->gpsdata.gps_device); else strcpy(phrase, ",F=?"); break; case 'I': if (assign_channel(whoami)) - snprintf(phrase, sizeof(phrase), ",I=%s", + (void)snprintf(phrase, sizeof(phrase), ",I=%s", whoami->device->device_type->typename); else strcpy(phrase, ",B=?"); @@ -518,7 +520,7 @@ static int handle_request(int cfd, char *buf, int buflen) for (j = i = 0; i < MAXDEVICES; i++) if (channels[i]) j++; - sprintf(phrase, ",K=%d ", j); + (void)snprintf(phrase, sizeof(phrase), ",K=%d ", j); for (i = 0; i < MAXDEVICES; i++) { if (channels[i] && strlen(phrase)+strlen(channels[i]->gpsdata.gps_device)+1 < sizeof(phrase)) { strcat(phrase, channels[i]->gpsdata.gps_device); @@ -528,13 +530,13 @@ static int handle_request(int cfd, char *buf, int buflen) phrase[strlen(phrase)-1] = '\0'; break; case 'L': - sprintf(phrase, ",L=2 " VERSION " abcdefiklmnpqrstuvwxy"); //ghj + (void)snprintf(phrase, sizeof(phrase), ",L=2 " VERSION " abcdefiklmnpqrstuvwxy"); //ghj break; case 'M': if (!assign_channel(whoami) && (!whoami->device || whoami->device->gpsdata.fix.mode == MODE_NOT_SEEN)) strcpy(phrase, ",M=?"); else - sprintf(phrase, ",M=%d", whoami->device->gpsdata.fix.mode); + (void)snprintf(phrase, sizeof(phrase), ",M=%d", whoami->device->gpsdata.fix.mode); break; case 'N': if (!assign_channel(whoami)) @@ -552,15 +554,15 @@ static int handle_request(int cfd, char *buf, int buflen) } } if (!whoami->device) - sprintf(phrase, ",N=?"); + (void)snprintf(phrase, sizeof(phrase), ",N=?"); else - sprintf(phrase, ",N=%d", whoami->device->gpsdata.driver_mode); + (void)snprintf(phrase, sizeof(phrase), ",N=%d", whoami->device->gpsdata.driver_mode); break; case 'O': if (!assign_channel(whoami) || !have_fix(whoami->device)) strcpy(phrase, ",O=?"); else { - sprintf(phrase, ",O=%s %.2f %.3f %.6f %.6f", + (void)snprintf(phrase, sizeof(phrase), ",O=%s %.2f %.3f %.6f %.6f", whoami->device->gpsdata.tag[0] ? whoami->device->gpsdata.tag : "-", whoami->device->gpsdata.fix.time, whoami->device->gpsdata.fix.ept, whoami->device->gpsdata.fix.latitude, whoami->device->gpsdata.fix.longitude); @@ -601,7 +603,7 @@ static int handle_request(int cfd, char *buf, int buflen) break; case 'P': if (assign_channel(whoami) && have_fix(whoami->device)) - sprintf(phrase, ",P=%.6f %.6f", + (void)snprintf(phrase, sizeof(phrase), ",P=%.6f %.6f", whoami->device->gpsdata.fix.latitude, whoami->device->gpsdata.fix.longitude); else @@ -609,7 +611,7 @@ static int handle_request(int cfd, char *buf, int buflen) break; case 'Q': if (assign_channel(whoami) && (whoami->device->gpsdata.pdop || whoami->device->gpsdata.hdop || whoami->device->gpsdata.vdop)) - sprintf(phrase, ",Q=%d %.2f %.2f %.2f %.2f %.2f", + (void)snprintf(phrase, sizeof(phrase), ",Q=%d %.2f %.2f %.2f %.2f %.2f", whoami->device->gpsdata.satellites_used, whoami->device->gpsdata.pdop, whoami->device->gpsdata.hdop, @@ -625,51 +627,51 @@ static int handle_request(int cfd, char *buf, int buflen) assign_channel(whoami); subscribers[cfd].raw = 2; gpsd_report(3, "%d turned on super-raw mode\n", cfd); - sprintf(phrase, ",R=2"); + (void)snprintf(phrase, sizeof(phrase), ",R=2"); p++; } else if (*p == '1' || *p == '+') { assign_channel(whoami); subscribers[cfd].raw = 1; gpsd_report(3, "%d turned on raw mode\n", cfd); - sprintf(phrase, ",R=1"); + (void)snprintf(phrase, sizeof(phrase), ",R=1"); p++; } else if (*p == '0' || *p == '-') { subscribers[cfd].raw = 0; gpsd_report(3, "%d turned off raw mode\n", cfd); - sprintf(phrase, ",R=0"); + (void)snprintf(phrase, sizeof(phrase), ",R=0"); p++; } else if (subscribers[cfd].raw) { subscribers[cfd].raw = 0; gpsd_report(3, "%d turned off raw mode\n", cfd); - sprintf(phrase, ",R=0"); + (void)snprintf(phrase, sizeof(phrase), ",R=0"); } else { assign_channel(whoami); subscribers[cfd].raw = 1; gpsd_report(3, "%d turned on raw mode\n", cfd); - sprintf(phrase, ",R=1"); + (void)snprintf(phrase, sizeof(phrase), ",R=1"); } break; case 'S': if (assign_channel(whoami)) - sprintf(phrase, ",S=%d", whoami->device->gpsdata.status); + (void)snprintf(phrase, sizeof(phrase), ",S=%d", whoami->device->gpsdata.status); else strcpy(phrase, ",S=?"); break; case 'T': if (assign_channel(whoami) && have_fix(whoami->device) && whoami->device->gpsdata.fix.track != TRACK_NOT_VALID) - sprintf(phrase, ",T=%.4f", whoami->device->gpsdata.fix.track); + (void)snprintf(phrase, sizeof(phrase), ",T=%.4f", whoami->device->gpsdata.fix.track); else strcpy(phrase, ",T=?"); break; case 'U': if (assign_channel(whoami) && have_fix(whoami->device) && whoami->device->gpsdata.fix.mode == MODE_3D) - sprintf(phrase, ",U=%.3f", whoami->device->gpsdata.fix.climb); + (void)snprintf(phrase, sizeof(phrase), ",U=%.3f", whoami->device->gpsdata.fix.climb); else strcpy(phrase, ",U=?"); break; case 'V': if (assign_channel(whoami) && have_fix(whoami->device) && whoami->device->gpsdata.fix.track != TRACK_NOT_VALID) - sprintf(phrase, ",V=%.3f", whoami->device->gpsdata.fix.speed / KNOTS_TO_KPH); + (void)snprintf(phrase, sizeof(phrase), ",V=%.3f", whoami->device->gpsdata.fix.speed / KNOTS_TO_KPH); else strcpy(phrase, ",V=?"); break; @@ -678,25 +680,25 @@ static int handle_request(int cfd, char *buf, int buflen) if (*p == '1' || *p == '+') { subscribers[cfd].watcher = 1; assign_channel(whoami); - sprintf(phrase, ",W=1"); + (void)snprintf(phrase, sizeof(phrase), ",W=1"); p++; } else if (*p == '0' || *p == '-') { subscribers[cfd].watcher = 0; - sprintf(phrase, ",W=0"); + (void)snprintf(phrase, sizeof(phrase), ",W=0"); p++; } else if (subscribers[cfd].watcher) { subscribers[cfd].watcher = 0; - sprintf(phrase, ",W=0"); + (void)snprintf(phrase, sizeof(phrase), ",W=0"); } else { subscribers[cfd].watcher = 1; assign_channel(whoami); gpsd_report(3, "%d turned on watching\n", cfd); - sprintf(phrase, ",W=1"); + (void)snprintf(phrase, sizeof(phrase), ",W=1"); } break; case 'X': if (assign_channel(whoami) && whoami->device) - sprintf(phrase, ",X=%f", whoami->device->gpsdata.online); + (void)snprintf(phrase, sizeof(phrase), ",X=%f", whoami->device->gpsdata.online); else strcpy(phrase, ",X=?"); break; @@ -741,27 +743,27 @@ static int handle_request(int cfd, char *buf, int buflen) assign_channel(whoami); if (*p == '=') ++p; if (whoami->device == NULL) { - sprintf(phrase, ",Z=?"); + (void)snprintf(phrase, sizeof(phrase), ",Z=?"); p++; } else if (*p == '1' || *p == '+') { whoami->device->gpsdata.profiling = 1; gpsd_report(3, "%d turned on profiling mode\n", cfd); - sprintf(phrase, ",Z=1"); + (void)snprintf(phrase, sizeof(phrase), ",Z=1"); p++; } else if (*p == '0' || *p == '-') { whoami->device->gpsdata.profiling = 0; gpsd_report(3, "%d turned off profiling mode\n", cfd); - sprintf(phrase, ",Z=0"); + (void)snprintf(phrase, sizeof(phrase), ",Z=0"); p++; } else { whoami->device->gpsdata.profiling = !whoami->device->gpsdata.profiling; gpsd_report(3, "%d toggled profiling mode\n", cfd); - sprintf(phrase, ",Z=%d", whoami->device->gpsdata.profiling); + (void)snprintf(phrase, sizeof(phrase), ",Z=%d", whoami->device->gpsdata.profiling); } break; case '$': if (whoami->device->gpsdata.sentence_time) - sprintf(phrase, ",$=%s %d %f %f %f %f %f %f", + (void)snprintf(phrase, sizeof(phrase), ",$=%s %d %f %f %f %f %f %f", whoami->device->gpsdata.tag, whoami->device->gpsdata.sentence_length, whoami->device->gpsdata.sentence_time, @@ -771,7 +773,7 @@ static int handle_request(int cfd, char *buf, int buflen) whoami->device->poll_times[cfd] - whoami->device->gpsdata.sentence_time, timestamp() - whoami->device->gpsdata.sentence_time); else - sprintf(phrase, ",$=%s %d 0 %f %f %f %f %f", + (void)snprintf(phrase, sizeof(phrase), ",$=%s %d 0 %f %f %f %f %f", whoami->device->gpsdata.tag, whoami->device->gpsdata.sentence_length, whoami->device->gpsdata.d_xmit_time, @@ -811,9 +813,9 @@ static void handle_control(int sfd, char *buf) if (subscribers[cfd].device == *chp) subscribers[cfd].device = NULL; *chp = NULL; - write(sfd, "OK\n", 3); + (void)write(sfd, "OK\n", 3); } else - write(sfd, "ERROR\n", 6); + (void)write(sfd, "ERROR\n", 6); free(stash); } else if (buf[0] == '+') { p = snarfline(buf+1, &stash); @@ -822,9 +824,9 @@ static void handle_control(int sfd, char *buf) else { gpsd_report(1,"<= control(%d): adding %s \n", sfd, stash); if (open_device(stash, 1)) - write(sfd, "OK\n", 3); + (void)write(sfd, "OK\n", 3); else - write(sfd, "ERROR\n", 6); + (void)write(sfd, "ERROR\n", 6); } free(stash); } else if (buf[0] == '!') { @@ -832,16 +834,16 @@ static void handle_control(int sfd, char *buf) eq = strchr(stash, '='); if (!eq) { gpsd_report(1,"<= control(%d): ill-formed command \n", sfd); - write(sfd, "ERROR\n", 3); + (void)write(sfd, "ERROR\n", 3); } else { *eq++ = '\0'; if ((chp = find_device(stash))) { gpsd_report(1,"<= control(%d): writing to %s \n", sfd, stash); - write((*chp)->gpsdata.gps_fd, eq, strlen(eq)); - write(sfd, "OK\n", 3); + (void)write((*chp)->gpsdata.gps_fd, eq, strlen(eq)); + (void)write(sfd, "OK\n", 3); } else { gpsd_report(1,"<= control(%d): %s not active \n", sfd, stash); - write(sfd, "ERROR\n", 3); + (void)write(sfd, "ERROR\n", 3); } } free(stash); @@ -928,7 +930,7 @@ int main(int argc, char *argv[]) if ((fp = fopen(pid_file, "w")) != NULL) { fprintf(fp, "%u\n", getpid()); - (void) fclose(fp); + (void)fclose(fp); } else { gpsd_report(1, "Cannot create PID file: %s.\n", pid_file); } @@ -1006,11 +1008,11 @@ int main(int argc, char *argv[]) } /* Handle some signals */ - signal(SIGHUP, onsig); - signal(SIGINT, onsig); - signal(SIGTERM, onsig); - signal(SIGQUIT, onsig); - signal(SIGPIPE, SIG_IGN); + (void)signal(SIGHUP, onsig); + (void)signal(SIGINT, onsig); + (void)signal(SIGTERM, onsig); + (void)signal(SIGQUIT, onsig); + (void)signal(SIGPIPE, SIG_IGN); FD_SET(msock, &all_fds); FD_ZERO(&control_fds); @@ -1106,7 +1108,7 @@ int main(int argc, char *argv[]) gpsd_report(1, "<= control(%d): %s\n", cfd, buf); handle_control(cfd, buf); } - close(cfd); + (void)close(cfd); FD_CLR(cfd, &all_fds); FD_CLR(cfd, &control_fds); } @@ -46,15 +46,16 @@ struct gps_device_t; struct gps_type_t { /* GPS method table, describes how to talk to a particular GPS type */ - char *typename, *trigger; - int (*probe)(struct gps_device_t *session); - void (*initializer)(struct gps_device_t *session); - int (*get_packet)(struct gps_device_t *session, unsigned int waiting); - int (*parse_packet)(struct gps_device_t *session); - int (*rtcm_writer)(struct gps_device_t *session, char *rtcmbuf, int rtcmbytes); - int (*speed_switcher)(struct gps_device_t *session, int speed); - void (*mode_switcher)(struct gps_device_t *session, int mode); - void (*wrapup)(struct gps_device_t *session); + char *typename; + /*@null@*/char *trigger; + /*@null@*/int (*probe)(struct gps_device_t *session); + /*@null@*/void (*initializer)(struct gps_device_t *session); + /*@null@*/int (*get_packet)(struct gps_device_t *session, unsigned int waiting); + /*@null@*/int (*parse_packet)(struct gps_device_t *session); + /*@null@*/int (*rtcm_writer)(struct gps_device_t *session, char *rtcmbuf, int rtcmbytes); + /*@null@*/int (*speed_switcher)(struct gps_device_t *session, int speed); + /*@null@*/void (*mode_switcher)(struct gps_device_t *session, int mode); + /*@null@*/void (*wrapup)(struct gps_device_t *session); int cycle; }; @@ -127,8 +128,8 @@ struct gps_device_t { * Zodiac chipset channel status from PRWIZCH. Keep it so raw-mode * translation of Zodiac binary protocol can send it up to the client. */ - int Zs[MAXCHANNELS]; /* satellite PRNs */ - int Zv[MAXCHANNELS]; /* signal values (0-7) */ + unsigned int Zs[MAXCHANNELS]; /* satellite PRNs */ + unsigned int Zv[MAXCHANNELS]; /* signal values (0-7) */ #endif /* ZODIAC_ENABLE */ #endif /* BINARY_ENABLE */ #ifdef NTPSHM_ENABLE @@ -607,7 +607,7 @@ main(int argc, char *argv[]) } } - gps_close(collect); + (void)gps_close(collect); } #endif /* TESTMAIN */ diff --git a/libgpsd_core.c b/libgpsd_core.c index 0624d31b..b2f3d281 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -88,7 +88,7 @@ void gpsd_deactivate(struct gps_device_t *session) /* temporarily release the GPS device */ { gpsd_report(1, "closing GPS=%s\n", session->gpsdata.gps_device); - gpsd_close(session); + (void)gpsd_close(session); session->gpsdata.gps_fd = -1; #ifdef NTPSHM_ENABLE ntpshm_free(session->context, session->shmTime); @@ -26,8 +26,8 @@ int netlib_connectsock(const char *host, const char *service, const char *protoc memset((char *) &sin, '\0', sizeof(sin)); sin.sin_family = AF_INET; if ((pse = getservbyname(service, protocol))) - sin.sin_port = htons(ntohs((u_short) pse->s_port)); - else if ((sin.sin_port = htons((u_short) atoi(service))) == 0) + sin.sin_port = htons(ntohs((unsigned short) pse->s_port)); + else if ((sin.sin_port = htons((unsigned short) atoi(service))) == 0) return NL_NOSERVICE; if ((phe = gethostbyname(host))) memcpy((char *) &sin.sin_addr, phe->h_addr, phe->h_length); @@ -43,11 +43,11 @@ int netlib_connectsock(const char *host, const char *service, const char *protoc if ((s = socket(PF_INET, type, ppe->p_proto)) < 0) return NL_NOSOCK; if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(one))==-1) { - close(s); + (void)close(s); return NL_NOSOCKOPT; } if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) { - close(s); + (void)close(s); return NL_NOCONNECT; } return s; diff --git a/nmea_parse.c b/nmea_parse.c index 927fc1ac..cd5003f3 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -529,7 +529,7 @@ int nmea_parse(char *sentence, struct gps_data_t *outdata) if (nmea_phrase[i].decoder) { retval = (nmea_phrase[i].decoder)(count, field, outdata); strncpy(outdata->tag, nmea_phrase[i].name, MAXTAGLEN); - outdata->sentence_length = strlen(sentence); + outdata->sentence_length = (int)strlen(sentence); } if (nmea_phrase[i].mask) outdata->seen_sentences |= nmea_phrase[i].mask; @@ -547,7 +547,7 @@ int nmea_send(int fd, const char *fmt, ... ) va_list ap; va_start(ap, fmt) ; - vsnprintf(buf, sizeof(buf)-5, fmt, ap); + (void)vsnprintf(buf, sizeof(buf)-5, fmt, ap); va_end(ap); strcat(buf, "*"); nmea_add_checksum(buf); @@ -178,6 +178,6 @@ void gpsd_close(struct gps_device_t *session) /* this is the clean way to do it */ session->ttyset_old.c_cflag |= HUPCL; tcsetattr(session->gpsdata.gps_fd,TCSANOW,&session->ttyset_old); - close(session->gpsdata.gps_fd); + (void)close(session->gpsdata.gps_fd); } } @@ -99,7 +99,7 @@ static int sirf_to_nmea(int ttyfd, int speed) return (sirf_write(ttyfd, msg)); } -#define getb(off) (buf[off]) +#define getb(off) ((u_int8_t)buf[off]) #define getw(off) ((short)((getb(off) << 8) | getb(off+1))) #define getl(off) ((int)((getw(off) << 16) | (getw(off+2) & 0xffff))) @@ -277,7 +277,7 @@ int sirf_parse(struct gps_device_t *session, unsigned char *buf, int len) 0xa6, 0x00, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0xb0, 0xb3}; gpsd_report(4, "Enabling PPS message...\n"); - sirf_write(session->gpsdata.gps_fd, enablemid52); + (void)sirf_write(session->gpsdata.gps_fd, enablemid52); session->driverstate |= SIRF_GE_232; session->context->valid |= LEAP_SECOND_VALID; } @@ -287,7 +287,7 @@ int sirf_parse(struct gps_device_t *session, unsigned char *buf, int len) session->time_seen = 0; if (!(session->context->valid & LEAP_SECOND_VALID)) { gpsd_report(4, "Enabling subframe transmission...\n"); - sirf_write(session->gpsdata.gps_fd, enablesubframe); + (void)sirf_write(session->gpsdata.gps_fd, enablesubframe); } return 0; @@ -405,7 +405,7 @@ int sirf_parse(struct gps_device_t *session, unsigned char *buf, int len) if (session->context->valid & LEAP_SECOND_VALID) { gpsd_report(4, "Disabling subframe transmission...\n"); - sirf_write(session->gpsdata.gps_fd, disablesubframe); + (void)sirf_write(session->gpsdata.gps_fd, disablesubframe); } } break; @@ -716,13 +716,13 @@ static void sirfbin_initializer(struct gps_device_t *session) 0x01, /* enable track smoothing */ 0x00, 0x00, 0xb0, 0xb3}; gpsd_report(4, "Setting DGPS control to use SBAS...\n"); - sirf_write(session->gpsdata.gps_fd, dgpscontrol); + (void)sirf_write(session->gpsdata.gps_fd, dgpscontrol); gpsd_report(4, "Setting SBAS to auto/integrity mode...\n"); - sirf_write(session->gpsdata.gps_fd, sbasparams); + (void)sirf_write(session->gpsdata.gps_fd, sbasparams); gpsd_report(4, "Probing for firmware version...\n"); - sirf_write(session->gpsdata.gps_fd, versionprobe); + (void)sirf_write(session->gpsdata.gps_fd, versionprobe); gpsd_report(4, "Setting mode...\n"); - sirf_write(session->gpsdata.gps_fd, modecontrol); + (void)sirf_write(session->gpsdata.gps_fd, modecontrol); } } @@ -101,6 +101,8 @@ static WINDOW *mid19win, *mid27win, *cmdwin, *debugwin; #define SIRF_PACKET 1 #define NMEA_PACKET 2 +#define display (void)mvwprintw + /***************************************************************************** * * NMEA command composition @@ -160,14 +162,14 @@ static void decode_time(int week, int tow) m = (m - s) / 6000; - wmove(mid2win, 3,7); - wprintw(mid2win, "%4d+%9.2f", week, (double)tow/100); - wmove(mid2win, 3, 29); - wprintw(mid2win, "%d %02d:%02d:%05.2f", day, h,m,(double)s/100); - wmove(mid2win, 4, 8); - wprintw(mid2win, "%f", timestamp()-gpstime_to_unix(week,tow/100)); - wmove(mid2win, 4, 29); - wprintw(mid2win, "%d", gmt_offset); + (void)wmove(mid2win, 3,7); + (void)wprintw(mid2win, "%4d+%9.2f", week, (double)tow/100); + (void)wmove(mid2win, 3, 29); + (void)wprintw(mid2win, "%d %02d:%02d:%05.2f", day, h,m,(double)s/100); + (void)wmove(mid2win, 4, 8); + (void)wprintw(mid2win, "%f", timestamp()-gpstime_to_unix(week,tow/100)); + (void)wmove(mid2win, 4, 29); + (void)wprintw(mid2win, "%d", gmt_offset); } static void decode_ecef(double x, double y, double z, @@ -195,21 +197,21 @@ static void decode_ecef(double x, double y, double z, if (heading < 0) heading += 2 * PI; - wmove(mid2win, 1,40); - wprintw(mid2win, "%9.5f %9.5f",(double)(RAD2DEG*phi), + (void)wmove(mid2win, 1,40); + (void)wprintw(mid2win, "%9.5f %9.5f",(double)(RAD2DEG*phi), (double)(RAD2DEG*lambda)); - wmove(mid2win, 1,63); - wprintw(mid2win, "%8d",(int)h); - - wmove(mid2win, 2,40); - wprintw(mid2win, "%9.1f %9.1f",vnorth,veast); - wmove(mid2win, 2,63); - wprintw(mid2win, "%8.1f",vup); - - wmove(mid2win, 3,54); - wprintw(mid2win, "%5.1f",(double)(RAD2DEG*heading)); - wmove(mid2win, 3,63); - wprintw(mid2win, "%8.1f",speed); + (void)wmove(mid2win, 1,63); + (void)wprintw(mid2win, "%8d",(int)h); + + (void)wmove(mid2win, 2,40); + (void)wprintw(mid2win, "%9.1f %9.1f",vnorth,veast); + (void)wmove(mid2win, 2,63); + (void)wprintw(mid2win, "%8.1f",vup); + + (void)wmove(mid2win, 3,54); + (void)wprintw(mid2win, "%5.1f",(double)(RAD2DEG*heading)); + (void)wmove(mid2win, 3,63); + (void)wprintw(mid2win, "%8.1f",speed); } static void decode_sirf(unsigned char buf[], int len) @@ -219,31 +221,31 @@ static void decode_sirf(unsigned char buf[], int len) switch (buf[0]) { case 0x02: /* Measured Navigation Data */ - wmove(mid2win, 1,6); - wprintw(mid2win, "%8d %8d %8d",getl(1),getl(5),getl(9)); - wmove(mid2win, 2,6); - wprintw(mid2win, "%8.1f %8.1f %8.1f", + (void)wmove(mid2win, 1,6); + (void)wprintw(mid2win, "%8d %8d %8d",getl(1),getl(5),getl(9)); + (void)wmove(mid2win, 2,6); + (void)wprintw(mid2win, "%8.1f %8.1f %8.1f", (double)getw(13)/8,(double)getw(15)/8,(double)getw(17)/8); decode_ecef((double)getl(1),(double)getl(5),(double)getl(9), (double)getw(13)/8,(double)getw(15)/8,(double)getw(17)/8); decode_time(getw(22),getl(24)); /* line 4 */ - wmove(mid2win, 4,49); - wprintw(mid2win, "%4.1f",(double)getb(20)/5); /* HDOP */ - wmove(mid2win, 4,58); - wprintw(mid2win, "%02x",getb(19)); /* Mode 1 */ - wmove(mid2win, 4,72); - wprintw(mid2win, "%02x",getb(21)); /* Mode 2 */ - wmove(mid2win, 5,7); + (void)wmove(mid2win, 4,49); + (void)wprintw(mid2win, "%4.1f",(double)getb(20)/5); /* HDOP */ + (void)wmove(mid2win, 4,58); + (void)wprintw(mid2win, "%02x",getb(19)); /* Mode 1 */ + (void)wmove(mid2win, 4,72); + (void)wprintw(mid2win, "%02x",getb(21)); /* Mode 2 */ + (void)wmove(mid2win, 5,7); nfix = getb(28); - wprintw(mid2win, "%d = ",nfix); /* SVs in fix */ + (void)wprintw(mid2win, "%d = ",nfix); /* SVs in fix */ for (i = 0; i < MAXCHANNELS; i++) { /* SV list */ if (i < nfix) - wprintw(mid2win, "%3d",fix[i] = getb(29+i)); + (void)wprintw(mid2win, "%3d",fix[i] = getb(29+i)); else - wprintw(mid2win, " "); + (void)wprintw(mid2win, " "); } - wprintw(debugwin, "MND 0x02="); + (void)wprintw(debugwin, "MND 0x02="); break; case 0x04: /* Measured Tracking Data */ @@ -253,11 +255,11 @@ static void decode_sirf(unsigned char buf[], int len) int sv,st; off = 8 + 15 * i; - wmove(mid4win, i+2, 3); + (void)wmove(mid4win, i+2, 3); sv = getb(off); - wprintw(mid4win, " %3d",sv); + (void)wprintw(mid4win, " %3d",sv); - wprintw(mid4win, " %3d%3d %04x",(getb(off+1)*3)/2,getb(off+2)/2,getw(off+3)); + (void)wprintw(mid4win, " %3d%3d %04x",(getb(off+1)*3)/2,getb(off+2)/2,getw(off+3)); st = ' '; if (getw(off+3) == 0xbf) @@ -273,19 +275,19 @@ static void decode_sirf(unsigned char buf[], int len) for (j = 0; j < 10; j++) cn += getb(off+5+j); - wprintw(mid4win, "%5.1f %c",(double)cn/10,st); + (void)wprintw(mid4win, "%5.1f %c",(double)cn/10,st); if (sv == 0) /* not tracking? */ - wprintw(mid4win, " "); /* clear other info */ + (void)wprintw(mid4win, " "); /* clear other info */ } - wprintw(debugwin, "MTD 0x04="); + (void)wprintw(debugwin, "MTD 0x04="); break; #ifdef __UNUSED__ case 0x05: /* raw track data */ for (off = 1; off < len; off += 51) { ch = getl(off); - wmove(mid4win, ch+2, 19); + (void)wmove(mid4win, ch+2, 19); cn = 0; for (j = 0; j < 10; j++) @@ -297,91 +299,91 @@ static void decode_sirf(unsigned char buf[], int len) printw("%8.5f %10.5f", (double)getl(off+16)/65536,(double)getl(off+20)/1024); } - wprintw(debugwin, "RTD 0x05="); + (void)wprintw(debugwin, "RTD 0x05="); break; #endif /* __UNUSED */ case 0x06: /* firmware version */ - mvwprintw(mid6win, 1, 10, "%s",buf + 1); - wprintw(debugwin, "FV 0x06="); + display(mid6win, 1, 10, "%s",buf + 1); + (void)wprintw(debugwin, "FV 0x06="); break; case 0x07: /* Response - Clock Status Data */ decode_time(getw(1),getl(3)); - mvwprintw(mid7win, 1, 5, "%2d", getb(7)); /* SVs */ - mvwprintw(mid7win, 1, 16, "%lu", getl(8)); /* Clock drift */ - mvwprintw(mid7win, 1, 29, "%lu", getl(12)); /* Clock Bias */ - mvwprintw(mid7win, 2, 21, "%lu", getl(16)); /* Estimated Time */ - wprintw(debugwin, "CSD 0x07="); + display(mid7win, 1, 5, "%2d", getb(7)); /* SVs */ + display(mid7win, 1, 16, "%lu", getl(8)); /* Clock drift */ + display(mid7win, 1, 29, "%lu", getl(12)); /* Clock Bias */ + display(mid7win, 2, 21, "%lu", getl(16)); /* Estimated Time */ + (void)wprintw(debugwin, "CSD 0x07="); break; case 0x08: /* 50 BPS data */ ch = getb(1); - mvwprintw(mid4win, ch, 27, "Y"); - wprintw(debugwin, "50B 0x08="); + display(mid4win, ch, 27, "Y"); + (void)wprintw(debugwin, "50B 0x08="); subframe_enabled = 1; break; case 0x09: /* Throughput */ - mvwprintw(mid9win, 1, 6, "%.3f",(double)getw(1)/186); /*SegStatMax*/ - mvwprintw(mid9win, 1, 18, "%.3f",(double)getw(3)/186); /*SegStatLat*/ - mvwprintw(mid9win, 1, 31, "%.3f",(double)getw(5)/186); /*SegStatTime*/ - mvwprintw(mid9win, 1, 42, "%3d",getw(7)); /* Last Millisecond */ - wprintw(debugwin, "THR 0x09="); + display(mid9win, 1, 6, "%.3f",(double)getw(1)/186); /*SegStatMax*/ + display(mid9win, 1, 18, "%.3f",(double)getw(3)/186); /*SegStatLat*/ + display(mid9win, 1, 31, "%.3f",(double)getw(5)/186); /*SegStatTime*/ + display(mid9win, 1, 42, "%3d",getw(7)); /* Last Millisecond */ + (void)wprintw(debugwin, "THR 0x09="); break; case 0x0b: /* Command Acknowledgement */ - wprintw(debugwin, "ACK 0x0b="); + (void)wprintw(debugwin, "ACK 0x0b="); break; case 0x0c: /* Command NAcknowledgement */ - wprintw(debugwin, "NAK 0x0c="); + (void)wprintw(debugwin, "NAK 0x0c="); break; case 0x0d: /* Visible List */ - mvwprintw(mid13win, 1, 6, "%d",getb(1)); - wmove(mid13win, 1, 10); + display(mid13win, 1, 6, "%d",getb(1)); + (void)wmove(mid13win, 1, 10); for (i = 0; i < MAXCHANNELS; i++) { if (i < getb(1)) - wprintw(mid13win, " %2d",getb(2 + 5 * i)); + (void)wprintw(mid13win, " %2d",getb(2 + 5 * i)); else - wprintw(mid13win, " "); + (void)wprintw(mid13win, " "); } - wprintw(mid13win, "\n"); - wprintw(debugwin, "VL 0x0d="); + (void)wprintw(mid13win, "\n"); + (void)wprintw(debugwin, "VL 0x0d="); break; case 0x13: - mvwprintw(mid19win, 1, 20, "%d", getb(5)); /* Alt. hold mode */ - mvwprintw(mid19win, 2, 20, "%d", getb(6)); /* Alt. hold source*/ - mvwprintw(mid19win, 3, 20, "%dm", getw(7)); /* Alt. source input */ - mvwprintw(mid19win, 4, 20, "%d", getb(9)); /* Degraded mode*/ - mvwprintw(mid19win, 5, 20, "%dsec", getb(10)); /* Degraded timeout*/ - mvwprintw(mid19win, 6, 20, "%dsec",getb(11)); /* DR timeout*/ - mvwprintw(mid19win, 7, 20, "%c", getb(12)?'Y':'N');/* Track smooth mode*/ - mvwprintw(mid19win, 8, 20, "%c", getb(13)?'Y':'N'); /* Static Nav.*/ - mvwprintw(mid19win, 9, 20, "0x%x", getb(14)); /* 3SV Least Squares*/ - mvwprintw(mid19win, 10,20, "0x%x", getb(19)); /* DOP Mask mode*/ - mvwprintw(mid19win, 11,20, "0x%x", getw(20)); /* Nav. Elev. mask*/ - mvwprintw(mid19win, 12,20, "0x%x", getb(22)); /* Nav. Power mask*/ - mvwprintw(mid19win, 13,20, "0x%x", getb(27)); /* DGPS Source*/ - mvwprintw(mid19win, 14,20, "0x%x", getb(28)); /* DGPS Mode*/ - mvwprintw(mid19win, 15,20, "%dsec",getb(29)); /* DGPS Timeout*/ - mvwprintw(mid19win, 1, 42, "%c", getb(34)?'Y':'N');/* LP Push-to-Fix */ - mvwprintw(mid19win, 2, 42, "%dms", getl(35)); /* LP On Time */ - mvwprintw(mid19win, 3, 42, "%d", getl(39)); /* LP Interval */ - mvwprintw(mid19win, 4, 42, "%c", getb(43)?'Y':'N');/* User Tasks enabled */ - mvwprintw(mid19win, 5, 42, "%d", getl(44)); /* User Task Interval */ - mvwprintw(mid19win, 6, 42, "%c", getb(48)?'Y':'N');/* LP Power Cycling Enabled */ - mvwprintw(mid19win, 7, 42, "%d", getl(49));/* LP Max Acq Search Time */ - mvwprintw(mid19win, 8, 42, "%d", getl(53));/* LP Max Off Time */ - mvwprintw(mid19win, 9, 42, "%c", getb(57)?'Y':'N');/* APM Enabled */ - mvwprintw(mid19win,10, 42, "%d", getw(58));/* # of fixes */ - mvwprintw(mid19win,11, 42, "%d", getw(60));/* Time Between fixes */ - mvwprintw(mid19win,12, 42, "%d", getb(62));/* H/V Error Max */ - mvwprintw(mid19win,13, 42, "%d", getb(63));/* Response Time Max */ - mvwprintw(mid19win,14, 42, "%d", getb(64));/* Time/Accu & Duty Cycle Priority */ + display(mid19win, 1, 20, "%d", getb(5)); /* Alt. hold mode */ + display(mid19win, 2, 20, "%d", getb(6)); /* Alt. hold source*/ + display(mid19win, 3, 20, "%dm", getw(7)); /* Alt. source input */ + display(mid19win, 4, 20, "%d", getb(9)); /* Degraded mode*/ + display(mid19win, 5, 20, "%dsec", getb(10)); /* Degraded timeout*/ + display(mid19win, 6, 20, "%dsec",getb(11)); /* DR timeout*/ + display(mid19win, 7, 20, "%c", getb(12)?'Y':'N');/* Track smooth mode*/ + display(mid19win, 8, 20, "%c", getb(13)?'Y':'N'); /* Static Nav.*/ + display(mid19win, 9, 20, "0x%x", getb(14)); /* 3SV Least Squares*/ + display(mid19win, 10,20, "0x%x", getb(19)); /* DOP Mask mode*/ + display(mid19win, 11,20, "0x%x", getw(20)); /* Nav. Elev. mask*/ + display(mid19win, 12,20, "0x%x", getb(22)); /* Nav. Power mask*/ + display(mid19win, 13,20, "0x%x", getb(27)); /* DGPS Source*/ + display(mid19win, 14,20, "0x%x", getb(28)); /* DGPS Mode*/ + display(mid19win, 15,20, "%dsec",getb(29)); /* DGPS Timeout*/ + display(mid19win, 1, 42, "%c", getb(34)?'Y':'N');/* LP Push-to-Fix */ + display(mid19win, 2, 42, "%dms", getl(35)); /* LP On Time */ + display(mid19win, 3, 42, "%d", getl(39)); /* LP Interval */ + display(mid19win, 4, 42, "%c", getb(43)?'Y':'N');/* User Tasks enabled */ + display(mid19win, 5, 42, "%d", getl(44)); /* User Task Interval */ + display(mid19win, 6, 42, "%c", getb(48)?'Y':'N');/* LP Power Cycling Enabled */ + display(mid19win, 7, 42, "%d", getl(49));/* LP Max Acq Search Time */ + display(mid19win, 8, 42, "%d", getl(53));/* LP Max Off Time */ + display(mid19win, 9, 42, "%c", getb(57)?'Y':'N');/* APM Enabled */ + display(mid19win,10, 42, "%d", getw(58));/* # of fixes */ + display(mid19win,11, 42, "%d", getw(60));/* Time Between fixes */ + display(mid19win,12, 42, "%d", getb(62));/* H/V Error Max */ + display(mid19win,13, 42, "%d", getb(63));/* Response Time Max */ + display(mid19win,14, 42, "%d", getb(64));/* Time/Accu & Duty Cycle Priority */ dispmode = !dispmode; break; @@ -426,15 +428,15 @@ static void decode_sirf(unsigned char buf[], int len) total 2 x 12 = 24 bytes ******************************************************************/ - mvwprintw(mid27win, 1, 14, "%d (%s)", getb(1), sbasvec[getb(1)]); + display(mid27win, 1, 14, "%d (%s)", getb(1), sbasvec[getb(1)]); for (i = j = 0; i < MAXCHANNELS; i++) { if (getb(16+2*i)) { - wprintw(mid27win, "%d=%d ", getb(16+2*i), getb(16+2*i+1)); + (void)wprintw(mid27win, "%d=%d ", getb(16+2*i), getb(16+2*i+1)); j++; } } - mvwprintw(mid27win, 1, 44, "%d", j); - wprintw(debugwin, "DST 0x1b="); + display(mid27win, 1, 44, "%d", j); + (void)wprintw(debugwin, "DST 0x1b="); break; case 0x1C: /* NL Measurement Data */ @@ -503,7 +505,7 @@ static void decode_sirf(unsigned char buf[], int len) clk.tv_sec % 3600,clk.tv_usec); #endif } - wprintw(debugwin, "??? 0x62="); + (void)wprintw(debugwin, "??? 0x62="); break; #endif /* __UNUSED__ */ @@ -520,19 +522,19 @@ static void decode_sirf(unsigned char buf[], int len) break; } if (j) - wprintw(debugwin, "%s\n",buf+1); - wprintw(debugwin, "DD 0xff="); + (void)wprintw(debugwin, "%s\n",buf+1); + (void)wprintw(debugwin, "DD 0xff="); break; default: - wprintw(debugwin, " 0x%02x=", buf[0]); + (void)wprintw(debugwin, " 0x%02x=", buf[0]); break; } - wprintw(debugwin, "(%d) ", len); + (void)wprintw(debugwin, "(%d) ", len); for (i = 1; i < len; i++) - wprintw(debugwin, "%02x",buf[i]); - wprintw(debugwin, "\n"); + (void)wprintw(debugwin, "%02x",buf[i]); + (void)wprintw(debugwin, "\n"); } /***************************************************************************** @@ -785,10 +787,10 @@ static int sendpkt(unsigned char *buf, int len, char *device) putb(len + 3,END2); len += 8; - wprintw(debugwin, ">>>"); + (void)wprintw(debugwin, ">>>"); for (i = 0; i < len; i++) - wprintw(debugwin, " %02x",buf[i]); - wprintw(debugwin, "\n"); + (void)wprintw(debugwin, " %02x",buf[i]); + (void)wprintw(debugwin, "\n"); if (controlfd == -1) return -1; @@ -835,16 +837,16 @@ static int tzoffset(void) static void refresh_rightpanel1(void) { - touchwin(mid6win); - touchwin(mid7win); - touchwin(mid9win); - touchwin(mid13win); - touchwin(mid27win); - wrefresh(mid6win); - wrefresh(mid7win); - wrefresh(mid9win); - wrefresh(mid13win); - wrefresh(mid27win); + (void)touchwin(mid6win); + (void)touchwin(mid7win); + (void)touchwin(mid9win); + (void)touchwin(mid13win); + (void)touchwin(mid27win); + (void)wrefresh(mid6win); + (void)wrefresh(mid7win); + (void)wrefresh(mid9win); + (void)wrefresh(mid13win); + (void)wrefresh(mid27win); } static void command(char *buf, int len, const char *fmt, ... ) @@ -955,117 +957,117 @@ int main (int argc, char **argv) wborder(mid2win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid2win, A_BOLD); - wmove(mid2win, 0,1); - mvwprintw(mid2win, 0, 12, " X "); - mvwprintw(mid2win, 0, 21, " Y "); - mvwprintw(mid2win, 0, 30, " Z "); - mvwprintw(mid2win, 0, 43, " North "); - mvwprintw(mid2win, 0, 54, " East "); - mvwprintw(mid2win, 0, 67, " Alt "); - - wmove(mid2win, 1,1); - wprintw(mid2win, "Pos: m deg m"); - wmove(mid2win, 2,1); - wprintw(mid2win, "Vel: m/s m/s"); - wmove(mid2win, 3,1); - wprintw(mid2win, "Time: UTC: Heading: deg m/s"); - wmove(mid2win, 4,1); - wprintw(mid2win, "Skew: TZ: HDOP: M1: M2: "); - wmove(mid2win, 5,1); - wprintw(mid2win, "Fix:"); - mvwprintw(mid2win, 6, 24, " Packet type 2 (0x02) "); + (void)wmove(mid2win, 0,1); + display(mid2win, 0, 12, " X "); + display(mid2win, 0, 21, " Y "); + display(mid2win, 0, 30, " Z "); + display(mid2win, 0, 43, " North "); + display(mid2win, 0, 54, " East "); + display(mid2win, 0, 67, " Alt "); + + (void)wmove(mid2win, 1,1); + (void)wprintw(mid2win, "Pos: m deg m"); + (void)wmove(mid2win, 2,1); + (void)wprintw(mid2win, "Vel: m/s m/s"); + (void)wmove(mid2win, 3,1); + (void)wprintw(mid2win, "Time: UTC: Heading: deg m/s"); + (void)wmove(mid2win, 4,1); + (void)wprintw(mid2win, "Skew: TZ: HDOP: M1: M2: "); + (void)wmove(mid2win, 5,1); + (void)wprintw(mid2win, "Fix:"); + display(mid2win, 6, 24, " Packet type 2 (0x02) "); wattrset(mid2win, A_NORMAL); wborder(mid4win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid4win, A_BOLD); - mvwprintw(mid4win, 1, 1, " Ch SV Az El Stat C/N ? A"); + display(mid4win, 1, 1, " Ch SV Az El Stat C/N ? A"); for (i = 0; i < MAXCHANNELS; i++) { - mvwprintw(mid4win, i+2, 1, "%2d",i); + display(mid4win, i+2, 1, "%2d",i); } - mvwprintw(mid4win, 14, 4, " Packet Type 4 (0x04) "); + display(mid4win, 14, 4, " Packet Type 4 (0x04) "); wattrset(mid4win, A_NORMAL); wborder(mid19win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid19win, A_BOLD); - mvwprintw(mid19win, 1, 1, "Alt. hold mode:"); - mvwprintw(mid19win, 2, 1, "Alt. hold source:"); - mvwprintw(mid19win, 3, 1, "Alt. source input:"); - mvwprintw(mid19win, 4, 1, "Degraded mode:"); - mvwprintw(mid19win, 5, 1, "Degraded timeout:"); - mvwprintw(mid19win, 6, 1, "DR timeout:"); - mvwprintw(mid19win, 7, 1, "Track smooth mode:"); - mvwprintw(mid19win, 8, 1, "Static Navigation:"); - mvwprintw(mid19win, 9, 1, "3SV Least Squares:"); - mvwprintw(mid19win, 10,1, "DOP Mask mode:"); - mvwprintw(mid19win, 11,1, "Nav. Elev. mask:"); - mvwprintw(mid19win, 12,1, "Nav. Power mask:"); - mvwprintw(mid19win, 13,1, "DGPS Source:"); - mvwprintw(mid19win, 14,1, "DGPS Mode:"); - mvwprintw(mid19win, 15,1, "DGPS Timeout:"); - mvwprintw(mid19win, 1, 26,"LP Push-to-Fix:"); - mvwprintw(mid19win, 2, 26,"LP On Time:"); - mvwprintw(mid19win, 3, 26,"LP Interval:"); - mvwprintw(mid19win, 4, 26,"U. Tasks Enab.:"); - mvwprintw(mid19win, 5, 26,"U. Task Inter.:"); - mvwprintw(mid19win, 6, 26,"LP Pwr Cyc En:"); - mvwprintw(mid19win, 7, 26,"LP Max Acq Srch:"); - mvwprintw(mid19win, 8, 26,"LP Max Off Time:"); - mvwprintw(mid19win, 9, 26,"APM enabled:"); - mvwprintw(mid19win,10, 26,"# of Fixes:"); - mvwprintw(mid19win,11, 26,"Time btw Fixes:"); - mvwprintw(mid19win,12, 26,"H/V Error Max:"); - mvwprintw(mid19win,13, 26,"Rsp Time Max:"); - mvwprintw(mid19win,14, 26,"Time/Accu:"); - - mvwprintw(mid19win, 16, 8, " Packet type 19 (0x13) "); + display(mid19win, 1, 1, "Alt. hold mode:"); + display(mid19win, 2, 1, "Alt. hold source:"); + display(mid19win, 3, 1, "Alt. source input:"); + display(mid19win, 4, 1, "Degraded mode:"); + display(mid19win, 5, 1, "Degraded timeout:"); + display(mid19win, 6, 1, "DR timeout:"); + display(mid19win, 7, 1, "Track smooth mode:"); + display(mid19win, 8, 1, "Static Navigation:"); + display(mid19win, 9, 1, "3SV Least Squares:"); + display(mid19win, 10,1, "DOP Mask mode:"); + display(mid19win, 11,1, "Nav. Elev. mask:"); + display(mid19win, 12,1, "Nav. Power mask:"); + display(mid19win, 13,1, "DGPS Source:"); + display(mid19win, 14,1, "DGPS Mode:"); + display(mid19win, 15,1, "DGPS Timeout:"); + display(mid19win, 1, 26,"LP Push-to-Fix:"); + display(mid19win, 2, 26,"LP On Time:"); + display(mid19win, 3, 26,"LP Interval:"); + display(mid19win, 4, 26,"U. Tasks Enab.:"); + display(mid19win, 5, 26,"U. Task Inter.:"); + display(mid19win, 6, 26,"LP Pwr Cyc En:"); + display(mid19win, 7, 26,"LP Max Acq Srch:"); + display(mid19win, 8, 26,"LP Max Off Time:"); + display(mid19win, 9, 26,"APM enabled:"); + display(mid19win,10, 26,"# of Fixes:"); + display(mid19win,11, 26,"Time btw Fixes:"); + display(mid19win,12, 26,"H/V Error Max:"); + display(mid19win,13, 26,"Rsp Time Max:"); + display(mid19win,14, 26,"Time/Accu:"); + + display(mid19win, 16, 8, " Packet type 19 (0x13) "); wattrset(mid19win, A_NORMAL); wborder(mid6win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid6win, A_BOLD); - mvwprintw(mid6win, 1, 1, "Version:"); - mvwprintw(mid6win, 2, 8, " Packet Type 6 (0x06) "); + display(mid6win, 1, 1, "Version:"); + display(mid6win, 2, 8, " Packet Type 6 (0x06) "); wattrset(mid6win, A_NORMAL); wborder(mid7win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid7win, A_BOLD); - mvwprintw(mid7win, 1, 1, "SVs: "); - mvwprintw(mid7win, 1, 9, "Drift: "); - mvwprintw(mid7win, 1, 23, "Bias: "); - mvwprintw(mid7win, 2, 1, "Estimated GPS Time: "); - mvwprintw(mid7win, 3, 8, " Packet type 7 (0x07) "); + display(mid7win, 1, 1, "SVs: "); + display(mid7win, 1, 9, "Drift: "); + display(mid7win, 1, 23, "Bias: "); + display(mid7win, 2, 1, "Estimated GPS Time: "); + display(mid7win, 3, 8, " Packet type 7 (0x07) "); wattrset(mid7win, A_NORMAL); wborder(mid9win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid9win, A_BOLD); - mvwprintw(mid9win, 1, 1, "Max: "); - mvwprintw(mid9win, 1, 13, "Lat: "); - mvwprintw(mid9win, 1, 25, "Time: "); - mvwprintw(mid9win, 1, 39, "MS: "); - mvwprintw(mid9win, 2, 8, " Packet type 9 (0x09) "); + display(mid9win, 1, 1, "Max: "); + display(mid9win, 1, 13, "Lat: "); + display(mid9win, 1, 25, "Time: "); + display(mid9win, 1, 39, "MS: "); + display(mid9win, 2, 8, " Packet type 9 (0x09) "); wattrset(mid9win, A_NORMAL); wborder(mid13win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid13win, A_BOLD); - mvwprintw(mid13win, 1, 1, "SVs: "); - mvwprintw(mid13win, 1, 9, "="); - mvwprintw(mid13win, 2, 8, " Packet type 13 (0x0D) "); + display(mid13win, 1, 1, "SVs: "); + display(mid13win, 1, 9, "="); + display(mid13win, 2, 8, " Packet type 13 (0x0D) "); wattrset(mid13win, A_NORMAL); wborder(mid27win, 0, 0, 0, 0, 0, 0, 0, 0), wattrset(mid27win, A_BOLD); - mvwprintw(mid27win, 1, 1, "SBAS source: "); - mvwprintw(mid27win, 1, 31, "Corrections: "); - mvwprintw(mid27win, 3, 8, " Packet type 27 (0x1B) "); + display(mid27win, 1, 1, "SBAS source: "); + display(mid27win, 1, 31, "Corrections: "); + display(mid27win, 3, 8, " Packet type 27 (0x1B) "); wattrset(mid27win, A_NORMAL); wattrset(cmdwin, A_BOLD); if (serial) - mvwprintw(cmdwin, 1, 0, "%s %4d N %d", device, bps, stopbits); + display(cmdwin, 1, 0, "%s %4d N %d", device, bps, stopbits); else - mvwprintw(cmdwin, 1, 0, "%s:%s:%s", server, port, device); + display(cmdwin, 1, 0, "%s:%s:%s", server, port, device); wattrset(cmdwin, A_NORMAL); - wmove(debugwin,0, 0); + (void)wmove(debugwin,0, 0); FD_ZERO(&select_set); @@ -1075,20 +1077,20 @@ int main (int argc, char **argv) sendpkt(buf, 2, device); for (;;) { - wmove(cmdwin, 0,0); - wprintw(cmdwin, "cmd> "); + (void)wmove(cmdwin, 0,0); + (void)wprintw(cmdwin, "cmd> "); wclrtoeol(cmdwin); - refresh(); - wrefresh(mid2win); - wrefresh(mid4win); + (void)refresh(); + (void)wrefresh(mid2win); + (void)wrefresh(mid4win); if (dispmode == 0) { refresh_rightpanel1(); } else { - touchwin(mid19win); - wrefresh(mid19win); + (void)touchwin(mid19win); + (void)wrefresh(mid19win); } - wrefresh(debugwin); - wrefresh(cmdwin); + (void)wrefresh(debugwin); + (void)wrefresh(cmdwin); FD_SET(0,&select_set); FD_SET(devicefd,&select_set); @@ -1097,25 +1099,25 @@ int main (int argc, char **argv) break; if (FD_ISSET(0,&select_set)) { - wmove(cmdwin, 0,5); - wrefresh(cmdwin); + (void)wmove(cmdwin, 0,5); + (void)wrefresh(cmdwin); echo(); wgetnstr(cmdwin, line, 80); noecho(); //move(0,0); //clrtoeol(); - //refresh(); - wrefresh(mid2win); - wrefresh(mid4win); + //(void)refresh(); + (void)wrefresh(mid2win); + (void)wrefresh(mid4win); if (dispmode == 0) { refresh_rightpanel1(); } else { - touchwin(mid19win); - wrefresh(mid19win); + (void)touchwin(mid19win); + (void)wrefresh(mid19win); } - wrefresh(mid19win); - wrefresh(debugwin); - wrefresh(cmdwin); + (void)wrefresh(mid19win); + (void)wrefresh(debugwin); + (void)wrefresh(cmdwin); if ((p = strchr(line,'\r')) != NULL) *p = '\0'; @@ -1157,7 +1159,7 @@ int main (int argc, char **argv) sendpkt(buf, 9, device); usleep(50000); set_speed(bps = v, stopbits); - mvwprintw(cmdwin, 1, 0, "%s %d N %d", device,bps,stopbits); + display(cmdwin, 1, 0, "%s %d N %d", device,bps,stopbits); } else { line[0] = 'b'; write(devicefd, line, strlen(line)); @@ -223,8 +223,8 @@ static void handle_time_out(XtPointer client_data UNUSED, static struct gps_data_t *gpsdata; static time_t timer; /* time of last state change */ static int state = 0; /* or MODE_NO_FIX=1, MODE_2D=2, MODE_3D=3 */ -XtAppContext app; -XtIntervalId timeout; +static XtAppContext app; +static XtIntervalId timeout; static void handle_input(XtPointer client_data UNUSED, int *source UNUSED, XtInputId *id UNUSED) @@ -237,7 +237,7 @@ static void handle_input(XtPointer client_data UNUSED, int *source UNUSED, static void update_panel(struct gps_data_t *gpsdata, char *message, - int level UNUSED) + int len UNUSED, int level UNUSED) /* runs on each sentence */ { unsigned int i; @@ -459,6 +459,6 @@ altunits_ok:; (XtPointer)XtInputReadMask, handle_input, NULL); XtAppMainLoop(app); - gps_close(gpsdata); + (void)gps_close(gpsdata); return 0; } @@ -341,7 +341,7 @@ static int zodiac_analyze(struct gps_device_t *session) if (session->outbuflen < 10) return 0; - snprintf(session->gpsdata.tag, sizeof(session->gpsdata.tag), "%d", id); + snprintf(session->gpsdata.tag, sizeof(session->gpsdata.tag), "%u", id); switch (id) { case 1000: @@ -353,7 +353,7 @@ static int zodiac_analyze(struct gps_device_t *session) mask = handle1002(session); strcpy(buf, "$PRWIZCH"); for (i = 0; i < MAXCHANNELS; i++) { - sprintf(buf+strlen(buf), ",%02d,%X", session->Zs[i], session->Zv[i] & 0x0f); + sprintf(buf+strlen(buf), ",%02u,%X", session->Zs[i], session->Zv[i] & 0x0f); } strcat(buf, "*"); nmea_add_checksum(buf); |