зеркало из https://github.com/github/ruby.git
* pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
713e99cec2
Коммит
e8665a6bc2
|
@ -1,3 +1,7 @@
|
|||
Thu Feb 18 21:50:00 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* pack.c (pack_unpack): call PACK_ITEM_ADJUST for 'Q'.
|
||||
|
||||
Thu Feb 18 02:14:26 2010 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* io.c (io_fread, io_getpartial, io_read, io_sysread): by using lock,
|
||||
|
|
3
pack.c
3
pack.c
|
@ -1605,6 +1605,7 @@ pack_unpack(VALUE str, VALUE fmt)
|
|||
}
|
||||
PACK_ITEM_ADJUST();
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
PACK_LENGTH_ADJUST(unsigned long,4);
|
||||
while (len-- > 0) {
|
||||
|
@ -1625,6 +1626,7 @@ pack_unpack(VALUE str, VALUE fmt)
|
|||
}
|
||||
PACK_ITEM_ADJUST();
|
||||
break;
|
||||
|
||||
case 'Q':
|
||||
PACK_LENGTH_ADJUST_SIZE(QUAD_SIZE);
|
||||
while (len-- > 0) {
|
||||
|
@ -1632,6 +1634,7 @@ pack_unpack(VALUE str, VALUE fmt)
|
|||
s += QUAD_SIZE;
|
||||
UNPACK_PUSH(rb_quad_unpack(tmp, 0));
|
||||
}
|
||||
PACK_ITEM_ADJUST();
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
|
|
|
@ -491,4 +491,11 @@ class TestPack < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче