Nikolay Sivov : wincodecs: Fix failure paths in scaler's GetSize().
Alexandre Julliard
julliard at winehq.org
Tue Nov 13 15:01:58 CST 2018
Module: wine
Branch: master
Commit: 9556419d7c4355fa675a4db78ccfc00dbc60f2c1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9556419d7c4355fa675a4db78ccfc00dbc60f2c1
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Nov 9 14:26:44 2018 +0300
wincodecs: Fix failure paths in scaler's GetSize().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/windowscodecs/scaler.c | 6 +++---
dlls/windowscodecs/tests/bitmap.c | 5 -----
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/dlls/windowscodecs/scaler.c b/dlls/windowscodecs/scaler.c
index f576ad5..46f1dbf 100644
--- a/dlls/windowscodecs/scaler.c
+++ b/dlls/windowscodecs/scaler.c
@@ -108,12 +108,12 @@ static HRESULT WINAPI BitmapScaler_GetSize(IWICBitmapScaler *iface,
BitmapScaler *This = impl_from_IWICBitmapScaler(iface);
TRACE("(%p,%p,%p)\n", iface, puiWidth, puiHeight);
+ if (!This->source)
+ return WINCODEC_ERR_NOTINITIALIZED;
+
if (!puiWidth || !puiHeight)
return E_INVALIDARG;
- if (!This->source)
- return WINCODEC_ERR_WRONGSTATE;
-
*puiWidth = This->width;
*puiHeight = This->height;
diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c
index 34da3b2..e4cb863 100644
--- a/dlls/windowscodecs/tests/bitmap.c
+++ b/dlls/windowscodecs/tests/bitmap.c
@@ -1107,17 +1107,14 @@ static void test_bitmap_scaler(void)
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_GetSize(scaler, NULL, &height);
-todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_GetSize(scaler, &width, NULL);
-todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
width = 123;
height = 321;
hr = IWICBitmapScaler_GetSize(scaler, &width, &height);
-todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
ok(width == 123, "Unexpected width %u.\n", width);
ok(height == 321, "Unexpected height %u.\n", height);
@@ -1127,7 +1124,6 @@ todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_GetSize(scaler, &width, &height);
-todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_Initialize(scaler, (IWICBitmapSource *)bitmap, 0, 2,
@@ -1135,7 +1131,6 @@ todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_GetSize(scaler, &width, &height);
-todo_wine
ok(hr == WINCODEC_ERR_NOTINITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IWICBitmapScaler_Initialize(scaler, NULL, 8, 4,
More information about the wine-cvs
mailing list