ruby-changes:60773
From: Nobuyoshi <ko1@a...>
Date: Tue, 14 Apr 2020 15:14:08 +0900 (JST)
Subject: [ruby-changes:60773] 7a85d31c29 (master): [ruby/date] Suppress -Wchar-subscripts warnings by Cygwin gcc 9.3.0
https://git.ruby-lang.org/ruby.git/commit/?id=7a85d31c29 From 7a85d31c298a4585bed9f20214dfe0af48e4ec1f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 14 Apr 2020 14:49:48 +0900 Subject: [ruby/date] Suppress -Wchar-subscripts warnings by Cygwin gcc 9.3.0 https://github.com/ruby/date/commit/9968eb69f0 diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c index 519f29c..0378e50 100644 --- a/ext/date/date_parse.c +++ b/ext/date/date_parse.c @@ -70,7 +70,7 @@ static size_t https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L70 digit_span(const char *s, const char *e) { size_t i = 0; - while (s + i < e && isdigit(s[i])) i++; + while (s + i < e && isdigit((unsigned char)s[i])) i++; return i; } @@ -110,7 +110,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L110 s = RSTRING_PTR(y); ep = RSTRING_END(y); - while (s < ep && !issign(*s) && !isdigit(*s)) + while (s < ep && !issign(*s) && !isdigit((unsigned char)*s)) s++; if (s >= ep) goto no_date; bp = s; @@ -162,7 +162,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L162 s = RSTRING_PTR(y); ep = RSTRING_END(y); - while (s < ep && !issign(*s) && !isdigit(*s)) + while (s < ep && !issign(*s) && !isdigit((unsigned char)*s)) s++; if (s >= ep) goto no_year; bp = s; @@ -199,7 +199,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L199 s = RSTRING_PTR(m); ep = RSTRING_END(m); - while (s < ep && !isdigit(*s)) + while (s < ep && !isdigit((unsigned char)*s)) s++; if (s >= ep) goto no_month; bp = s; @@ -225,7 +225,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L225 s = RSTRING_PTR(d); ep = RSTRING_END(d); - while (s < ep && !isdigit(*s)) + while (s < ep && !isdigit((unsigned char)*s)) s++; if (s >= ep) goto no_mday; bp = s; @@ -364,9 +364,9 @@ static int https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L364 str_end_with_word(const char *s, long l, const char *w) { int n = (int)strlen(w); - if (l <= n || !isspace(s[l - n - 1])) return 0; + if (l <= n || !isspace((unsigned char)s[l - n - 1])) return 0; if (strncasecmp(&s[l - n], w, n)) return 0; - do ++n; while (l > n && isspace(s[l - n - 1])); + do ++n; while (l > n && isspace((unsigned char)s[l - n - 1])); return n; } @@ -376,7 +376,7 @@ shrunk_size(const char *s, long l) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L376 long i, ni; int sp = 0; for (i = ni = 0; i < l; ++i) { - if (!isspace(s[i])) { + if (!isspace((unsigned char)s[i])) { if (sp) ni++; sp = 0; ni++; @@ -394,7 +394,7 @@ shrink_space(char *d, const char *s, long l) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L394 long i, ni; int sp = 0; for (i = ni = 0; i < l; ++i) { - if (!isspace(s[i])) { + if (!isspace((unsigned char)s[i])) { if (sp) d[ni++] = ' '; sp = 0; d[ni++] = s[i]; @@ -754,8 +754,8 @@ check_year_width(VALUE y) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L754 l = RSTRING_LEN(y); if (l < 2) return 0; s = RSTRING_PTR(y); - if (!isdigit(s[1])) return 0; - return (l == 2 || !isdigit(s[2])); + if (!isdigit((unsigned char)s[1])) return 0; + return (l == 2 || !isdigit((unsigned char)s[2])); } static int -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/