Dmitry Timoshkov : windowscodecs: Make GetFrameCount in the TIFF decoder not fail without an image stream.

Alexandre Julliard julliard at winehq.org
Wed Nov 21 14:45:16 CST 2012


Module: wine
Branch: master
Commit: 9e5ecdb74532e0d2a503d26d16de98376c17f7f8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9e5ecdb74532e0d2a503d26d16de98376c17f7f8

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Nov 21 17:11:15 2012 +0800

windowscodecs: Make GetFrameCount in the TIFF decoder not fail without an image stream.

---

 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);




More information about the wine-cvs mailing list