Commit 66c9a73d authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/imagelist: Fail in ImageList_GetIconSize on null parameters.

parent 8bcdc9ad
...@@ -1726,14 +1726,12 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle) ...@@ -1726,14 +1726,12 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
BOOL WINAPI BOOL WINAPI
ImageList_GetIconSize (HIMAGELIST himl, INT *cx, INT *cy) ImageList_GetIconSize (HIMAGELIST himl, INT *cx, INT *cy)
{ {
if (!is_valid(himl)) if (!is_valid(himl) || !cx || !cy)
return FALSE; return FALSE;
if ((himl->cx <= 0) || (himl->cy <= 0)) if ((himl->cx <= 0) || (himl->cy <= 0))
return FALSE; return FALSE;
if (cx)
*cx = himl->cx; *cx = himl->cx;
if (cy)
*cy = himl->cy; *cy = himl->cy;
return TRUE; return TRUE;
......
...@@ -1163,14 +1163,14 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) ...@@ -1163,14 +1163,14 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr)
if (!(infoPtr->fHeightSet)) if (!(infoPtr->fHeightSet))
{ {
int item_height; int item_height;
int icon_height = 0; INT icon_height = 0, cx;
/* Use the current font to determine the height of a tab. */ /* Use the current font to determine the height of a tab. */
GetTextMetricsW(hdc, &fontMetrics); GetTextMetricsW(hdc, &fontMetrics);
/* Get the icon height */ /* Get the icon height */
if (infoPtr->himl) if (infoPtr->himl)
ImageList_GetIconSize(infoPtr->himl, 0, &icon_height); ImageList_GetIconSize(infoPtr->himl, &cx, &icon_height);
/* Take the highest between font or icon */ /* Take the highest between font or icon */
if (fontMetrics.tmHeight > icon_height) if (fontMetrics.tmHeight > icon_height)
...@@ -1195,7 +1195,9 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr) ...@@ -1195,7 +1195,9 @@ static void TAB_SetItemBounds (TAB_INFO *infoPtr)
/* Get the icon width */ /* Get the icon width */
if (infoPtr->himl) if (infoPtr->himl)
{ {
ImageList_GetIconSize(infoPtr->himl, &icon_width, 0); INT cy;
ImageList_GetIconSize(infoPtr->himl, &icon_width, &cy);
if (infoPtr->dwStyle & TCS_FIXEDWIDTH) if (infoPtr->dwStyle & TCS_FIXEDWIDTH)
icon_width += 4; icon_width += 4;
......
...@@ -1734,21 +1734,19 @@ static void test_iconsize(void) ...@@ -1734,21 +1734,19 @@ static void test_iconsize(void)
himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3);
/* null pointers, not zero imagelist dimensions */ /* null pointers, not zero imagelist dimensions */
ret = ImageList_GetIconSize(himl, NULL, NULL); ret = ImageList_GetIconSize(himl, NULL, NULL);
todo_wine ok(!ret, "got %d\n", ret); ok(!ret, "got %d\n", ret);
/* doesn't touch return pointers */ /* doesn't touch return pointers */
cx = 0xdeadbeef; cx = 0xdeadbeef;
ret = ImageList_GetIconSize(himl, &cx, NULL); ret = ImageList_GetIconSize(himl, &cx, NULL);
todo_wine {
ok(!ret, "got %d\n", ret); ok(!ret, "got %d\n", ret);
ok(cx == 0xdeadbeef, "got %d\n", cx); ok(cx == 0xdeadbeef, "got %d\n", cx);
}
cy = 0xdeadbeef; cy = 0xdeadbeef;
ret = ImageList_GetIconSize(himl, NULL, &cy); ret = ImageList_GetIconSize(himl, NULL, &cy);
todo_wine {
ok(!ret, "got %d\n", ret); ok(!ret, "got %d\n", ret);
ok(cy == 0xdeadbeef, "got %d\n", cy); ok(cy == 0xdeadbeef, "got %d\n", cy);
}
ImageList_Destroy(himl); ImageList_Destroy(himl);
} }
......
...@@ -772,12 +772,12 @@ static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam) ...@@ -772,12 +772,12 @@ static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam)
HFONT hfontprev; HFONT hfontprev;
TEXTMETRICW tm; TEXTMETRICW tm;
LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam; LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam;
INT height = 0; INT height = 0, cx;
if (!himlTT) if (!himlTT)
himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38), himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38),
TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0); TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0);
ImageList_GetIconSize( himlTT, 0, &height); ImageList_GetIconSize( himlTT, &cx, &height);
lpmi->itemHeight = height + 2; lpmi->itemHeight = height + 2;
/* use MAX of bitmap height and tm.tmHeight .*/ /* use MAX of bitmap height and tm.tmHeight .*/
hdc=GetDC(hDlg); hdc=GetDC(hDlg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment