As far as I can tell, this simple patch (against 1.17, the last release that bundles the XS implementation) that replaces all the deprecated functions by their suggested counterparts makes the dist build and test fine on any perl from 5.6.1 to the latest 5.23.
I haven't tested on a EBCDIC platform, but I don't think it can possibly be worse than before.
Vincent
--- Unicode-Normalize-1.17/Normalize.xs 2013-10-04 23:38:11.000000000 -0300
+++ Unicode-Normalize-1.17/Normalize.xs 2015-07-14 15:06:25.000000000 -0300
@@ -21,14 +21,14 @@
#include "unfexc.h"
/* Perl 5.6.1 ? */
-#ifndef uvuni_to_utf8
-#define uvuni_to_utf8 uv_to_utf8
-#endif /* uvuni_to_utf8 */
+#ifndef uvchr_to_utf8
+#define uvchr_to_utf8 uv_to_utf8
+#endif /* uvchr_to_utf8 */
/* Perl 5.6.1 ? */
-#ifndef utf8n_to_uvuni
-#define utf8n_to_uvuni utf8_to_uv
-#endif /* utf8n_to_uvuni */
+#ifndef utf8n_to_uvchr
+#define utf8n_to_uvchr utf8_to_uv
+#endif /* utf8n_to_uvchr */
/* UTF8_ALLOW_BOM is used before Perl 5.8.0 */
#ifndef UTF8_ALLOW_BOM
@@ -49,7 +49,7 @@
#define AllowAnyUTF (UTF8_ALLOW_SURROGATE|UTF8_ALLOW_BOM|UTF8_ALLOW_FE_FF|UTF8_ALLOW_FFFF)
-/* check if the string buffer is enough before uvuni_to_utf8(). */
+/* check if the string buffer is enough before uvchr_to_utf8(). */
/* dstart, d, and dlen should be defined outside before. */
#define Renew_d_if_not_enough_to(need) STRLEN curlen = d - dstart; \
if (dlen < curlen + (need)) { \
@@ -58,7 +58,7 @@
d = dstart + curlen; \
}
-/* if utf8n_to_uvuni() sets retlen to 0 (if broken?) */
+/* if utf8n_to_uvchr() sets retlen to 0 (if broken?) */
#define ErrRetlenIsZero "panic (Unicode::Normalize %s): zero-length character"
/* utf8_hop() hops back before start. Maybe broken UTF-8 */
@@ -197,10 +197,10 @@
if (! Hangul_IsS(uv))
return d;
- d = uvuni_to_utf8(d, (lindex + Hangul_LBase));
- d = uvuni_to_utf8(d, (vindex + Hangul_VBase));
+ d = uvchr_to_utf8(d, (lindex + Hangul_LBase));
+ d = uvchr_to_utf8(d, (vindex + Hangul_VBase));
if (tindex)
- d = uvuni_to_utf8(d, (tindex + Hangul_TBase));
+ d = uvchr_to_utf8(d, (tindex + Hangul_TBase));
return d;
}
@@ -231,7 +231,7 @@
while (p < e) {
STRLEN retlen;
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "decompose");
p += retlen;
@@ -251,7 +251,7 @@
}
else {
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, uv);
+ d = uvchr_to_utf8(d, uv);
}
}
}
@@ -276,7 +276,7 @@
while (p < e) {
U8 curCC;
STRLEN retlen;
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "reorder");
p += retlen;
@@ -316,14 +316,14 @@
for (i = 0; i < cc_pos; i++) {
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, seq_ptr[i].uv);
+ d = uvchr_to_utf8(d, seq_ptr[i].uv);
}
cc_pos = 0;
}
if (curCC == 0) {
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, uv);
+ d = uvchr_to_utf8(d, uv);
}
}
if (seq_ext)
@@ -353,7 +353,7 @@
while (p < e) {
U8 curCC;
STRLEN retlen;
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "compose");
p += retlen;
@@ -369,7 +369,7 @@
}
else {
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, uv);
+ d = uvchr_to_utf8(d, uv);
continue;
}
}
@@ -428,7 +428,7 @@
/* output */
{
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, uvS); /* starter (composed or not) */
+ d = uvchr_to_utf8(d, uvS); /* starter (composed or not) */
}
if (cc_pos) {
@@ -436,7 +436,7 @@
for (i = 0; i < cc_pos; i++) {
Renew_d_if_not_enough_to(UTF8_MAXLEN)
- d = uvuni_to_utf8(d, seq_ptr[i]);
+ d = uvchr_to_utf8(d, seq_ptr[i]);
}
cc_pos = 0;
}
@@ -623,7 +623,7 @@
preCC = 0;
for (p = s; p < e; p += retlen) {
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "checkNFD or -NFKD");
@@ -660,7 +660,7 @@
preCC = 0;
for (p = s; p < e; p += retlen) {
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "checkNFC or -NFKC");
@@ -718,7 +718,7 @@
U8 *sCan;
UV uvLead;
STRLEN canlen = 0;
- UV uv = utf8n_to_uvuni(p, e - p, &retlen, AllowAnyUTF);
+ UV uv = utf8n_to_uvchr(p, e - p, &retlen, AllowAnyUTF);
if (!retlen)
croak(ErrRetlenIsZero, "checkFCD or -FCC");
@@ -727,7 +727,7 @@
if (sCan) {
STRLEN canret;
canlen = (STRLEN)strlen((char *) sCan);
- uvLead = utf8n_to_uvuni(sCan, canlen, &canret, AllowAnyUTF);
+ uvLead = utf8n_to_uvchr(sCan, canlen, &canret, AllowAnyUTF);
if (!canret)
croak(ErrRetlenIsZero, "checkFCD or -FCC");
}
@@ -758,7 +758,7 @@
U8* pCan = utf8_hop(eCan, -1);
if (pCan < sCan)
croak(ErrHopBeforeStart);
- uvTrail = utf8n_to_uvuni(pCan, eCan - pCan, &canret, AllowAnyUTF);
+ uvTrail = utf8n_to_uvchr(pCan, eCan - pCan, &canret, AllowAnyUTF);
if (!canret)
croak(ErrRetlenIsZero, "checkFCD or -FCC");
preCC = getCombinClass(uvTrail);
@@ -897,7 +897,7 @@
p = utf8_hop(p, -1);
if (p < s)
croak(ErrHopBeforeStart);
- uv = utf8n_to_uvuni(p, e - p, NULL, AllowAnyUTF);
+ uv = utf8n_to_uvchr(p, e - p, NULL, AllowAnyUTF);
if (getCombinClass(uv) == 0) /* Last Starter found */
break;
}