diff --git a/reactos/lib/rtl/sprintf.c b/reactos/lib/rtl/sprintf.c index e020319603a..c258476e7d8 100644 --- a/reactos/lib/rtl/sprintf.c +++ b/reactos/lib/rtl/sprintf.c @@ -286,6 +286,10 @@ static char* string(char* buf, char* end, const char* s, int len, int field_width, int precision, int flags) { int i; + char c; + + c = (flags & ZEROPAD) ? '0' : ' '; + if (s == NULL) { s = ""; @@ -309,7 +313,7 @@ string(char* buf, char* end, const char* s, int len, int field_width, int precis while (len < field_width--) { if (buf <= end) - *buf = ' '; + *buf = c; ++buf; } for (i = 0; i < len; ++i) @@ -331,6 +335,10 @@ static char* stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int precision, int flags) { int i; + char c; + + c = (flags & ZEROPAD) ? '0' : ' '; + if (sw == NULL) { sw = L""; @@ -354,7 +362,7 @@ stringw(char* buf, char* end, const wchar_t* sw, int len, int field_width, int p while (len < field_width--) { if (buf <= end) - *buf = ' '; + *buf = c; buf++; } for (i = 0; i < len; ++i) diff --git a/reactos/lib/rtl/swprintf.c b/reactos/lib/rtl/swprintf.c index 4a71ffda121..33f5ac4e371 100644 --- a/reactos/lib/rtl/swprintf.c +++ b/reactos/lib/rtl/swprintf.c @@ -286,6 +286,10 @@ static wchar_t* string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int precision, int flags) { int i; + wchar_t c; + + c = (flags & ZEROPAD) ? L'0' : L' '; + if (s == NULL) { s = ""; @@ -309,7 +313,7 @@ string(wchar_t* buf, wchar_t* end, const char* s, int len, int field_width, int while (len < field_width--) { if (buf <= end) - *buf = L' '; + *buf = c; ++buf; } for (i = 0; i < len; ++i) @@ -331,6 +335,10 @@ static wchar_t* stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width, int precision, int flags) { int i; + wchar_t c; + + c = (flags & ZEROPAD) ? L'0' : L' '; + if (sw == NULL) { sw = L""; @@ -354,7 +362,7 @@ stringw(wchar_t* buf, wchar_t* end, const wchar_t* sw, int len, int field_width, while (len < field_width--) { if (buf <= end) - *buf = L' '; + *buf = c; buf++; } for (i = 0; i < len; ++i)