From: Gisle Aas Date: Tue, 20 Oct 1998 14:24:44 +0000 (+0200) Subject: ord() and unpack("U*",...) should not be negative X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bdeef251cd01b4ea0422cf98195dbdbc42aa71fd;p=p5sagit%2Fp5-mst-13.2.git ord() and unpack("U*",...) should not be negative Message-ID: p4raw-id: //depot/perl@2064 --- diff --git a/pp.c b/pp.c index 495b9ea..72599d1 100644 --- a/pp.c +++ b/pp.c @@ -2120,15 +2120,15 @@ PP(pp_sprintf) PP(pp_ord) { djSP; dTARGET; - I32 value; + UV value; U8 *tmps = (U8*)POPp; I32 retlen; if (IN_UTF8 && (*tmps & 0x80)) - value = (I32) utf8_to_uv(tmps, &retlen); + value = utf8_to_uv(tmps, &retlen); else - value = (I32) (*tmps & 255); - XPUSHi(value); + value = (UV)(*tmps & 255); + XPUSHu(value); RETURN; } @@ -3433,7 +3433,7 @@ PP(pp_unpack) auint = utf8_to_uv((U8*)s, &along); s += along; sv = NEWSV(37, 0); - sv_setiv(sv, (IV)auint); + sv_setuv(sv, (UV)auint); PUSHs(sv_2mortal(sv)); } }