From: Roca, Ignasi Date: Thu, 4 Jan 2001 17:50:12 +0000 (+0100) Subject: scanning two hex-constants fails on EBCDIC environment (script length.t) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a5a960be6c91f5e1c1ea8891620b2000a118fd18;p=p5sagit%2Fp5-mst-13.2.git scanning two hex-constants fails on EBCDIC environment (script length.t) Message-ID: <5930DC161690D211966700902715754703738AA6@madt009a.siemens.es> p4raw-id: //depot/perl@8305 --- diff --git a/toke.c b/toke.c index 7427bc5..76707c1 100644 --- a/toke.c +++ b/toke.c @@ -1311,29 +1311,6 @@ S_scan_const(pTHX_ char *start) break; /* in regexp, $ might be tail anchor */ } - /* (now in tr/// code again) */ - - if (*s & 0x80 && (this_utf8 || has_utf8)) { - STRLEN len = (STRLEN) -1; - UV uv; - if (this_utf8) { - uv = utf8_to_uv((U8*)s, send - s, &len, UTF8_CHECK_ONLY); - } - if (len == (STRLEN)-1) { - /* Illegal UTF8 (a high-bit byte), make it valid. */ - char *old_pvx = SvPVX(sv); - /* need space for one extra char (NOTE: SvCUR() not set here) */ - d = SvGROW(sv, SvLEN(sv) + 1) + (d - old_pvx); - d = (char*)uv_to_utf8((U8*)d, (U8)*s++); - } - else { - while (len--) - *d++ = *s++; - } - has_utf8 = TRUE; - continue; - } - /* backslashes */ if (*s == '\\' && s+1 < send) { bool to_be_utf8 = FALSE; @@ -1568,6 +1545,29 @@ S_scan_const(pTHX_ char *start) continue; } /* end if (backslash) */ + /* (now in tr/// code again) */ + + if (*s & 0x80 && (this_utf8 || has_utf8)) { + STRLEN len = (STRLEN) -1; + UV uv; + if (this_utf8) { + uv = utf8_to_uv((U8*)s, send - s, &len, UTF8_CHECK_ONLY); + } + if (len == (STRLEN)-1) { + /* Illegal UTF8 (a high-bit byte), make it valid. */ + char *old_pvx = SvPVX(sv); + /* need space for one extra char (NOTE: SvCUR() not set here) */ + d = SvGROW(sv, SvLEN(sv) + 1) + (d - old_pvx); + d = (char*)uv_to_utf8((U8*)d, (U8)*s++); + } + else { + while (len--) + *d++ = *s++; + } + has_utf8 = TRUE; + continue; + } + *d++ = *s++; } /* while loop to process each character */