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

ruby-changes:3482

From: ko1@a...
Date: 10 Jan 2008 15:43:08 +0900
Subject: [ruby-changes:3482] matz - Ruby:r14975 (trunk): * io.c (io_encoding_set): handle nil for v1.

matz	2008-01-10 15:42:49 +0900 (Thu, 10 Jan 2008)

  New Revision: 14975

  Modified files:
    trunk/ChangeLog
    trunk/io.c

  Log:
    * io.c (io_encoding_set): handle nil for v1.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14975&r2=14974&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=14975&r2=14974&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14974)
+++ ChangeLog	(revision 14975)
@@ -3,6 +3,8 @@
 	* io.c (io_encoding_set): IO.pipe("euc-jp", nil) should work as
 	  IO.pipe("euc-jp", nil).  [ruby-dev:33000]
 
+	* io.c (io_encoding_set): handle nil for v1.
+
 Thu Jan 10 02:41:22 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* io.c (rb_io_binmode): should not alter encoding.  [ruby-dev:32918]
Index: io.c
===================================================================
--- io.c	(revision 14974)
+++ io.c	(revision 14975)
@@ -5627,12 +5627,17 @@
 	fptr->enc = rb_to_encoding(v2);
     }
     else if (argc == 1) {
-	VALUE tmp = rb_check_string_type(v1);
-	if (!NIL_P(tmp)) {
-	    mode_enc(fptr, StringValueCStr(tmp));
+	if if (NIL_P(v1)) {
+	    fptr->enc = 0;
 	}
 	else {
-	    fptr->enc = rb_to_encoding(v1);
+	    VALUE tmp = rb_check_string_type(v1);
+	    if (!NIL_P(tmp)) {
+		mode_enc(fptr, StringValueCStr(tmp));
+	    }
+	    else {
+		fptr->enc = rb_to_encoding(v1);
+	    }
 	}
     }
 }

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

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