Commit f8d2c922 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: Do not assume that vtable is the first element of the object,…

windowscodecs: Do not assume that vtable is the first element of the object, avoid not necessary casts.
parent b7efa008
...@@ -175,9 +175,10 @@ static HRESULT WINAPI JpegDecoder_QueryInterface(IWICBitmapDecoder *iface, REFII ...@@ -175,9 +175,10 @@ static HRESULT WINAPI JpegDecoder_QueryInterface(IWICBitmapDecoder *iface, REFII
if (!ppv) return E_INVALIDARG; if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IWICBitmapDecoder, iid)) if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapDecoder, iid))
{ {
*ppv = This; *ppv = &This->IWICBitmapDecoder_iface;
} }
else else
{ {
...@@ -469,6 +470,8 @@ static const IWICBitmapDecoderVtbl JpegDecoder_Vtbl = { ...@@ -469,6 +470,8 @@ static const IWICBitmapDecoderVtbl JpegDecoder_Vtbl = {
static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid,
void **ppv) void **ppv)
{ {
JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG; if (!ppv) return E_INVALIDARG;
...@@ -477,7 +480,7 @@ static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *if ...@@ -477,7 +480,7 @@ static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *if
IsEqualIID(&IID_IWICBitmapSource, iid) || IsEqualIID(&IID_IWICBitmapSource, iid) ||
IsEqualIID(&IID_IWICBitmapFrameDecode, iid)) IsEqualIID(&IID_IWICBitmapFrameDecode, iid))
{ {
*ppv = iface; *ppv = &This->IWICBitmapFrameDecode_iface;
} }
else else
{ {
...@@ -492,13 +495,13 @@ static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *if ...@@ -492,13 +495,13 @@ static HRESULT WINAPI JpegDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *if
static ULONG WINAPI JpegDecoder_Frame_AddRef(IWICBitmapFrameDecode *iface) static ULONG WINAPI JpegDecoder_Frame_AddRef(IWICBitmapFrameDecode *iface)
{ {
JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface); JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
return IUnknown_AddRef((IUnknown*)This); return IWICBitmapDecoder_AddRef(&This->IWICBitmapDecoder_iface);
} }
static ULONG WINAPI JpegDecoder_Frame_Release(IWICBitmapFrameDecode *iface) static ULONG WINAPI JpegDecoder_Frame_Release(IWICBitmapFrameDecode *iface)
{ {
JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface); JpegDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
return IUnknown_Release((IUnknown*)This); return IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
} }
static HRESULT WINAPI JpegDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface, static HRESULT WINAPI JpegDecoder_Frame_GetSize(IWICBitmapFrameDecode *iface,
...@@ -722,8 +725,8 @@ HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) ...@@ -722,8 +725,8 @@ HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
InitializeCriticalSection(&This->lock); InitializeCriticalSection(&This->lock);
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegDecoder.lock"); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegDecoder.lock");
ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv); ret = IWICBitmapDecoder_QueryInterface(&This->IWICBitmapDecoder_iface, iid, ppv);
IUnknown_Release((IUnknown*)This); IWICBitmapDecoder_Release(&This->IWICBitmapDecoder_iface);
return ret; return ret;
} }
...@@ -1219,7 +1222,7 @@ static HRESULT WINAPI JpegEncoder_QueryInterface(IWICBitmapEncoder *iface, REFII ...@@ -1219,7 +1222,7 @@ static HRESULT WINAPI JpegEncoder_QueryInterface(IWICBitmapEncoder *iface, REFII
if (IsEqualIID(&IID_IUnknown, iid) || if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapEncoder, iid)) IsEqualIID(&IID_IWICBitmapEncoder, iid))
{ {
*ppv = This; *ppv = &This->IWICBitmapEncoder_iface;
} }
else else
{ {
...@@ -1470,8 +1473,8 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) ...@@ -1470,8 +1473,8 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
InitializeCriticalSection(&This->lock); InitializeCriticalSection(&This->lock);
This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegEncoder.lock"); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegEncoder.lock");
ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv); ret = IWICBitmapEncoder_QueryInterface(&This->IWICBitmapEncoder_iface, iid, ppv);
IUnknown_Release((IUnknown*)This); IWICBitmapEncoder_Release(&This->IWICBitmapEncoder_iface);
return ret; return ret;
} }
......
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