Padding was broken for strings and characters since the move to vsnprintf().

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9529 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2004-10-27 12:47:16 +00:00
parent 162eda1e2f
commit f048d50953

View File

@ -285,12 +285,12 @@ vsnprintf(char *buffer, size_t bufferSize, const char *format, va_list args)
switch (format[0]) {
case 'c':
if (!(flags & LEFT) && !put_padding(&string, &bytesLeft, fieldWidth))
if (!(flags & LEFT) && !put_padding(&string, &bytesLeft, fieldWidth - 1))
goto out;
put_character(&string, &bytesLeft, (char)va_arg(args, int));
if ((flags & LEFT) != 0 && !put_padding(&string, &bytesLeft, fieldWidth))
if ((flags & LEFT) != 0 && !put_padding(&string, &bytesLeft, fieldWidth - 1))
goto out;
continue;
@ -303,6 +303,7 @@ vsnprintf(char *buffer, size_t bufferSize, const char *format, va_list args)
argument = "<NULL>";
length = strnlen(argument, precision);
fieldWidth -= length;
if (!(flags & LEFT) && !put_padding(&string, &bytesLeft, fieldWidth))
goto out;