summaryrefslogtreecommitdiffhomepage
path: root/src/pack.c
diff options
context:
space:
mode:
authorTomoyuki Sahara <[email protected]>2013-05-08 09:40:24 +0900
committerTomoyuki Sahara <[email protected]>2013-05-08 09:40:24 +0900
commit8c5cb5e782ac03f28ecaa3e2bf77b2062e6be279 (patch)
tree174682c4f75a29e7e560cb5e047d85b435ff761b /src/pack.c
parent7618ca6bb300c7bc1599a6796105cd12c9d03cd7 (diff)
downloadmruby-8c5cb5e782ac03f28ecaa3e2bf77b2062e6be279.tar.gz
mruby-8c5cb5e782ac03f28ecaa3e2bf77b2062e6be279.zip
cannot pack objects other than the first one. closes #1.
Diffstat (limited to 'src/pack.c')
-rw-r--r--src/pack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c
index a2dc0bdd6..659a0e424 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -664,6 +664,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
prepare_tmpl(mrb, &tmpl);
result = mrb_str_new(mrb, NULL, 128); /* allocate initial buffer */
+ aidx = 0;
ridx = 0;
while (has_tmpl(&tmpl)) {
read_tmpl(mrb, &tmpl, &dir, &type, &size, &count, &flags);
@@ -671,7 +672,7 @@ mrb_pack_pack(mrb_state *mrb, mrb_value ary)
if (dir == PACK_DIR_INVALID)
continue;
- for (aidx = 0; aidx < RARRAY_LEN(ary); aidx++) {
+ for (; aidx < RARRAY_LEN(ary); aidx++) {
if (count == 0 && !(flags & PACK_FLAG_WIDTH))
break;