[24/28] shell32/tests: Use common wine_dbgstr_guid implementation from test.h

Frédéric Delanoy frederic.delanoy at gmail.com
Fri Jan 17 09:52:13 CST 2014


---
 dlls/shell32/tests/ebrowser.c  | 25 +++++--------------------
 dlls/shell32/tests/shellole.c  | 20 ++++----------------
 dlls/shell32/tests/shellpath.c | 28 ++++++++--------------------
 dlls/shell32/tests/shlfolder.c | 14 +-------------
 4 files changed, 18 insertions(+), 69 deletions(-)

diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 07f5019..fe05e5f 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -121,21 +121,6 @@ static void process_msgs(void)
     }
 }
 
-static const char *debugstr_guid(REFIID riid)
-{
-    static char buf[50];
-
-    if(!riid)
-        return "(null)";
-
-    sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
-            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
-            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
-    return buf;
-}
-
 /*********************************************************************
  * IExplorerBrowserEvents implementation
  */
@@ -231,7 +216,7 @@ static inline IExplorerPaneVisibilityImpl *impl_from_IExplorerPaneVisibility(IEx
 static HRESULT WINAPI IExplorerPaneVisibility_fnQueryInterface(IExplorerPaneVisibility *iface,
                                                                REFIID riid, LPVOID *ppvObj)
 {
-    ok(0, "unexpected, %s\n", debugstr_guid(riid));
+    ok(0, "unexpected, %s\n", wine_dbgstr_guid(riid));
     *ppvObj = NULL;
     return E_NOINTERFACE;
 }
@@ -275,7 +260,7 @@ static HRESULT WINAPI IExplorerPaneVisibility_fnGetPaneState(IExplorerPaneVisibi
     else if(IsEqualGUID(&EP_AdvQueryPane, ep))       This->aqp++;
     else
     {
-        trace("Unknown explorer pane: %s\n", debugstr_guid(ep));
+        trace("Unknown explorer pane: %s\n", wine_dbgstr_guid(ep));
         This->unk++;
     }
 
@@ -320,7 +305,7 @@ static inline ICommDlgBrowser3Impl *impl_from_ICommDlgBrowser3(ICommDlgBrowser3
 
 static HRESULT WINAPI ICommDlgBrowser3_fnQueryInterface(ICommDlgBrowser3 *iface, REFIID riid, LPVOID *ppvObj)
 {
-    ok(0, "unexpected %s\n", debugstr_guid(riid));
+    ok(0, "unexpected %s\n", wine_dbgstr_guid(riid));
     *ppvObj = NULL;
     return E_NOINTERFACE;
 }
@@ -490,7 +475,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryInterface(IServiceProvider *iface,
         return E_NOINTERFACE;
     }
 
-    ok(0, "Unexpected interface requested, %s\n", debugstr_guid(riid));
+    ok(0, "Unexpected interface requested, %s\n", wine_dbgstr_guid(riid));
     return E_NOINTERFACE;
 }
 
@@ -534,7 +519,7 @@ static HRESULT WINAPI IServiceProvider_fnQueryService(IServiceProvider *iface,
         }
     }
 
-    ok(was_in_list, "unknown service, serviceID: %s, riid: %s\n", debugstr_guid(guidService), debugstr_guid(riid));
+    ok(was_in_list, "unknown service, serviceID: %s, riid: %s\n", wine_dbgstr_guid(guidService), wine_dbgstr_guid(riid));
 
     /* Give back an interface, if any. */
     if(punk)
diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c
index af07545..3f0b490 100644
--- a/dlls/shell32/tests/shellole.c
+++ b/dlls/shell32/tests/shellole.c
@@ -75,18 +75,6 @@ static HRESULT (WINAPI *pSHPropStgWriteMultiple)(IPropertyStorage*, UINT*,
         ULONG, const PROPSPEC*, PROPVARIANT*, PROPID);
 static HRESULT (WINAPI *pSHCreateQueryCancelAutoPlayMoniker)(IMoniker**);
 
-static const char *debugstr_guid(REFIID riid)
-{
-    static char buf[50];
-
-    sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
-            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
-            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
-            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
-    return buf;
-}
-
 static void init(void)
 {
     HMODULE hmod = GetModuleHandleA("shell32.dll");
@@ -478,8 +466,8 @@ static HRESULT WINAPI test_activator_GetClassObject(IClassActivator *iface, REFC
     DWORD context, LCID locale, REFIID riid, void **ppv)
 {
     CHECK_EXPECT(autoplay_GetClassObject);
-    ok(IsEqualGUID(clsid, &CLSID_QueryCancelAutoPlay), "clsid %s\n", debugstr_guid(clsid));
-    ok(IsEqualIID(riid, &IID_IQueryCancelAutoPlay), "riid %s\n", debugstr_guid(riid));
+    ok(IsEqualGUID(clsid, &CLSID_QueryCancelAutoPlay), "clsid %s\n", wine_dbgstr_guid(clsid));
+    ok(IsEqualIID(riid, &IID_IQueryCancelAutoPlay), "riid %s\n", wine_dbgstr_guid(riid));
     return E_NOTIMPL;
 }
 
@@ -559,7 +547,7 @@ static HRESULT WINAPI test_moniker_BindToObject(IMoniker* iface,
     CHECK_EXPECT(autoplay_BindToObject);
     ok(pbc != NULL, "got %p\n", pbc);
     ok(moniker_to_left == NULL, "got %p\n", moniker_to_left);
-    ok(IsEqualIID(riid, &IID_IClassActivator), "got riid %s\n", debugstr_guid(riid));
+    ok(IsEqualIID(riid, &IID_IClassActivator), "got riid %s\n", wine_dbgstr_guid(riid));
 
     if (IsEqualIID(riid, &IID_IClassActivator))
     {
@@ -737,7 +725,7 @@ static void test_SHCreateQueryCancelAutoPlayMoniker(void)
     memset(&clsid, 0, sizeof(clsid));
     hr = IMoniker_GetClassID(mon, &clsid);
     ok(hr == S_OK, "got 0x%08x\n", hr);
-    ok(IsEqualGUID(&clsid, &CLSID_ClassMoniker), "got %s\n", debugstr_guid(&clsid));
+    ok(IsEqualGUID(&clsid, &CLSID_ClassMoniker), "got %s\n", wine_dbgstr_guid(&clsid));
 
     /* extract used CLSID that implements this hook */
     SET_EXPECT(autoplay_BindToObject);
diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c
index f3c40a5..462c6b4 100644
--- a/dlls/shell32/tests/shellpath.c
+++ b/dlls/shell32/tests/shellpath.c
@@ -304,17 +304,6 @@ static const char *getFolderName(int folder)
     }
 }
 
-static const char *printGUID(const GUID *guid, char * guidSTR)
-{
-    if (!guid) return NULL;
-
-    sprintf(guidSTR, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
-     guid->Data1, guid->Data2, guid->Data3,
-     guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
-     guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
-    return guidSTR;
-}
-
 static void test_parameters(void)
 {
     LPITEMIDLIST pidl = NULL;
@@ -549,18 +538,17 @@ static void matchGUID(int folder, const GUID *guid, const GUID *guid_alt)
          pidlLast->mkid.abID[0] == PT_GUID))
         {
             GUID *shellGuid = (GUID *)(pidlLast->mkid.abID + 2);
-            char shellGuidStr[39], guidStr[39], guid_altStr[39];
 
             if (!guid_alt)
              ok(IsEqualIID(shellGuid, guid),
               "%s: got GUID %s, expected %s\n", getFolderName(folder),
-              printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr));
+              wine_dbgstr_guid(shellGuid), wine_dbgstr_guid(guid));
             else
              ok(IsEqualIID(shellGuid, guid) ||
               IsEqualIID(shellGuid, guid_alt),
               "%s: got GUID %s, expected %s or %s\n", getFolderName(folder),
-              printGUID(shellGuid, shellGuidStr), printGUID(guid, guidStr),
-              printGUID(guid_alt, guid_altStr));
+              wine_dbgstr_guid(shellGuid), wine_dbgstr_guid(guid),
+              wine_dbgstr_guid(guid_alt));
         }
         IMalloc_Free(pMalloc, pidl);
     }
