ruby-changes:37716
From: normal <ko1@a...>
Date: Mon, 2 Mar 2015 06:03:37 +0900 (JST)
Subject: [ruby-changes:37716] normal:r49797 (trunk): io/wait: fix return value for buffered read
normal 2015-03-02 06:03:22 +0900 (Mon, 02 Mar 2015) New Revision: 49797 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49797 Log: io/wait: fix return value for buffered read * ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX Thanks to Yura Sokolov <funny.falcon@g...> [ruby-core:68369] [Bug#10923] * test/io/wait/test_io_wait.rb (test_nread_buffered): fix broken test Modified files: trunk/ChangeLog trunk/ext/io/wait/wait.c trunk/test/io/wait/test_io_wait.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49796) +++ ChangeLog (revision 49797) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Mar 2 06:01:41 2015 Eric Wong <e@8...> + + * ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX + Thanks to Yura Sokolov <funny.falcon@g...> + [ruby-core:68369] [Bug#10923] + * test/io/wait/test_io_wait.rb (test_nread_buffered): + fix broken test + Sun Mar 1 20:21:16 2015 Nobuyoshi Nakada <nobu@r...> * configure.in (RUBY_REPLACE_TYPE): restore convertible type from Index: ext/io/wait/wait.c =================================================================== --- ext/io/wait/wait.c (revision 49796) +++ ext/io/wait/wait.c (revision 49797) @@ -62,7 +62,7 @@ io_nread(VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L62 GetOpenFile(io, fptr); rb_io_check_readable(fptr); len = rb_io_read_pending(fptr); - if (len > 0) return len; + if (len > 0) return INT2FIX(len); if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0); if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0); if (n > 0) return ioctl_arg2num(n); Index: test/io/wait/test_io_wait.rb =================================================================== --- test/io/wait/test_io_wait.rb (revision 49796) +++ test/io/wait/test_io_wait.rb (revision 49797) @@ -31,7 +31,7 @@ class TestIOWait < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/io/wait/test_io_wait.rb#L31 def test_nread_buffered @w.syswrite ".\n!" - assert_equal ".\n", @r.read(2) + assert_equal ".\n", @r.gets assert_equal 1, @r.nread end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/