This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 6c4c09eb44 tools/cfgdefine.c: Resolve compile warning array subscript
has type ‘char’
6c4c09eb44 is described below
commit 6c4c09eb449fb3bd4bc32f835e05cc9467850b74
Author: simbit18 <[email protected]>
AuthorDate: Wed Oct 25 15:07:33 2023 +0200
tools/cfgdefine.c: Resolve compile warning array subscript has type ‘char’
In file included from cfgdefine.c:26:
cfgdefine.c: In function ‘skip_space’:
cfgdefine.c:91:26: warning: array subscript has type ‘char’
[-Wchar-subscripts]
91 | while (*ptr && isspace(*ptr)) ptr++;
| ^~~~
cfgdefine.c: In function ‘find_name_end’:
cfgdefine.c:99:27: warning: array subscript has type ‘char’
[-Wchar-subscripts]
99 | while (*ptr && (isalnum(*ptr) || *ptr == '_')) ptr++;
| ^~~~
cfgdefine.c: In function ‘find_value_end’:
cfgdefine.c:107:27: warning: array subscript has type ‘char’
[-Wchar-subscripts]
107 | while (*ptr && !isspace(*ptr))
| ^~~~
cfgdefine.c:116:45: warning: array subscript has type ‘char’
[-Wchar-subscripts]
116 | do ptr++; while (*ptr && !isspace(*ptr) && *ptr != '"');
|
---
tools/cfgdefine.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/cfgdefine.c b/tools/cfgdefine.c
index b872b849e6..091a53172d 100644
--- a/tools/cfgdefine.c
+++ b/tools/cfgdefine.c
@@ -88,7 +88,7 @@ static const char *dequote_list[] =
static char *skip_space(char *ptr)
{
- while (*ptr && isspace(*ptr)) ptr++;
+ while (*ptr && isspace((int)*ptr)) ptr++;
return ptr;
}
@@ -96,7 +96,7 @@ static char *skip_space(char *ptr)
static char *find_name_end(char *ptr)
{
- while (*ptr && (isalnum(*ptr) || *ptr == '_')) ptr++;
+ while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++;
return ptr;
}
@@ -104,7 +104,7 @@ static char *find_name_end(char *ptr)
static char *find_value_end(char *ptr)
{
- while (*ptr && !isspace(*ptr))
+ while (*ptr && !isspace((int)*ptr))
{
if (*ptr == '"')
{
@@ -113,7 +113,7 @@ static char *find_value_end(char *ptr)
}
else
{
- do ptr++; while (*ptr && !isspace(*ptr) && *ptr != '"');
+ do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"');
}
}