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

ruby-changes:19808

From: yugui <ko1@a...>
Date: Tue, 31 May 2011 12:22:52 +0900 (JST)
Subject: [ruby-changes:19808] yugui:r31853 (ruby_1_9_2): merges r29851 from trunk into ruby_1_9_2.

yugui	2011-05-31 12:18:30 +0900 (Tue, 31 May 2011)

  New Revision: 31853

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

  Log:
    merges r29851 from trunk into ruby_1_9_2.
    --
    * time.c (time_zone): use rb_locale_str_new_cstr to set encoding
      as locale and convert its content to internal encoding.
      [ruby-core:33278]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/test/ruby/test_time.rb
    branches/ruby_1_9_2/time.c
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/time.c
===================================================================
--- ruby_1_9_2/time.c	(revision 31852)
+++ ruby_1_9_2/time.c	(revision 31853)
@@ -4151,11 +4151,11 @@
     MAKE_TM(time, tobj);
 
     if (TIME_UTC_P(tobj)) {
-	return rb_str_new2("UTC");
+	return rb_obj_untaint(rb_locale_str_new_cstr("UTC"));
     }
     if (tobj->vtm.zone == NULL)
         return Qnil;
-    return rb_str_new2(tobj->vtm.zone);
+    return rb_obj_untaint(rb_locale_str_new_cstr(tobj->vtm.zone));
 }
 
 /*
Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 31852)
+++ ruby_1_9_2/ChangeLog	(revision 31853)
@@ -1,3 +1,9 @@
+Mon Nov 22 14:22:45 2010  NARUSE, Yui  <naruse@r...>
+
+	* time.c (time_zone): use rb_locale_str_new_cstr to set encoding
+	  as locale and convert its content to internal encoding.
+	  [ruby-core:33278]
+
 Fri Jan 14 14:01:12 2011  NARUSE, Yui  <naruse@r...>
 
 	* pack.c (pack_unpack): the resulted string of unpack('M') must have
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 31852)
+++ ruby_1_9_2/version.h	(revision 31853)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 268
+#define RUBY_PATCHLEVEL 269
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/ruby/test_time.rb
===================================================================
--- ruby_1_9_2/test/ruby/test_time.rb	(revision 31852)
+++ ruby_1_9_2/test/ruby/test_time.rb	(revision 31853)
@@ -469,6 +469,7 @@
     assert_equal(1, T2000.yday)
     assert_equal(false, T2000.isdst)
     assert_equal("UTC", T2000.zone)
+    assert_equal(Encoding.find("locale"), T2000.zone.encoding)
     assert_equal(0, T2000.gmt_offset)
     assert(!T2000.sunday?)
     assert(!T2000.monday?)
@@ -490,6 +491,7 @@
     assert_equal(t.yday, Time.at(946684800).yday)
     assert_equal(t.isdst, Time.at(946684800).isdst)
     assert_equal(t.zone, Time.at(946684800).zone)
+    assert_equal(Encoding.find("locale"), Time.at(946684800).zone.encoding)
     assert_equal(t.gmt_offset, Time.at(946684800).gmt_offset)
     assert_equal(t.sunday?, Time.at(946684800).sunday?)
     assert_equal(t.monday?, Time.at(946684800).monday?)

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

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