net: lwm2m: Fix warning when building with newlib
If we use newlib the isdigit (and other similar functions) return an error as char can possibly be viewed as signed: usr/include/ctype.h:57:54: error: array subscript has type ‘char’ [-Werror=char-subscripts] #define __ctype_lookup(__c) ((__ctype_ptr__+sizeof(""[__c]))[(int)(__c)]) Explicity cast to unsigned char so we deal with both this warning and possible warning when -Wpointer-sign is enabled. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
92c1c2a24b
commit
21d6e302f6
1 changed files with 2 additions and 2 deletions
|
@ -845,7 +845,7 @@ static int atof32(const char *input, float32_value_t *out)
|
|||
return 0;
|
||||
}
|
||||
|
||||
while (*(++pos) && base > 1 && isdigit(*pos)) {
|
||||
while (*(++pos) && base > 1 && isdigit((unsigned char)*pos)) {
|
||||
out->val2 = out->val2 * 10 + (*pos - '0');
|
||||
base /= 10;
|
||||
}
|
||||
|
@ -1209,7 +1209,7 @@ static int string_to_path(char *pathstr, struct lwm2m_obj_path *path,
|
|||
for (i = 0; i <= end_index; i++) {
|
||||
/* search for first numeric */
|
||||
if (tokstart == -1) {
|
||||
if (!isdigit(pathstr[i])) {
|
||||
if (!isdigit((unsigned char)pathstr[i])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue