[PATCH 2/5] wincodecs: Fix failure paths in scaler's GetSize().
Nikolay Sivov
nsivov at codeweavers.com
Fri Nov 9 05:26:44 CST 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
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 f576ad51fd..46f1dbfb81 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 34da3b2083..e4cb8637f4 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,
--
2.19.1
More information about the wine-devel
mailing list