summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorAnatoly Vorobey <unknown>2006-10-08 10:58:16 -0700
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-10 14:36:49 +0000
commit59b61096be97d8d463125e3b0422c5a6bd05f1e5 (patch)
tree2e34bb58aa02b2004e8103d42c57568423847c5f /sv.c
parent562c8117872556faadd31f703c1c1a0907ed9a04 (diff)
downloadperl-59b61096be97d8d463125e3b0422c5a6bd05f1e5.tar.gz
[perl #40473] sprintf width+precision fails on wide chars
From: Anatoly Vorobey (via RT) <perlbug-followup@perl.org> Message-ID: <rt-3.5.HEAD-31259-1160355496-1702.40473-75-0@perl.org> p4raw-id: //depot/perl@28985
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 4fa44986ad..7dd83cc13f 100644
--- a/sv.c
+++ b/sv.c
@@ -8919,13 +8919,17 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
else {
eptr = SvPVx_const(argsv, elen);
if (DO_UTF8(argsv)) {
+ I32 old_precis = precis;
if (has_precis && precis < elen) {
I32 p = precis;
sv_pos_u2b(argsv, &p, 0); /* sticks at end */
precis = p;
}
if (width) { /* fudge width (can't fudge elen) */
- width += elen - sv_len_utf8(argsv);
+ if (has_precis && precis < elen)
+ width += precis - old_precis;
+ else
+ width += elen - sv_len_utf8(argsv);
}
is_utf8 = TRUE;
}