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

ruby-changes:18285

From: yugui <ko1@a...>
Date: Thu, 23 Dec 2010 19:49:32 +0900 (JST)
Subject: [ruby-changes:18285] Ruby:r30308 (ruby_1_9_2): merges r30063 from trunk into ruby_1_9_2.

yugui	2010-12-23 19:49:07 +0900 (Thu, 23 Dec 2010)

  New Revision: 30308

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

  Log:
    merges r30063 from trunk into ruby_1_9_2.
    --
    * ext/stringio/stringio.c (strio_getline): round upto next char
      boundary.  [ruby-dev:42674]

  Modified files:
    branches/ruby_1_9_2/ChangeLog
    branches/ruby_1_9_2/ext/stringio/stringio.c
    branches/ruby_1_9_2/test/stringio/test_stringio.rb
    branches/ruby_1_9_2/version.h

Index: ruby_1_9_2/ChangeLog
===================================================================
--- ruby_1_9_2/ChangeLog	(revision 30307)
+++ ruby_1_9_2/ChangeLog	(revision 30308)
@@ -1,3 +1,8 @@
+Fri Dec  3 07:08:42 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/stringio/stringio.c (strio_getline): round upto next char
+	  boundary.  [ruby-dev:42674]
+
 Thu Dec  2 15:31:14 2010  NAKAMURA Usaku  <usa@r...>
 
 	* win32/win32.c (rb_w32_read): more fix. [ruby-core:33513]
Index: ruby_1_9_2/ext/stringio/stringio.c
===================================================================
--- ruby_1_9_2/ext/stringio/stringio.c	(revision 30307)
+++ ruby_1_9_2/ext/stringio/stringio.c	(revision 30308)
@@ -952,7 +952,7 @@
     e = s + RSTRING_LEN(ptr->string);
     s += ptr->pos;
     if (limit > 0 && s + limit < e) {
-	e = s + limit;
+	e = rb_enc_right_char_head(s, s + limit, e, rb_enc_get(ptr->string));
     }
     if (NIL_P(str)) {
 	str = strio_substr(ptr, ptr->pos, e - s);
Index: ruby_1_9_2/version.h
===================================================================
--- ruby_1_9_2/version.h	(revision 30307)
+++ ruby_1_9_2/version.h	(revision 30308)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 113
+#define RUBY_PATCHLEVEL 114
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_2/test/stringio/test_stringio.rb
===================================================================
--- ruby_1_9_2/test/stringio/test_stringio.rb	(revision 30307)
+++ ruby_1_9_2/test/stringio/test_stringio.rb	(revision 30308)
@@ -378,6 +378,12 @@
     assert_equal("a" * 10000 + "zz", f.gets("zz"))
     f = StringIO.new("a" * 10000 + "zz!")
     assert_equal("a" * 10000 + "zz!", f.gets("zzz"))
+
+    bug4112 = '[ruby-dev:42674]'
+    ["a".encode("utf-16be"), "\u3042"].each do |s|
+      assert_equal(s, StringIO.new(s).gets(1), bug4112)
+      assert_equal(s, StringIO.new(s).gets(nil, 1), bug4112)
+    end
   end
 
   def test_each

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

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