Surrogates have to be written in pairs. Also, handle related errors
Signed-off-by: David Kahurani k.kahurani@gmail.com
-- v2: xmllite/writer: Handle surrogate pairs
From: David Kahurani k.kahurani@gmail.com
Surrogates have to be written in pairs. Also, handle related errors.
Signed-off-by: David Kahurani k.kahurani@gmail.com --- dlls/xmllite/tests/writer.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/dlls/xmllite/tests/writer.c b/dlls/xmllite/tests/writer.c index c4ab079373c..1777bf0f40e 100644 --- a/dlls/xmllite/tests/writer.c +++ b/dlls/xmllite/tests/writer.c @@ -1339,6 +1339,7 @@ static void test_WriteRaw(void) IXmlWriter *writer; IStream *stream; HRESULT hr; + WCHAR surrogates[] = {0xdc00, 0xd800, '\0'};
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1351,6 +1352,9 @@ static void test_WriteRaw(void)
stream = writer_set_output(writer);
+ hr = IXmlWriter_WriteRaw(writer, surrogates); + ok(hr == WR_E_INVALIDSURROGATEPAIR, "Unexpected hr %#lx.\n", hr); + hr = IXmlWriter_WriteRaw(writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@@ -1888,6 +1892,7 @@ static void test_WriteString(void) IXmlWriter *writer; IStream *stream; HRESULT hr; + WCHAR surrogates[] = {0xd800, 0xdc00, 'x', 'y', '\0'};
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -1905,6 +1910,21 @@ static void test_WriteString(void)
stream = writer_set_output(writer);
+ hr = IXmlWriter_WriteStartElement(writer, NULL, L"sub", NULL); + ok(hr == S_OK, "Unexpected hr #%lx.\n", hr); + + hr = IXmlWriter_WriteString(writer, surrogates); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IXmlWriter_Flush(writer); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + CHECK_OUTPUT(stream, + "<sub>\U00010000xy"); + IStream_Release(stream); + + stream = writer_set_output(writer); + hr = IXmlWriter_WriteStartElement(writer, NULL, L"b", NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126096
Your paranoid android.
=== debian11 (32 bit report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit ar:MA report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit de report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit fr report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit he:IL report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit hi:IN report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit ja:JP report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11 (32 bit zh:CN report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11b (32 bit WoW report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CD|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy/></|, expected |<sub>����xy|
=== debian11b (64 bit WoW report) ===
xmllite: writer.c:1356: Test failed: Unexpected hr 0. writer.c:1390: Test failed: data size mismatch, expected 65, got 71 writer.c:1390: Test failed: got |<?xml version="1.0" encoding="UTF-8"?>������a<:a<:<!--a<:-->a<:<a>a</a>![CDATA[(|, expected |<?xml version="1.0" encoding="UTF-8"?>a<:a<:<!--a<:-->a<:<a>a</a>| writer.c:1922: Test failed: data size mismatch, expected 11, got 13 writer.c:1922: Test failed: got |<sub>������xy|, expected |<sub>����xy|