Branch: Tag:

2013-02-07

2013-02-07 12:53:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fixed padding bug in string_builder_append_integer().

It would add erroneous left padding if the field was full.

eg string_builder_append_integer(&s, 16, 10, APPEND_SIGNED, 2, 0)
would append the string "16 " instead of the expected "16".

This bug also affected string_builder_sprintf().

2688:    if (len < precision) len = precision;       /* Perform padding. */ -  if ((len < min_width) && !(flags & APPEND_LEFT)) { +  if (!(flags & APPEND_LEFT)) { +  if (len < min_width) {    string_builder_fill(s, min_width - len, MKPCHARP(" ", 0),    4, 0); -  +  }    min_width = 0;    }