ruby-changes:9028
From: yugui <ko1@a...>
Date: Sat, 6 Dec 2008 17:56:16 +0900 (JST)
Subject: [ruby-changes:9028] Ruby:r20564 (trunk): * pack.c (pack_pack): 'u0' is not special differently from 'm0'.
yugui 2008-12-06 17:55:57 +0900 (Sat, 06 Dec 2008) New Revision: 20564 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20564 Log: * pack.c (pack_pack): 'u0' is not special differently from 'm0'. Modified files: trunk/ChangeLog trunk/pack.c trunk/test/ruby/test_pack.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 20563) +++ ChangeLog (revision 20564) @@ -1,3 +1,7 @@ +Sat Dec 6 17:51:35 2008 Yuki Sonoda (Yugui) <yugui@y...> + + * pack.c (pack_pack): 'u0' is not special differently from 'm0'. + Sat Dec 6 14:35:06 2008 NARUSE, Yui <naruse@r...> * pack.c (pack_pack): set US-ASCII and CODERANGE_7BIT Index: pack.c =================================================================== --- pack.c (revision 20563) +++ pack.c (revision 20564) @@ -901,7 +901,7 @@ ptr = RSTRING_PTR(from); plen = RSTRING_LEN(from); - if (len == 0) { + if (len == 0 && type == 'm') { encodes(res, ptr, plen, type, 0); ptr += plen; break; Index: test/ruby/test_pack.rb =================================================================== --- test/ruby/test_pack.rb (revision 20563) +++ test/ruby/test_pack.rb (revision 20564) @@ -349,6 +349,10 @@ assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u")) assert_equal("&86)C9&5F\n#9VAI\n", ["abcdefghi"].pack("u6")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u0")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u1")) + assert_equal("M86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A\n!80``\n", ["a"*46].pack("u2")) + assert_equal([""], "".unpack("u")) assert_equal(["a"], "!80``\n".unpack("u")) assert_equal(["abc"], "#86)C\n".unpack("u")) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/