From 477820977f0d1a44b6eda24c14b7cb26a8d16109 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 2 Apr 2024 17:28:03 +0200 Subject: [PATCH] (submit/fix-char-signedness) os: utils: fix char signess mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On NetBSD gives warning: In file included from /usr/include/ctype.h:100, from ../include/misc.h:174, from ../os/utils.c:75: ../os/utils.c: In function ‘VerifyDisplayName’: ../os/utils.c:624:23: warning: array subscript has type ‘char’ [-Wchar-subscripts] 624 | if (!isdigit(d[i])) { | ^ ../os/utils.c: In function ‘ProcessCommandLine’: ../os/utils.c:942:44: warning: array subscript has type ‘char’ [-Wchar-subscripts] 942 | if ((i + 1 < argc) && (isdigit(*argv[i + 1]))) | ^ Signed-off-by: Enrico Weigelt, metux IT consult --- os/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/os/utils.c b/os/utils.c index 5b73d27b0..c9d49350a 100644 --- a/os/utils.c +++ b/os/utils.c @@ -379,7 +379,7 @@ VerifyDisplayName(const char *d) for digits, or exception of :0.0 and similar (two decimal points max) */ for (i = 0; i < strlen(d); i++) { - if (!isdigit(d[i])) { + if (!isdigit((unsigned char)d[i])) { if (d[i] != '.' || period_found) return 0; period_found = TRUE; @@ -695,7 +695,7 @@ ProcessCommandLine(int argc, char *argv[]) else if (strcmp(argv[i], "-terminate") == 0) { dispatchExceptionAtReset = DE_TERMINATE; terminateDelay = -1; - if ((i + 1 < argc) && (isdigit(*argv[i + 1]))) + if ((i + 1 < argc) && (isdigit((unsigned char)*argv[i + 1]))) terminateDelay = atoi(argv[++i]); terminateDelay = max(0, terminateDelay); }