mirror of https://gerrit.osmocom.org/libosmocore
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
This commit is contained in:
parent
274ac4dcc3
commit
1af2cd5624
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue