[PATCH 1/5] msxml3: When writing to stream \0 terminate output.
Dmitry Timoshkov
dmitry at baikal.ru
Tue Apr 27 04:29:17 CDT 2021
Nikolay Sivov <nsivov at codeweavers.com> wrote:
> >>> static int XMLCALL domdoc_stream_save_closecallback(void *ctx)
> >>> {
> >>> + ULONG written;
> >>> + HRESULT hr;
> >>> +
> >>> + hr = IStream_Write((IStream*)ctx, "\0", 1, &written);
> >>> + if (hr != S_OK)
> >>> + {
> >>> + WARN("stream write error: 0x%08x\n", hr);
> >>> + hr = -1;
> >>> + }
> >>> +
> >>> IStream_Release((IStream*)ctx);
> >>> - return 0;
> >>> + return hr;
> >>> }
> >> This will need a test on its own, if it really does that.
> > It appears that Windows started to do that since Windows 8. What kind of
> > test would you like to see?
>
> The one that shows additional single 0 byte, regardless of document
> encoding. Or initial stream memory block contents.
>
> >
> >> Callback
> >> should return 0 or -1, as documented.
> > Yes, and the logic in domdoc_stream_save_closecallback() follows that.
> >
> Ok, it's confusing. It's more readable to do SUCCEEDED(hr) ? 0 : -1, or
> similar.
I decided to fix the tests without patching ::save() to avoid not related
changes preventing reviewing further patches. Thanks for the help.
--
Dmitry.
More information about the wine-devel
mailing list