xmllite/writer: Fix initial state handling in WriteEndDocument().

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-23 13:07:27 +03:00 committed by Alexandre Julliard
parent 8ad295ed70
commit 86a7dd99e0
2 changed files with 8 additions and 12 deletions

View File

@ -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 */
}

View File

@ -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)
;