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

ruby-changes:18013

From: yugui <ko1@a...>
Date: Thu, 2 Dec 2010 17:06:43 +0900 (JST)
Subject: [ruby-changes:18013] Ruby:r30034 (ruby_1_9_2): merges r29435 from trunk into ruby_1_9_2.

yugui	2010-12-02 17:06:23 +0900 (Thu, 02 Dec 2010)

  New Revision: 30034

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

  Log:
    merges r29435 from trunk into ruby_1_9_2.
    --
    * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
      a T_FILE. [ruby-dev:42356]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/io.c
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 30033)
+++ ruby_1_9_2/ChangeLog	(revision 30034)
@@ -1,3 +1,8 @@
+Mon Oct 11 06:11:30 2010  NARUSE, Yui  <naruse@r...>
+
+	* io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
+	  a T_FILE. [ruby-dev:42356]
+
 Fri Oct  8 00:24:54 2010  James Edward Gray II  <jeg2@r...>
 
 	* lib/csv.rb: Fixing documentation typos.  [ruby-core:32712]
Index: ruby_1_9_2/io.c
===================================================================
--- ruby_1_9_2/io.c	(revision 30033)
+++ ruby_1_9_2/io.c	(revision 30034)
@@ -137,7 +137,7 @@
 
 static VALUE argf;
 
-static ID id_write, id_read, id_getc, id_flush, id_readpartial;
+static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
 static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
 static VALUE sym_textmode, sym_binmode, sym_autoclose;
 
@@ -8661,6 +8661,10 @@
     rb_io_t *fptr;
     VALUE v1, v2, opt;
 
+    if (TYPE(io) != T_FILE) {
+        return rb_funcall2(io, id_set_encoding, argc, argv);
+    }
+
     opt = pop_last_hash(&argc, argv);
     rb_scan_args(argc, argv, "11", &v1, &v2);
     GetOpenFile(io, fptr);
@@ -9838,6 +9842,7 @@
     id_getc = rb_intern("getc");
     id_flush = rb_intern("flush");
     id_readpartial = rb_intern("readpartial");
+    id_set_encoding = rb_intern("set_encoding");
 
     rb_define_global_function("syscall", rb_f_syscall, -1);
 
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 30033)
+++ ruby_1_9_2/version.h	(revision 30034)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 64
+#define RUBY_PATCHLEVEL 65
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1

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

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