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

ruby-changes:8878

From: yugui <ko1@a...>
Date: Sun, 30 Nov 2008 18:25:06 +0900 (JST)
Subject: [ruby-changes:8878] Ruby:r20415 (ruby_1_9_1): merges r20357 from trunk into ruby_1_9_1.

yugui	2008-11-30 18:23:45 +0900 (Sun, 30 Nov 2008)

  New Revision: 20415

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

  Log:
    merges r20357 from trunk into ruby_1_9_1.
    * strftime.c (STRFTIME): should add padding for %[xXrR] etc.
      [ruby-dev:37185] fix: #792

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/strftime.c

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 20414)
+++ ruby_1_9_1/ChangeLog	(revision 20415)
@@ -1,3 +1,8 @@
+Wed Nov 26 00:26:30 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* strftime.c (STRFTIME): should add padding for %[xXrR] etc.
+	  [ruby-dev:37185] fix: #792
+
 Tue Nov 25 16:26:12 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* array.c (rb_ary_times): taint (and untrust) status should be
Index: ruby_1_9_1/strftime.c
===================================================================
--- ruby_1_9_1/strftime.c	(revision 20414)
+++ ruby_1_9_1/strftime.c	(revision 20415)
@@ -295,7 +295,12 @@
 		do { \
 			i = strftime(s, endp - s, fmt, tm); \
 			if (!i) return 0; \
-			s += i; \
+			if (precision > i) {\
+				memmove(s + precision - i, s, i);\
+				memset(s, padding ? padding : ' ', precision - i); \
+				s += precision;	\
+	                }\
+			else s += i; \
 		} while (0)
 
 		if (*format != '%') {

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

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