Change 14850 by jhi@alpha on 2002/02/24 05:28:15
EBCDIC: this seems to calm the last of the
Malformed UTF-8 warnings.
Affected files ...
.... //depot/perl/regcomp.c#287 edit
.... //depot/perl/utf8.c#178 edit
Differences ...
==== //depot/perl/regcomp.c#287 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c.~1~ Sat Feb 23 22:45:05 2002
+++ perl/regcomp.c Sat Feb 23 22:45:05 2002
@@ -3182,6 +3182,8 @@
if (len)
p = oldp;
else if (UTF) {
+ STRLEN unilen;
+
if (FOLD) {
/* Emit all the Unicode characters. */
for (foldbuf = tmpbuf;
@@ -3189,9 +3191,11 @@
foldlen -= numlen) {
ender = utf8_to_uvchr(foldbuf, &numlen);
if (numlen > 0) {
- reguni(pRExC_state, ender, s, &numlen);
- s += numlen;
- len += numlen;
+ reguni(pRExC_state, ender, s, &unilen);
+ s += unilen;
+ len += unilen;
+ /* In EBCDIC the numlen
+ * and unilen can differ. */
foldbuf += numlen;
if (numlen >= foldlen)
break;
@@ -3201,10 +3205,10 @@
}
}
else {
- reguni(pRExC_state, ender, s, &numlen);
+ reguni(pRExC_state, ender, s, &unilen);
if (numlen > 0) {
- s += numlen;
- len += numlen;
+ s += unilen;
+ len += unilen;
}
}
}
@@ -3215,6 +3219,8 @@
break;
}
if (UTF) {
+ STRLEN unilen;
+
if (FOLD) {
/* Emit all the Unicode characters. */
for (foldbuf = tmpbuf;
@@ -3222,9 +3228,11 @@
foldlen -= numlen) {
ender = utf8_to_uvchr(foldbuf, &numlen);
if (numlen > 0) {
- reguni(pRExC_state, ender, s, &numlen);
- len += numlen;
- s += numlen;
+ reguni(pRExC_state, ender, s, &unilen);
+ len += unilen;
+ s += unilen;
+ /* In EBCDIC the numlen
+ * and unilen can differ. */
foldbuf += numlen;
if (numlen >= foldlen)
break;
@@ -3234,10 +3242,10 @@
}
}
else {
- reguni(pRExC_state, ender, s, &numlen);
+ reguni(pRExC_state, ender, s, &unilen);
if (numlen > 0) {
- s += numlen;
- len += numlen;
+ s += unilen;
+ len += unilen;
}
}
len--;
==== //depot/perl/utf8.c#178 (text) ====
Index: perl/utf8.c
--- perl/utf8.c.~1~ Sat Feb 23 22:45:05 2002
+++ perl/utf8.c Sat Feb 23 22:45:05 2002
@@ -952,33 +952,29 @@
UV
Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_upper(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_upper(p, p, lenp);
}
UV
Perl_to_uni_title(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_title(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_title(p, p, lenp);
}
UV
Perl_to_uni_lower(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_UCLC+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_lower(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_lower(p, p, lenp);
}
UV
Perl_to_uni_fold(pTHX_ UV c, U8* p, STRLEN *lenp)
{
- U8 tmpbuf[UTF8_MAXLEN_FOLD+1];
- uvchr_to_utf8(tmpbuf, c);
- return to_utf8_fold(tmpbuf, p, lenp);
+ uvchr_to_utf8(p, c);
+ return to_utf8_fold(p, p, lenp);
}
/* for now these all assume no locale info available for Unicode > 255 */
End of Patch.