ext/date/date_parse.c in date-3.0.0 vs ext/date/date_parse.c in date-3.0.1
- old
+ new
@@ -68,11 +68,11 @@
static size_t
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;
}
static void
s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
@@ -108,11 +108,11 @@
const char *s, *bp, *ep;
size_t l;
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;
if (issign((unsigned char)*s))
s++;
@@ -160,11 +160,11 @@
size_t l;
VALUE iy;
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;
if (issign(*s)) {
s++;
@@ -197,11 +197,11 @@
size_t l;
VALUE im;
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;
l = digit_span(s, ep);
ep = s + l;
@@ -223,11 +223,11 @@
size_t l;
VALUE id;
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;
l = digit_span(s, ep);
ep = s + l;
@@ -362,23 +362,23 @@
static int
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;
}
static long
shrunk_size(const char *s, long l)
{
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++;
}
else {
@@ -392,11 +392,11 @@
shrink_space(char *d, const char *s, long l)
{
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];
}
else {
@@ -752,11 +752,11 @@
long l;
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
check_apost(VALUE a, VALUE b, VALUE c)
{