if (DO_UTF8(argsv)) {
STRLEN old_precis = precis;
if (has_precis && precis < elen) {
- STRLEN ulen = sv_len_utf8_nomg(argsv);
+ STRLEN ulen = sv_or_pv_len_utf8(argsv, eptr, elen);
STRLEN p = precis > ulen ? ulen : precis;
- precis = sv_pos_u2b_flags(argsv, p, 0, 0);
+ precis = sv_or_pv_pos_u2b(argsv, eptr, p, 0);
/* sticks at end */
}
if (width) { /* fudge width (can't fudge elen) */
if (has_precis && precis < elen)
width += precis - old_precis;
else
- width += elen - sv_len_utf8_nomg(argsv);
+ width +=
+ elen - sv_or_pv_len_utf8(argsv,eptr,elen);
}
is_utf8 = TRUE;
}
require './test.pl';
}
-plan tests => 1368;
+plan tests => 1370;
use strict;
use Config;
);
}
}
+
+# Overload count
+package o { use overload '""', sub { ++our $count; $_[0][0]; } }
+my $o = bless ["\x{100}"], o::;
+() = sprintf "%1s", $o;
+is $o::count, '1', 'sprinf %1s overload count';
+$o::count = 0;
+() = sprintf "%.1s", $o;
+is $o::count, '1', 'sprinf %.1s overload count';