[1/2] windowscodecs: Make GetFrameCount in the TIFF decoder not fail without an image stream.

Dmitry Timoshkov dmitry at baikal.ru
Wed Nov 21 03:11:15 CST 2012


---
 dlls/windowscodecs/tests/tiffformat.c | 3 ---
 dlls/windowscodecs/tiffformat.c       | 8 ++------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/dlls/windowscodecs/tests/tiffformat.c b/dlls/windowscodecs/tests/tiffformat.c
index 9b5db52..4cbda4d 100644
--- a/dlls/windowscodecs/tests/tiffformat.c
+++ b/dlls/windowscodecs/tests/tiffformat.c
@@ -203,9 +203,7 @@ static void test_QueryCapability(void)
 
     frame_count = 0xdeadbeef;
     hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
-todo_wine
     ok(hr == S_OK || broken(hr == E_POINTER) /* XP */, "GetFrameCount error %#x\n", hr);
-todo_wine
     ok(frame_count == 0, "expected 0, got %u\n", frame_count);
 
     pos.QuadPart = 4;
@@ -222,7 +220,6 @@ todo_wine
 
     frame_count = 0xdeadbeef;
     hr = IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
-todo_wine
     ok(hr == S_OK, "GetFrameCount error %#x\n", hr);
 todo_wine
     ok(frame_count == 1, "expected 1, got %u\n", frame_count);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index cf93540..f22d9f6 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -668,14 +668,10 @@ static HRESULT WINAPI TiffDecoder_GetFrameCount(IWICBitmapDecoder *iface,
 {
     TiffDecoder *This = impl_from_IWICBitmapDecoder(iface);
 
-    if (!This->tiff)
-    {
-        WARN("(%p) <-- WINCODEC_ERR_WRONGSTATE\n", iface);
-        return WINCODEC_ERR_WRONGSTATE;
-    }
+    if (!pCount) return E_INVALIDARG;
 
     EnterCriticalSection(&This->lock);
-    *pCount = pTIFFNumberOfDirectories(This->tiff);
+    *pCount = This->tiff ? pTIFFNumberOfDirectories(This->tiff) : 0;
     LeaveCriticalSection(&This->lock);
 
     TRACE("(%p) <-- %i\n", iface, *pCount);
-- 
1.7.12.4




More information about the wine-patches mailing list