msctf: Avoid a cast from IEnumTfLanguageProfiles to the COM object.

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-07-19 09:47:24 +02:00 committed by Alexandre Julliard
parent fd0101ab61
commit a944b4eed9
1 changed files with 13 additions and 7 deletions

View File

@ -93,7 +93,7 @@ typedef struct {
} EnumTfInputProcessorProfiles;
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut);
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out);
static inline EnumTfInputProcessorProfiles *impl_from_IEnumTfInputProcessorProfiles(IEnumTfInputProcessorProfiles *iface)
{
@ -616,12 +616,17 @@ static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles(
IEnumTfLanguageProfiles **ppEnum)
{
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
EnumTfLanguageProfiles *profenum;
HRESULT hr;
TRACE("(%p) %x %p\n",This,langid,ppEnum);
if (!ppEnum)
return E_INVALIDARG;
hr = EnumTfLanguageProfiles_Constructor(langid, &profenum);
*ppEnum = &profenum->IEnumTfLanguageProfiles_iface;
return EnumTfLanguageProfiles_Constructor(langid, ppEnum);
return hr;
}
static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
@ -1292,16 +1297,16 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *ifa
IEnumTfLanguageProfiles **ppenum)
{
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
EnumTfLanguageProfiles *new_This;
HRESULT res;
TRACE("(%p)\n",This);
if (ppenum == NULL) return E_POINTER;
res = EnumTfLanguageProfiles_Constructor(This->langid, ppenum);
res = EnumTfLanguageProfiles_Constructor(This->langid, &new_This);
if (SUCCEEDED(res))
{
EnumTfLanguageProfiles *new_This = (EnumTfLanguageProfiles *)*ppenum;
new_This->tip_index = This->tip_index;
lstrcpynW(new_This->szwCurrentClsid,This->szwCurrentClsid,39);
@ -1314,6 +1319,7 @@ static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *ifa
res = RegOpenKeyExW(new_This->tipkey, fullkey, 0, KEY_READ | KEY_WRITE, &This->langkey);
new_This->lang_index = This->lang_index;
}
*ppenum = &new_This->IEnumTfLanguageProfiles_iface;
}
return res;
}
@ -1329,7 +1335,7 @@ static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl =
EnumTfLanguageProfiles_Skip
};
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguageProfiles **ppOut)
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out)
{
HRESULT hr;
EnumTfLanguageProfiles *This;
@ -1356,7 +1362,7 @@ static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, IEnumTfLanguage
return E_FAIL;
}
*ppOut = &This->IEnumTfLanguageProfiles_iface;
TRACE("returning %p\n", *ppOut);
*out = This;
TRACE("returning %p\n", *out);
return S_OK;
}