diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-24 16:09:37 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-24 16:09:37 +0000 |
commit | d50dd4e4eaf05f186e67ce979ed880c59f1a81bc (patch) | |
tree | 4743b00ba1c2c033381bb6844ff9f96a1bd8b9aa /pp_pack.c | |
parent | 65486cd120c0733b920597ede1ed5a6c26c798d8 (diff) | |
download | perl-d50dd4e4eaf05f186e67ce979ed880c59f1a81bc.tar.gz |
unpack("Z*Z*", pack("Z*Z*", ..)) bug, patch and test from
Wolfgang Laun <Wolfgang.Laun@alcatel.at>
p4raw-id: //depot/perl@12180
Diffstat (limited to 'pp_pack.c')
-rw-r--r-- | pp_pack.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -266,13 +266,14 @@ PP(pp_unpack) goto uchar_checksum; sv = NEWSV(35, len); sv_setpvn(sv, s, len); - s += len; if (datumtype == 'A' || datumtype == 'Z') { aptr = s; /* borrow register */ if (datumtype == 'Z') { /* 'Z' strips stuff after first null */ s = SvPVX(sv); while (*s) s++; + if (star) /* exact for 'Z*' */ + len = s - SvPVX(sv) + 1; } else { /* 'A' strips both nulls and spaces */ s = SvPVX(sv) + len - 1; @@ -283,6 +284,7 @@ PP(pp_unpack) SvCUR_set(sv, s - SvPVX(sv)); s = aptr; /* unborrow register */ } + s += len; XPUSHs(sv_2mortal(sv)); break; case 'B': |