@@ -4525,8 +4525,8 @@ PP_wrapped(pp_uc, 1, 0)
45254525 bool in_iota_subscript = FALSE;
45264526
45274527 while (s < send ) {
4528- STRLEN u ;
4529- STRLEN ulen ;
4528+ STRLEN this_len ;
4529+ STRLEN upper_len ;
45304530 UV uv ;
45314531 if (UNLIKELY (in_iota_subscript )) {
45324532 UV cp = utf8_to_uv_or_die (s , send , NULL );
@@ -4543,11 +4543,12 @@ PP_wrapped(pp_uc, 1, 0)
45434543 /* Then handle the current character. Get the changed case value
45444544 * and copy it to the output buffer */
45454545
4546- u = UTF8SKIP (s );
4546+ this_len = UTF8SKIP (s );
45474547#ifdef USE_LOCALE_CTYPE
4548- uv = _toUPPER_utf8_flags (s , send , tmpbuf , & ulen , IN_LC_RUNTIME (LC_CTYPE ));
4548+ uv = _toUPPER_utf8_flags (s , send , tmpbuf , & upper_len ,
4549+ IN_LC_RUNTIME (LC_CTYPE ));
45494550#else
4550- uv = _toUPPER_utf8_flags (s , send , tmpbuf , & ulen , 0 );
4551+ uv = _toUPPER_utf8_flags (s , send , tmpbuf , & upper_len , 0 );
45514552#endif
45524553 if ( uv == GREEK_CAPITAL_LETTER_IOTA
45534554 && utf8_to_uv_or_die (s , send , 0 ) ==
@@ -4556,7 +4557,9 @@ PP_wrapped(pp_uc, 1, 0)
45564557 in_iota_subscript = TRUE;
45574558 }
45584559 else {
4559- if (ulen > u && (SvLEN (dest ) < (min += ulen - u ))) {
4560+ if ( upper_len > this_len
4561+ && (SvLEN (dest ) < (min += upper_len - this_len )))
4562+ {
45604563 /* If the eventually required minimum size outgrows the
45614564 * available space, we need to grow. */
45624565 const UV o = d - (U8 * )SvPVX_const (dest );
@@ -4569,10 +4572,10 @@ PP_wrapped(pp_uc, 1, 0)
45694572 * another option */
45704573 d = o + (U8 * ) SvGROW (dest , min );
45714574 }
4572- Copy (tmpbuf , d , ulen , U8 );
4573- d += ulen ;
4575+ Copy (tmpbuf , d , upper_len , U8 );
4576+ d += upper_len ;
45744577 }
4575- s += u ;
4578+ s += this_len ;
45764579 }
45774580 if (in_iota_subscript ) {
45784581 * d ++ = UTF8_TWO_BYTE_HI (GREEK_CAPITAL_LETTER_IOTA );
@@ -4866,12 +4869,13 @@ PP_wrapped(pp_lc, 1, 0)
48664869 bool remove_dot_above = FALSE;
48674870
48684871 while (s < send ) {
4869- const STRLEN u = UTF8SKIP (s );
4870- STRLEN ulen ;
4872+ const STRLEN this_len = UTF8SKIP (s );
4873+ STRLEN lower_len ;
48714874
48724875#ifdef USE_LOCALE_CTYPE
48734876
4874- _toLOWER_utf8_flags (s , send , tmpbuf , & ulen , IN_LC_RUNTIME (LC_CTYPE ));
4877+ _toLOWER_utf8_flags (s , send , tmpbuf , & lower_len ,
4878+ IN_LC_RUNTIME (LC_CTYPE ));
48754879
48764880 /* If we are in a Turkic locale, we have to do more work. As noted
48774881 * in the comments for lcfirst, there is a special case if a 'I'
@@ -4886,9 +4890,10 @@ PP_wrapped(pp_lc, 1, 0)
48864890 && IN_LC_RUNTIME (LC_CTYPE ))
48874891 {
48884892 if ( UNLIKELY (remove_dot_above )
4889- && memBEGINs (tmpbuf , sizeof (tmpbuf ), COMBINING_DOT_ABOVE_UTF8 ))
4893+ && memBEGINs (tmpbuf , sizeof (tmpbuf ),
4894+ COMBINING_DOT_ABOVE_UTF8 ))
48904895 {
4891- s += u ;
4896+ s += this_len ;
48924897 remove_dot_above = FALSE;
48934898 continue ;
48944899 }
@@ -4899,15 +4904,16 @@ PP_wrapped(pp_lc, 1, 0)
48994904#else
49004905 PERL_UNUSED_VAR (remove_dot_above );
49014906
4902- _toLOWER_utf8_flags (s , send , tmpbuf , & ulen , 0 );
4907+ _toLOWER_utf8_flags (s , send , tmpbuf , & lower_len , 0 );
49034908#endif
49044909
49054910 /* Here is where we would do context-sensitive actions for the
49064911 * Greek final sigma. See the commit message for 86510fb15 for why
49074912 * there isn't any */
49084913
4909- if (ulen > u && (SvLEN (dest ) < (min += ulen - u ))) {
4910-
4914+ if ( lower_len > this_len
4915+ && (SvLEN (dest ) < (min += lower_len - this_len )))
4916+ {
49114917 /* If the eventually required minimum size outgrows the
49124918 * available space, we need to grow. */
49134919 const UV o = d - (U8 * )SvPVX_const (dest );
@@ -4923,9 +4929,9 @@ PP_wrapped(pp_lc, 1, 0)
49234929
49244930 /* Copy the newly lowercased letter to the output buffer we're
49254931 * building */
4926- Copy (tmpbuf , d , ulen , U8 );
4927- d += ulen ;
4928- s += u ;
4932+ Copy (tmpbuf , d , lower_len , U8 );
4933+ d += lower_len ;
4934+ s += this_len ;
49294935 } /* End of looping through the source string */
49304936 SvUTF8_on (dest );
49314937 * d = '\0' ;
@@ -5129,19 +5135,19 @@ PP_wrapped(pp_fc, 1, 0)
51295135
51305136 if (DO_UTF8 (source )) { /* UTF-8 flagged string. */
51315137 while (s < send ) {
5132- const STRLEN u = UTF8SKIP (s );
5138+ const STRLEN this_len = UTF8SKIP (s );
51335139 STRLEN ulen ;
51345140
51355141 _toFOLD_utf8_flags (s , send , tmpbuf , & ulen , flags );
51365142
5137- if (ulen > u && (SvLEN (dest ) < (min += ulen - u ))) {
5143+ if (ulen > this_len && (SvLEN (dest ) < (min += ulen - this_len ))) {
51385144 const UV o = d - (U8 * )SvPVX_const (dest );
51395145 d = o + (U8 * ) SvGROW (dest , min );
51405146 }
51415147
51425148 Copy (tmpbuf , d , ulen , U8 );
51435149 d += ulen ;
5144- s += u ;
5150+ s += this_len ;
51455151 }
51465152 SvUTF8_on (dest );
51475153 } /* Unflagged string */
0 commit comments