X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_pack.c;h=ceb01c5a57ee822ff2292a6649aacdf91383f5a2;hb=c721372142d4c809beb9dbba1d6d9e8702004478;hp=ff2f8e0ee8eac1bb07b1ae55d2f32d81d34241a5;hpb=b85d93de80777e72578287d135fa7522521da8e8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_pack.c b/pp_pack.c index ff2f8e0..ceb01c5 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -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': @@ -920,6 +922,8 @@ PP(pp_unpack) } break; case 'P': + if (star) + DIE(aTHX_ "P must have an explicit size"); EXTEND(SP, 1); if (sizeof(char*) > strend - s) break; @@ -1384,7 +1388,7 @@ PP(pp_pack) case 'a': fromstr = NEXTFROM; aptr = SvPV(fromstr, fromlen); - if (pat[-1] == '*') { + if (pat[lengthcode ? -2 : -1] == '*') { /* -2 after '/' */ len = fromlen; if (datumtype == 'Z') ++len;