summaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-08 09:31:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-08 09:31:44 +0000
commit8469a17ed75f506ac0499e34f316ec0f125864be (patch)
treeb376296d9d2364db4007faa8ea21f15d42a11e22 /pack.c
parent2c23f5d489e7d9ba6b5093e00928b3785524faaa (diff)
downloadruby-8469a17ed75f506ac0499e34f316ec0f125864be.tar.gz
ruby-8469a17ed75f506ac0499e34f316ec0f125864be.tar.xz
ruby-8469a17ed75f506ac0499e34f316ec0f125864be.zip
* pack.c (pack_pack): fixed length for odd length string.
[ruby-dev:37283] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@20580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pack.c b/pack.c
index 718f977d3..f353d67c8 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++) {