From 46b7057d91e123f24e681a251178b1866779e8ab Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 27 Jan 2021 13:33:28 +0100 Subject: [PATCH] Fix signed vs unsigned char issues found by NetBSD. --- bin/xbps-checkvers/main.c | 6 +++--- lib/fetch/common.c | 6 +++--- lib/util.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/xbps-checkvers/main.c b/bin/xbps-checkvers/main.c index 26c7b231..df8d4585 100644 --- a/bin/xbps-checkvers/main.c +++ b/bin/xbps-checkvers/main.c @@ -234,7 +234,7 @@ rcv_sh_substitute(rcv_t *rcv, const char *str, size_t len) cmd = NULL; continue; } else if (*p == '{') { - for (ref = ++p; *p && p < str+len && (isalnum(*p) || *p == '_'); p++) + for (ref = ++p; *p && p < str+len && (isalnum((unsigned char)*p) || *p == '_'); p++) ; reflen = p-ref; switch (*p) { @@ -253,7 +253,7 @@ rcv_sh_substitute(rcv_t *rcv, const char *str, size_t len) goto err1; } } else { - for (ref = p; *p && p < str+len && (isalnum(*p) || *p == '_'); p++) + for (ref = p; *p && p < str+len && (isalnum((unsigned char)*p) || *p == '_'); p++) ; reflen = p-ref; p--; @@ -349,7 +349,7 @@ rcv_get_pkgver(rcv_t *rcv) vlen--; } vlen--; - while (isspace(v[vlen-1])) { + while (isspace((unsigned char)v[vlen-1])) { vlen--; } } diff --git a/lib/fetch/common.c b/lib/fetch/common.c index 9a5ef748..f5491e3f 100644 --- a/lib/fetch/common.c +++ b/lib/fetch/common.c @@ -927,7 +927,7 @@ fetch_ssl_tolower(char in) * conversions. */ static int -fetch_ssl_isalpha(char in) +fetch_ssl_isalpha(unsigned char in) { return ((in >= 'A' && in <= 'Z') || (in >= 'a' && in <= 'z')); } @@ -964,8 +964,8 @@ fetch_ssl_is_trad_domain_label(const char *l, size_t len, int wcok) if (!len || l[0] == '-' || l[len-1] == '-') return (0); for (i = 0; i < len; ++i) { - if (!isdigit(l[i]) && - !fetch_ssl_isalpha(l[i]) && + if (!isdigit((unsigned char)l[i]) && + !fetch_ssl_isalpha((unsigned char)l[i]) && !(l[i] == '*' && wcok) && !(l[i] == '-' && l[i - 1] != '-')) return (0); diff --git a/lib/util.c b/lib/util.c index 71afd43b..3de8bf3c 100644 --- a/lib/util.c +++ b/lib/util.c @@ -55,7 +55,7 @@ static bool is_revision(const char *str) { return false; } /* allow underscore for accepting perl-Digest-1.17_01_1 etc. */ - while (isdigit(str[0]) || str[0] == '_') { + while (isdigit((unsigned char)str[0]) || str[0] == '_') { ++str; } return str[0] == '\0';