* pack.c (pack_unpack): output characters even if the input doesn't
have paddings. [Bug #8286] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2446c96547
commit
3e2fdaf1dd
@ -1,3 +1,8 @@
|
|||||||
|
Thu Apr 18 13:35:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* pack.c (pack_unpack): output characters even if the input doesn't
|
||||||
|
have paddings. [Bug #8286]
|
||||||
|
|
||||||
Thu Apr 18 08:20:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu Apr 18 08:20:48 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* common.mk (clean-ext): remove timestamps.
|
* common.mk (clean-ext): remove timestamps.
|
||||||
|
4
pack.c
4
pack.c
@ -2006,9 +2006,9 @@ pack_unpack(VALUE str, VALUE fmt)
|
|||||||
*ptr++ = castchar(c << 6 | d);
|
*ptr++ = castchar(c << 6 | d);
|
||||||
}
|
}
|
||||||
if (a != -1 && b != -1) {
|
if (a != -1 && b != -1) {
|
||||||
if (c == -1 && *s == '=')
|
if (c == -1)
|
||||||
*ptr++ = castchar(a << 2 | b >> 4);
|
*ptr++ = castchar(a << 2 | b >> 4);
|
||||||
else if (c != -1 && *s == '=') {
|
else {
|
||||||
*ptr++ = castchar(a << 2 | b >> 4);
|
*ptr++ = castchar(a << 2 | b >> 4);
|
||||||
*ptr++ = castchar(b << 4 | c >> 2);
|
*ptr++ = castchar(b << 4 | c >> 2);
|
||||||
}
|
}
|
||||||
|
@ -545,6 +545,10 @@ EXPECTED
|
|||||||
assert_equal(["\377"], "/w==\n".unpack("m"))
|
assert_equal(["\377"], "/w==\n".unpack("m"))
|
||||||
assert_equal(["\377\377"], "//8=\n".unpack("m"))
|
assert_equal(["\377\377"], "//8=\n".unpack("m"))
|
||||||
assert_equal(["\377\377\377"], "////\n".unpack("m"))
|
assert_equal(["\377\377\377"], "////\n".unpack("m"))
|
||||||
|
assert_equal([""], "A\n".unpack("m"))
|
||||||
|
assert_equal(["\0"], "AA\n".unpack("m"))
|
||||||
|
assert_equal(["\0"], "AA=\n".unpack("m"))
|
||||||
|
assert_equal(["\0\0"], "AAA\n".unpack("m"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pack_unpack_m0
|
def test_pack_unpack_m0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user