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

ruby-changes:18519

From: naruse <ko1@a...>
Date: Fri, 14 Jan 2011 14:07:40 +0900 (JST)
Subject: [ruby-changes:18519] Ruby:r30542 (trunk): * pack.c (pack_unpack): the resulted string of unpack('M') must have

naruse	2011-01-14 14:03:22 +0900 (Fri, 14 Jan 2011)

  New Revision: 30542

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

  Log:
    * pack.c (pack_unpack): the resulted string of unpack('M') must have
      ASCII-8BIT encoding (and ENC_CODERANGE_VALID). [ruby-core:34482]

  Modified files:
    trunk/ChangeLog
    trunk/pack.c
    trunk/test/ruby/test_pack.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30541)
+++ ChangeLog	(revision 30542)
@@ -1,3 +1,8 @@
+Fri Jan 14 14:01:12 2011  NARUSE, Yui  <naruse@r...>
+
+	* pack.c (pack_unpack): the resulted string of unpack('M') must have
+	  ASCII-8BIT encoding (and ENC_CODERANGE_VALID). [ruby-core:34482]
+
 Fri Jan 14 13:38:58 2011  NARUSE, Yui  <naruse@r...>
 
 	* ext/zlib/zlib.c (gzfile_check_footer): ISIZE (Input SIZE) in
Index: pack.c
===================================================================
--- pack.c	(revision 30541)
+++ pack.c	(revision 30542)
@@ -2024,7 +2024,7 @@
 		    s++;
 		}
 		rb_str_set_len(buf, ptr - RSTRING_PTR(buf));
-		ENCODING_CODERANGE_SET(buf, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
+		ENCODING_CODERANGE_SET(buf, rb_ascii8bit_encindex(), ENC_CODERANGE_VALID);
 		UNPACK_PUSH(buf);
 	    }
 	    break;
Index: test/ruby/test_pack.rb
===================================================================
--- test/ruby/test_pack.rb	(revision 30541)
+++ test/ruby/test_pack.rb	(revision 30542)
@@ -570,6 +570,8 @@
     assert_equal(["\x0a"], "=0A=\n".unpack("M"))
     assert_equal([""], "=0Z=\n".unpack("M"))
     assert_equal([""], "=\r\n".unpack("M"))
+    assert_equal([""], "=\r\n".unpack("M"))
+    assert_equal(["\xC6\xF7"], "=C6=F7".unpack('M*'))
   end
 
   def test_pack_unpack_P2

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

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