@@ -1911,7 +1899,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
     IKnownFolder *folder;
     WCHAR sName[1024], sRelativePath[MAX_PATH], sParsingName[MAX_PATH];
     BOOL validPath;
-    char sParentGuid[39];
+    const char *sParentGuid;
     BOOL *current_known_folder_found = &known_folder_found[0];
     BOOL found = FALSE;
     const char *srcParsingName;
@@ -1953,7 +1941,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
 
                     ok_(__FILE__, known_folder->line)(kfd.category == known_folder->category, "invalid known folder category for %s: %d expected, but %d retrieved\n", known_folder->sFolderId, known_folder->category, kfd.category);
 
-                    printGUID(&kfd.fidParent, sParentGuid);
+                    sParentGuid = wine_dbgstr_guid(&kfd.fidParent);
                     ok_(__FILE__, known_folder->line)(IsEqualGUID(known_folder->fidParent, &kfd.fidParent), "invalid known folder parent for %s: %s expected, but %s retrieved\n", known_folder->sFolderId, known_folder->sParent, sParentGuid);
 
                     if(!known_folder->sRelativePath)
@@ -2012,7 +2000,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
 
     if(!found)
     {
-        printGUID(folderId, sParentGuid);
+        sParentGuid = wine_dbgstr_guid(folderId);
         trace("unknown known folder found: %s\n", sParentGuid);
 
         hr = IKnownFolderManager_GetFolder(mgr, folderId, &folder);
@@ -2027,7 +2015,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
                 trace("  category: %d\n", kfd.category);
                 trace("  name: %s\n", wine_dbgstr_w(kfd.pszName));
                 trace("  description: %s\n", wine_dbgstr_w(kfd.pszDescription));
-                printGUID(&kfd.fidParent, sParentGuid);
+                sParentGuid = wine_dbgstr_guid(&kfd.fidParent);
                 trace("  parent: %s\n", sParentGuid);
                 trace("  relative path: %s\n", wine_dbgstr_w(kfd.pszRelativePath));
                 trace("  parsing name: %s\n", wine_dbgstr_w(kfd.pszParsingName));
@@ -2037,7 +2025,7 @@ static void check_known_folder(IKnownFolderManager *mgr, KNOWNFOLDERID *folderId
                 trace("  security: %s\n", wine_dbgstr_w(kfd.pszSecurity));
                 trace("  attributes: 0x%08x\n", kfd.dwAttributes);
                 trace("  flags: 0x%08x\n", kfd.kfdFlags);
-                printGUID(&kfd.ftidType, sParentGuid);
+                sParentGuid = wine_dbgstr_guid(&kfd.ftidType);
                 trace("  type: %s\n", sParentGuid);
                 FreeKnownFolderDefinitionFields(&kfd);
             }
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index f692837..7b8a57e 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -75,18 +75,6 @@ static HRESULT (WINAPI *pSHCreateDefaultContextMenu)(const DEFCONTEXTMENU*,REFII
 static HRESULT (WINAPI *pSHCreateShellFolderView)(const SFV_CREATE *pcsfv, IShellView **ppsv);
 static HRESULT (WINAPI *pSHCreateShellFolderViewEx)(LPCSFV psvcbi, IShellView **ppv);
 
-static const char *debugstr_guid(REFIID riid)
-{
-    static char buf[50];
-
-    sprintf(buf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-            riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
-            riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
-            riid->Data4[5], riid->Data4[6], riid->Data4[7]);
-
-    return buf;
-}
-
 static WCHAR *make_wstr(const char *str)
 {
     WCHAR *ret;
@@ -587,7 +575,7 @@ if (0)
                     ok(hr == S_OK, "Got 0x%08x\n", hr);
                     /* CLSID_ShellFSFolder on some w2k systems */
                     ok(IsEqualIID(&id, &CLSID_ShellDocObjView) || broken(IsEqualIID(&id, &CLSID_ShellFSFolder)),
-                        "Unexpected classid %s\n", debugstr_guid(&id));
+                        "Unexpected classid %s\n", wine_dbgstr_guid(&id));
                     IPersist_Release(pp);
                 }
 
-- 
1.8.5.2




More information about the wine-patches mailing list