ruby-changes:14840
From: akr <ko1@a...>
Date: Thu, 18 Feb 2010 21:53:54 +0900 (JST)
Subject: [ruby-changes:14840] Ruby:r26705 (trunk): * pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'.
akr 2010-02-18 21:53:31 +0900 (Thu, 18 Feb 2010) New Revision: 26705 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26705 Log: * pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'. Modified files: trunk/ChangeLog trunk/pack.c trunk/test/ruby/test_pack.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 26704) +++ ChangeLog (revision 26705) @@ -1,3 +1,7 @@ +Thu Feb 18 21:50:00 2010 Tanaka Akira <akr@f...> + + * pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'. + Thu Feb 18 02:14:26 2010 Yusuke Endoh <mame@t...> * io.c (io_fread, io_getpartial, io_read, io_sysread): by using lock, Index: pack.c =================================================================== --- pack.c (revision 26704) +++ pack.c (revision 26705) @@ -1605,6 +1605,7 @@ } PACK_ITEM_ADJUST(); break; + case 'L': PACK_LENGTH_ADJUST(unsigned long,4); while (len-- > 0) { @@ -1625,6 +1626,7 @@ } PACK_ITEM_ADJUST(); break; + case 'Q': PACK_LENGTH_ADJUST_SIZE(QUAD_SIZE); while (len-- > 0) { @@ -1632,6 +1634,7 @@ s += QUAD_SIZE; UNPACK_PUSH(rb_quad_unpack(tmp, 0)); } + PACK_ITEM_ADJUST(); break; case 'n': Index: test/ruby/test_pack.rb =================================================================== --- test/ruby/test_pack.rb (revision 26704) +++ test/ruby/test_pack.rb (revision 26705) @@ -491,4 +491,11 @@ def test_length_too_big assert_raise(RangeError) { [].pack("C100000000000000000000") } end + + def test_short_string + %w[n N v V s S l L q Q].each {|fmt| + str = [1].pack(fmt) + assert_equal([1,nil], str.unpack("#{fmt}2")) + } + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/