Module: wine Branch: master Commit: 8028ef5be8afb786e9905d3b0668770aa29b18b8 URL: https://gitlab.winehq.org/wine/wine/-/commit/8028ef5be8afb786e9905d3b0668770...
Author: Piotr Caban piotr@codeweavers.com Date: Thu Jan 5 19:22:17 2023 +0100
msvcirt: Fix ostream_print_char on 0 character.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54180
---
dlls/msvcirt/msvcirt.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index 9ad0f45cbed..8d83fca7c94 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -2670,15 +2670,12 @@ ostream* __thiscall ostream_write(ostream *this, const char *str, int count) return this; }
-/* ?writepad@ostream@@AAEAAV1@PBD0@Z */ -/* ?writepad@ostream@@AEAAAEAV1@PEBD0@Z */ -DEFINE_THISCALL_WRAPPER(ostream_writepad, 12) -ostream* __thiscall ostream_writepad(ostream *this, const char *str1, const char *str2) +static ostream* ostream_writepad_len(ostream *this, const char *str1, const char *str2, int len2) { ios *base = ostream_get_ios(this); - int len1 = strlen(str1), len2 = strlen(str2), i; + int len1 = strlen(str1), i;
- TRACE("(%p %p %p)\n", this, str1, str2); + TRACE("(%p %p %p %d)\n", this, str1, str2, len2);
/* left of the padding */ if (base->flags & (FLAGS_left|FLAGS_internal)) { @@ -2703,6 +2700,14 @@ ostream* __thiscall ostream_writepad(ostream *this, const char *str1, const char return this; }
+/* ?writepad@ostream@@AAEAAV1@PBD0@Z */ +/* ?writepad@ostream@@AEAAAEAV1@PEBD0@Z */ +DEFINE_THISCALL_WRAPPER(ostream_writepad, 12) +ostream* __thiscall ostream_writepad(ostream *this, const char *str1, const char *str2) +{ + return ostream_writepad_len(this, str1, str2, strlen(str2)); +} + static ostream* ostream_internal_print_integer(ostream *ostr, int n, BOOL unsig, BOOL shrt) { ios *base = ostream_get_ios(ostr); @@ -2792,12 +2797,10 @@ static ostream* ostream_internal_print_float(ostream *ostr, double d, BOOL dbl) DEFINE_THISCALL_WRAPPER(ostream_print_char, 8) ostream* __thiscall ostream_print_char(ostream *this, char c) { - const char c_str[2] = {c, 0}; - - TRACE("(%p %c)\n", this, c); + TRACE("(%p %d)\n", this, c);
if (ostream_opfx(this)) { - ostream_writepad(this, "", c_str); + ostream_writepad_len(this, "", &c, 1); ostream_osfx(this); } return this;