From 69cc184b71d2368b981feb90a3ed26718963ec67 Mon Sep 17 00:00:00 2001 From: Paul Marquess Date: Mon, 27 Jul 1998 07:16:15 +0100 Subject: [PATCH] fix bogus warning on "\x{123}" Message-Id: <9807270534.AA11102@claudius.bfsec.bt.co.uk> Subject: [5.005_50 PATCH] Some unicode problems p4raw-id: //depot/perl@1771 --- regcomp.c | 4 ++-- toke.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/regcomp.c b/regcomp.c index 2daa72b..3c047b6 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2115,7 +2115,7 @@ regclass(void) * (POSIX Extended Character Classes, that is) * The text between e.g. [: and :] would start * at posixccs + 1 and stop at regcomp_parse - 2. */ - if (dowarn && !SIZE_ONLY) + if (PL_dowarn && !SIZE_ONLY) warn("Character class syntax [%c %c] is reserved for future extensions", posixccc, posixccc); PL_regcomp_parse++; /* skip over the ending ] */ } @@ -2317,7 +2317,7 @@ regclassutf8(void) * (POSIX Extended Character Classes, that is) * The text between e.g. [: and :] would start * at posixccs + 1 and stop at regcomp_parse - 2. */ - if (dowarn && !SIZE_ONLY) + if (PL_dowarn && !SIZE_ONLY) warn("Character class syntax [%c %c] is reserved for future extensions", posixccc, posixccc); PL_regcomp_parse++; /* skip over the ending ] */ } diff --git a/toke.c b/toke.c index f56aeec..b71394f 100644 --- a/toke.c +++ b/toke.c @@ -981,7 +981,7 @@ scan_const(char *start) /* (now in tr/// code again) */ - if (*s & 0x80 && dowarn && thisutf) { + if (*s & 0x80 && PL_dowarn && thisutf) { (void)utf8_to_uv(s, &len); /* could cvt latin-1 to utf8 here... */ if (len) { while (len--) @@ -1047,10 +1047,10 @@ scan_const(char *start) if (!e) yyerror("Missing right brace on \\x{}"); - if (dowarn && !utf) + if (PL_dowarn && !utf) warn("Use of \\x{} without utf8 declaration"); /* note: utf always shorter than hex */ - d = uv_to_utf8(d, scan_hex(s + 1, e - s, &len)); + d = uv_to_utf8(d, scan_hex(s + 1, e - s - 1, &len)); s = e + 1; } @@ -1062,7 +1062,7 @@ scan_const(char *start) d = uv_to_utf8(d, uv); /* doing a CU or UC */ } else { - if (dowarn && uv >= 127 && UTF) + if (PL_dowarn && uv >= 127 && UTF) warn( "\\x%.*s will produce malformed UTF-8 character; use \\x{%.*s} for that", len,s,len,s); -- 2.7.4