ruby-changes:5185
From: mame <ko1@a...>
Date: Thu, 29 May 2008 22:30:26 +0900 (JST)
Subject: [ruby-changes:5185] Ruby:r16680 (trunk): * io.c (argf_external_encoding, argf_internal_encoding): fix SEGV by
mame 2008-05-29 22:30:09 +0900 (Thu, 29 May 2008)
New Revision: 16680
Modified files:
trunk/ChangeLog
trunk/io.c
Log:
* io.c (argf_external_encoding, argf_internal_encoding): fix SEGV by
ARGF.external_encoding.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16680&r2=16679&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/io.c?r1=16680&r2=16679&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16679)
+++ ChangeLog (revision 16680)
@@ -1,3 +1,8 @@
+Thu May 29 22:29:39 2008 Yusuke Endoh <mame@t...>
+
+ * io.c (argf_external_encoding, argf_internal_encoding): fix SEGV by
+ ARGF.external_encoding.
+
Wed May 28 18:05:28 2008 Akinori MUSHA <knu@i...>
* array.c (rb_ary_nitems, Init_Array): Axe Array#nitems().
Index: io.c
===================================================================
--- io.c (revision 16679)
+++ io.c (revision 16680)
@@ -6942,13 +6942,19 @@
static VALUE
argf_external_encoding(VALUE argf)
{
- return rb_io_external_encoding(current_file);
+ if (!RTEST(current_file)) {
+ return rb_enc_from_encoding(rb_default_external_encoding());
+ }
+ return rb_io_external_encoding(rb_io_check_io(current_file));
}
static VALUE
argf_internal_encoding(VALUE argf)
{
- return rb_io_internal_encoding(current_file);
+ if (!RTEST(current_file)) {
+ return rb_enc_from_encoding(rb_default_external_encoding());
+ }
+ return rb_io_internal_encoding(rb_io_check_io(current_file));
}
static VALUE
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/