summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeat Bolli <bbolli@ewanet.ch>2013-11-03 15:01:46 +0100
committerEric S. Raymond <esr@thyrsus.com>2013-11-06 08:34:14 -0500
commit61dc6385ea25570b02559886658a2e1284b389e6 (patch)
tree089bf6af30f9304737813ae1ad8f141918243e2c
parent73fe1dc96b099aacf05982e4590897384fbe0b1f (diff)
downloadgpsd-61dc6385ea25570b02559886658a2e1284b389e6.tar.gz
Fix compiler warnings with clang 4.2 on OS X 10.7.5
On OS X, /usr/include/sys/termios.h typedefs speed_t as unsigned long. On Linux, it is an unsigned int. This causes printf() format string warnings. Fix this by down-casting to an unsigned int and using "%u" as format. Also discard a close() result. Signed-off-by: Beat Bolli <bbolli@ewanet.ch> Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
-rw-r--r--driver_evermore.c2
-rw-r--r--driver_garmin.c2
-rw-r--r--driver_sirf.c6
-rw-r--r--gpsd.c4
-rw-r--r--libgpsd_core.c4
-rw-r--r--net_ntrip.c2
6 files changed, 10 insertions, 10 deletions
diff --git a/driver_evermore.c b/driver_evermore.c
index 092da3a1..238a82f9 100644
--- a/driver_evermore.c
+++ b/driver_evermore.c
@@ -550,7 +550,7 @@ static bool evermore_speed(struct gps_device_t *session,
{
/*@ -type @*/
gpsd_report(session->context->debug, LOG_PROG,
- "evermore_speed(%u%c%d)\n", speed, parity,
+ "evermore_speed(%u%c%d)\n", (unsigned int)speed, parity,
stopbits);
/* parity and stopbit switching aren't available on this chip */
if (parity != session->gpsdata.dev.parity
diff --git a/driver_garmin.c b/driver_garmin.c
index ea33320b..aa5a1609 100644
--- a/driver_garmin.c
+++ b/driver_garmin.c
@@ -925,7 +925,7 @@ static bool is_usb_device(const char *path UNUSED, int vendor, int product,
* return 1 is device found
* return 0 if not
*/
-static bool garmin_usb_detect(struct gps_device_t *session)
+static bool garmin_usb_detect(struct gps_device_t *session UNUSED)
{
#if defined(__linux__) || defined(S_SPLINT_S)
/*
diff --git a/driver_sirf.c b/driver_sirf.c
index c8f38813..cd483fcf 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -283,8 +283,8 @@ static bool sirfbin_speed(struct gps_device_t *session, speed_t speed, char pari
};
/*@ -charint @*/
gpsd_report(session->context->debug, LOG_PROG,
- "SiRF: sirf_speed(%d,%c,%d)\n",
- speed, parity, stopbits);
+ "SiRF: sirf_speed(%u,%c,%d)\n",
+ (unsigned int)speed, parity, stopbits);
if (9600 >= speed) {
gpsd_report(session->context->debug, LOG_WARN,
"SiRF may lag at 9600bps or less.\n");
@@ -339,7 +339,7 @@ static bool sirf_to_nmea(struct gps_device_t *session, speed_t speed)
if (speed >= 0xffff) {
gpsd_report(session->context->debug, LOG_ERROR,
"SiRF: can't switch from SiRF to NMEA because current speed %u is big.",
- speed);
+ (unsigned int)speed);
return false;
}
diff --git a/gpsd.c b/gpsd.c
index 2e903e59..347a9090 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -993,9 +993,9 @@ static void set_serial(struct gps_device_t *device,
}
gpsd_report(context.debug, LOG_PROG,
- "set_serial(%s,%d,%s) %c%d\n",
+ "set_serial(%s,%u,%s) %c%d\n",
device->gpsdata.dev.path,
- speed, modestring, parity, stopbits);
+ (unsigned int)speed, modestring, parity, stopbits);
/* no support for other word sizes yet */
/* *INDENT-OFF* */
if (wordsize == (int)(9 - stopbits)
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 25672125..80b24e2b 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1278,11 +1278,11 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
/*@-nullderef@*/
/* coverity[var_deref_op] */
gpsd_report(session->context->debug, LOG_INF,
- "%s identified as type %s, %f sec @ %dbps\n",
+ "%s identified as type %s, %f sec @ %ubps\n",
session->gpsdata.dev.path,
session->device_type->type_name,
timestamp() - session->opentime,
- speed);
+ (unsigned int)speed);
/*@+nullderef@*/
/* fire the identified hook */
if (session->device_type != NULL
diff --git a/net_ntrip.c b/net_ntrip.c
index 858a1872..cd1078b2 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -330,7 +330,7 @@ static int ntrip_stream_req_probe(const struct ntrip_stream_t *stream,
gpsd_report(debug, LOG_ERROR,
"ntrip stream write error %d on fd %d during probe request %zd\n",
errno, dsock, r);
- (int)close(dsock);
+ (void)close(dsock);
return -1;
}
/* coverity[leaked_handle] This is an intentional allocation */