Nikolay Sivov : xmllite/writer: Put writer into closed state on WriteAttributeString().

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 24 11:04:00 CDT 2016


Module: wine
Branch: master
Commit: 2d9f6f7215db832205f8e1da8b5ccaa3eaaafc2d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2d9f6f7215db832205f8e1da8b5ccaa3eaaafc2d

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Mar 24 10:41:24 2016 +0300

xmllite/writer: Put writer into closed state on WriteAttributeString().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/xmllite/tests/writer.c | 10 ++++++++++
 dlls/xmllite/writer.c       |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c
index 81945d1..cb379fe 100644
--- a/dlls/xmllite/tests/writer.c
+++ b/dlls/xmllite/tests/writer.c
@@ -907,6 +907,7 @@ static void test_WriteRaw(void)
 
 static void test_writer_state(void)
 {
+    static const WCHAR aW[] = {'a',0};
     IXmlWriter *writer;
     IStream *stream;
     HRESULT hr;
@@ -927,6 +928,15 @@ static void test_writer_state(void)
 
     IStream_Release(stream);
 
+    stream = writer_set_output(writer);
+
+    hr = IXmlWriter_WriteAttributeString(writer, NULL, aW, NULL, aW);
+    ok(hr == WR_E_INVALIDACTION, "got 0x%08x\n", hr);
+
+    check_writer_state(writer, WR_E_INVALIDACTION);
+
+    IStream_Release(stream);
+
     IXmlWriter_Release(writer);
 }
 
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c
index 7895fb0..5e3557b 100644
--- a/dlls/xmllite/writer.c
+++ b/dlls/xmllite/writer.c
@@ -591,7 +591,9 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
     {
     case XmlWriterState_Initial:
         return E_UNEXPECTED;
+    case XmlWriterState_Ready:
     case XmlWriterState_DocClosed:
+        This->state = XmlWriterState_DocClosed;
         return WR_E_INVALIDACTION;
     default:
         ;




More information about the wine-cvs mailing list