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

ruby-changes:20909

From: tadf <ko1@a...>
Date: Sat, 13 Aug 2011 09:12:16 +0900 (JST)
Subject: [ruby-changes:20909] tadf:r32958 (trunk): * ext/date/date_core.c (date_strftime_alloc): followed the change

tadf	2011-08-13 09:12:05 +0900 (Sat, 13 Aug 2011)

  New Revision: 32958

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

  Log:
    * ext/date/date_core.c (date_strftime_alloc): followed the change
      of r32885.
    * doc/NEWS-1.9.3: followed the above change.

  Modified files:
    trunk/ChangeLog
    trunk/doc/NEWS-1.9.3
    trunk/ext/date/date_core.c

Index: doc/NEWS-1.9.3
===================================================================
--- doc/NEWS-1.9.3	(revision 32957)
+++ doc/NEWS-1.9.3	(revision 32958)
@@ -145,10 +145,10 @@
 
   * A method strftime cannot produce huge output (same as Time's one).
 
-    * Even though Date/DateTime can handle far dates, the following gives
-      an empty string:
+    * Even though Date/DateTime can handle far dates, the following causes
+      an exception.
 
-      DateTime.new(1<<10000).strftime('%Y')  #=> ""
+      DateTime.new(1<<10000).strftime('%Y')  # Errno::ERANGE
 
   * Changed the format of inspect.
   * Changed the format of marshal (but, can load old dumps).
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 32957)
+++ ChangeLog	(revision 32958)
@@ -1,3 +1,9 @@
+Sat Aug 13 09:05:16 2011  Tadayoshi Funaba  <tadf@d...>
+
+	* ext/date/date_core.c (date_strftime_alloc): followed the change
+	  of r32885.
+	* doc/NEWS-1.9.3: followed the above change.
+
 Sat Aug 13 08:55:38 2011  Aaron Patterson <aaron@t...>
 
 	* ext/psych/lib/psych/scalar_scanner.rb: Only consider strings
Index: ext/date/date_core.c
===================================================================
--- ext/date/date_core.c	(revision 32957)
+++ ext/date/date_core.c	(revision 32958)
@@ -6721,8 +6721,12 @@
 	 * if the buffer is 1024 times bigger than the length of the
 	 * format string, it's not failing for lack of room.
 	 */
-	if (len > 0 || size >= 1024 * flen) break;
+	if (len > 0) break;
 	xfree(*buf);
+	if (size >= 1024 * flen) {
+	    rb_sys_fail(format);
+	    break;
+	}
     }
     return len;
 }

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

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