Michael Stefaniuc : combase/tests: Use wide-char string literals.

Alexandre Julliard julliard at winehq.org
Mon Oct 5 15:54:57 CDT 2020


Module: wine
Branch: master
Commit: 4c4ac8a98714264857a2fd63ed543c27cdceb0b9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4c4ac8a98714264857a2fd63ed543c27cdceb0b9

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Sep 30 23:14:48 2020 +0200

combase/tests: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/combase/tests/roapi.c  |  8 +++-----
 dlls/combase/tests/string.c | 17 ++++++++---------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/dlls/combase/tests/roapi.c b/dlls/combase/tests/roapi.c
index eef00fcc8b..6180ad24d6 100644
--- a/dlls/combase/tests/roapi.c
+++ b/dlls/combase/tests/roapi.c
@@ -60,9 +60,6 @@ static BOOL init_functions(void)
 
 static void test_ActivationFactories(void)
 {
-    static const WCHAR xmldocumentW[] = { 'W','i','n','d','o','w','s','.','D','a','t','a','.','X','m','l','.',
-                                   'D','o','m','.','X','m','l','D','o','c','u','m','e','n','t',0 };
-    static const WCHAR nonexistW[] = { 'D','o','e','s','.','N','o','t','.','E','x','i','s','t',0 };
     HRESULT hr;
     HSTRING str, str2;
     IActivationFactory *factory = NULL;
@@ -74,10 +71,11 @@ static void test_ActivationFactories(void)
         return;
     }
 
-    hr = pWindowsCreateString(xmldocumentW, ARRAY_SIZE(xmldocumentW) - 1, &str);
+    hr = pWindowsCreateString(L"Windows.Data.Xml.Dom.XmlDocument",
+                              ARRAY_SIZE(L"Windows.Data.Xml.Dom.XmlDocument") - 1, &str);
     ok(hr == S_OK, "got %08x\n", hr);
 
-    hr = pWindowsCreateString(nonexistW, ARRAY_SIZE(nonexistW) - 1, &str2);
+    hr = pWindowsCreateString(L"Does.Not.Exist", ARRAY_SIZE(L"Does.Not.Exist") - 1, &str2);
     ok(hr == S_OK, "got %08x\n", hr);
 
     hr = pRoInitialize(RO_INIT_MULTITHREADED);
diff --git a/dlls/combase/tests/string.c b/dlls/combase/tests/string.c
index 04d0f3e3a5..a84973ff56 100644
--- a/dlls/combase/tests/string.c
+++ b/dlls/combase/tests/string.c
@@ -101,12 +101,11 @@ static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length,
     ok_(__FILE__, line)(memcmp(ptr, content, sizeof(*content) * length) == 0, "Incorrect string content\n");
 }
 
-static const WCHAR input_string[] = { 'a', 'b', 'c', 'd', 'e', 'f', '\0', '\0' };
-static const WCHAR input_string1[] = { 'a', 'b', 'c', '\0' };
-static const WCHAR input_string2[] = { 'd', 'e', 'f', '\0' };
-static const WCHAR input_empty_string[] = { '\0' };
-static const WCHAR input_embed_null[] = { 'a', '\0', 'c', '\0', 'e', 'f', '\0' };
-static const WCHAR output_substring[] = { 'c', 'd', 'e', 'f', '\0' };
+static const WCHAR input_string[] = L"abcdef\0";
+static const WCHAR input_string1[] = L"abc";
+static const WCHAR input_string2[] = L"def";
+static const WCHAR input_embed_null[] = L"a\0c\0ef";
+static const WCHAR output_substring[] = L"cdef";
 
 static void test_create_delete(void)
 {
@@ -147,7 +146,7 @@ static void test_create_delete(void)
     ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n");
 
     /* Test an empty string */
-    ok(pWindowsCreateString(input_empty_string, 0, &str) == S_OK, "Failed to create string\n");
+    ok(pWindowsCreateString(L"", 0, &str) == S_OK, "Failed to create string\n");
     ok(str == NULL, "Empty string not a null string\n");
     ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n");
 
@@ -155,7 +154,7 @@ static void test_create_delete(void)
     ok(str == NULL, "Empty string not a null string\n");
     ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n");
 
-    ok(pWindowsCreateStringReference(input_empty_string, 0, &header, &str) == S_OK, "Failed to create string\n");
+    ok(pWindowsCreateStringReference(L"", 0, &header, &str) == S_OK, "Failed to create string\n");
     ok(str == NULL, "Empty string not a null string\n");
     ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n");
 
@@ -230,7 +229,7 @@ static void test_string_buffer(void)
     ok(ptr != NULL, "Empty string didn't return a buffer pointer\n");
     ok(pWindowsPromoteStringBuffer(buf, &str) == S_OK, "Failed to promote string buffer\n");
     ok(str == NULL, "Empty string isn't a null string\n");
-    check_string(str, input_empty_string, 0, FALSE);
+    check_string(str, L"", 0, FALSE);
     ok(pWindowsDeleteString(str) == S_OK, "Failed to delete string\n");
 
     ok(pWindowsDeleteStringBuffer(NULL) == S_OK, "Failed to delete null string buffer\n");




More information about the wine-cvs mailing list