Module: wine Branch: master Commit: 5e81e917a194b281479ead6ca7a4ee1a5b79f180 URL: https://source.winehq.org/git/wine.git/?a=commit;h=5e81e917a194b281479ead6ca...
Author: Jactry Zeng jzeng@codeweavers.com Date: Tue Apr 3 17:57:50 2018 +0800
riched20: Get ITextRange interface from QueryInterface instead of casting.
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/riched20/richole.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c index a52cd52..c19a2e7 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -4455,6 +4455,8 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG value) static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **font) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr;
TRACE("(%p)->(%p)\n", This, font);
@@ -4464,12 +4466,16 @@ static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **f if (!font) return E_INVALIDARG;
- return create_textfont((ITextRange*)me, NULL, font); + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = create_textfont(range, NULL, font); + ITextRange_Release(range); + return hr; }
static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *font) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL;
TRACE("(%p)->(%p)\n", This, font);
@@ -4479,13 +4485,17 @@ static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *fo if (!This->reOle) return CO_E_RELEASED;
- textrange_set_font((ITextRange*)me, font); + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + textrange_set_font(range, font); + ITextRange_Release(range); return S_OK; }
static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **para) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr;
TRACE("(%p)->(%p)\n", This, para);
@@ -4495,7 +4505,10 @@ static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **p if (!para) return E_INVALIDARG;
- return create_textpara((ITextRange*)me, para); + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = create_textpara(range, para); + ITextRange_Release(range); + return hr; }
static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *para) @@ -4560,13 +4573,18 @@ static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart) static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG unit, LONG *delta) { ITextSelectionImpl *This = impl_from_ITextSelection(me); + ITextRange *range = NULL; + HRESULT hr;
TRACE("(%p)->(%d %p)\n", This, unit, delta);
if (!This->reOle) return CO_E_RELEASED;
- return textrange_expand((ITextRange*)me, unit, delta); + ITextSelection_QueryInterface(me, &IID_ITextRange, (void**)&range); + hr = textrange_expand(range, unit, delta); + ITextRange_Release(range); + return hr; }
static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG unit, LONG *index)