ctype: Fix undefined behavior in ctype.h usage

When parse.c is build against newlib nano
following error shows up:
iparse.c:304:20: error: array subscript has type 'char' [-Werror=char-subscripts]

This can be easily fixed with casting to unsigned type first.
This commit is contained in:
Jerzy Kasenberg
2021-06-16 14:49:42 +02:00
committed by kasjer
parent 9b562a6546
commit aecd4b2038
+2 -2
View File
@@ -301,7 +301,7 @@ parse_time_us(const char *str, int *out_status)
uint32_t val_mult = 1;
uint32_t val_us;
while (isdigit(*str)) {
while (isdigit((unsigned char)*str)) {
val *= 10;
val += *str - '0';
str++;
@@ -309,7 +309,7 @@ parse_time_us(const char *str, int *out_status)
if (*str == '.') {
str++;
while (isdigit(*str)) {
while (isdigit((unsigned char)*str)) {
val *= 10;
val += *str - '0';
val_div *= 10;