Re: [01/18] windowscodecs: Do not assume that vtable is the first element of the object.
Hello Dmitry, On 07/24/2012 08:01 AM, Dmitry Timoshkov wrote:
The patches in this series do not depend on each other, numeration is just for a convenience. Patches do basically the same job for different objects, so I decided to not invent a new subject for every separate kind of object. --- dlls/windowscodecs/bmpdecode.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 6da6a3c..1a1ee0a 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -94,6 +94,8 @@ static inline BmpDecoder *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, void **ppv) { + BmpDecoder *This = impl_from_IWICBitmapFrameDecode(iface); + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG; @@ -102,7 +104,7 @@ static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface IsEqualIID(&IID_IWICBitmapSource, iid) || IsEqualIID(&IID_IWICBitmapFrameDecode, iid)) { - *ppv = iface; + *ppv = &This->IWICBitmapFrameDecode_iface; } else { this part of the change is gratuitous. As long as there is only one interface implementation in the object there is no need for impl_from_Foo().
bye michael
Michael Stefaniuc <mstefani(a)redhat.com> wrote:
@@ -102,7 +104,7 @@ static HRESULT WINAPI BmpFrameDecode_QueryInterface(IWICBitmapFrameDecode *iface IsEqualIID(&IID_IWICBitmapSource, iid) || IsEqualIID(&IID_IWICBitmapFrameDecode, iid)) { - *ppv = iface; + *ppv = &This->IWICBitmapFrameDecode_iface; } else { this part of the change is gratuitous. As long as there is only one interface implementation in the object there is no need for impl_from_Foo().
That's for consistency with other places, so if/when a new interface is going to be added it's obvious for an implementror what to do. Thanks for the review. -- Dmitry.
participants (2)
-
Dmitry Timoshkov -
Michael Stefaniuc