gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] Silence compiler warnings about array subscripts of type 'cha


From: Matt
Subject: [gpsd-dev] Silence compiler warnings about array subscripts of type 'char'
Date: Wed, 10 Sep 2014 01:09:43 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0

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)) {
  ^

Attachment: silence-warnings-array-subscript-char.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]