[PATCH 2/2] msctf: Avoid a cast from IEnumTfLanguageProfiles to the COM object.
Aric Stewart
aric at codeweavers.com
Tue Jul 19 14:31:34 CDT 2016
Signed-off-by: Aric Stewart <aric at codeweavers.com>
On 7/19/16 2:47 AM, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
> ---
> dlls/msctf/inputprocessor.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/dlls/msctf/inputprocessor.c b/dlls/msctf/inputprocessor.c
> index fca78e4..fdeba38 100644
> --- a/dlls/msctf/inputprocessor.c
> +++ b/dlls/msctf/inputprocessor.c
> @@ -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;
> }
>
More information about the wine-patches
mailing list