From e5e2673984ec5ba14da8a91f12c3e72f9caa30b9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 16 Aug 2012 13:19:27 +0200 Subject: [PATCH] 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 776abfcef2f..1dda9a87f13 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 69ef5280581..a9cc6bfc9e0 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 208ec8cf937..ce05ed86ec7 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); }