@@ -1377,7 +1377,6 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1377
1377
U8 * adjusted_s0 ;
1378
1378
U8 temp_char_buf [UTF8_MAXBYTES + 1 ]; /* Used to avoid a Newx in this
1379
1379
routine; see [perl #130921] */
1380
- UV uv_so_far ;
1381
1380
dTHX ;
1382
1381
1383
1382
PERL_ARGS_ASSERT__UTF8N_TO_UVCHR_MSGS_HELPER ;
@@ -1421,7 +1420,6 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1421
1420
avail_len = 0 ;
1422
1421
discard_errors = 0 ;
1423
1422
adjusted_s0 = (U8 * ) s0 ;
1424
- uv_so_far = 0 ;
1425
1423
1426
1424
if (errors ) {
1427
1425
* errors = 0 ;
@@ -1534,16 +1532,10 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1534
1532
* A convenience macro that matches either of the too-short conditions. */
1535
1533
# define UTF8_GOT_TOO_SHORT (UTF8_GOT_SHORT|UTF8_GOT_NON_CONTINUATION)
1536
1534
1537
- if (UNLIKELY (possible_problems & UTF8_GOT_TOO_SHORT )) {
1538
- uv_so_far = uv ;
1539
- uv = UNICODE_REPLACEMENT ;
1540
- }
1541
-
1542
1535
/* Check for overflow. The algorithm requires us to not look past the end
1543
1536
* of the current character, even if partial, so the upper limit is 's' */
1544
1537
if (UNLIKELY (does_utf8_overflow (s0 , s ) >= ALMOST_CERTAINLY_OVERFLOWS )) {
1545
1538
possible_problems |= UTF8_GOT_OVERFLOW ;
1546
- uv = UNICODE_REPLACEMENT ;
1547
1539
}
1548
1540
1549
1541
/* Check for overlong. If no problems so far, 'uv' is the correct code
@@ -1566,7 +1558,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1566
1558
* cases */
1567
1559
&& LIKELY (! (possible_problems & UTF8_GOT_OVERFLOW )))
1568
1560
{
1569
- UV min_uv = uv_so_far ;
1561
+ UV min_uv = uv ;
1570
1562
STRLEN i ;
1571
1563
1572
1564
/* Here, the input is both overlong and is missing some trailing
@@ -1714,6 +1706,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1714
1706
* extended UTF-8, but we handle all three cases here */
1715
1707
possible_problems &= ~(UTF8_GOT_SUPER |UTF8_GOT_PERL_EXTENDED );
1716
1708
* errors |= UTF8_GOT_OVERFLOW ;
1709
+ uv = UNICODE_REPLACEMENT ;
1717
1710
1718
1711
/* But the API says we flag all errors found */
1719
1712
if (flags & (UTF8_WARN_SUPER |UTF8_DISALLOW_SUPER )) {
@@ -1807,6 +1800,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1807
1800
1808
1801
case UTF8_GOT_SHORT :
1809
1802
* errors |= UTF8_GOT_SHORT ;
1803
+ uv = UNICODE_REPLACEMENT ;
1810
1804
1811
1805
if (! (flags & UTF8_ALLOW_SHORT )) {
1812
1806
disallowed = TRUE;
@@ -1829,6 +1823,7 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1829
1823
1830
1824
case UTF8_GOT_NON_CONTINUATION :
1831
1825
* errors |= UTF8_GOT_NON_CONTINUATION ;
1826
+ uv = UNICODE_REPLACEMENT ;
1832
1827
1833
1828
if (! (flags & UTF8_ALLOW_NON_CONTINUATION )) {
1834
1829
disallowed = TRUE;
0 commit comments