From: Jarkko Hietaniemi Date: Wed, 21 Feb 2001 14:00:03 +0000 (+0000) Subject: unpack("C", ...) was left slightly unfinished by #8865. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=93dfd55ec6c7f4ad52d53a9c024a8ac903bff254;p=p5sagit%2Fp5-mst-13.2.git unpack("C", ...) was left slightly unfinished by #8865. p4raw-id: //depot/perl@8869 --- diff --git a/pp.c b/pp.c index b3d769a..2b975e4 100644 --- a/pp.c +++ b/pp.c @@ -4335,7 +4335,8 @@ PP(pp_unpack) if (DO_UTF8(right)) { while (len > 0) { STRLEN l; - auv = utf8_to_uv((U8*)s, len, &l, UTF8_ALLOW_ANYUV); + auv = utf8_to_uv((U8*)s, strend - s, + &l, UTF8_ALLOW_ANYUV); culong += auv; s += l; len -= l; @@ -4355,7 +4356,8 @@ PP(pp_unpack) if (DO_UTF8(right)) { while (len > 0) { STRLEN l; - auv = utf8_to_uv((U8*)s, len, &l, UTF8_ALLOW_ANYUV); + auv = utf8_to_uv((U8*)s, strend - s, + &l, UTF8_ALLOW_ANYUV); sv = NEWSV(37, 0); sv_setuv(sv, auv); PUSHs(sv_2mortal(sv)); diff --git a/t/op/pack.t b/t/op/pack.t index 06e47f2..3483597 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -426,8 +426,8 @@ print "ok $test\n"; $test++; # 160: unpack("C") and ord() equivalence for Unicode -#print "not " unless unpack("C", chr(0x100)) eq ord(chr(0x100)) && -# ord(chr(0x100)) == 0x100; +print "not " unless unpack("C", chr(0x100)) eq ord(chr(0x100)) && + ord(chr(0x100)) == 0x100; print "ok $test\n"; $test++; # 161: use bytes + unpack C == UTF-8 unraveling