options/posix: Fix several sign compare warnings in musl imported code
@@ -32,7 +32,7 @@ static int str_next(const char *str, size_t n, size_t *step)
*step = 0;
return 0;
}
- if (str[0] >= 128U) {
+ if ((unsigned char)str[0] >= 128U) {
wchar_t wc;
int k = mbtowc(&wc, str, n);
if (k<0) {
@@ -85,7 +85,7 @@ static int pat_next(const char *pat, size_t m, size_t *step, int flags)
if (pat[0] == '?')
return QUESTION;
escaped:
- if (pat[0] >= 128U) {
+ if ((unsigned char)pat[0] >= 128U) {
wchar_t wc;
int k = mbtowc(&wc, pat, m);
if (k<0) {
@@ -127,8 +127,8 @@ static int match_bracket(const char *p, int k, int kfold)
int l = mbtowc(&wc2, p+1, 4);
if (l < 0) return 0;
if (wc <= wc2)
- if ((unsigned)k-wc <= wc2-wc ||
- (unsigned)kfold-wc <= wc2-wc)
+ if ((unsigned)k-wc <= (unsigned)wc2-wc ||
+ (unsigned)kfold-wc <= (unsigned)wc2-wc)
return !inv;
p += l-1;
continue;
@@ -148,7 +148,7 @@ static int match_bracket(const char *p, int k, int kfold)
}
continue;
}
- if (*p < 128U) {
+ if ((unsigned char)*p < 128U) {
wc = (unsigned char)*p;
} else {
int l = mbtowc(&wc, p, 4);
@@ -230,7 +230,7 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n
* On illegal sequences we may get it wrong, but in that case
* we necessarily have a matching failure anyway. */
for (s=endstr; s>str && tailcnt; tailcnt--) {
- if (s[-1] < 128U || MB_CUR_MAX==1) s--;
+ if ((unsigned char)s[-1] < 128U || MB_CUR_MAX==1) s--;
else while ((unsigned char)*--s-0x80U<0x40 && s>str);
}
if (tailcnt) return FNM_NOMATCH;
