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

ruby-changes:13006

From: nobu <ko1@a...>
Date: Sat, 5 Sep 2009 06:30:03 +0900 (JST)
Subject: [ruby-changes:13006] Ruby:r24751 (ruby_1_8): * io.c (rb_io_binmode): check if closed regardless platforms.

nobu	2009-09-05 06:29:29 +0900 (Sat, 05 Sep 2009)

  New Revision: 24751

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

  Log:
    * io.c (rb_io_binmode): check if closed regardless platforms.
      [ruby-core:25363]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/io.c
    branches/ruby_1_8/test/ruby/test_io.rb
    branches/ruby_1_8/version.h

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 24750)
+++ ruby_1_8/ChangeLog	(revision 24751)
@@ -1,3 +1,8 @@
+Sat Sep  5 06:29:22 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* io.c (rb_io_binmode): check if closed regardless platforms.
+	  [ruby-core:25363]
+
 Fri Sep  4 20:40:57 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* numeric.c (round): added declaration.  [ruby-dev:39222]
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 24750)
+++ ruby_1_8/version.h	(revision 24751)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.8.8"
-#define RUBY_RELEASE_DATE "2009-09-04"
+#define RUBY_RELEASE_DATE "2009-09-05"
 #define RUBY_VERSION_CODE 188
-#define RUBY_RELEASE_CODE 20090904
+#define RUBY_RELEASE_CODE 20090905
 #define RUBY_PATCHLEVEL -1
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 8
 #define RUBY_RELEASE_YEAR 2009
 #define RUBY_RELEASE_MONTH 9
-#define RUBY_RELEASE_DAY 4
+#define RUBY_RELEASE_DAY 5
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: ruby_1_8/io.c
===================================================================
--- ruby_1_8/io.c	(revision 24750)
+++ ruby_1_8/io.c	(revision 24751)
@@ -2713,11 +2713,11 @@
 rb_io_binmode(io)
     VALUE io;
 {
-#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
     rb_io_t *fptr;
 
     GetOpenFile(io, fptr);
-#ifdef __human68k__
+#if (defined(O_BINARY) && O_BINARY) || (defined(_IOBIN) && _IOBIN)
+#if (defined(_IOBIN) && _IOBIN)	/* __human68k__ */
     if (fptr->f)
 	fmode(fptr->f, _IOBIN);
     if (fptr->f2)
Index: ruby_1_8/test/ruby/test_io.rb
===================================================================
--- ruby_1_8/test/ruby/test_io.rb	(revision 24750)
+++ ruby_1_8/test/ruby/test_io.rb	(revision 24751)
@@ -1,5 +1,6 @@
 require 'test/unit'
 require 'tmpdir'
+require 'tempfile'
 
 class TestIO < Test::Unit::TestCase
   def mkcdtmpdir
@@ -17,4 +18,20 @@
     assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]")
     r.close
   end
+
+  def make_tempfile
+    t = Tempfile.new("foo")
+    t.binmode
+    t.puts "foo"
+    t.puts "bar"
+    t.puts "baz"
+    t.close
+    t
+  end
+
+  def test_binmode_after_closed
+    t = make_tempfile
+    t.close
+    assert_raise(IOError) {t.binmode}
+  end
 end

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

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