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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-24 10:41:24 +03:00 committed by Alexandre Julliard
parent e89c2df7c5
commit 2d9f6f7215
2 changed files with 12 additions and 0 deletions

View File

@ -907,6 +907,7 @@ static void test_WriteRaw(void)
static void test_writer_state(void) static void test_writer_state(void)
{ {
static const WCHAR aW[] = {'a',0};
IXmlWriter *writer; IXmlWriter *writer;
IStream *stream; IStream *stream;
HRESULT hr; HRESULT hr;
@ -927,6 +928,15 @@ static void test_writer_state(void)
IStream_Release(stream); 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); IXmlWriter_Release(writer);
} }

View File

@ -591,7 +591,9 @@ static HRESULT WINAPI xmlwriter_WriteAttributeString(IXmlWriter *iface, LPCWSTR
{ {
case XmlWriterState_Initial: case XmlWriterState_Initial:
return E_UNEXPECTED; return E_UNEXPECTED;
case XmlWriterState_Ready:
case XmlWriterState_DocClosed: case XmlWriterState_DocClosed:
This->state = XmlWriterState_DocClosed;
return WR_E_INVALIDACTION; return WR_E_INVALIDACTION;
default: default:
; ;