[前][次][番号順一覧][スレッド一覧]

ruby-changes:22839

From: tadf <ko1@a...>
Date: Sat, 3 Mar 2012 12:14:39 +0900 (JST)
Subject: [ruby-changes:22839] tadf:r34888 (trunk): * ext/date/date_{parse,strptime}.c .

tadf	2012-03-03 12:14:27 +0900 (Sat, 03 Mar 2012)

  New Revision: 34888

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34888

  Log:
    * ext/date/date_{parse,strptime}.c [ruby-dev:45303].

  Modified files:
    trunk/ChangeLog
    trunk/ext/date/date_parse.c
    trunk/ext/date/date_strptime.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34887)
+++ ChangeLog	(revision 34888)
@@ -1,3 +1,7 @@
+Sat Mar  3 12:12:16 2012  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_{parse,strptime}.c [ruby-dev:45303].
+
 Sat Mar  3 10:09:21 2012  Aaron Patterson <aaron@t...>
 
 	* lib/xmlrpc/client.rb (initialize): net/http defaults to 1_2 in 1.8+,
Index: ext/date/date_strptime.c
===================================================================
--- ext/date/date_strptime.c	(revision 34887)
+++ ext/date/date_strptime.c	(revision 34888)
@@ -58,14 +58,15 @@
 static int
 num_pattern_p(const char *s)
 {
-    if (isdigit(*s))
+    if (isdigit((unsigned char)*s))
 	return 1;
     if (*s == '%') {
 	s++;
 	if (*s == 'E' || *s == 'O')
 	    s++;
 	if (*s &&
-	    (strchr("CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy", *s) || isdigit(*s)))
+	    (strchr("CDdeFGgHIjkLlMmNQRrSsTUuVvWwXxYy", *s) ||
+	     isdigit((unsigned char)*s)))
 	    return 1;
     }
     return 0;
@@ -624,7 +625,7 @@
 	  case '\v':
 	  case '\f':
 	  case '\r':
-	    while (isspace(str[si]))
+	    while (isspace((unsigned char)str[si]))
 		si++;
 	    fi++;
 	    break;
Index: ext/date/date_parse.c
===================================================================
--- ext/date/date_parse.c	(revision 34887)
+++ ext/date/date_parse.c	(revision 34888)
@@ -89,10 +89,10 @@
 	size_t l;
 
 	s = RSTRING_PTR(y);
-	while (!issign(*s) && !isdigit(*s))
+	while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s))
 	    s++;
 	bp = s;
-	if (issign(*s))
+	if (issign((unsigned char)*s))
 	    s++;
 	l = strspn(s, "0123456789");
 	ep = s + l;
@@ -138,7 +138,7 @@
 	VALUE iy;
 
 	s = RSTRING_PTR(y);
-	while (!issign(*s) && !isdigit(*s))
+	while (!issign((unsigned char)*s) && !isdigit((unsigned char)*s))
 	    s++;
 	bp = s;
 	if (issign(*s)) {
@@ -170,7 +170,7 @@
 	VALUE im;
 
 	s = RSTRING_PTR(m);
-	while (!isdigit(*s))
+	while (!isdigit((unsigned char)*s))
 	    s++;
 	bp = s;
 	l = strspn(s, "0123456789");
@@ -192,7 +192,7 @@
 	VALUE id;
 
 	s = RSTRING_PTR(d);
-	while (!isdigit(*s))
+	while (!isdigit((unsigned char)*s))
 	    s++;
 	bp = s;
 	l = strspn(s, "0123456789");
@@ -381,14 +381,14 @@
     dest = d = ALLOCA_N(char, l + 1);
 
     for (i = 0; i < l; i++) {
-	if (isspace(s[i]) || s[i] == '\0') {
+	if (isspace((unsigned char)s[i]) || s[i] == '\0') {
 	    if (!sp)
 		*d++ = ' ';
 	    sp = 1;
 	}
 	else {
-	    if (isalpha(s[i]))
-		*d++ = tolower(s[i]);
+	    if (isalpha((unsigned char)s[i]))
+		*d++ = tolower((unsigned char)s[i]);
 	    else
 		*d++ = s[i];
 	    sp = 0;
@@ -1413,7 +1413,7 @@
 		s3 = s1;
 	    zone = rb_str_new2(s3);
 	    set_hash("zone", zone);
-	    if (isdigit(*s1))
+	    if (isdigit((unsigned char)*s1))
 		*--s1 = '+';
 	    set_hash("offset", date_zone_to_diff(rb_str_new2(s1)));
 	}
@@ -1520,9 +1520,9 @@
 
     flags = 0;
     for (i = 0; i < RSTRING_LEN(s); i++) {
-	if (isalpha(RSTRING_PTR(s)[i]))
+	if (isalpha((unsigned char)RSTRING_PTR(s)[i]))
 	    flags |= HAVE_ALPHA;
-	if (isdigit(RSTRING_PTR(s)[i]))
+	if (isdigit((unsigned char)RSTRING_PTR(s)[i]))
 	    flags |= HAVE_DIGIT;
 	if (RSTRING_PTR(s)[i] == '-')
 	    flags |= HAVE_DASH;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]