[PATCH] dpnet: Use wide-char string literals.
Michael Stefaniuc
mstefani at winehq.org
Tue Nov 17 17:06:40 CST 2020
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/dpnet/peer.c | 9 +++------
dlls/dpnet/tests/address.c | 21 ++++++++++-----------
dlls/dpnet/tests/client.c | 16 ++++++++--------
dlls/dpnet/tests/server.c | 22 +++++++---------------
dlls/dpnet/tests/thread.c | 5 ++---
5 files changed, 30 insertions(+), 43 deletions(-)
diff --git a/dlls/dpnet/peer.c b/dlls/dpnet/peer.c
index 7536af67963..329d9b3a828 100644
--- a/dlls/dpnet/peer.c
+++ b/dlls/dpnet/peer.c
@@ -128,12 +128,9 @@ static HRESULT WINAPI IDirectPlay8PeerImpl_Initialize(IDirectPlay8Peer *iface,
HRESULT enum_services_providers(const GUID * const service, DPN_SERVICE_PROVIDER_INFO * const info_buffer,
DWORD * const buf_size, DWORD * const returned)
{
- static const WCHAR serviceproviders[] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\',
- 'D','i','r','e','c','t','P','l','a','y','8','\\',
- 'S','e','r','v','i','c','e',' ','P','r','o','v','i','d','e','r','s',0};
- static const WCHAR friendly[] = {'F','r','i','e','n','d','l','y',' ','N','a','m','e',0};
- static const WCHAR dp_adapterW[] = {'L','o','c','a','l',' ','A','r','e','a',' ','C','o','n','n','e','c','t','i','o','n',
- ' ','-',' ','I','P','v','4',0};
+ static const WCHAR serviceproviders[] = L"SOFTWARE\\Microsoft\\DirectPlay8\\Service Providers";
+ static const WCHAR friendly[] = L"Friendly Name";
+ static const WCHAR dp_adapterW[] = L"Local Area Connection - IPv4";
static const GUID adapter_guid = {0x4ce725f6, 0xd3c0, 0xdade, {0xba, 0x6f, 0x11, 0xf9, 0x65, 0xbc, 0x42, 0x99}};
DWORD req_size = 0;
LONG res;
diff --git a/dlls/dpnet/tests/address.c b/dlls/dpnet/tests/address.c
index a1dcdef100d..a8d31c9854a 100644
--- a/dlls/dpnet/tests/address.c
+++ b/dlls/dpnet/tests/address.c
@@ -26,7 +26,7 @@
/* {6733C6E8-A0D6-450E-8C18-CEACF331DC27} */
static const GUID IID_Random = {0x6733c6e8, 0xa0d6, 0x450e, { 0x8c, 0x18, 0xce, 0xac, 0xf3, 0x31, 0xdc, 0x27 } };
-static const WCHAR localhost[] = {'l','o','c','a','l','h','o','s','t',0};
+static const WCHAR localhost[] = L"localhost";
static void create_directplay_address(void)
{
@@ -72,7 +72,6 @@ static void create_directplay_address(void)
static void address_addcomponents(void)
{
- static const WCHAR UNKNOWN[] = { 'u','n','k','n','o','w','n',0 };
static const char testing[] = "testing";
HRESULT hr;
IDirectPlay8Address *localaddr = NULL;
@@ -92,10 +91,10 @@ static void address_addcomponents(void)
WCHAR *name = NULL;
/* We can add any Component to the Address interface not just the predefined ones. */
- hr = IDirectPlay8Address_AddComponent(localaddr, UNKNOWN, &IID_Random, sizeof(GUID), DPNA_DATATYPE_GUID);
+ hr = IDirectPlay8Address_AddComponent(localaddr, L"unknown", &IID_Random, sizeof(GUID), DPNA_DATATYPE_GUID);
ok(hr == S_OK, "got 0x%08x\n", hr);
- hr = IDirectPlay8Address_AddComponent(localaddr, UNKNOWN, &IID_Random, sizeof(GUID)+1, DPNA_DATATYPE_GUID);
+ hr = IDirectPlay8Address_AddComponent(localaddr, L"unknown", &IID_Random, sizeof(GUID)+1, DPNA_DATATYPE_GUID);
ok(hr == DPNERR_INVALIDPARAM, "got 0x%08x\n", hr);
hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_HOSTNAME, &localhost, sizeof(localhost)+2, DPNA_DATATYPE_STRING);
@@ -150,31 +149,31 @@ static void address_addcomponents(void)
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(GUID)-1;
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, NULL, &size, &type);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", NULL, &size, &type);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(GUID);
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, NULL, &size, &type);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", NULL, &size, &type);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, NULL, &type);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", &compguid, NULL, &type);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(GUID)-1;
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, &size, NULL);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", &compguid, &size, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(GUID);
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, &size, NULL);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", &compguid, &size, NULL);
ok(hr == E_POINTER, "got 0x%08x\n", hr);
size = sizeof(GUID)-1;
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, &size, &type);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", &compguid, &size, &type);
ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr);
ok(size == sizeof(GUID), "got %d\n", size);
size = sizeof(GUID);
- hr = IDirectPlay8Address_GetComponentByName(localaddr, UNKNOWN, &compguid, &size, &type);
+ hr = IDirectPlay8Address_GetComponentByName(localaddr, L"unknown", &compguid, &size, &type);
ok(IsEqualGUID(&compguid, &IID_Random), "incorrect guid\n");
ok(size == sizeof(GUID), "incorrect size got %d\n", size);
ok(type == DPNA_DATATYPE_GUID, "incorrect type\n");
diff --git a/dlls/dpnet/tests/client.c b/dlls/dpnet/tests/client.c
index af56d85baa3..da42e6d6951 100644
--- a/dlls/dpnet/tests/client.c
+++ b/dlls/dpnet/tests/client.c
@@ -33,7 +33,7 @@ static IDirectPlay8Peer* peer = NULL;
static IDirectPlay8Client* client = NULL;
static IDirectPlay8LobbiedApplication* lobbied = NULL;
static const GUID appguid = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa5 } };
-static const WCHAR localhost[] = {'1','2','7','.','0','.','0','.','1',0};
+static const WCHAR localhost[] = L"127.0.0.1";
static HRESULT lastAsyncCode = E_FAIL;
static DPNHANDLE lastAsyncHandle = 0xdeadbeef;
@@ -91,7 +91,7 @@ static HRESULT WINAPI DirectPlayLobbyClientMessageHandler(void *context, DWORD m
static void create_server(void)
{
- static WCHAR sessionname[] = {'w','i','n','e','g','a','m','e','s','s','e','r','v','e','r',0};
+ static WCHAR sessionname[] = L"winegamesserver";
HRESULT hr;
IDirectPlay8Address *localaddr = NULL;
DPN_APPLICATION_DESC appdesc;
@@ -473,9 +473,9 @@ static void test_player_info(void)
{
HRESULT hr;
DPN_PLAYER_INFO info;
- WCHAR name[] = {'w','i','n','e',0};
- WCHAR name2[] = {'w','i','n','e','2',0};
- WCHAR data[] = {'X','X','X','X',0};
+ WCHAR name[] = L"wine";
+ WCHAR name2[] = L"wine2";
+ WCHAR data[] = L"XXXX";
ZeroMemory( &info, sizeof(DPN_PLAYER_INFO) );
info.dwSize = sizeof(DPN_PLAYER_INFO);
@@ -876,9 +876,9 @@ static void test_player_info_peer(void)
{
HRESULT hr;
DPN_PLAYER_INFO info;
- WCHAR name[] = {'w','i','n','e',0};
- WCHAR name2[] = {'w','i','n','e','2',0};
- WCHAR data[] = {'X','X','X','X',0};
+ WCHAR name[] = L"wine";
+ WCHAR name2[] = L"wine2";
+ WCHAR data[] = L"XXXX";
ZeroMemory( &info, sizeof(DPN_PLAYER_INFO) );
info.dwSize = sizeof(DPN_PLAYER_INFO);
diff --git a/dlls/dpnet/tests/server.c b/dlls/dpnet/tests/server.c
index ec7b76698fc..74a0e5adfcf 100644
--- a/dlls/dpnet/tests/server.c
+++ b/dlls/dpnet/tests/server.c
@@ -28,7 +28,7 @@
/* {CD0C3D4B-E15E-4CF2-9EA8-6E1D6548C5A5} */
static const GUID appguid = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa5 } };
-static WCHAR sessionname[] = {'w','i','n','e','g','a','m','e','s','s','e','r','v','e','r',0};
+static WCHAR sessionname[] = L"winegamesserver";
static BOOL nCreatePlayer;
static BOOL nDestroyPlayer;
@@ -106,9 +106,9 @@ static void test_server_info(void)
{
HRESULT hr;
DPN_PLAYER_INFO info;
- WCHAR name[] = {'w','i','n','e',0};
- WCHAR name2[] = {'w','i','n','e','2',0};
- WCHAR data[] = {'X','X','X','X',0};
+ WCHAR name[] = L"wine";
+ WCHAR name2[] = L"wine2";
+ WCHAR data[] = L"XXXX";
IDirectPlay8Server *server = NULL;
hr = CoCreateInstance( &CLSID_DirectPlay8Server, NULL, CLSCTX_ALL, &IID_IDirectPlay8Server, (LPVOID*)&server);
@@ -235,13 +235,6 @@ done:
HRESULT set_firewall( enum firewall_op op )
{
- static const WCHAR dpnsvrW[] =
- {'d','p','n','s','v','r','.','e','x','e',0};
- static const WCHAR separator[] = {'\\',0};
- static const WCHAR clientW[] =
- {'d','p','n','e','t','_','c','l','i','e','n','t',0};
- static const WCHAR serverW[] =
- {'d','p','n','e','t','_','s','e','r','v','e','r',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
@@ -262,8 +255,7 @@ HRESULT set_firewall( enum firewall_op op )
SysFreeString( image );
return E_FAIL;
}
- lstrcatW(path, separator);
- lstrcatW(path, dpnsvrW);
+ lstrcatW(path, L"\\dpnsvr.exe");
init = CoInitializeEx( 0, COINIT_APARTMENTTHREADED );
@@ -291,7 +283,7 @@ HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
- name = SysAllocString( clientW );
+ name = SysAllocString( L"dpnet_client" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
@@ -316,7 +308,7 @@ HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
- name = SysAllocString( serverW );
+ name = SysAllocString( L"dpnet_server" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
diff --git a/dlls/dpnet/tests/thread.c b/dlls/dpnet/tests/thread.c
index d7295ac5223..d681abded91 100644
--- a/dlls/dpnet/tests/thread.c
+++ b/dlls/dpnet/tests/thread.c
@@ -119,7 +119,6 @@ static void test_enum_hosts(void)
IDirectPlay8ThreadPool *pool1 = NULL;
DPN_APPLICATION_DESC appdesc;
DPNHANDLE async = 0, async2 = 0;
- static const WCHAR localhost[] = {'1','2','7','.','0','.','0','.','1',0};
DWORD threadcnt, threadorig;
enumevent = CreateEventA( NULL, TRUE, FALSE, NULL);
@@ -163,8 +162,8 @@ static void test_enum_hosts(void)
hr = IDirectPlay8Address_SetSP(host, &CLSID_DP8SP_TCPIP);
ok(hr == S_OK, "IDirectPlay8Address_SetSP failed with 0x%08x\n", hr);
- hr = IDirectPlay8Address_AddComponent(host, DPNA_KEY_HOSTNAME, localhost, sizeof(localhost),
- DPNA_DATATYPE_STRING);
+ hr = IDirectPlay8Address_AddComponent(host, DPNA_KEY_HOSTNAME, L"127.0.0.1", sizeof(L"127.0.0.1"),
+ DPNA_DATATYPE_STRING);
ok(hr == S_OK, "IDirectPlay8Address failed with 0x%08x\n", hr);
hr = IDirectPlay8Client_EnumHosts(client, &appdesc, host, local, NULL, 0, INFINITE, 0, INFINITE, NULL, &async, 0);
--
2.26.2
More information about the wine-devel
mailing list