diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-15 07:42:21 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-10-15 07:42:21 +0000 |
commit | ccaf61d5aff59f5e11a772c4f9bd0d1c10232e25 (patch) | |
tree | ba9578de633675c75f63f0d895d8625f2048a7b6 /pack.c | |
parent | dfd139b81977bd9405b497f9eced411d3334886d (diff) | |
download | ruby-ccaf61d5aff59f5e11a772c4f9bd0d1c10232e25.tar.gz |
* pack.c (pack_pack): fix more than one modifiers appear in the
format string. [ruby-core:32793]
* pack.c (pack_unpack): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -428,7 +428,6 @@ pack_pack(VALUE ary, VALUE fmt) int natint; /* native integer */ #endif int signed_p, integer_size, bigendian_p; - int explicit_endian = 0; StringValue(fmt); p = RSTRING_PTR(fmt); @@ -443,6 +442,7 @@ pack_pack(VALUE ary, VALUE fmt) #define NEXTFROM (items-- > 0 ? RARRAY_PTR(ary)[idx++] : TOO_FEW) while (p < pend) { + int explicit_endian = 0; if (RSTRING_PTR(fmt) + RSTRING_LEN(fmt) != pend) { rb_raise(rb_eRuntimeError, "format string modified"); } @@ -1366,7 +1366,6 @@ pack_unpack(VALUE str, VALUE fmt) #endif int block_p = rb_block_given_p(); int signed_p, integer_size, bigendian_p; - int explicit_endian = 0; #define UNPACK_PUSH(item) do {\ VALUE item_val = (item);\ if (block_p) {\ @@ -1386,6 +1385,7 @@ pack_unpack(VALUE str, VALUE fmt) ary = block_p ? Qnil : rb_ary_new(); while (p < pend) { + int explicit_endian = 0; type = *p++; #ifdef NATINT_PACK natint = 0; |