Jacek Caban : comdlg32: Use proper helpers for iface calls.

Alexandre Julliard julliard at winehq.org
Thu Aug 16 15:26:13 CDT 2012


Module: wine
Branch: master
Commit: e5e2673984ec5ba14da8a91f12c3e72f9caa30b9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e5e2673984ec5ba14da8a91f12c3e72f9caa30b9

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 16 13:19:27 2012 +0200

comdlg32: Use proper helpers for iface calls.

---

 dlls/comdlg32/filedlgbrowser.c |   28 ++++++++++++----------------
 dlls/comdlg32/itemdlg.c        |    4 ++--
 dlls/comdlg32/tests/itemdlg.c  |   12 ++++++------
 3 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/dlls/comdlg32/filedlgbrowser.c b/dlls/comdlg32/filedlgbrowser.c
index 776abfc..1dda9a8 100644
--- a/dlls/comdlg32/filedlgbrowser.c
+++ b/dlls/comdlg32/filedlgbrowser.c
@@ -226,26 +226,22 @@ static HRESULT WINAPI IShellBrowserImpl_QueryInterface(IShellBrowser *iface,
 
     *ppvObj = NULL;
 
-    if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
-    { *ppvObj = This;
-    }
-    else if(IsEqualIID(riid, &IID_IOleWindow))  /*IOleWindow*/
-    { *ppvObj = This;
-    }
-
-    else if(IsEqualIID(riid, &IID_IShellBrowser))  /*IShellBrowser*/
-    { *ppvObj = This;
-    }
-
-    else if(IsEqualIID(riid, &IID_ICommDlgBrowser))  /*ICommDlgBrowser*/
+    if(IsEqualIID(riid, &IID_IUnknown))
+        *ppvObj = &This->IShellBrowser_iface;
+    else if(IsEqualIID(riid, &IID_IOleWindow))
+        *ppvObj = &This->IShellBrowser_iface;
+    else if(IsEqualIID(riid, &IID_IShellBrowser))
+        *ppvObj = &This->IShellBrowser_iface;
+    else if(IsEqualIID(riid, &IID_ICommDlgBrowser))
         *ppvObj = &This->ICommDlgBrowser_iface;
-    else if(IsEqualIID(riid, &IID_IServiceProvider))  /* IServiceProvider */
+    else if(IsEqualIID(riid, &IID_IServiceProvider))
         *ppvObj = &This->IServiceProvider_iface;
 
-    if(*ppvObj)
-    { IUnknown_AddRef( (IShellBrowser*) *ppvObj);
-      return S_OK;
+    if(*ppvObj) {
+        IUnknown_AddRef((IUnknown*)*ppvObj);
+        return S_OK;
     }
+
     FIXME("Unknown interface requested\n");
     return E_NOINTERFACE;
 }
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 69ef528..a9cc6bf 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -506,7 +506,7 @@ static HRESULT on_default_action(FileDialogImpl *This)
         pidla[i] = COMDLG32_SHSimpleIDListFromPathAW(canon_filename);
 
         if(psf_parent && !(open_action == ONOPEN_BROWSE))
-            IShellItem_Release(psf_parent);
+            IShellFolder_Release(psf_parent);
 
         fn_iter += (WCHAR)lstrlenW(fn_iter) + 1;
     }
@@ -528,7 +528,7 @@ static HRESULT on_default_action(FileDialogImpl *This)
         if(FAILED(hr))
             ERR("Failed to browse to directory: %08x\n", hr);
 
-        IShellItem_Release(psf_parent);
+        IShellFolder_Release(psf_parent);
         break;
 
     case ONOPEN_OPEN:
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c
index 208ec8c..ce05ed8 100644
--- a/dlls/comdlg32/tests/itemdlg.c
+++ b/dlls/comdlg32/tests/itemdlg.c
@@ -369,7 +369,7 @@ static BOOL test_instantiation(void)
 
     hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogEvents, (void**)&punk);
     ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
-    if(SUCCEEDED(hr)) IUnknown_Release(pfd);
+    if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
 
     hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowser, (void**)&punk);
     ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
@@ -379,7 +379,7 @@ static BOOL test_instantiation(void)
     ok(hr == S_OK, "got 0x%08x.\n", hr);
     if(SUCCEEDED(hr)) IUnknown_Release(punk);
 
-    hr = IFileOpenDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3, (void**)&punk);
+    hr = IFileSaveDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3, (void**)&punk);
     ok(hr == S_OK, "got 0x%08x.\n", hr);
     if(SUCCEEDED(hr)) IUnknown_Release(punk);
 
@@ -1378,7 +1378,7 @@ static void test_customize(void)
                           &IID_IFileDialog, (void**)&pfod);
     ok(hr == S_OK, "got 0x%08x.\n", hr);
 
-    hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
+    hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
     ok(hr == S_OK, "got 0x%08x.\n", hr);
     if(FAILED(hr))
     {
@@ -1666,7 +1666,7 @@ static void test_customize(void)
 
     IFileDialogEvents_Release(pfde);
     IFileDialogCustomize_Release(pfdc);
-    ref = IFileOpenDialog_Release(pfod);
+    ref = IFileDialog_Release(pfod);
     ok(!ref, "Refcount not zero (%d).\n", ref);
 
 
@@ -1674,7 +1674,7 @@ static void test_customize(void)
                           &IID_IFileDialog, (void**)&pfod);
     ok(hr == S_OK, "got 0x%08x.\n", hr);
 
-    hr = IFileDialogCustomize_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
+    hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc);
     ok(hr == S_OK, "got 0x%08x.\n", hr);
 
     i = 0;
@@ -1884,7 +1884,7 @@ static void test_customize(void)
     }
 
     IFileDialogCustomize_Release(pfdc);
-    ref = IFileOpenDialog_Release(pfod);
+    ref = IFileDialog_Release(pfod);
     ok(!ref, "Refcount not zero (%d).\n", ref);
 }
 




More information about the wine-cvs mailing list