[rtems commit] Fix -Wchar-subscripts warnings
Sebastian Huber
sebh at rtems.org
Thu Aug 20 06:56:46 UTC 2020
Module: rtems
Branch: master
Commit: cbfdcba5551a93ed6b3b6dfe965fd556cbb9837a
Changeset: http://git.rtems.org/rtems/commit/?id=cbfdcba5551a93ed6b3b6dfe965fd556cbb9837a
Author: Aschref Ben Thabet <aschref.ben-thabet at embedded-brains.de>
Date: Tue Aug 18 17:31:21 2020 +0200
Fix -Wchar-subscripts warnings
The argument to the ctype functions must be an int and the value of the
character must be representable as an unsigned char or equal to the
value of the macro EOF. If the argument has any other value, the
behavior is undefined.
---
cpukit/libdl/rtl-archive.c | 4 ++--
cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/cpukit/libdl/rtl-archive.c b/cpukit/libdl/rtl-archive.c
index eb7641b..6eba158 100644
--- a/cpukit/libdl/rtl-archive.c
+++ b/cpukit/libdl/rtl-archive.c
@@ -516,13 +516,13 @@ rtems_rtl_archives_load_config (rtems_rtl_archives* archives)
{
size_t ls = strlen (&s[r]);
size_t b = 0;
- while (b < ls && isspace (s[r + b]))
+ while (b < ls && isspace ((unsigned char) s[r + b]))
{
s[r + b] = '\0';
++b;
}
b = ls - 1;
- while (b > 0 && isspace (s[r + b]))
+ while (b > 0 && isspace ((unsigned char) s[r + b]))
{
s[r + b] = '\0';
--b;
diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
index b15103e..b0894c1 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
@@ -338,7 +338,7 @@ rtems_fdt_shell_set (int argc, char *argv[])
if (!rtems_fdt_get_value32 (argv[1], "reg", sizeof (uint32_t), &address))
return 1;
- if (isdigit (argv[mask_arg][0]))
+ if (isdigit ((unsigned char) argv[mask_arg][0]))
mask = strtoul (argv[mask_arg], 0, 0);
else
{
@@ -380,7 +380,7 @@ rtems_fdt_shell_cl (int argc, char *argv[])
if (!rtems_fdt_get_value32 (argv[1], "reg", sizeof (uint32_t), &address))
return 1;
- if (isdigit (argv[mask_arg][0]))
+ if (isdigit ((unsigned char) argv[mask_arg][0]))
mask = strtoul (argv[mask_arg], 0, 0);
else
{
@@ -426,7 +426,7 @@ rtems_fdt_shell_up (int argc, char *argv[])
if (!rtems_fdt_get_value32 (argv[1], "reg", sizeof (uint32_t), &address))
return 1;
- if (isdigit (argv[mask_arg][0]))
+ if (isdigit ((unsigned char) argv[mask_arg][0]))
mask = strtoul (argv[mask_arg], 0, 0);
else
{
@@ -473,7 +473,7 @@ rtems_fdt_shell_tst (int argc, char *argv[])
if (!rtems_fdt_get_value32 (argv[1], "reg", sizeof (uint32_t), &address))
return 1;
- if (isdigit (argv[mask_arg][0]))
+ if (isdigit ((unsigned char) argv[mask_arg][0]))
mask = strtoul (argv[mask_arg], 0, 0);
else
{
More information about the vc
mailing list