In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/3708669706516490ba9699d9d57d92d59fda1006?hp=b33122be550de502b2a2c0da46023b7ef4e00466>
- Log ----------------------------------------------------------------- commit 3708669706516490ba9699d9d57d92d59fda1006 Author: Karl Williamson <[email protected]> Date: Thu Nov 24 10:54:23 2016 -0700 utf8.c: Fix EBCDIC detection of above-31 bit code points This was failing on EBCDIC machines, and I couldn't figure out why. I didn't see any flaws in the logic. It required special debugging code to answer. It turns out it was a bad declaration, and not logic at all. The declaration should have been const U8 prefix[] = ... instead it was const U8 * const prefix = ... sizeof() the latter is 4, as it is looking at pointer size. What was intended was the size of the array this was initialized to, which was longer. What this led to was later in the routine, a comparison was stopping too early. ----------------------------------------------------------------------- Summary of changes: utf8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utf8.c b/utf8.c index da575a9..074f738 100644 --- a/utf8.c +++ b/utf8.c @@ -383,8 +383,8 @@ S_is_utf8_cp_above_31_bits(const U8 * const s, const U8 * const e) #ifdef EBCDIC - /* [0] is start byte [1] [2] [3] [4] [5] [6] [7] */ - const U8 * const prefix = (U8 *) "\x41\x41\x41\x41\x41\x41\x42"; + /* [0] is start byte [1] [2] [3] [4] [5] [6] [7] */ + const U8 prefix[] = "\x41\x41\x41\x41\x41\x41\x42"; const STRLEN prefix_len = sizeof(prefix) - 1; const STRLEN len = e - s; const STRLEN cmp_len = MIN(prefix_len, len - 1); -- Perl5 Master Repository
