diff options
author | Gary E. Miller <gem@rellim.com> | 2018-09-25 15:47:38 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2018-09-25 15:47:38 -0700 |
commit | c29acb17ce75c068dfb93a847ae2c62f36161aa3 (patch) | |
tree | 0487ebebba4015f6d3285c506cb680f8937a2fd1 | |
parent | ff5015cfbfee9f3e4fcdd3f9cbdfaf739e154195 (diff) | |
download | gpsd-c29acb17ce75c068dfb93a847ae2c62f36161aa3.tar.gz |
cgps: small tweaks to make cppcheck happy.
-rw-r--r-- | cgps.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -531,7 +531,7 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message) /* This gets called once for each new GPS sentence. */ { int newstate; - char scr[128], *s; + char scr[60]; /* This is for the satellite status display. Originally lifted from * xgps.c. Note that the satellite list may be truncated based on @@ -730,8 +730,9 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message) if (window_ysize >= (MIN_GPS_DATAWIN_YSIZE + 5)) { int row = 9; - char *ep_str = NULL; - char *dop_str = NULL; + char *ep_str; + char *dop_str; + char *str; /* Fill in the estimated latitude position error, XDOP. */ ep_str = ep_to_str(gpsdata->fix.epx, altfactor, altunits); @@ -757,7 +758,7 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message) double sep = NAN; /* 3D EP */ /* Calculate estimated 2D circular position error, CEP */ - if (isfinite(gpsdata->fix.epy) != 0 + if (isfinite(gpsdata->fix.epx) != 0 && isfinite(gpsdata->fix.epy) != 0) { /* http://gauss.gge.unb.ca/papers.pdf/gpsworld.may99.pdf */ /* CEP is just the hypotenuse of the triangle of epx and epy */ @@ -843,11 +844,11 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message) /* Fill in the grid square (esr thought *this* one was interesting). */ if ((isfinite(gpsdata->fix.longitude) != 0 && isfinite(gpsdata->fix.latitude) != 0)) - s = maidenhead(gpsdata->fix.latitude,gpsdata->fix.longitude); + str = maidenhead(gpsdata->fix.latitude,gpsdata->fix.longitude); else - s = "n/a"; + str = "n/a"; (void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET + 9, "%-*s", - 18, s); + 18, str); } |