Module: wine Branch: master Commit: 1517342faccc841c4af4ed6230eb67ab81560a60 URL: https://gitlab.winehq.org/wine/wine/-/commit/1517342faccc841c4af4ed6230eb67a...
Author: Jeff Smith whydoubt@gmail.com Date: Tue Jul 11 10:02:29 2023 -0500
gdiplus: Fix GdipGetPropertySize return value when no properties exist.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54748
---
dlls/gdiplus/image.c | 7 ++++++- dlls/gdiplus/tests/image.c | 28 ++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 50a666c5bc9..7ad3ca0347e 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -2760,7 +2760,12 @@ GpStatus WINGDIPAPI GdipGetPropertySize(GpImage *image, UINT *size, UINT *count) }
reader = ((GpBitmap *)image)->metadata_reader; - if (!reader) return PropertyNotFound; + if (!reader) + { + *count = 0; + *size = 0; + return Ok; + }
hr = IWICMetadataReader_GetCount(reader, &prop_count); if (FAILED(hr)) return hresult_to_status(hr); diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index a2dcd448143..b718a6fca16 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -3804,6 +3804,18 @@ static void test_image_properties(void) "expected property id %#lx, got %#lx\n", prop_id[0], item.data.id); }
+ status = GdipGetPropertySize(NULL, &prop_size, &prop_count); + expect(InvalidParameter, status); + status = GdipGetPropertySize(image, &prop_size, NULL); + expect(InvalidParameter, status); + status = GdipGetPropertySize(image, NULL, &prop_count); + expect(InvalidParameter, status); + status = GdipGetPropertySize(image, NULL, NULL); + expect(InvalidParameter, status); + expected = (image_type == ImageTypeMetafile) ? NotImplemented : Ok; + status = GdipGetPropertySize(image, &prop_size, &prop_count); + expect(expected, status); + GdipDisposeImage(image);
winetest_pop_context(); @@ -4154,14 +4166,6 @@ static void test_GdipGetAllPropertyItems(void)
HeapFree(GetProcessHeap(), 0, prop_id);
- status = GdipGetPropertySize(NULL, &total_size, &total_count); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, &total_size, NULL); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, NULL, &total_count); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, NULL, NULL); - expect(InvalidParameter, status); total_size = 0xdeadbeef; total_count = 0xdeadbeef; status = GdipGetPropertySize(image, &total_size, &total_count); @@ -4918,14 +4922,6 @@ static void test_gif_properties(void)
HeapFree(GetProcessHeap(), 0, prop_id);
- status = GdipGetPropertySize(NULL, &total_size, &total_count); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, &total_size, NULL); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, NULL, &total_count); - expect(InvalidParameter, status); - status = GdipGetPropertySize(image, NULL, NULL); - expect(InvalidParameter, status); total_size = 0xdeadbeef; total_count = 0xdeadbeef; status = GdipGetPropertySize(image, &total_size, &total_count);