[PATCH] explorerframe: Use wide-char string literals.

Michael Stefaniuc mstefani at winehq.org
Sat Oct 3 13:28:11 CDT 2020


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/explorerframe/nstc.c       | 12 ++++--------
 dlls/explorerframe/tests/nstc.c | 17 +++++------------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/dlls/explorerframe/nstc.c b/dlls/explorerframe/nstc.c
index 37e1a553a44..0abaded85a6 100644
--- a/dlls/explorerframe/nstc.c
+++ b/dlls/explorerframe/nstc.c
@@ -75,8 +75,6 @@ static const DWORD unsupported_styles2 =
     NSTCS2_INTERRUPTNOTIFICATIONS | NSTCS2_SHOWNULLSPACEMENU | NSTCS2_DISPLAYPADDING |
     NSTCS2_DISPLAYPINNEDONLY | NTSCS2_NOSINGLETONAUTOEXPAND | NTSCS2_NEVERINSERTNONENUMERATED;
 
-static const WCHAR thispropW[] = {'P','R','O','P','_','T','H','I','S',0};
-
 static inline NSTC2Impl *impl_from_INameSpaceTreeControl2(INameSpaceTreeControl2 *iface)
 {
     return CONTAINING_RECORD(iface, NSTC2Impl, INameSpaceTreeControl2_iface);
@@ -510,7 +508,7 @@ static LRESULT create_namespacetree(HWND hWnd, CREATESTRUCTW *crs)
     This->tv_oldwndproc = (WNDPROC)SetWindowLongPtrW(This->hwnd_tv, GWLP_WNDPROC,
                                                      (ULONG_PTR)tv_wndproc);
     if(This->tv_oldwndproc)
-        SetPropW(This->hwnd_tv, thispropW, This);
+        SetPropW(This->hwnd_tv, L"PROP_THIS", This);
 
     return TRUE;
 }
@@ -534,7 +532,7 @@ static LRESULT destroy_namespacetree(NSTC2Impl *This)
     if(This->tv_oldwndproc)
     {
         SetWindowLongPtrW(This->hwnd_tv, GWLP_WNDPROC, (ULONG_PTR)This->tv_oldwndproc);
-        RemovePropW(This->hwnd_tv, thispropW);
+        RemovePropW(This->hwnd_tv, L"PROP_THIS");
     }
 
     INameSpaceTreeControl2_RemoveAllRoots(&This->INameSpaceTreeControl2_iface);
@@ -762,7 +760,7 @@ static LRESULT on_kbd_event(NSTC2Impl *This, UINT uMsg, WPARAM wParam, LPARAM lP
 
 static LRESULT CALLBACK tv_wndproc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam)
 {
-    NSTC2Impl *This = (NSTC2Impl*)GetPropW(hWnd, thispropW);
+    NSTC2Impl *This = (NSTC2Impl*)GetPropW(hWnd, L"PROP_THIS");
 
     switch(uMessage) {
     case WM_KEYDOWN:
@@ -879,9 +877,7 @@ static HRESULT WINAPI NSTC2_fnInitialize(INameSpaceTreeControl2* iface,
     DWORD window_style, window_ex_style;
     INITCOMMONCONTROLSEX icex;
     RECT rc;
-    static const WCHAR NSTC2_CLASS_NAME[] =
-        {'N','a','m','e','s','p','a','c','e','T','r','e','e',
-         'C','o','n','t','r','o','l',0};
+    static const WCHAR NSTC2_CLASS_NAME[] = L"NamespaceTreeControl";
 
     TRACE("%p (%p, %p, %x)\n", This, hwndParent, prc, nstcsFlags);
 
diff --git a/dlls/explorerframe/tests/nstc.c b/dlls/explorerframe/tests/nstc.c
index a48e3affefe..6433b69ebf8 100644
--- a/dlls/explorerframe/tests/nstc.c
+++ b/dlls/explorerframe/tests/nstc.c
@@ -781,13 +781,6 @@ static void test_basics(void)
     int cbstate;
     WCHAR curdirW[MAX_PATH];
     WCHAR buf[MAX_PATH];
-    static const WCHAR testdirW[] = {'t','e','s','t','d','i','r',0};
-    static const WCHAR testdir2W[] =
-        {'t','e','s','t','d','i','r','\\','t','e','s','t','d','i','r','2',0};
-    static const WCHAR test1W[] =
-        {'t','e','s','t','d','i','r','\\','t','e','s','t','1','.','t','x','t',0};
-    static const WCHAR explorerW[] = {'E','x','p','l','o','r','e','r',0};
-    static const WCHAR randomW[] = {'_','_','h','e','l','l','o',0};
 
     /* These should exist on platforms supporting the NSTC */
     ok(pSHCreateShellItem != NULL, "No SHCreateShellItem.\n");
@@ -827,19 +820,19 @@ static void test_basics(void)
 
     lstrcpyW(buf, curdirW);
     myPathAddBackslashW(buf);
-    lstrcatW(buf, testdirW);
+    lstrcatW(buf, L"testdir");
     hr = pSHCreateItemFromParsingName(buf, NULL, &IID_IShellItem, (void**)&psitestdir);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(FAILED(hr)) goto cleanup;
     lstrcpyW(buf, curdirW);
     myPathAddBackslashW(buf);
-    lstrcatW(buf, testdir2W);
+    lstrcatW(buf, L"testdir\\testdir2");
     hr = pSHCreateItemFromParsingName(buf, NULL, &IID_IShellItem, (void**)&psitestdir2);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(FAILED(hr)) goto cleanup;
     lstrcpyW(buf, curdirW);
     myPathAddBackslashW(buf);
-    lstrcatW(buf, test1W);
+    lstrcatW(buf, L"testdir\\test1.txt");
     hr = pSHCreateItemFromParsingName(buf, NULL, &IID_IShellItem, (void**)&psitest1);
     ok(hr == S_OK, "Got 0x%08x\n", hr);
     if(FAILED(hr)) goto cleanup;
@@ -1725,9 +1718,9 @@ static void test_basics(void)
     {
         hr = INameSpaceTreeControl_SetTheme(pnstc, NULL);
         ok(hr == S_OK, "Got 0x%08x\n", hr);
-        hr = INameSpaceTreeControl_SetTheme(pnstc, explorerW);
+        hr = INameSpaceTreeControl_SetTheme(pnstc, L"Explorer");
         ok(hr == S_OK, "Got 0x%08x\n", hr);
-        hr = INameSpaceTreeControl_SetTheme(pnstc, randomW);
+        hr = INameSpaceTreeControl_SetTheme(pnstc, L"__hello");
         ok(hr == S_OK, "Got 0x%08x\n", hr);
     }
 
-- 
2.26.2




More information about the wine-devel mailing list