From 4c4ac8a98714264857a2fd63ed543c27cdceb0b9 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 30 Sep 2020 23:14:48 +0200 Subject: [PATCH] combase/tests: Use wide-char string literals. Signed-off-by: Michael Stefaniuc Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- 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 eef00fcc8ba..6180ad24d68 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 04d0f3e3a55..a84973ff56b 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");