mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
pack.c: round down too long uuencode width
* pack.c (pack_pack): round down too long uuencode width. folding width in uuencode format cannot be longer than 63 bytes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
68a01f9cdf
commit
c0087df044
3 changed files with 11 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Jul 18 23:57:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* pack.c (pack_pack): round down too long uuencode width. folding
|
||||
width in uuencode format cannot be longer than 63 bytes.
|
||||
|
||||
Wed Jul 18 23:04:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/dbm/dbm.c (fdbm_empty_p): fix wrong condtion introduced in r36438.
|
||||
|
|
2
pack.c
2
pack.c
|
@ -927,6 +927,8 @@ pack_pack(VALUE ary, VALUE fmt)
|
|||
}
|
||||
if (len <= 2)
|
||||
len = 45;
|
||||
else if (len > 63 && type == 'u')
|
||||
len = 63;
|
||||
else
|
||||
len = len / 3 * 3;
|
||||
while (plen > 0) {
|
||||
|
|
|
@ -496,6 +496,10 @@ class TestPack < Test::Unit::TestCase
|
|||
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(<<EXPECTED, ["a"*80].pack("u68"))
|
||||
_86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A86%A
|
||||
186%A86%A86%A86%A86%A86$`
|
||||
EXPECTED
|
||||
|
||||
assert_equal([""], "".unpack("u"))
|
||||
assert_equal(["a"], "!80``\n".unpack("u"))
|
||||
|
|
Loading…
Reference in a new issue