xmllite/writer: Do not indent after just BOM has been written.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5773a5d3b4
commit
a6d6bebede
|
@ -648,6 +648,8 @@ static void test_bom(void)
|
|||
hr = IXmlWriter_SetOutput(writer, output);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
writer_set_property(writer, XmlWriterProperty_Indent);
|
||||
|
||||
hr = IXmlWriter_WriteElementString(writer, NULL, aW, NULL, NULL);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
|
@ -658,7 +660,8 @@ static void test_bom(void)
|
|||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
|
||||
ptr = GlobalLock(hglobal);
|
||||
ok(ptr[0] == 0xff && ptr[1] == 0xfe, "got %x,%x\n", ptr[0], ptr[1]);
|
||||
ok(ptr[0] == 0xff && ptr[1] == 0xfe && ptr[2] == '<', "Unexpected output: %#x,%#x,%#x\n",
|
||||
ptr[0], ptr[1], ptr[2]);
|
||||
GlobalUnlock(hglobal);
|
||||
|
||||
IUnknown_Release(output);
|
||||
|
|
|
@ -447,7 +447,9 @@ static void write_node_indent(xmlwriter *writer)
|
|||
if (!writer->indent)
|
||||
return;
|
||||
|
||||
if (writer->output->buffer.written)
|
||||
/* Do state check to prevent newline inserted after BOM. It is assumed that
|
||||
state does not change between writing BOM and inserting indentation. */
|
||||
if (writer->output->buffer.written && writer->state != XmlWriterState_Ready)
|
||||
write_output_buffer(writer->output, crlfW, ARRAY_SIZE(crlfW));
|
||||
while (indent_level--)
|
||||
write_output_buffer(writer->output, dblspaceW, ARRAY_SIZE(dblspaceW));
|
||||
|
@ -1208,12 +1210,13 @@ static HRESULT WINAPI xmlwriter_WriteStartElement(IXmlWriter *iface, LPCWSTR pre
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
write_encoding_bom(This);
|
||||
write_node_indent(This);
|
||||
|
||||
This->state = XmlWriterState_ElemStarted;
|
||||
This->starttagopen = TRUE;
|
||||
|
||||
push_element(This, element);
|
||||
|
||||
write_node_indent(This);
|
||||
write_output_buffer(This->output, ltW, ARRAY_SIZE(ltW));
|
||||
write_output_qname(This->output, prefix, local_name);
|
||||
writer_inc_indent(This);
|
||||
|
|
Loading…
Reference in New Issue