Fixing __printf for format strings with '+' specifier like '%+5d'.

This commit is contained in:
Ruben Ayrapetyan
2014-09-16 20:53:02 +04:00
parent fbcd393962
commit e8991abadb
+7 -12
View File
@@ -274,22 +274,17 @@ libc_printf_write_d_i (_FILE *stream, /**< stream pointer */
} }
char str_buffer[ 32 ]; char str_buffer[ 32 ];
const char *string_p = libc_printf_uint_to_string (value, char *string_p = libc_printf_uint_to_string (value,
str_buffer, str_buffer,
sizeof (str_buffer), sizeof (str_buffer),
"0123456789", "0123456789",
10); 10);
if (!sign if (!sign
|| (flags & LIBC_PRINTF_ARG_FLAG_PRINT_SIGN)) || (flags & LIBC_PRINTF_ARG_FLAG_PRINT_SIGN))
{ {
/* printing sign */ JERRY_ASSERT (string_p > str_buffer);
*--string_p = (sign ? '+' : '-');
libc_printf_putchar (stream, sign ? '+' : '-');
if (width > 0)
{
width--;
}
} }
else if (flags & LIBC_PRINTF_ARG_FLAG_SPACE) else if (flags & LIBC_PRINTF_ARG_FLAG_SPACE)
{ {