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

ruby-changes:8819

From: matz <ko1@a...>
Date: Tue, 25 Nov 2008 23:25:04 +0900 (JST)
Subject: [ruby-changes:8819] Ruby:r20355 (trunk): * strftime.c (rb_strftime): should not swallow incomplete

matz	2008-11-25 23:24:47 +0900 (Tue, 25 Nov 2008)

  New Revision: 20355

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

  Log:
    * strftime.c (rb_strftime): should not swallow incomplete
      formatter, e.g. "%E".  [ruby-dev:37170] fix: #787
    * strftime.c (rb_strftime): clear flags before processing unknown
      formatter, e.g. "%i".  [ruby-dev:37180]

  Modified files:
    trunk/ChangeLog
    trunk/strftime.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20354)
+++ ChangeLog	(revision 20355)
@@ -1,3 +1,11 @@
+Tue Nov 25 15:54:07 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* strftime.c (rb_strftime): should not swallow incomplete
+	  formatter, e.g. "%E".  [ruby-dev:37170] fix: #787
+
+	* strftime.c (rb_strftime): clear flags before processing unknown
+	  formatter, e.g. "%i".  [ruby-dev:37180]
+
 Tue Nov 25 10:35:29 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* strftime.c (rb_strftime): "%^P" should convert to upper case.
Index: strftime.c
===================================================================
--- strftime.c	(revision 20354)
+++ strftime.c	(revision 20355)
@@ -310,8 +310,8 @@
 	again:
 		switch (*++format) {
 		case '\0':
-			*s++ = '%';
-			goto out;
+			format--;
+			goto unknown;
 
 		case '%':
 			*s++ = '%';
@@ -762,8 +762,11 @@
 
 		default:
 		unknown:
+			i = format - sp + 1;
 			tp = sp;
-			i = format - sp + 1;
+			precision = -1;
+			flags = 0;
+			padding = 0;
 			break;
 		}
 		if (i) {
@@ -786,7 +789,6 @@
 			}
 		}
 	}
-out:
 	if (s >= endp) {
 		goto err;
 	}

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

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