From 5cb3b9c22d21157fbd762e39def74c3f1e1e7dbe Mon Sep 17 00:00:00 2001 From: yugui Date: Fri, 12 Dec 2008 14:53:49 +0000 Subject: merges r20580 from trunk into ruby_1_9_1. * pack.c (pack_pack): fixed length for odd length string. [ruby-dev:37283] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20672 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 ae0218afce..3f20d53c58 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