summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-02-21 19:34:34 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-02-21 19:34:34 +0000
commit9e6390329e0b2f4a2dab0836dc608590db56a9e1 (patch)
tree8fe1f89665e7ff087e7c88df3109292db0d038a1 /pp.c
parentc61790a238ee53bd915ae572325dabe678a89e75 (diff)
downloadperl-9e6390329e0b2f4a2dab0836dc608590db56a9e1.tar.gz
Retract #8875, cannot let go of the old semantics of unpack U
without rethinking utf8decode.t. p4raw-id: //depot/perl@8880
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index d8d00820f2..2b975e4a8d 100644
--- a/pp.c
+++ b/pp.c
@@ -4329,7 +4329,6 @@ PP(pp_unpack)
}
break;
case 'C':
- case 'U':
if (len > strend - s)
len = strend - s;
if (checksum) {
@@ -4338,10 +4337,7 @@ PP(pp_unpack)
STRLEN l;
auv = utf8_to_uv((U8*)s, strend - s,
&l, UTF8_ALLOW_ANYUV);
- if (checksum > 32)
- cdouble += (NV)auv;
- else
- culong += auv;
+ culong += auv;
s += l;
len -= l;
}
@@ -4379,6 +4375,35 @@ PP(pp_unpack)
}
}
break;
+ case 'U':
+ if (len > strend - s)
+ len = strend - s;
+ if (checksum) {
+ while (len-- > 0 && s < strend) {
+ STRLEN alen;
+ auint = utf8_to_uv((U8*)s, strend - s, &alen, 0);
+ along = alen;
+ s += along;
+ if (checksum > 32)
+ cdouble += (NV)auint;
+ else
+ culong += auint;
+ }
+ }
+ else {
+ EXTEND(SP, len);
+ EXTEND_MORTAL(len);
+ while (len-- > 0 && s < strend) {
+ STRLEN alen;
+ auint = utf8_to_uv((U8*)s, strend - s, &alen, 0);
+ along = alen;
+ s += along;
+ sv = NEWSV(37, 0);
+ sv_setuv(sv, (UV)auint);
+ PUSHs(sv_2mortal(sv));
+ }
+ }
+ break;
case 's':
#if SHORTSIZE == SIZE16
along = (strend - s) / SIZE16;