]> granicus.if.org Git - libexpat/commitdiff
Fix up accumulate_pi_characters() to work for UTF-16 builds
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 22 Aug 2017 15:24:40 +0000 (16:24 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Tue, 29 Aug 2017 21:13:14 +0000 (23:13 +0200)
expat/tests/runtests.c

index 1895cec08fea0fce51b444dcbf89a64d06f982be..1dc589fc1c9216c0a0540ef428209c562ae67cc4 100644 (file)
@@ -5635,15 +5635,15 @@ accumulate_pi_characters(void *userData,
     CharData *storage = (CharData *)userData;
 
     CharData_AppendXMLChars(storage, target, -1);
-    CharData_AppendXMLChars(storage, ": ", 2);
+    CharData_AppendXMLChars(storage, XCS(": "), 2);
     CharData_AppendXMLChars(storage, data, -1);
-    CharData_AppendXMLChars(storage, "\n", 1);
+    CharData_AppendXMLChars(storage, XCS("\n"), 1);
 }
 
 START_TEST(test_pi_yml)
 {
     const char *text = "<?yml something like data?><doc/>";
-    const XML_Char *expected = "yml: something like data\n";
+    const XML_Char *expected = XCS("yml: something like data\n");
     CharData storage;
 
     CharData_Init(&storage);
@@ -5659,7 +5659,7 @@ END_TEST
 START_TEST(test_pi_xnl)
 {
     const char *text = "<?xnl nothing like data?><doc/>";
-    const XML_Char *expected = "xnl: nothing like data\n";
+    const XML_Char *expected = XCS("xnl: nothing like data\n");
     CharData storage;
 
     CharData_Init(&storage);
@@ -5675,7 +5675,7 @@ END_TEST
 START_TEST(test_pi_xmm)
 {
     const char *text = "<?xmm everything like data?><doc/>";
-    const XML_Char *expected = "xmm: everything like data\n";
+    const XML_Char *expected = XCS("xmm: everything like data\n");
     CharData storage;
 
     CharData_Init(&storage);
@@ -5698,7 +5698,11 @@ START_TEST(test_utf16_pi)
         "<\0?\0\x04\x0e\x08\x0e?\0>\0"
         /* <q/> */
         "<\0q\0/\0>\0";
-    const XML_Char *expected = "\xe0\xb8\x84\xe0\xb8\x88: \n";
+#ifdef XML_UNICODE
+    const XML_Char *expected = XCS("\x0e04\x0e08: \n");
+#else
+    const XML_Char *expected = XCS("\xe0\xb8\x84\xe0\xb8\x88: \n");
+#endif
     CharData storage;
 
     CharData_Init(&storage);
@@ -5721,7 +5725,11 @@ START_TEST(test_utf16_be_pi)
         "\0<\0?\x0e\x04\x0e\x08\0?\0>"
         /* <q/> */
         "\0<\0q\0/\0>";
-    const XML_Char *expected = "\xe0\xb8\x84\xe0\xb8\x88: \n";
+#ifdef XML_UNICODE
+    const XML_Char *expected = XCS("\x0e04\x0e08: \n");
+#else
+    const XML_Char *expected = XCS("\xe0\xb8\x84\xe0\xb8\x88: \n");
+#endif
     CharData storage;
 
     CharData_Init(&storage);