summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2012-05-16 20:08:41 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-05-16 20:08:41 -0400
commite8ad2a489d193b81b9fbfa0525e4d607859f6b0d (patch)
treed52b0693705628195086e7ed0656d64147608cb8
parentacb1d33db991147d689857ca388ab20a0867050c (diff)
downloadgpsd-e8ad2a489d193b81b9fbfa0525e4d607859f6b0d.tar.gz
New version of cppcheck requires more suppressions.
-rw-r--r--SConstruct2
-rw-r--r--ais_json.c11
-rw-r--r--contrib/ashctl.c6
-rw-r--r--contrib/motosend.c2
4 files changed, 17 insertions, 4 deletions
diff --git a/SConstruct b/SConstruct
index fbc79d8e..95e5b684 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1282,7 +1282,7 @@ for (target,sources,description,params) in splint_table:
env.Alias('splint',Splint(target,sources,description,params))
Utility("cppcheck", ["gpsd.h", "packet_names.h"],
- "cppcheck --template gcc --all --force $SRCDIR")
+ "cppcheck --template gcc --enable=all --inline-suppr --force $SRCDIR")
# Sanity-check Python code. TODO: add xgps for the complete set.
Utility("pychecker", ["jsongen.py", "maskaudit.py"],
diff --git a/ais_json.c b/ais_json.c
index bb523c50..6f285a2b 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -97,6 +97,7 @@ int json_ais_read(const char *buf,
ais->type4.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type4.minute = AIS_MINUTE_NOT_AVAILABLE;
ais->type4.second = AIS_SECOND_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(timestamp, "%4u-%02u-%02uT%02u:%02u:%02uZ",
&ais->type4.year,
&ais->type4.month,
@@ -112,6 +113,7 @@ int json_ais_read(const char *buf,
ais->type5.day = AIS_DAY_NOT_AVAILABLE;
ais->type5.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type5.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type5.month,
&ais->type5.day,
@@ -128,6 +130,7 @@ int json_ais_read(const char *buf,
ais->type6.dac1fid12.lday = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid12.lhour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid12.lminute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(departure, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid12.lmonth,
&ais->type6.dac1fid12.lday,
@@ -137,6 +140,7 @@ int json_ais_read(const char *buf,
ais->type6.dac1fid12.nday = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid12.nhour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid12.nminute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid12.nmonth,
&ais->type6.dac1fid12.nday,
@@ -159,6 +163,7 @@ int json_ais_read(const char *buf,
ais->type6.dac1fid18.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid18.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid18.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(arrival, "%02uT%02u:%02uZ",
&ais->type6.dac1fid18.day,
&ais->type6.dac1fid18.hour,
@@ -173,6 +178,7 @@ int json_ais_read(const char *buf,
ais->type6.dac1fid20.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid20.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid20.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(arrival, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid20.month,
&ais->type6.dac1fid20.day,
@@ -192,6 +198,7 @@ int json_ais_read(const char *buf,
ais->type6.dac1fid28.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid28.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid28.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(start, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid28.month,
&ais->type6.dac1fid28.day,
@@ -228,6 +235,7 @@ int json_ais_read(const char *buf,
ais->type8.dac1fid13.fday = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac1fid13.fhour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac1fid13.fminute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(departure, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid13.fmonth,
&ais->type8.dac1fid13.fday,
@@ -237,6 +245,7 @@ int json_ais_read(const char *buf,
ais->type8.dac1fid13.tday = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac1fid13.thour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac1fid13.tminute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid13.tmonth,
&ais->type8.dac1fid13.tday,
@@ -264,6 +273,7 @@ int json_ais_read(const char *buf,
ais->type8.dac1fid27.day = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac1fid27.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac1fid27.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(start, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid27.month,
&ais->type8.dac1fid27.day,
@@ -282,6 +292,7 @@ int json_ais_read(const char *buf,
ais->type8.dac1fid31.day = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac1fid31.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac1fid31.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
(void)sscanf(eta, "%02uT%02u:%02uZ",
&ais->type8.dac1fid31.day,
&ais->type8.dac1fid31.hour,
diff --git a/contrib/ashctl.c b/contrib/ashctl.c
index 0475255a..fdf04bfd 100644
--- a/contrib/ashctl.c
+++ b/contrib/ashctl.c
@@ -135,10 +135,12 @@ static void config_raw(int fd){
static void nmea_add_checksum(char *sentence)
/* add NMEA checksum to a possibly *-terminated sentence */
{
- unsigned char sum = '\0';
- char c, *p = sentence;
+ char *p = sentence;
if (*p == '$') {
+ unsigned char sum = '\0';
+ char c;
+
p++;
while ( ((c = *p) != '*') && (c != '\0')) {
sum ^= c;
diff --git a/contrib/motosend.c b/contrib/motosend.c
index 7d19b647..c1c3e477 100644
--- a/contrib/motosend.c
+++ b/contrib/motosend.c
@@ -115,7 +115,7 @@ char moto_gen_checksum(char *buf, int len){
static int moto_send(int fd, char *type, char *body ) {
size_t status;
char *buf;
- unsigned short l, ck;
+ unsigned short l;
l = strlen(body) / 2;
if ((buf = malloc(l+7)) == NULL)