[PATCH 2/4] xmllite/writer: Fix initial state handling in WriteEndDocument()

Nikolay Sivov nsivov at codeweavers.com
Wed Mar 23 05:07:27 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/xmllite/tests/writer.c |  7 +++++--
 dlls/xmllite/writer.c       | 13 +++----------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c
index 2015109..e6ffbeb 100644
--- a/dlls/xmllite/tests/writer.c
+++ b/dlls/xmllite/tests/writer.c
@@ -104,7 +104,7 @@ todo_wine {
 
     hr = IXmlWriter_WriteNmToken(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
-
+}
     /* FIXME: add WriteNode */
     /* FIXME: add WriteNodeShallow */
 
@@ -112,12 +112,14 @@ todo_wine {
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteQualifiedName(writer, aW, NULL);
+todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteRaw(writer, aW);
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteRawChars(writer, aW, 1);
+todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteStartDocument(writer, XmlStandalone_Omit);
@@ -127,8 +129,9 @@ todo_wine {
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
 
     hr = IXmlWriter_WriteString(writer, aW);
+todo_wine
     ok(hr == exp_hr, "got 0x%08x, expected 0x%08x\n", hr, exp_hr);
-}
+
     /* FIXME: add WriteSurrogateCharEntity */
     /* FIXME: add WriteWhitespace */
 }
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c
index dac7f04..90e965f 100644
--- a/dlls/xmllite/writer.c
+++ b/dlls/xmllite/writer.c
@@ -754,28 +754,21 @@ static HRESULT WINAPI xmlwriter_WriteElementString(IXmlWriter *iface, LPCWSTR pr
 static HRESULT WINAPI xmlwriter_WriteEndDocument(IXmlWriter *iface)
 {
     xmlwriter *This = impl_from_IXmlWriter(iface);
-    HRESULT hr = S_OK;
 
     TRACE("%p\n", This);
 
     switch (This->state)
     {
     case XmlWriterState_Initial:
-        hr = E_UNEXPECTED;
-        break;
+        return E_UNEXPECTED;
     case XmlWriterState_Ready:
     case XmlWriterState_DocClosed:
-        hr = WR_E_INVALIDACTION;
-        break;
+        This->state = XmlWriterState_DocClosed;
+        return WR_E_INVALIDACTION;
     default:
         ;
     }
 
-    if (FAILED(hr)) {
-        This->state = XmlWriterState_DocClosed;
-        return hr;
-    }
-
     /* empty element stack */
     while (IXmlWriter_WriteEndElement(iface) == S_OK)
         ;
-- 
2.7.0




More information about the wine-patches mailing list