Skip to content

Commit 9968eb6

Browse files
committed
Suppress -Wchar-subscripts warnings by Cygwin gcc 9.3.0
1 parent e84090d commit 9968eb6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ext/date/date_parse.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static size_t
7070
digit_span(const char *s, const char *e)
7171
{
7272
size_t i = 0;
73-
while (s + i < e && isdigit(s[i])) i++;
73+
while (s + i < e && isdigit((unsigned char)s[i])) i++;
7474
return i;
7575
}
7676

@@ -110,7 +110,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
110110

111111
s = RSTRING_PTR(y);
112112
ep = RSTRING_END(y);
113-
while (s < ep && !issign(*s) && !isdigit(*s))
113+
while (s < ep && !issign(*s) && !isdigit((unsigned char)*s))
114114
s++;
115115
if (s >= ep) goto no_date;
116116
bp = s;
@@ -162,7 +162,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
162162

163163
s = RSTRING_PTR(y);
164164
ep = RSTRING_END(y);
165-
while (s < ep && !issign(*s) && !isdigit(*s))
165+
while (s < ep && !issign(*s) && !isdigit((unsigned char)*s))
166166
s++;
167167
if (s >= ep) goto no_year;
168168
bp = s;
@@ -199,7 +199,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
199199

200200
s = RSTRING_PTR(m);
201201
ep = RSTRING_END(m);
202-
while (s < ep && !isdigit(*s))
202+
while (s < ep && !isdigit((unsigned char)*s))
203203
s++;
204204
if (s >= ep) goto no_month;
205205
bp = s;
@@ -225,7 +225,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
225225

226226
s = RSTRING_PTR(d);
227227
ep = RSTRING_END(d);
228-
while (s < ep && !isdigit(*s))
228+
while (s < ep && !isdigit((unsigned char)*s))
229229
s++;
230230
if (s >= ep) goto no_mday;
231231
bp = s;
@@ -364,9 +364,9 @@ static int
364364
str_end_with_word(const char *s, long l, const char *w)
365365
{
366366
int n = (int)strlen(w);
367-
if (l <= n || !isspace(s[l - n - 1])) return 0;
367+
if (l <= n || !isspace((unsigned char)s[l - n - 1])) return 0;
368368
if (strncasecmp(&s[l - n], w, n)) return 0;
369-
do ++n; while (l > n && isspace(s[l - n - 1]));
369+
do ++n; while (l > n && isspace((unsigned char)s[l - n - 1]));
370370
return n;
371371
}
372372

@@ -376,7 +376,7 @@ shrunk_size(const char *s, long l)
376376
long i, ni;
377377
int sp = 0;
378378
for (i = ni = 0; i < l; ++i) {
379-
if (!isspace(s[i])) {
379+
if (!isspace((unsigned char)s[i])) {
380380
if (sp) ni++;
381381
sp = 0;
382382
ni++;
@@ -394,7 +394,7 @@ shrink_space(char *d, const char *s, long l)
394394
long i, ni;
395395
int sp = 0;
396396
for (i = ni = 0; i < l; ++i) {
397-
if (!isspace(s[i])) {
397+
if (!isspace((unsigned char)s[i])) {
398398
if (sp) d[ni++] = ' ';
399399
sp = 0;
400400
d[ni++] = s[i];
@@ -754,8 +754,8 @@ check_year_width(VALUE y)
754754
l = RSTRING_LEN(y);
755755
if (l < 2) return 0;
756756
s = RSTRING_PTR(y);
757-
if (!isdigit(s[1])) return 0;
758-
return (l == 2 || !isdigit(s[2]));
757+
if (!isdigit((unsigned char)s[1])) return 0;
758+
return (l == 2 || !isdigit((unsigned char)s[2]));
759759
}
760760

761761
static int

0 commit comments

Comments
 (0)