summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@perl.com>1997-04-18 00:00:00 +0000
committerChip Salzenberg <chip@atlantic.net>1997-04-18 00:00:00 +0000
commitbbdab0432496b4b2fda64f190e98e90b407f7023 (patch)
tree1eb56be83494f95c616fe0b5544af426f50b5e6f /pp.c
parentdebf9080d68fa692bfcb034241122c6cfa1b8d6e (diff)
downloadperl-bbdab0432496b4b2fda64f190e98e90b407f7023.tar.gz
Fix (and test) spaces in {,un}pack()
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/pp.c b/pp.c
index 34c4ed3e1f..6423e277b3 100644
--- a/pp.c
+++ b/pp.c
@@ -2682,7 +2682,9 @@ PP(pp_unpack)
}
while (pat < patend) {
reparse:
- datumtype = *pat++;
+ datumtype = *pat++ & 0xFF;
+ if (isSPACE(datumtype))
+ continue;
if (pat >= patend)
len = 1;
else if (*pat == '*') {
@@ -2698,7 +2700,7 @@ PP(pp_unpack)
len = (datumtype != '@');
switch(datumtype) {
default:
- croak("Invalid type in unpack: '%c'", datumtype);
+ croak("Invalid type in unpack: '%c'", (int)datumtype);
case '%':
if (len == 1 && pat[-1] != '1')
len = 16;
@@ -3460,7 +3462,9 @@ PP(pp_pack)
sv_setpvn(cat, "", 0);
while (pat < patend) {
#define NEXTFROM (items-- > 0 ? *MARK++ : &sv_no)
- datumtype = *pat++;
+ datumtype = *pat++ & 0xFF;
+ if (isSPACE(datumtype))
+ continue;
if (*pat == '*') {
len = strchr("@Xxu", datumtype) ? 0 : items;
pat++;
@@ -3474,7 +3478,7 @@ PP(pp_pack)
len = 1;
switch(datumtype) {
default:
- croak("Invalid type in pack: '%c'", datumtype);
+ croak("Invalid type in pack: '%c'", (int)datumtype);
case '%':
DIE("%% may only be used in unpack");
case '@':