Commit 8525f695 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

shell32: autocomplete: There is no need for separate IAutoComplete and IAutoComplete2 vtbls.

parent 112effb1
...@@ -61,8 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); ...@@ -61,8 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
typedef struct typedef struct
{ {
const IAutoCompleteVtbl *lpVtbl; const IAutoComplete2Vtbl *lpVtbl;
const IAutoComplete2Vtbl *lpvtblAutoComplete2;
LONG ref; LONG ref;
BOOL enabled; BOOL enabled;
HWND hwndEdit; HWND hwndEdit;
...@@ -75,20 +74,14 @@ typedef struct ...@@ -75,20 +74,14 @@ typedef struct
AUTOCOMPLETEOPTIONS options; AUTOCOMPLETEOPTIONS options;
} IAutoCompleteImpl; } IAutoCompleteImpl;
static const IAutoCompleteVtbl acvt; static const IAutoComplete2Vtbl acvt;
static const IAutoComplete2Vtbl ac2vt;
static inline IAutoCompleteImpl *impl_from_IAutoComplete2( IAutoComplete2 *iface )
{
return (IAutoCompleteImpl *)((char*)iface - FIELD_OFFSET(IAutoCompleteImpl, lpvtblAutoComplete2));
}
/* /*
converts This to an interface pointer converts This to an interface pointer
*/ */
#define _IUnknown_(This) (IUnknown*)&(This->lpVtbl) #define _IUnknown_(This) (IUnknown*)&(This->lpVtbl)
#define _IAutoComplete2_(This) (IAutoComplete2*)&(This->lpvtblAutoComplete2) #define _IAutoComplete2_(This) (IAutoComplete2*)&(This->lpvtbl)
static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
...@@ -109,7 +102,6 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO ...@@ -109,7 +102,6 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
lpac->ref = 1; lpac->ref = 1;
lpac->lpVtbl = &acvt; lpac->lpVtbl = &acvt;
lpac->lpvtblAutoComplete2 = &ac2vt;
lpac->enabled = TRUE; lpac->enabled = TRUE;
lpac->enumstr = NULL; lpac->enumstr = NULL;
lpac->options = ACO_AUTOAPPEND; lpac->options = ACO_AUTOAPPEND;
...@@ -131,8 +123,8 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO ...@@ -131,8 +123,8 @@ HRESULT WINAPI IAutoComplete_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVO
/************************************************************************** /**************************************************************************
* AutoComplete_QueryInterface * AutoComplete_QueryInterface
*/ */
static HRESULT WINAPI IAutoComplete_fnQueryInterface( static HRESULT WINAPI IAutoComplete2_fnQueryInterface(
IAutoComplete * iface, IAutoComplete2 * iface,
REFIID riid, REFIID riid,
LPVOID *ppvObj) LPVOID *ppvObj)
{ {
...@@ -141,22 +133,16 @@ static HRESULT WINAPI IAutoComplete_fnQueryInterface( ...@@ -141,22 +133,16 @@ static HRESULT WINAPI IAutoComplete_fnQueryInterface(
TRACE("(%p)->(\n\tIID:\t%s,%p)\n", This, shdebugstr_guid(riid), ppvObj); TRACE("(%p)->(\n\tIID:\t%s,%p)\n", This, shdebugstr_guid(riid), ppvObj);
*ppvObj = NULL; *ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) if (IsEqualIID(riid, &IID_IUnknown) ||
{ IsEqualIID(riid, &IID_IAutoComplete) ||
*ppvObj = This; IsEqualIID(riid, &IID_IAutoComplete2))
}
else if(IsEqualIID(riid, &IID_IAutoComplete))
{ {
*ppvObj = (IAutoComplete*)This; *ppvObj = (IAutoComplete2*)This;
}
else if(IsEqualIID(riid, &IID_IAutoComplete2))
{
*ppvObj = _IAutoComplete2_ (This);
} }
if (*ppvObj) if (*ppvObj)
{ {
IAutoComplete_AddRef((IAutoComplete*)*ppvObj); IUnknown_AddRef((IUnknown*)*ppvObj);
TRACE("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj); TRACE("-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
return S_OK; return S_OK;
} }
...@@ -165,10 +151,10 @@ static HRESULT WINAPI IAutoComplete_fnQueryInterface( ...@@ -165,10 +151,10 @@ static HRESULT WINAPI IAutoComplete_fnQueryInterface(
} }
/****************************************************************************** /******************************************************************************
* IAutoComplete_fnAddRef * IAutoComplete2_fnAddRef
*/ */
static ULONG WINAPI IAutoComplete_fnAddRef( static ULONG WINAPI IAutoComplete2_fnAddRef(
IAutoComplete * iface) IAutoComplete2 * iface)
{ {
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface; IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref); ULONG refCount = InterlockedIncrement(&This->ref);
...@@ -179,10 +165,10 @@ static ULONG WINAPI IAutoComplete_fnAddRef( ...@@ -179,10 +165,10 @@ static ULONG WINAPI IAutoComplete_fnAddRef(
} }
/****************************************************************************** /******************************************************************************
* IAutoComplete_fnRelease * IAutoComplete2_fnRelease
*/ */
static ULONG WINAPI IAutoComplete_fnRelease( static ULONG WINAPI IAutoComplete2_fnRelease(
IAutoComplete * iface) IAutoComplete2 * iface)
{ {
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface; IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref); ULONG refCount = InterlockedDecrement(&This->ref);
...@@ -203,10 +189,10 @@ static ULONG WINAPI IAutoComplete_fnRelease( ...@@ -203,10 +189,10 @@ static ULONG WINAPI IAutoComplete_fnRelease(
} }
/****************************************************************************** /******************************************************************************
* IAutoComplete_fnEnable * IAutoComplete2_fnEnable
*/ */
static HRESULT WINAPI IAutoComplete_fnEnable( static HRESULT WINAPI IAutoComplete2_fnEnable(
IAutoComplete * iface, IAutoComplete2 * iface,
BOOL fEnable) BOOL fEnable)
{ {
IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface; IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
...@@ -221,10 +207,10 @@ static HRESULT WINAPI IAutoComplete_fnEnable( ...@@ -221,10 +207,10 @@ static HRESULT WINAPI IAutoComplete_fnEnable(
} }
/****************************************************************************** /******************************************************************************
* IAutoComplete_fnInit * IAutoComplete2_fnInit
*/ */
static HRESULT WINAPI IAutoComplete_fnInit( static HRESULT WINAPI IAutoComplete2_fnInit(
IAutoComplete * iface, IAutoComplete2 * iface,
HWND hwndEdit, HWND hwndEdit,
IUnknown *punkACL, IUnknown *punkACL,
LPCOLESTR pwzsRegKeyPath, LPCOLESTR pwzsRegKeyPath,
...@@ -312,91 +298,7 @@ static HRESULT WINAPI IAutoComplete_fnInit( ...@@ -312,91 +298,7 @@ static HRESULT WINAPI IAutoComplete_fnInit(
} }
/************************************************************************** /**************************************************************************
* IAutoComplete_fnVTable * IAutoComplete2_fnGetOptions
*/
static const IAutoCompleteVtbl acvt =
{
IAutoComplete_fnQueryInterface,
IAutoComplete_fnAddRef,
IAutoComplete_fnRelease,
IAutoComplete_fnInit,
IAutoComplete_fnEnable,
};
/**************************************************************************
* AutoComplete2_QueryInterface
*/
static HRESULT WINAPI IAutoComplete2_fnQueryInterface(
IAutoComplete2 * iface,
REFIID riid,
LPVOID *ppvObj)
{
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
return IAutoComplete_QueryInterface((IAutoComplete*)This, riid, ppvObj);
}
/******************************************************************************
* IAutoComplete2_fnAddRef
*/
static ULONG WINAPI IAutoComplete2_fnAddRef(
IAutoComplete2 * iface)
{
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
TRACE ("(%p)->(count=%u)\n", This, This->ref);
return IAutoComplete2_AddRef((IAutoComplete*)This);
}
/******************************************************************************
* IAutoComplete2_fnRelease
*/
static ULONG WINAPI IAutoComplete2_fnRelease(
IAutoComplete2 * iface)
{
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
TRACE ("(%p)->(count=%u)\n", This, This->ref);
return IAutoComplete_Release((IAutoComplete*)This);
}
/******************************************************************************
* IAutoComplete2_fnEnable
*/
static HRESULT WINAPI IAutoComplete2_fnEnable(
IAutoComplete2 * iface,
BOOL fEnable)
{
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
TRACE ("(%p)->(%s)\n", This, (fEnable)?"true":"false");
return IAutoComplete_Enable((IAutoComplete*)This, fEnable);
}
/******************************************************************************
* IAutoComplete2_fnInit
*/
static HRESULT WINAPI IAutoComplete2_fnInit(
IAutoComplete2 * iface,
HWND hwndEdit,
IUnknown *punkACL,
LPCOLESTR pwzsRegKeyPath,
LPCOLESTR pwszQuickComplete)
{
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface);
TRACE("(%p)\n", This);
return IAutoComplete_Init((IAutoComplete*)This, hwndEdit, punkACL, pwzsRegKeyPath, pwszQuickComplete);
}
/**************************************************************************
* IAutoComplete_fnGetOptions
*/ */
static HRESULT WINAPI IAutoComplete2_fnGetOptions( static HRESULT WINAPI IAutoComplete2_fnGetOptions(
IAutoComplete2 * iface, IAutoComplete2 * iface,
...@@ -404,7 +306,7 @@ static HRESULT WINAPI IAutoComplete2_fnGetOptions( ...@@ -404,7 +306,7 @@ static HRESULT WINAPI IAutoComplete2_fnGetOptions(
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
TRACE("(%p) -> (%p)\n", This, pdwFlag); TRACE("(%p) -> (%p)\n", This, pdwFlag);
...@@ -414,7 +316,7 @@ static HRESULT WINAPI IAutoComplete2_fnGetOptions( ...@@ -414,7 +316,7 @@ static HRESULT WINAPI IAutoComplete2_fnGetOptions(
} }
/************************************************************************** /**************************************************************************
* IAutoComplete_fnSetOptions * IAutoComplete2_fnSetOptions
*/ */
static HRESULT WINAPI IAutoComplete2_fnSetOptions( static HRESULT WINAPI IAutoComplete2_fnSetOptions(
IAutoComplete2 * iface, IAutoComplete2 * iface,
...@@ -422,7 +324,7 @@ static HRESULT WINAPI IAutoComplete2_fnSetOptions( ...@@ -422,7 +324,7 @@ static HRESULT WINAPI IAutoComplete2_fnSetOptions(
{ {
HRESULT hr = S_OK; HRESULT hr = S_OK;
IAutoCompleteImpl *This = impl_from_IAutoComplete2(iface); IAutoCompleteImpl *This = (IAutoCompleteImpl *)iface;
TRACE("(%p) -> (0x%x)\n", This, dwFlag); TRACE("(%p) -> (0x%x)\n", This, dwFlag);
...@@ -434,7 +336,7 @@ static HRESULT WINAPI IAutoComplete2_fnSetOptions( ...@@ -434,7 +336,7 @@ static HRESULT WINAPI IAutoComplete2_fnSetOptions(
/************************************************************************** /**************************************************************************
* IAutoComplete2_fnVTable * IAutoComplete2_fnVTable
*/ */
static const IAutoComplete2Vtbl ac2vt = static const IAutoComplete2Vtbl acvt =
{ {
IAutoComplete2_fnQueryInterface, IAutoComplete2_fnQueryInterface,
IAutoComplete2_fnAddRef, IAutoComplete2_fnAddRef,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment