This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert Perl_sv_pos_u2b_proper() to Perl_sv_pos_u2b_flags().
[perl5.git] / mg.c
diff --git a/mg.c b/mg.c
index 4f8207c..cc01547 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -2015,12 +2015,12 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg)
     PERL_UNUSED_ARG(mg);
 
     if (SvUTF8(lsv))
-       sv_pos_u2b_proper(lsv, &offs, &rem);
+       offs = sv_pos_u2b_flags(lsv, offs, &rem, SV_CONST_RETURN);
     if (offs > len)
        offs = len;
     if (rem > len - offs)
        rem = len - offs;
-    sv_setpvn(sv, tmps + offs, (STRLEN)rem);
+    sv_setpvn(sv, tmps + offs, rem);
     if (SvUTF8(lsv))
         SvUTF8_on(sv);
     return 0;
@@ -2041,14 +2041,14 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
 
     if (DO_UTF8(sv)) {
        sv_utf8_upgrade(lsv);
-       sv_pos_u2b_proper(lsv, &lvoff, &lvlen);
+       lvoff = sv_pos_u2b_flags(lsv, lvoff, &lvlen, SV_CONST_RETURN);
        sv_insert(lsv, lvoff, lvlen, tmps, len);
        LvTARGLEN(sv) = sv_len_utf8(sv);
        SvUTF8_on(lsv);
     }
     else if (lsv && SvUTF8(lsv)) {
        const char *utf8;
-       sv_pos_u2b_proper(lsv, &lvoff, &lvlen);
+       lvoff = sv_pos_u2b_flags(lsv, lvoff, &lvlen, SV_CONST_RETURN);
        LvTARGLEN(sv) = len;
        utf8 = (char*)bytes_to_utf8((U8*)tmps, &len);
        sv_insert(lsv, lvoff, lvlen, utf8, len);