[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: small fix for lib/sh/snprintf.c
From: |
Petr Sumbera |
Subject: |
Re: small fix for lib/sh/snprintf.c |
Date: |
Fri, 13 Apr 2012 15:57:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9.2.13) Gecko/20110117 Lightning/1.0b2 Thunderbird/3.1.7 |
On 04/13/12 03:18 PM, Petr Sumbera wrote:
Problem 2:
==========
bash -c 'printf "x%+010.0fx\n" 123'
x000000+123x
where it should be:
x+000000123x
Fixed in chunk #3 (but the problem is there also for other types!).
My fix breaks following case:
bash -c 'printf "x%+10.0fx\n" 123'
x+ 123x
where it should be
x +123x
So this would be probably fixed in my original patch (chunk #3) with
following code:
if (p->pad == ' ')
{
PAD_RIGHT(p);
PUT_PLUS(d, p, 0.);
} else {
if (*tmp == '-')
PUT_CHAR(*tmp++, p);
PUT_PLUS(d, p, 0.);
PAD_RIGHT(p);
}
PUT_SPACE(d, p, 0.);
--
Petr