summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpsd.c14
-rw-r--r--gpsmon.c10
-rw-r--r--gpsutils.c4
-rw-r--r--hex.c2
-rw-r--r--json.c22
-rw-r--r--libgpsd_core.c2
-rw-r--r--packet.c6
7 files changed, 30 insertions, 30 deletions
diff --git a/gpsd.c b/gpsd.c
index 30ebc077..b591ce63 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -605,7 +605,7 @@ static ssize_t throttled_write(struct subscriber_t *sub, char *buf,
ssize_t status;
if (context.errout.debug >= LOG_CLIENT) {
- if (isprint(buf[0]))
+ if (isprint((unsigned char) buf[0]))
gpsd_report(&context.errout, LOG_CLIENT,
"=> client(%d): %s\n", sub_index(sub), buf);
else {
@@ -782,7 +782,7 @@ bool gpsd_add_device(const char *device_name, bool flag_nowait)
static char stash[BUFSIZ];
/*@ -temptrans -mayaliasunique @*/
- for (q = p; isprint(*p) && !isspace(*p) && /*@i@*/ (p - q < BUFSIZ - 1);
+ for (q = p; isprint((unsigned char) *p) && !isspace((unsigned char) *p) && /*@i@*/ (p - q < BUFSIZ - 1);
p++)
continue;
(void)memcpy(stash, q, (size_t) (p - q));
@@ -1002,12 +1002,12 @@ static void set_serial(struct gps_device_t *device,
int wordsize = 8;
if (strchr("78", *modestring) != NULL) {
- while (isspace(*modestring))
+ while (isspace((unsigned char) *modestring))
modestring++;
wordsize = (int)(*modestring++ - '0');
if (strchr("NOE", *modestring) != NULL) {
parity = *modestring++;
- while (isspace(*modestring))
+ while (isspace((unsigned char) *modestring))
modestring++;
if (strchr("12", *modestring) != NULL)
stopbits = (unsigned int)(*modestring - '0');
@@ -1077,7 +1077,7 @@ static void rstrip(char *str)
{
char *strend;
strend = str + strlen(str) - 1;
- while (isspace(*strend)) {
+ while (isspace((unsigned char) *strend)) {
*strend = '\0';
--strend;
}
@@ -1360,7 +1360,7 @@ static void handle_request(struct subscriber_t *sub,
} else {
const char *errend;
errend = buf + strlen(buf) - 1;
- while (isspace(*errend) && errend > buf)
+ while (isspace((unsigned char) *errend) && errend > buf)
--errend;
(void)snprintf(reply, replylen,
"{\"class\":\"ERROR\",\"message\":\"Unrecognized request '%.*s'\"}\r\n",
@@ -1662,7 +1662,7 @@ static int handle_gpsd_request(struct subscriber_t *sub, const char *buf)
if (buf[0] == '?') {
const char *end;
for (end = buf; *buf != '\0'; buf = end)
- if (isspace(*buf))
+ if (isspace((unsigned char) *buf))
end = buf + 1;
else
handle_request(sub, buf, &end,
diff --git a/gpsmon.c b/gpsmon.c
index 909f2712..a5ee0b2a 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -170,7 +170,7 @@ static void visibilize(/*@out@*/char *buf2, size_t len2, const char *buf)
buf2[0] = '\0';
for (sp = buf; *sp != '\0' && strlen(buf2)+4 < len2; sp++)
- if (isprint(*sp) || (sp[0] == '\n' && sp[1] == '\0')
+ if (isprint((unsigned char) *sp) || (sp[0] == '\n' && sp[1] == '\0')
|| (sp[0] == '\r' && sp[2] == '\0'))
(void)snprintf(buf2 + strlen(buf2), 2, "%c", *sp);
else
@@ -186,12 +186,12 @@ static void cond_hexdump(/*@out@*/char *buf2, size_t len2,
size_t i;
bool printable = true;
for (i = 0; i < len; i++)
- if (!isprint(buf[i]) && !isspace(buf[i]))
+ if (!isprint((unsigned char) buf[i]) && !isspace((unsigned char) buf[i]))
printable = false;
if (printable) {
size_t j;
for (i = j = 0; i < len && j < len2 - 1; i++)
- if (isprint(buf[i])) {
+ if (isprint((unsigned char) buf[i])) {
buf2[j++] = buf[i];
buf2[j] = '\0';
}
@@ -750,8 +750,8 @@ static bool do_command(const char *line)
unsigned char buf[BUFLEN];
const char *arg;
- if (isspace(line[1])) {
- for (arg = line + 2; *arg != '\0' && isspace(*arg); arg++)
+ if (isspace((unsigned char) line[1])) {
+ for (arg = line + 2; *arg != '\0' && isspace((unsigned char) *arg); arg++)
arg++;
arg++;
} else
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;
}
diff --git a/hex.c b/hex.c
index ac1705f3..635bd53a 100644
--- a/hex.c
+++ b/hex.c
@@ -17,7 +17,7 @@ const char /*@ observer @*/ *gpsd_packetdump(char *scbuf, size_t scbuflen,
assert(binbuf != NULL);
for (cp = binbuf; cp < binbuf + binbuflen; cp++)
- if (!isprint(*cp) && !isspace(*cp))
+ if (!isprint((unsigned char) *cp) && !isspace((unsigned char) *cp))
printable = false;
if (printable)
return binbuf;
diff --git a/json.c b/json.c
index 1f6877f2..8efc4227 100644
--- a/json.c
+++ b/json.c
@@ -235,7 +235,7 @@ static int json_internal_read_object(const char *cp,
statenames[state], *cp, cp));
switch (state) {
case init:
- if (isspace(*cp))
+ if (isspace((unsigned char) *cp))
continue;
else if (*cp == '{')
state = await_attr;
@@ -246,7 +246,7 @@ static int json_internal_read_object(const char *cp,
}
break;
case await_attr:
- if (isspace(*cp))
+ if (isspace((unsigned char) *cp))
continue;
else if (*cp == '"') {
state = in_attr;
@@ -294,7 +294,7 @@ static int json_internal_read_object(const char *cp,
*pattr++ = *cp;
break;
case await_value:
- if (isspace(*cp) || *cp == ':')
+ if (isspace((unsigned char) *cp) || *cp == ':')
continue;
else if (*cp == '[') {
if (cursor->type != t_array) {
@@ -372,7 +372,7 @@ static int json_internal_read_object(const char *cp,
case in_val_token:
if (pval == NULL)
return JSON_ERR_NULLPTR;
- if (isspace(*cp) || *cp == ',' || *cp == '}') {
+ if (isspace((unsigned char) *cp) || *cp == ',' || *cp == '}') {
*pval = '\0';
json_debug_trace((1, "Collected token value %s.\n", valbuf));
state = post_val;
@@ -400,7 +400,7 @@ static int json_internal_read_object(const char *cp,
if ((strcmp(valbuf, "true")==0 || strcmp(valbuf, "false")==0)
&& seeking == t_boolean)
break;
- if (isdigit(valbuf[0])) {
+ if (isdigit((unsigned char) valbuf[0])) {
bool decimal = strchr(valbuf, '.') != NULL;
if (decimal && seeking == t_real)
break;
@@ -501,7 +501,7 @@ static int json_internal_read_object(const char *cp,
}
/*@fallthrough@*/
case post_array:
- if (isspace(*cp))
+ if (isspace((unsigned char) *cp))
continue;
else if (*cp == ',')
state = await_attr;
@@ -518,7 +518,7 @@ static int json_internal_read_object(const char *cp,
good_parse:
/* in case there's another object following, consune trailing WS */
- while (isspace(*cp))
+ while (isspace((unsigned char) *cp))
++cp;
if (end != NULL)
*end = cp;
@@ -539,7 +539,7 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
json_debug_trace((1, "Entered json_read_array()\n"));
- while (isspace(*cp))
+ while (isspace((unsigned char) *cp))
cp++;
if (*cp != '[') {
json_debug_trace((1, "Didn't find expected array start\n"));
@@ -551,7 +551,7 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
arrcount = 0;
/* Check for empty array */
- while (isspace(*cp))
+ while (isspace((unsigned char) *cp))
cp++;
if (*cp == ']')
goto breakout;
@@ -560,7 +560,7 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
json_debug_trace((1, "Looking at %s\n", cp));
switch (arr->element_type) {
case t_string:
- if (isspace(*cp))
+ if (isspace((unsigned char) *cp))
cp++;
if (*cp != '"')
return JSON_ERR_BADSTRING;
@@ -605,7 +605,7 @@ int json_read_array(const char *cp, const struct json_array_t *arr,
return JSON_ERR_SUBTYPE;
}
arrcount++;
- if (isspace(*cp))
+ if (isspace((unsigned char) *cp))
cp++;
if (*cp == ']') {
json_debug_trace((1, "End of array found.\n"));
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 3e2a0f25..bec2ddc1 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -79,7 +79,7 @@ static void visibilize(/*@out@*/char *buf2, size_t len, const char *buf)
buf2[0] = '\0';
for (sp = buf; *sp != '\0' && strlen(buf2)+4 < len; sp++)
- if (isprint(*sp) || (sp[0] == '\n' && sp[1] == '\0')
+ if (isprint((unsigned char) *sp) || (sp[0] == '\n' && sp[1] == '\0')
|| (sp[0] == '\r' && sp[2] == '\0'))
(void)snprintf(buf2 + strlen(buf2), 2, "%c", *sp);
else
diff --git a/packet.c b/packet.c
index 9bdfae99..d5220fdf 100644
--- a/packet.c
+++ b/packet.c
@@ -1500,7 +1500,7 @@ void packet_parse(struct gps_lexer_t *lexer)
* Back up past any whitespace. Need to do this because
* at least one GPS (the Firefly 1a) emits \r\r\n
*/
- for (end = (char *)lexer->inbufptr - 1; isspace(*end); end--)
+ for (end = (char *)lexer->inbufptr - 1; isspace((unsigned char) *end); end--)
continue;
while (strchr("0123456789ABCDEF", *end))
--end;
@@ -1509,8 +1509,8 @@ void packet_parse(struct gps_lexer_t *lexer)
for (n = 1; (char *)lexer->inbuffer + n < end; n++)
crc ^= lexer->inbuffer[n];
(void)snprintf(csum, sizeof(csum), "%02X", crc);
- checksum_ok = (csum[0] == toupper(end[1])
- && csum[1] == toupper(end[2]));
+ checksum_ok = (csum[0] == toupper((unsigned char) end[1])
+ && csum[1] == toupper((unsigned char) end[2]));
}
if (!checksum_ok) {
gpsd_report(&lexer->errout, LOG_WARN,