summaryrefslogtreecommitdiff
path: root/gpsutils.c
diff options
context:
space:
mode:
authorMatt <ukyg9e5r6k7gubiekd6@yahoo.com>2014-09-10 01:09:43 +1000
committerEric S. Raymond <esr@thyrsus.com>2014-09-10 09:10:02 -0400
commit280d52b7d78ad2ba695f5f6faa61f0679c447f3c (patch)
tree1159db868a8f914f9b5567473a6059f04f2fe974 /gpsutils.c
parent60583e9ee10b778934452845f004b94ce5c74205 (diff)
downloadgpsd-280d52b7d78ad2ba695f5f6faa61f0679c447f3c.tar.gz
Silence compiler warnings about array subscripts of type 'char'
Cygwin GCC complains about code like isprint(c), where c is of type char. The isX() and toX() functions/macros (ISO C allows either) all accept an int, whose value should be either that of an unsigned char, or the special value EOF (== -1). So cast to unsigned char each argument to isprint, tolower, etc. Silences several warnings of the form: gpsutils.c: In function 'safe_atof': gpsutils.c:90:5: warning: array subscript has type 'char' [-Wchar-subscripts] while (isspace(*p)) { ^ gpsutils.c:188:2: warning: array subscript has type 'char' [-Wchar-subscripts] while (isdigit(*p)) { ^
Diffstat (limited to 'gpsutils.c')
-rw-r--r--gpsutils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gpsutils.c b/gpsutils.c
index 9b0761b2..dfcaa3f9 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -87,7 +87,7 @@ double safe_atof(const char *string)
*/
p = string;
- while (isspace(*p)) {
+ while (isspace((unsigned char) *p)) {
p += 1;
}
if (*p == '-') {
@@ -185,7 +185,7 @@ double safe_atof(const char *string)
}
expSign = false;
}
- while (isdigit(*p)) {
+ while (isdigit((unsigned char) *p)) {
exp = exp * 10 + (*p - '0');
p += 1;
}