summaryrefslogtreecommitdiff
path: root/common/base32.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-11 12:20:10 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-12 22:12:19 +0000
commit21f58b39ee05903a6d3255476e3a32ea124e4191 (patch)
treefd65c96d7ef2f15b336c209448bceb9c55b6d29d /common/base32.c
parent0189fc914366562c204e8556a0ac46ef24cc320e (diff)
downloadchrome-ec-21f58b39ee05903a6d3255476e3a32ea124e4191.tar.gz
Avoid passing char values to ctype functions
With Zephyr's newlib we get a warning when trying to do this, since it includes the following note in: /opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/include/ctype.h "These macros are intentionally written in a manner that will trigger a gcc -Wall warning if the user mistakenly passes a 'char' instead of an int containing an 'unsigned char'." Presumably this is so characters above ASCII 127 are handled correctly, even if these are seldom used. Update the few affected call sites to ensure the value is cast to an unsigned char so that it will not fall afoul of the newlib warning. Note that the ECOS version of the ctype functions does not make use of an array, so does not suffer from failure if negative values are passed. Still, it is harmless to fix it. BUG=b:180023514 BRANCH=none TEST=build zephyr volteer with CONFIG_NEWLIB_LIBC and see no warnings Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ieae2fab8c20b75baa46d01dd8cdb393c6bb5c2c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691413 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/base32.c')
-rw-r--r--common/base32.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/base32.c b/common/base32.c
index 8a33d7685c..a6be8409b1 100644
--- a/common/base32.c
+++ b/common/base32.c
@@ -119,7 +119,7 @@ int base32_decode(uint8_t *dest, int destlen_bits, const char *src,
for (; *src; src++) {
int sym, sbits, dbits, b;
- if (isspace(*src) || *src == '-')
+ if (isspace((unsigned char)*src) || *src == '-')
continue;
sym = decode_sym(*src);