From 92e0f99d375648b9f12dd25a556eace54a3aa6af Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 8 Dec 2008 09:31:44 +0000 Subject: * pack.c (pack_pack): fixed length for odd length string. [ruby-dev:37283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- pack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pack.c') diff --git a/pack.c b/pack.c index 718f977d35..f353d67c87 100644 --- a/pack.c +++ b/pack.c @@ -620,7 +620,7 @@ pack_pack(VALUE ary, VALUE fmt) long i, j = 0; if (len > plen) { - j = (len - plen + 1)/2; + j = (len + 1) / 2 - (plen + 1) / 2; len = plen; } for (i=0; i++ < len; ptr++) { @@ -651,7 +651,7 @@ pack_pack(VALUE ary, VALUE fmt) long i, j = 0; if (len > plen) { - j = (len - plen + 1)/2; + j = (len + 1) / 2 - (plen + 1) / 2; len = plen; } for (i=0; i++ < len; ptr++) { -- cgit v1.2.3