bugfix in %D: output was 1 byte too short

This commit is contained in:
2018-06-18 15:26:59 +02:00
parent c1b89cb087
commit 18a0e54033

View File

@ -53,8 +53,9 @@ printLong(const StreamFormat& fmt, StreamBuffer& output, long value)
if (fmt.flags & alt_flag)
{
// least significant byte first (little endian)
while (width-- && prec)
while (width && prec)
{
width--;
bcd = value%10;
if (--prec)
{
@ -75,8 +76,9 @@ printLong(const StreamFormat& fmt, StreamBuffer& output, long value)
output.append('\0', width);
if (neg) output[-(long)width] |= 0xf0;
i = 0;
while (width-- && prec)
while (width && prec)
{
width--;
bcd = value%10;
if (--prec)
{