summaryrefslogtreecommitdiff
path: root/libgps_sock.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-08-27 08:55:33 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-08-27 08:55:33 -0400
commit86f669a7b2ad9a8c38b23aaf9f222241d0ea59b7 (patch)
tree270370ead33327d39781eaad0b62e57ed95768cf /libgps_sock.c
parent35135b1f379a103e2bc236577358db060f6cf90d (diff)
downloadgpsd-86f669a7b2ad9a8c38b23aaf9f222241d0ea59b7.tar.gz
Uniform use of safe_atof(). All regression tests pass.
Diffstat (limited to 'libgps_sock.c')
-rw-r--r--libgps_sock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libgps_sock.c b/libgps_sock.c
index eda50f8c..5a5b425c 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -254,12 +254,14 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
*/
char *ns, *sp, *tp;
+#ifdef __UNUSED__
static char decimal_point = '\0';
if (decimal_point == '\0') {
struct lconv *locale_data = localeconv();
if (locale_data != NULL && locale_data->decimal_point[0] != '.')
decimal_point = locale_data->decimal_point[0];
}
+#endif /* __UNUSED__ */
for (ns = buf; ns; ns = strstr(ns + 1, "GPSD")) {
if ( /*@i1@*/ strncmp(ns, "GPSD", 4) == 0) {
@@ -273,6 +275,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
else
*tp = '\0';
+#ifdef __UNUSED__
/*
* The daemon always emits the Anglo-American and SI
* decimal point. Hack these into whatever the
@@ -287,6 +290,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
if (*cp == '.')
*cp = decimal_point;
}
+#endif /* __UNUSED__ */
/* note, there's a bit of skip logic after the switch */
@@ -333,7 +337,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata)
climb,
epd, eps, epc, mode);
if (st >= 14) {
-#define DEFAULT(val) (val[0] == '?') ? NAN : atof(val)
+#define DEFAULT(val) (val[0] == '?') ? NAN : safe_atof(val)
/*@ +floatdouble @*/
nf.time = DEFAULT(timestr);
nf.latitude = DEFAULT(lat);