summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2019-05-23 19:00:19 +0200
committerlaforge <laforge@gnumonks.org>2019-06-13 13:49:30 +0000
commit1af2cd56248b449f4bca7e5763c27043c4a78873 (patch)
tree2113199c74e7c05060b86f0f49584d94b4271282 /src
parent274ac4dcc3c74f1ff0efcb1cee68c737bfa37044 (diff)
fix isdigit taking unsigned as input
fixes the following error warnings when cross-compiling using: ./configure --enable-static --prefix=/usr/local/arm-none-eabi --host=arm-none-eabi --enable-embedded --disable-doxygen --disable-shared --disable-pseudotalloc --enable-external-tests CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles -nodefaultlibs -Werror -Wno-error=deprecated -Wno-error=deprecated-declarations -Wno-error=cpp -mthumb -Os -mlong-calls -g3 -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -Wno-error=format" utils.c:1002:18: error: array subscript has type 'char' [-Werror=char-subscripts] 1002 | if (!isdigit(in[i])) gsm23003.c:414:34: error: array subscript has type 'char' [-Werror=char-subscripts] 414 | if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3) Change-Id: Ia13fd5ee79fc6dc3291c0b99958ab3c01afee17d
Diffstat (limited to 'src')
-rw-r--r--src/gsm/gsm23003.c2
-rw-r--r--src/utils.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c
index 4cc2671f..e20afcbc 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -411,7 +411,7 @@ int osmo_mnc_from_str(const char *mnc_str, uint16_t *mnc, bool *mnc_3_digits)
char *endptr;
int rc = 0;
- if (!mnc_str || !isdigit(mnc_str[0]) || strlen(mnc_str) > 3)
+ if (!mnc_str || !isdigit((unsigned char)mnc_str[0]) || strlen(mnc_str) > 3)
return -EINVAL;
errno = 0;
diff --git a/src/utils.c b/src/utils.c
index 7b7178ca..7364bfb1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -999,7 +999,7 @@ char osmo_luhn(const char* in, int in_len)
/* All input must be numbers */
for (i = 0; i < in_len; i++) {
- if (!isdigit(in[i]))
+ if (!isdigit((unsigned char)in[i]))
return -EINVAL;
}