s += numlen;
len += numlen;
foldbuf += numlen;
+ if (numlen >= foldlen)
+ break;
}
else
break; /* "Can't happen." */
ender = utf8_to_uvchr(foldbuf, &numlen);
if (numlen > 0) {
reguni(pRExC_state, ender, s, &numlen);
- s += numlen;
len += numlen;
+ s += numlen;
foldbuf += numlen;
+ if (numlen >= foldlen)
+ break;
}
else
break;
{
UV uv0, uv1, uv2;
U8 tmpbuf[UTF8_MAXLEN_FOLD+1];
- char *s = NULL;
STRLEN len;
if (!*swashp)
/* It was "normal" (a single character mapping). */
UV uv3 = UNI_TO_NATIVE(uv2);
- len = uvuni_to_utf8(ustrp, uv2) - ustrp;
+ len = uvuni_to_utf8(ustrp, uv3) - ustrp;
}
else {
/* It might be "special" (sometimes, but not always,
(keysv = sv_2mortal(Perl_newSVpvf(aTHX_ "%04"UVXf, uv1))) &&
(he = hv_fetch_ent(hv, keysv, FALSE, 0)) &&
(val = HeVAL(he))) {
- U8* d;
-
+ char *s;
+ U8 *d;
+
s = SvPV(val, len);
- if (len == 1) {
- d = uvuni_to_utf8(ustrp, NATIVE_TO_UNI(*(U8*)s));
- len = d - ustrp;
- }
+ if (len == 1)
+ len = uvuni_to_utf8(ustrp, NATIVE_TO_UNI(*(U8*)s)) - ustrp;
else {
#ifdef EBCDIC
/* If we have EBCDIC we need to remap the characters
}
}
else {
- while (t < tend) {
- d = uvchr_to_utf8(d, UNI_TO_NATIVE(*t));
- t++;
- }
+ while (t < tend)
+ d = uvchr_to_utf8(d, UNI_TO_NATIVE(*t++));
}
len = d - tmpbuf;
Copy(tmpbuf, ustrp, len, U8);