significand = 0;
if (*cp == '0') {
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char) *cp)) {
json_error(p, "leading zeros not allowed");
return;
}
- } else if (isdigit(*cp)) {
+ } else if (isdigit((unsigned char) *cp)) {
do {
if (significand <= ULLONG_MAX / 10) {
significand = significand * 10 + (*cp - '0');
}
}
cp++;
- } while (isdigit(*cp));
+ } while (isdigit((unsigned char) *cp));
} else {
json_error(p, "'-' must be followed by digit");
return;
/* Optional fraction. */
if (*cp == '.') {
cp++;
- if (!isdigit(*cp)) {
+ if (!isdigit((unsigned char) *cp)) {
json_error(p, "decimal point must be followed by digit");
return;
}
imprecise = true;
}
cp++;
- } while (isdigit(*cp));
+ } while (isdigit((unsigned char) *cp));
}
/* Optional exponent. */
cp++;
}
- if (!isdigit(*cp)) {
+ if (!isdigit((unsigned char) *cp)) {
json_error(p, "exponent must contain at least one digit");
return;
}
}
exponent = exponent * 10 + (*cp - '0');
cp++;
- } while (isdigit(*cp));
+ } while (isdigit((unsigned char) *cp));
if (negative_exponent) {
pow10 -= exponent;
stream = fopen(file_name, "r");
if (!stream) {
return json_string_create_nocopy(
- xasprintf("error opening \"%s\": %s", file_name, strerror(errno)));
+ xasprintf("error opening \"%s\": %s", file_name,
+ ovs_strerror(errno)));
}
json = json_from_stream(stream);
fclose(stream);
if (ferror(stream)) {
json_destroy(json);
json = json_string_create_nocopy(
- xasprintf("error reading JSON stream: %s", strerror(errno)));
+ xasprintf("error reading JSON stream: %s", ovs_strerror(errno)));
}
return json;