From 91acc19d46406444e9d5c70b094070ad0967c939 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 6 Jul 2009 13:10:46 -0500 Subject: [PATCH] windowscodecs: return proper error codes in unneeded BMP decoder methods --- dlls/windowscodecs/bmpdecode.c | 28 ++++++++++++++-------------- dlls/windowscodecs/tests/bmpformat.c | 24 ++++++++++++++++++++++++ include/wincodec.idl | 1 + 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/dlls/windowscodecs/bmpdecode.c b/dlls/windowscodecs/bmpdecode.c index 61d68c1..70923a1 100644 --- a/dlls/windowscodecs/bmpdecode.c +++ b/dlls/windowscodecs/bmpdecode.c @@ -311,22 +311,22 @@ static HRESULT WINAPI BmpFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface, static HRESULT WINAPI BmpFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount) { - FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount); - return E_NOTIMPL; + TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpFrameDecode_GetThumbnail(IWICBitmapFrameDecode *iface, IWICBitmapSource **ppIThumbnail) { - FIXME("(%p,%p): stub\n", iface, ppIThumbnail); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIThumbnail); + return WINCODEC_ERR_CODECNOTHUMBNAIL; } static HRESULT BmpFrameDecode_ReadUncompressed(BmpFrameDecode* This) @@ -637,29 +637,29 @@ static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface, static HRESULT WINAPI BmpDecoder_GetMetadataQueryReader(IWICBitmapDecoder *iface, IWICMetadataQueryReader **ppIMetadataQueryReader) { - FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetPreview(IWICBitmapDecoder *iface, IWICBitmapSource **ppIBitmapSource) { - FIXME("(%p,%p): stub\n", iface, ppIBitmapSource); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIBitmapSource); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetColorContexts(IWICBitmapDecoder *iface, UINT cCount, IWICColorContext **ppIColorContexts, UINT *pcActualCount) { - FIXME("(%p,%u,%p,%p): stub\n", iface, cCount, ppIColorContexts, pcActualCount); - return E_NOTIMPL; + TRACE("(%p,%u,%p,%p)\n", iface, cCount, ppIColorContexts, pcActualCount); + return WINCODEC_ERR_UNSUPPORTEDOPERATION; } static HRESULT WINAPI BmpDecoder_GetThumbnail(IWICBitmapDecoder *iface, IWICBitmapSource **ppIThumbnail) { - FIXME("(%p,%p): stub\n", iface, ppIThumbnail); - return E_NOTIMPL; + TRACE("(%p,%p)\n", iface, ppIThumbnail); + return WINCODEC_ERR_CODECNOTHUMBNAIL; } static HRESULT WINAPI BmpDecoder_GetFrameCount(IWICBitmapDecoder *iface, diff --git a/dlls/windowscodecs/tests/bmpformat.c b/dlls/windowscodecs/tests/bmpformat.c index 2456245..1ed77e2 100644 --- a/dlls/windowscodecs/tests/bmpformat.c +++ b/dlls/windowscodecs/tests/bmpformat.c @@ -49,6 +49,9 @@ static void test_decode_24bpp(void) { IWICBitmapDecoder *decoder, *decoder2; IWICBitmapFrameDecode *framedecode; + IWICMetadataQueryReader *queryreader; + IWICColorContext *colorcontext; + IWICBitmapSource *thumbnail; HRESULT hr; HGLOBAL hbmpdata; char *bmpdata; @@ -88,6 +91,18 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetContainerFormat failed, hr=%x\n", hr); ok(IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp), "unexpected container format\n"); + hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &queryreader); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &colorcontext, &count); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumbnail); + ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr); + + hr = IWICBitmapDecoder_GetPreview(decoder, &thumbnail); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + hr = IWICBitmapDecoder_GetFrameCount(decoder, &count); ok(SUCCEEDED(hr), "GetFrameCount failed, hr=%x\n", hr); ok(count == 1, "unexpected count %u\n", count); @@ -116,6 +131,15 @@ static void test_decode_24bpp(void) ok(SUCCEEDED(hr), "GetPixelFormat failed, hr=%x\n", hr); ok(IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n"); + hr = IWICBitmapFrameDecode_GetMetadataQueryReader(framedecode, &queryreader); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapFrameDecode_GetColorContexts(framedecode, 1, &colorcontext, &count); + ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "expected WINCODEC_ERR_UNSUPPORTEDOPERATION, got %x\n", hr); + + hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail); + ok(hr == WINCODEC_ERR_CODECNOTHUMBNAIL, "expected WINCODEC_ERR_CODECNOTHUMBNAIL, got %x\n", hr); + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory); ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); diff --git a/include/wincodec.idl b/include/wincodec.idl index d8712b8..691a4fd 100644 --- a/include/wincodec.idl +++ b/include/wincodec.idl @@ -96,6 +96,7 @@ typedef UINT32 WICColor; cpp_quote("#define WINCODEC_ERR_WRONGSTATE 0x88982f04") cpp_quote("#define WINCODEC_ERR_CODECNOTHUMBNAIL 0x88982f44") cpp_quote("#define WINCODEC_ERR_PALETTEUNAVAILABLE 0x88982f45") +cpp_quote("#define WINCODEC_ERR_UNSUPPORTEDOPERATION 0x88982f81") interface IWICBitmap; interface IWICComponentInfo; -- 1.5.4.3