Module: wine Branch: master Commit: cd55a67424ed75d6356e5b42d4cc22eaab2a0f58 URL: https://gitlab.winehq.org/wine/wine/-/commit/cd55a67424ed75d6356e5b42d4cc22e...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Sep 14 23:48:07 2022 +0300
xmllite/writer: Close open tag on WriteRaw().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
---
dlls/xmllite/tests/writer.c | 16 ++++++++++++++-- dlls/xmllite/writer.c | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c index c76f3708fca..72ca7309355 100644 --- a/dlls/xmllite/tests/writer.c +++ b/dlls/xmllite/tests/writer.c @@ -1320,11 +1320,23 @@ static void test_WriteRaw(void)
hr = IXmlWriter_Flush(writer); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - CHECK_OUTPUT(stream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>a<:a<:<!--a<:-->a<:<a>a</a>"); + IStream_Release(stream);
- IXmlWriter_Release(writer); + /* With open element. */ + stream = writer_set_output(writer); + + hr = IXmlWriter_WriteStartElement(writer, NULL, L"w", NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IXmlWriter_WriteRaw(writer, L"text"); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + CHECK_OUTPUT(stream, "<w>text"); IStream_Release(stream); + + IXmlWriter_Release(writer); }
static void test_writer_state(void) diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c index 2ec1a3b12da..99dfff3c918 100644 --- a/dlls/xmllite/writer.c +++ b/dlls/xmllite/writer.c @@ -1563,6 +1563,9 @@ static HRESULT WINAPI xmlwriter_WriteRaw(IXmlWriter *iface, LPCWSTR data) break; case XmlWriterState_InvalidEncoding: return MX_E_ENCODING; + case XmlWriterState_ElemStarted: + writer_close_starttag(This); + break; default: This->state = XmlWriterState_DocClosed; return WR_E_INVALIDACTION;