diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-04-09 18:04:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-04-09 18:04:08 +0000 |
commit | 32e799db485107ba9d47fb4fb4cd44c9d6f57b8a (patch) | |
tree | e33fd45f76d7f31959c1e5298902588de716657c /pack.c | |
parent | 35247a52ef719584a59ae9c518523f0ee825c8e3 (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r-- | pack.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -916,9 +916,11 @@ hex2num(c) #define PACK_LENGTH_ADJUST(type) do { \ tmp = 0; \ - if (len > (send - s)/sizeof(type)) { \ - tmp = len - (send - s) / sizeof(type); \ - len = (send - s) / sizeof(type); \ + if (len > (send-s)/sizeof(type)) { \ + if (!star) { \ + tmp = len - (send-s)/sizeof(type); \ + } \ + len = (send-s)/sizeof(type); \ } \ } while (0) @@ -933,7 +935,7 @@ pack_unpack(str, fmt) char *p, *pend; VALUE ary; char type; - int len, tmp; + int len, tmp, star; s = rb_str2cstr(str, &len); send = s + len; @@ -942,8 +944,10 @@ pack_unpack(str, fmt) ary = rb_ary_new(); while (p < pend) { + star = 0; type = *p++; if (*p == '*') { + star = 1; len = send - s; p++; } |