From 3c6cf6ef2c3c919ef82de28a634a22f70ce8312a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 20 Jan 2021 10:30:06 +0100 Subject: [PATCH] windowscodecs: Use IWICComponentFactory_CreateStream in GetReaderByIndex. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of StreamImpl_Create. Signed-off-by: RĂ©mi Bernon Signed-off-by: Esme Povirk Signed-off-by: Alexandre Julliard --- dlls/windowscodecs/decoder.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/dlls/windowscodecs/decoder.c b/dlls/windowscodecs/decoder.c index 5970a44cd53..b05d50dfea9 100644 --- a/dlls/windowscodecs/decoder.c +++ b/dlls/windowscodecs/decoder.c @@ -595,7 +595,7 @@ static HRESULT WINAPI CommonDecoderFrame_Block_GetReaderByIndex(IWICMetadataBloc { CommonDecoderFrame *This = impl_from_IWICMetadataBlockReader(iface); HRESULT hr; - IWICComponentFactory* factory; + IWICComponentFactory* factory = NULL; IWICStream* stream; TRACE("%p,%d,%p\n", iface, nIndex, ppIMetadataReader); @@ -609,7 +609,10 @@ static HRESULT WINAPI CommonDecoderFrame_Block_GetReaderByIndex(IWICMetadataBloc hr = E_INVALIDARG; if (SUCCEEDED(hr)) - hr = StreamImpl_Create(&stream); + hr = create_instance(&CLSID_WICImagingFactory, &IID_IWICComponentFactory, (void**)&factory); + + if (SUCCEEDED(hr)) + hr = IWICComponentFactory_CreateStream(factory, &stream); if (SUCCEEDED(hr)) { @@ -664,23 +667,17 @@ static HRESULT WINAPI CommonDecoderFrame_Block_GetReaderByIndex(IWICMetadataBloc } else { - if (SUCCEEDED(hr)) - hr = create_instance(&CLSID_WICImagingFactory, &IID_IWICComponentFactory, (void**)&factory); - - if (SUCCEEDED(hr)) - { - hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, - &This->parent->decoder_info.block_format, NULL, - This->metadata_blocks[nIndex].options & DECODER_BLOCK_OPTION_MASK, - (IStream*)stream, ppIMetadataReader); - - IWICComponentFactory_Release(factory); - } + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + &This->parent->decoder_info.block_format, NULL, + This->metadata_blocks[nIndex].options & DECODER_BLOCK_OPTION_MASK, + (IStream*)stream, ppIMetadataReader); } IWICStream_Release(stream); } + if (factory) IWICComponentFactory_Release(factory); + if (FAILED(hr)) *ppIMetadataReader = NULL;