From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/header.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c index be4c5616bb7..e905d18e2fa 100644 --- a/dlls/comctl32/header.c +++ b/dlls/comctl32/header.c @@ -41,7 +41,6 @@ #include "vssym32.h" #include "uxtheme.h" #include "wine/debug.h" -#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(header);
@@ -141,7 +140,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
if (mask & HDI_TEXT) { - heap_free(lpItem->pszText); + free(lpItem->pszText); lpItem->pszText = NULL;
if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ @@ -336,7 +335,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
if (size > sizeof(buffer)) { - data = heap_alloc( size ); + data = malloc( size ); if (!data) return NULL; } data->rdh.dwSize = sizeof(data->rdh); @@ -362,7 +361,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up ) data->rdh.nCount++; } rgn = ExtCreateRegion( NULL, size, data ); - if (data != (RGNDATA *)buffer) heap_free( data ); + if (data != (RGNDATA *)buffer) free( data ); return rgn; }
@@ -983,7 +982,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) if (mask&HDI_TEXT && lpItem->pszText != NULL) { ERR("(): function called without a call to FreeCallbackItems\n"); - heap_free(lpItem->pszText); + free(lpItem->pszText); lpItem->pszText = NULL; }
@@ -994,13 +993,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) { dispInfo.hdr.code = HDN_GETDISPINFOW; if (mask & HDI_TEXT) - pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(WCHAR)); + pvBuffer = calloc(MAX_HEADER_TEXT_LEN, sizeof(WCHAR)); } else { dispInfo.hdr.code = HDN_GETDISPINFOA; if (mask & HDI_TEXT) - pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(CHAR)); + pvBuffer = calloc(MAX_HEADER_TEXT_LEN, sizeof(CHAR)); } dispInfo.pszText = pvBuffer; dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0); @@ -1031,7 +1030,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) else { Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText); - heap_free(pvBuffer); + free(pvBuffer); } }
@@ -1057,7 +1056,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem) { if (lpItem->callbackMask&HDI_TEXT) { - heap_free(lpItem->pszText); + free(lpItem->pszText); lpItem->pszText = NULL; }
@@ -1179,15 +1178,15 @@ HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem) TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
iOrder = infoPtr->items[iItem].iOrder; - heap_free(infoPtr->items[iItem].pszText); + free(infoPtr->items[iItem].pszText);
infoPtr->uNumItem--; memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1], (infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM)); memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1], (infoPtr->uNumItem - iOrder) * sizeof(INT)); - infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); - infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem); + infoPtr->items = realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); + infoPtr->order = realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* Correct the orders */ for (i = 0; i < infoPtr->uNumItem; i++) @@ -1417,8 +1416,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b iOrder = infoPtr->uNumItem;
infoPtr->uNumItem++; - infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); - infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem); + infoPtr->items = realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); + infoPtr->order = realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* make space for the new item */ memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem], @@ -1537,7 +1536,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch); if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify)) { - heap_free(pvScratch); + free(pvScratch); return FALSE; }
@@ -1554,7 +1553,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
- heap_free(pvScratch); + free(pvScratch); return TRUE; }
@@ -1577,7 +1576,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) HFONT hOldFont; HDC hdc;
- infoPtr = heap_alloc_zero (sizeof(*infoPtr)); + infoPtr = calloc(1, sizeof(*infoPtr)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndSelf = hwnd; @@ -1632,14 +1631,14 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr) if (infoPtr->items) { lpItem = infoPtr->items; for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) - heap_free(lpItem->pszText); - heap_free(infoPtr->items); + free(lpItem->pszText); + free(infoPtr->items); }
- heap_free(infoPtr->order); + free(infoPtr->order);
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); - heap_free(infoPtr); + free(infoPtr);
return 0; }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/monthcal.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 4fc984f6f4b..ea220136182 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -46,7 +46,6 @@ #include "uxtheme.h" #include "vssym32.h" #include "wine/debug.h" -#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(monthcal);
@@ -1946,7 +1945,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.cDayState = MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0); - nmds.prgDayState = state = heap_alloc_zero(nmds.cDayState * sizeof(MONTHDAYSTATE)); + nmds.prgDayState = state = calloc(nmds.cDayState, sizeof(MONTHDAYSTATE));
MONTHCAL_GetMinDate(infoPtr, &nmds.stStart); nmds.stStart.wDay = 1; @@ -1955,7 +1954,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) memcpy(infoPtr->monthdayState, nmds.prgDayState, MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE));
- heap_free(state); + free(state); }
/* no valid range check performed */ @@ -2593,9 +2592,9 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) { infoPtr->dim.cx = x; infoPtr->dim.cy = y; - infoPtr->calendars = heap_realloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO)); + infoPtr->calendars = realloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO));
- infoPtr->monthdayState = heap_realloc(infoPtr->monthdayState, + infoPtr->monthdayState = realloc(infoPtr->monthdayState, MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE)); MONTHCAL_NotifyDayState(infoPtr);
@@ -2750,7 +2749,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) MONTHCAL_INFO *infoPtr;
/* allocate memory for info structure */ - infoPtr = heap_alloc_zero(sizeof(*infoPtr)); + infoPtr = calloc(1, sizeof(*infoPtr)); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
if (infoPtr == NULL) { @@ -2762,9 +2761,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE); infoPtr->dim.cx = infoPtr->dim.cy = 1; - infoPtr->calendars = heap_alloc_zero(sizeof(CALENDAR_INFO)); + infoPtr->calendars = calloc(1, sizeof(*infoPtr->calendars)); if (!infoPtr->calendars) goto fail; - infoPtr->monthdayState = heap_alloc_zero(3 * sizeof(MONTHDAYSTATE)); + infoPtr->monthdayState = calloc(3, sizeof(*infoPtr->monthdayState)); if (!infoPtr->monthdayState) goto fail;
/* initialize info structure */ @@ -2805,9 +2804,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) return 0;
fail: - heap_free(infoPtr->monthdayState); - heap_free(infoPtr->calendars); - heap_free(infoPtr); + free(infoPtr->monthdayState); + free(infoPtr->calendars); + free(infoPtr); return 0; }
@@ -2816,9 +2815,8 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr) { INT i;
- /* free month calendar info data */ - heap_free(infoPtr->monthdayState); - heap_free(infoPtr->calendars); + free(infoPtr->monthdayState); + free(infoPtr->calendars); SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
CloseThemeData (GetWindowTheme (infoPtr->hwndSelf)); @@ -2826,7 +2824,7 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr) for (i = 0; i < BrushLast; i++) DeleteObject(infoPtr->brushes[i]); for (i = 0; i < PenLast; i++) DeleteObject(infoPtr->pens[i]);
- heap_free(infoPtr); + free(infoPtr); return 0; }
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/static.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/static.c b/dlls/comctl32/static.c index 25eee289204..cab0235b8d3 100644 --- a/dlls/comctl32/static.c +++ b/dlls/comctl32/static.c @@ -29,6 +29,7 @@ */
#include <stdarg.h> +#include <stdlib.h>
#include "windef.h" #include "winbase.h" @@ -37,7 +38,6 @@ #include "commctrl.h" #include "uxtheme.h"
-#include "wine/heap.h" #include "wine/debug.h"
#include "comctl32.h" @@ -94,7 +94,7 @@ static struct static_extra_info *get_extra_ptr( HWND hwnd, BOOL force ) struct static_extra_info *extra = (struct static_extra_info *)GetWindowLongPtrW( hwnd, 0 ); if (!extra && force) { - extra = heap_alloc_zero( sizeof(*extra) ); + extra = calloc( 1, sizeof(*extra) ); if (extra) SetWindowLongPtrW( hwnd, 0, (ULONG_PTR)extra ); } @@ -470,7 +470,7 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, { if (extra->image_has_alpha) DeleteObject( extra->image.hbitmap ); - heap_free( extra ); + free( extra ); } /* * FIXME @@ -751,13 +751,13 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style ) }
buf_size = 256; - if (!(text = HeapAlloc( GetProcessHeap(), 0, buf_size * sizeof(WCHAR) ))) + if (!(text = malloc( buf_size * sizeof(WCHAR) ))) goto no_TextOut;
while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1) { buf_size *= 2; - if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) ))) + if (!(text = realloc( text, buf_size * sizeof(WCHAR) ))) goto no_TextOut; }
@@ -777,7 +777,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style ) }
no_TextOut: - HeapFree( GetProcessHeap(), 0, text ); + free( text );
if (hFont) SelectObject( hdc, hOldFont );
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/imagelist.c | 58 +++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 22d8d8c40e0..c70e48dbbee 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -45,7 +45,6 @@ #include "commoncontrols.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagelist);
@@ -269,7 +268,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count, SelectObject( hdc, hbmImage ); mask_width = (bm.bmWidth + 31) / 32 * 4;
- if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; + if (!(info = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biWidth = bm.bmWidth; info->bmiHeader.biHeight = -height; @@ -281,17 +280,17 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count, info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrImportant = 0; - if (!(bits = heap_alloc( info->bmiHeader.biSizeImage ))) goto done; + if (!(bits = malloc( info->bmiHeader.biSizeImage ))) goto done; if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done;
if (hbmMask) { - if (!(mask_info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))) + if (!(mask_info = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))) goto done; mask_info->bmiHeader = info->bmiHeader; mask_info->bmiHeader.biBitCount = 1; mask_info->bmiHeader.biSizeImage = mask_width * height; - if (!(mask_bits = heap_alloc_zero( mask_info->bmiHeader.biSizeImage ))) + if (!(mask_bits = calloc( 1, mask_info->bmiHeader.biSizeImage ))) goto done; if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) goto done; } @@ -300,10 +299,10 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count, ret = TRUE;
done: - heap_free( info ); - heap_free( mask_info ); - heap_free( bits ); - heap_free( mask_bits ); + free( info ); + free( mask_info ); + free( bits ); + free( mask_bits ); return ret; }
@@ -380,8 +379,8 @@ IMAGELIST_InternalExpandBitmaps(HIMAGELIST himl, INT nImageCount) himl->hbmMask = hbmNewBitmap; }
- himl->item_flags = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, himl->item_flags, - nNewCount * sizeof(*himl->item_flags)); + himl->item_flags = realloc(himl->item_flags, nNewCount * sizeof(*himl->item_flags)); + memset( himl->item_flags + himl->cMaxImage, 0, (nNewCount - himl->cMaxImage) * sizeof(*himl->item_flags) ); himl->cMaxImage = nNewCount;
DeleteDC (hdcBitmap); @@ -848,7 +847,7 @@ ImageList_Create (INT cx, INT cy, UINT flags, else himl->hbmMask = 0;
- himl->item_flags = heap_alloc_zero( himl->cMaxImage * sizeof(*himl->item_flags) ); + himl->item_flags = calloc( himl->cMaxImage, sizeof(*himl->item_flags) );
/* create blending brushes */ hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25); @@ -1260,7 +1259,7 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des func.AlphaFormat = AC_SRC_ALPHA;
if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE; - if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; + if (!(info = malloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biWidth = cx; info->bmiHeader.biHeight = cy; @@ -1371,7 +1370,7 @@ done: DeleteDC( hdc ); if (bmp) DeleteObject( bmp ); if (mask) DeleteObject( mask ); - heap_free( info ); + free( info ); return ret; }
@@ -1981,11 +1980,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, uType, uFlags);
len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0); - lpbmpW = heap_alloc(len * sizeof(WCHAR)); + lpbmpW = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags); - heap_free (lpbmpW); + free (lpbmpW); return himl; }
@@ -2226,12 +2225,12 @@ static void *read_bitmap(IStream *pstm, BITMAPINFO *bmi) if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL))) return NULL;
- bits = heap_alloc_zero(bmi->bmiHeader.biSizeImage); + bits = calloc( 1, bmi->bmiHeader.biSizeImage); if (!bits) return NULL;
if (FAILED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL))) { - heap_free(bits); + free(bits); return NULL; } return bits; @@ -2343,8 +2342,8 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm) 0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight, mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY); } - heap_free( image_bits ); - heap_free( mask_bits ); + free( image_bits ); + free( mask_bits );
himl->cCurImage = ilHead.cCurImage; himl->cMaxImage = ilHead.cMaxImage; @@ -2406,8 +2405,8 @@ ImageList_Remove (HIMAGELIST himl, INT i) for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++) himl->nOvlIdx[nCount] = -1;
- heap_free( himl->item_flags ); - himl->item_flags = heap_alloc_zero( himl->cMaxImage * sizeof(*himl->item_flags) ); + free( himl->item_flags ); + himl->item_flags = calloc( himl->cMaxImage, sizeof(*himl->item_flags) );
hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage); SelectObject (himl->hdcImage, hbmNewImage); @@ -2947,8 +2946,9 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
DeleteDC (hdcBitmap);
- himl->item_flags = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, himl->item_flags, - nNewCount * sizeof(*himl->item_flags)); + himl->item_flags = realloc( himl->item_flags, nNewCount * sizeof(*himl->item_flags)); + if (nNewCount > himl->cMaxImage) + memset( himl->item_flags + himl->cMaxImage, 0, (nNewCount - himl->cMaxImage) * sizeof(*himl->item_flags) );
/* Update max image count and current image count */ himl->cMaxImage = nNewCount; @@ -3013,7 +3013,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm) offBits = totalSize; totalSize += sizeImage;
- data = heap_alloc_zero(totalSize); + data = calloc(1, totalSize); bmfh = (LPBITMAPFILEHEADER)data; bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER)); lpBits = data + offBits; @@ -3054,7 +3054,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm) result = TRUE;
failed: - heap_free(data); + free(data);
return result; } @@ -3299,8 +3299,8 @@ static ULONG WINAPI ImageListImpl_Release(IImageList2 *iface) if (This->hbrBlend50) DeleteObject (This->hbrBlend50);
This->IImageList2_iface.lpVtbl = NULL; - heap_free(This->item_flags); - heap_free(This); + free(This->item_flags); + free(This); }
return ref; @@ -3834,7 +3834,7 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
- This = heap_alloc_zero(sizeof(struct _IMAGELIST)); + This = calloc(1, sizeof(struct _IMAGELIST)); if (!This) return E_OUTOFMEMORY;
This->IImageList2_iface.lpVtbl = &ImageListImpl_Vtbl;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/propsheet.c | 137 ++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 79 deletions(-)
diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 43192771300..d650243230c 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -51,6 +51,7 @@
#include <stdarg.h> #include <string.h> +#include <stdlib.h>
#define NONAMELESSUNION
@@ -184,28 +185,13 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
WINE_DEFAULT_DEBUG_CHANNEL(propsheet);
-static char *heap_strdupA(const char *str) -{ - int len = strlen(str) + 1; - char *ret = Alloc(len); - return strcpy(ret, str); -} - -static WCHAR *heap_strdupW(const WCHAR *str) -{ - int len = lstrlenW(str) + 1; - WCHAR *ret = Alloc(len * sizeof(WCHAR)); - lstrcpyW(ret, str); - return ret; -} - static WCHAR *heap_strdupAtoW(const char *str) { WCHAR *ret; INT len;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, 0, 0); - ret = Alloc(len * sizeof(WCHAR)); + ret = malloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
return ret; @@ -217,7 +203,7 @@ static char *heap_strdupWtoA(const WCHAR *str) INT len;
len = WideCharToMultiByte(CP_ACP, 0, str, -1, 0, 0, 0, 0); - ret = Alloc(len); + ret = malloc(len); WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, 0, 0);
return ret; @@ -447,11 +433,11 @@ static WCHAR* HPSP_get_title(HPROPSHEETPAGE hpsp, const WCHAR *template_title) else pTitle = L"(null)";
- return heap_strdupW(pTitle); + return wcsdup(pTitle); }
if (hpsp->unicode) - return heap_strdupW(title); + return wcsdup(title); return heap_strdupAtoW(title); }
@@ -523,15 +509,15 @@ static void HPSP_set_header_title(HPROPSHEETPAGE hpsp, const WCHAR *title) if (hpsp->unicode) { if (!IS_INTRESOURCE(hpsp->pspW.pszHeaderTitle)) - Free((void *)hpsp->pspW.pszHeaderTitle); + free((void *)hpsp->pspW.pszHeaderTitle);
- hpsp->pspW.pszHeaderTitle = heap_strdupW(title); + hpsp->pspW.pszHeaderTitle = wcsdup(title); hpsp->pspW.dwFlags |= PSP_USEHEADERTITLE; } else { if (!IS_INTRESOURCE(hpsp->pspA.pszHeaderTitle)) - Free((void *)hpsp->pspA.pszHeaderTitle); + free((void *)hpsp->pspA.pszHeaderTitle);
hpsp->pspA.pszHeaderTitle = heap_strdupWtoA(title); hpsp->pspA.dwFlags |= PSP_USEHEADERTITLE; @@ -543,15 +529,15 @@ static void HPSP_set_header_subtitle(HPROPSHEETPAGE hpsp, const WCHAR *subtitle) if (hpsp->unicode) { if (!IS_INTRESOURCE(hpsp->pspW.pszHeaderTitle)) - Free((void *)hpsp->pspW.pszHeaderTitle); + free((void *)hpsp->pspW.pszHeaderTitle);
- hpsp->pspW.pszHeaderTitle = heap_strdupW(subtitle); + hpsp->pspW.pszHeaderTitle = wcsdup(subtitle); hpsp->pspW.dwFlags |= PSP_USEHEADERSUBTITLE; } else { if (!IS_INTRESOURCE(hpsp->pspA.pszHeaderTitle)) - Free((void *)hpsp->pspA.pszHeaderTitle); + free((void *)hpsp->pspA.pszHeaderTitle);
hpsp->pspA.pszHeaderTitle = heap_strdupWtoA(subtitle); hpsp->pspA.dwFlags |= PSP_USEHEADERSUBTITLE; @@ -718,13 +704,7 @@ static void PROPSHEET_CollectSheetInfoA(LPCPROPSHEETHEADERA lppsh, else { if (!IS_INTRESOURCE(lppsh->pszCaption)) - { - int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0); - WCHAR *caption = Alloc( len*sizeof (WCHAR) ); - - MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, caption, len); - psInfo->ppshheader.pszCaption = caption; - } + psInfo->ppshheader.pszCaption = heap_strdupAtoW(lppsh->pszCaption); } psInfo->nPages = lppsh->nPages;
@@ -761,7 +741,7 @@ static void PROPSHEET_CollectSheetInfoW(LPCPROPSHEETHEADERW lppsh, else { if (!IS_INTRESOURCE(lppsh->pszCaption)) - psInfo->ppshheader.pszCaption = heap_strdupW( lppsh->pszCaption ); + psInfo->ppshheader.pszCaption = wcsdup( lppsh->pszCaption ); } psInfo->nPages = lppsh->nPages;
@@ -975,7 +955,7 @@ static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo) */ resSize = SizeofResource(COMCTL32_hModule, hRes);
- temp = Alloc(2 * resSize); + temp = malloc(2 * resSize);
if (!temp) return -1; @@ -1020,7 +1000,7 @@ static INT_PTR PROPSHEET_CreateDialog(PropSheetInfo* psInfo) if ( !ret ) ret = -1; }
- Free(temp); + free(temp);
return ret; } @@ -1561,7 +1541,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent, }
pTemplate = HPSP_load_template(hpsp, &resSize); - pTemplateCopy = Alloc(resSize); + pTemplateCopy = malloc(resSize); if (!pTemplateCopy) return FALSE;
@@ -1597,8 +1577,7 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
HPSP_call_callback(hpsp, PSPCB_CREATE); hwndPage = HPSP_create_page(hpsp, pTemplateCopy, hwndParent); - /* Free a no more needed copy */ - Free(pTemplateCopy); + free(pTemplateCopy);
if(!hwndPage) return FALSE; @@ -2290,11 +2269,11 @@ static void PROPSHEET_SetTitleW(HWND hwndDlg, DWORD dwStyle, LPCWSTR lpszText) int lentitle = lstrlenW(lpszText); int lenprop = lstrlenW(psInfo->strPropertiesFor);
- dest = Alloc( (lentitle + lenprop + 1)*sizeof (WCHAR)); + dest = malloc( (lentitle + lenprop + 1)*sizeof (WCHAR)); wsprintfW(dest, psInfo->strPropertiesFor, lpszText);
SetWindowTextW(hwndDlg, dest); - Free(dest); + free(dest); } else SetWindowTextW(hwndDlg, lpszText); @@ -2408,7 +2387,7 @@ static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, if (index > psInfo->nPages) index = psInfo->nPages;
- ppi = Alloc(sizeof(PropPageInfo) * (psInfo->nPages + 1)); + ppi = malloc(sizeof(PropPageInfo) * (psInfo->nPages + 1)); if (!ppi) return FALSE;
@@ -2433,7 +2412,7 @@ static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, if (!PROPSHEET_CollectPageInfo(hpage, psInfo, index, FALSE)) { psInfo->proppage = prev_ppi; - Free(ppi); + free(ppi); return FALSE; }
@@ -2445,12 +2424,12 @@ static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, if (!PROPSHEET_CreatePage(hwndDlg, index, psInfo, hpage)) { psInfo->proppage = prev_ppi; - Free(ppi); + free(ppi); return FALSE; } }
- Free(prev_ppi); + free(prev_ppi); psInfo->nPages++; if (index <= psInfo->active_page) psInfo->active_page++; @@ -2565,7 +2544,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, if(psInfo->proppage[index].hpage) { if (HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_USETITLE) - Free ((LPVOID)psInfo->proppage[index].pszText); + free( (LPVOID)psInfo->proppage[index].pszText);
DestroyPropertySheetPage(psInfo->proppage[index].hpage); } @@ -2575,7 +2554,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
oldPages = psInfo->proppage; psInfo->nPages--; - psInfo->proppage = Alloc(sizeof(PropPageInfo) * psInfo->nPages); + psInfo->proppage = malloc(sizeof(PropPageInfo) * psInfo->nPages);
if (index > 0) memcpy(&psInfo->proppage[0], &oldPages[0], index * sizeof(PropPageInfo)); @@ -2584,7 +2563,7 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg, memcpy(&psInfo->proppage[index], &oldPages[index + 1], (psInfo->nPages - index) * sizeof(PropPageInfo));
- Free(oldPages); + free(oldPages);
return FALSE; } @@ -2667,7 +2646,7 @@ static void PROPSHEET_SetHeaderTitleA(HWND hwndDlg, UINT page_index, const char
titleW = heap_strdupAtoW(title); PROPSHEET_SetHeaderTitleW(hwndDlg, page_index, titleW); - Free(titleW); + free(titleW); }
/****************************************************************************** @@ -2696,7 +2675,7 @@ static void PROPSHEET_SetHeaderSubTitleA(HWND hwndDlg, UINT page_index, const ch
subtitleW = heap_strdupAtoW(subtitle); PROPSHEET_SetHeaderSubTitleW(hwndDlg, page_index, subtitleW); - Free(subtitleW); + free(subtitleW); }
/****************************************************************************** @@ -2845,7 +2824,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) TRACE("\n"); if (!psInfo) return; if (!IS_INTRESOURCE(psInfo->ppshheader.pszCaption)) - Free ((LPVOID)psInfo->ppshheader.pszCaption); + free ((LPVOID)psInfo->ppshheader.pszCaption);
for (i = 0; i < psInfo->nPages; i++) { @@ -2864,7 +2843,7 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) DestroyWindow(psInfo->proppage[i].hwndPage);
if (flags & PSP_USETITLE) - Free ((LPVOID)psInfo->proppage[i].pszText); + free ((LPVOID)psInfo->proppage[i].pszText);
DestroyPropertySheetPage(psInfo->proppage[i].hpage); } @@ -2879,8 +2858,8 @@ static void PROPSHEET_CleanUp(HWND hwndDlg) (!(psInfo->ppshheader.dwFlags & PSH_USEHBMHEADER)) ) DeleteObject(psInfo->ppshheader.u5.hbmHeader);
- Free(psInfo->proppage); - Free(psInfo->strPropertiesFor); + free(psInfo->proppage); + free(psInfo->strPropertiesFor); ImageList_Destroy(psInfo->hImageList);
GlobalFree(psInfo); @@ -2967,7 +2946,7 @@ INT_PTR WINAPI PropertySheetA(LPCPROPSHEETHEADERA lppsh)
PROPSHEET_CollectSheetInfoA(lppsh, psInfo);
- psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); + psInfo->proppage = malloc(sizeof(PropPageInfo) * lppsh->nPages); pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++) @@ -3018,7 +2997,7 @@ INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
PROPSHEET_CollectSheetInfoW(lppsh, psInfo);
- psInfo->proppage = Alloc(sizeof(PropPageInfo) * lppsh->nPages); + psInfo->proppage = malloc(sizeof(PropPageInfo) * lppsh->nPages); pByte = (const BYTE*) psInfo->ppshheader.u3.ppsp;
for (n = i = 0; i < lppsh->nPages; i++, n++) @@ -3077,7 +3056,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( if (lpPropSheetPage->dwSize < PROPSHEETPAGEA_V1_SIZE) return NULL;
- ret = Alloc(FIELD_OFFSET(struct _PSP, data[lpPropSheetPage->dwSize])); + ret = malloc(FIELD_OFFSET(struct _PSP, data[lpPropSheetPage->dwSize])); ret->magic = HPROPSHEETPAGE_MAGIC; ppsp = &ret->pspA; memcpy(ppsp, lpPropSheetPage, lpPropSheetPage->dwSize); @@ -3085,19 +3064,19 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { if (!IS_INTRESOURCE( ppsp->u.pszTemplate )) - ppsp->u.pszTemplate = heap_strdupA( lpPropSheetPage->u.pszTemplate ); + ppsp->u.pszTemplate = strdup( lpPropSheetPage->u.pszTemplate ); }
if (ppsp->dwFlags & PSP_USEICONID) { if (!IS_INTRESOURCE( ppsp->u2.pszIcon )) - ppsp->u2.pszIcon = heap_strdupA( lpPropSheetPage->u2.pszIcon ); + ppsp->u2.pszIcon = strdup( lpPropSheetPage->u2.pszIcon ); }
if (ppsp->dwFlags & PSP_USETITLE) { if (!IS_INTRESOURCE( ppsp->pszTitle )) - ppsp->pszTitle = heap_strdupA( lpPropSheetPage->pszTitle ); + ppsp->pszTitle = strdup( lpPropSheetPage->pszTitle ); }
if (ppsp->dwFlags & PSP_HIDEHEADER) @@ -3106,13 +3085,13 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( if (ppsp->dwFlags & PSP_USEHEADERTITLE) { if (!IS_INTRESOURCE( ppsp->pszHeaderTitle )) - ppsp->pszHeaderTitle = heap_strdupA( lpPropSheetPage->pszHeaderTitle ); + ppsp->pszHeaderTitle = strdup( lpPropSheetPage->pszHeaderTitle ); }
if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE) { if (!IS_INTRESOURCE( ppsp->pszHeaderSubTitle )) - ppsp->pszHeaderSubTitle = heap_strdupA( lpPropSheetPage->pszHeaderSubTitle ); + ppsp->pszHeaderSubTitle = strdup( lpPropSheetPage->pszHeaderSubTitle ); }
HPSP_call_callback(ret, PSPCB_ADDREF); @@ -3132,7 +3111,7 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage if (lpPropSheetPage->dwSize < PROPSHEETPAGEW_V1_SIZE) return NULL;
- ret = Alloc(FIELD_OFFSET(struct _PSP, data[lpPropSheetPage->dwSize])); + ret = malloc(FIELD_OFFSET(struct _PSP, data[lpPropSheetPage->dwSize])); ret->magic = HPROPSHEETPAGE_MAGIC; ret->unicode = TRUE; ppsp = &ret->pspW; @@ -3141,19 +3120,19 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { if (!IS_INTRESOURCE( ppsp->u.pszTemplate )) - ppsp->u.pszTemplate = heap_strdupW( lpPropSheetPage->u.pszTemplate ); + ppsp->u.pszTemplate = wcsdup( lpPropSheetPage->u.pszTemplate ); }
if ( ppsp->dwFlags & PSP_USEICONID ) { if (!IS_INTRESOURCE( ppsp->u2.pszIcon )) - ppsp->u2.pszIcon = heap_strdupW( lpPropSheetPage->u2.pszIcon ); + ppsp->u2.pszIcon = wcsdup( lpPropSheetPage->u2.pszIcon ); }
if (ppsp->dwFlags & PSP_USETITLE) { if (!IS_INTRESOURCE( ppsp->pszTitle )) - ppsp->pszTitle = heap_strdupW( lpPropSheetPage->pszTitle ); + ppsp->pszTitle = wcsdup( lpPropSheetPage->pszTitle ); }
if (ppsp->dwFlags & PSP_HIDEHEADER) @@ -3162,13 +3141,13 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage if (ppsp->dwFlags & PSP_USEHEADERTITLE) { if (!IS_INTRESOURCE( ppsp->pszHeaderTitle )) - ppsp->pszHeaderTitle = heap_strdupW( ppsp->pszHeaderTitle ); + ppsp->pszHeaderTitle = wcsdup( ppsp->pszHeaderTitle ); }
if (ppsp->dwFlags & PSP_USEHEADERSUBTITLE) { if (!IS_INTRESOURCE( ppsp->pszHeaderSubTitle )) - ppsp->pszHeaderSubTitle = heap_strdupW( ppsp->pszHeaderSubTitle ); + ppsp->pszHeaderSubTitle = wcsdup( ppsp->pszHeaderSubTitle ); }
HPSP_call_callback(ret, PSPCB_ADDREF); @@ -3198,41 +3177,41 @@ BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hpsp) PROPSHEETPAGEW *psp = &hpsp->pspW;
if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE(psp->u.pszTemplate)) - Free((void *)psp->u.pszTemplate); + free((void *)psp->u.pszTemplate);
if ((psp->dwFlags & PSP_USEICONID) && !IS_INTRESOURCE(psp->u2.pszIcon)) - Free((void *)psp->u2.pszIcon); + free((void *)psp->u2.pszIcon);
if ((psp->dwFlags & PSP_USETITLE) && !IS_INTRESOURCE(psp->pszTitle)) - Free((void *)psp->pszTitle); + free((void *)psp->pszTitle);
if ((psp->dwFlags & PSP_USEHEADERTITLE) && !IS_INTRESOURCE(psp->pszHeaderTitle)) - Free((void *)psp->pszHeaderTitle); + free((void *)psp->pszHeaderTitle);
if ((psp->dwFlags & PSP_USEHEADERSUBTITLE) && !IS_INTRESOURCE(psp->pszHeaderSubTitle)) - Free((void *)psp->pszHeaderSubTitle); + free((void *)psp->pszHeaderSubTitle); } else { PROPSHEETPAGEA *psp = &hpsp->pspA;
if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE(psp->u.pszTemplate)) - Free((void *)psp->u.pszTemplate); + free((void *)psp->u.pszTemplate);
if ((psp->dwFlags & PSP_USEICONID) && !IS_INTRESOURCE(psp->u2.pszIcon)) - Free((void *)psp->u2.pszIcon); + free((void *)psp->u2.pszIcon);
if ((psp->dwFlags & PSP_USETITLE) && !IS_INTRESOURCE(psp->pszTitle)) - Free((void *)psp->pszTitle); + free((void *)psp->pszTitle);
if ((psp->dwFlags & PSP_USEHEADERTITLE) && !IS_INTRESOURCE(psp->pszHeaderTitle)) - Free((void *)psp->pszHeaderTitle); + free((void *)psp->pszHeaderTitle);
if ((psp->dwFlags & PSP_USEHEADERSUBTITLE) && !IS_INTRESOURCE(psp->pszHeaderSubTitle)) - Free((void *)psp->pszHeaderSubTitle); + free((void *)psp->pszHeaderSubTitle); }
- Free(hpsp); + free(hpsp); return TRUE; }
@@ -3531,7 +3510,7 @@ PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: { PropSheetInfo* psInfo = (PropSheetInfo*) lParam; - WCHAR* strCaption = Alloc(MAX_CAPTION_LENGTH*sizeof(WCHAR)); + WCHAR* strCaption = malloc(MAX_CAPTION_LENGTH*sizeof(WCHAR)); HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); int idx; LOGFONTW logFont;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/button.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index 6c04c458a6a..d4196b144ed 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -55,7 +55,6 @@ #include "uxtheme.h" #include "vssym32.h" #include "wine/debug.h" -#include "wine/heap.h"
#include "comctl32.h"
@@ -255,7 +254,7 @@ static inline void paint_button( BUTTON_INFO *infoPtr, LONG style, UINT action ) static inline WCHAR *get_button_text( const BUTTON_INFO *infoPtr ) { INT len = GetWindowTextLengthW( infoPtr->hwnd ); - WCHAR *buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ); + WCHAR *buffer = malloc( (len + 1) * sizeof(WCHAR) ); if (buffer) GetWindowTextW( infoPtr->hwnd, buffer, len + 1 ); return buffer; @@ -335,7 +334,7 @@ HRGN set_control_clipping( HDC hdc, const RECT *rect ) static WCHAR *heap_strndupW(const WCHAR *src, size_t length) { size_t size = (length + 1) * sizeof(WCHAR); - WCHAR *dst = heap_alloc(size); + WCHAR *dst = malloc(size); if (dst) memcpy(dst, src, size); return dst; } @@ -504,7 +503,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L { CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
- infoPtr = heap_alloc_zero( sizeof(*infoPtr) ); + infoPtr = calloc( 1, sizeof(*infoPtr) ); SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr ); infoPtr->hwnd = hWnd; infoPtr->parent = cs->hwndParent; @@ -521,8 +520,8 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L DeleteObject(infoPtr->u.bitmap); else if (infoPtr->image_type == IMAGE_ICON) DestroyIcon(infoPtr->u.icon); - heap_free(infoPtr->note); - heap_free(infoPtr); + free(infoPtr->note); + free(infoPtr); break;
case WM_CREATE: @@ -782,7 +781,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L return FALSE; }
- heap_free(infoPtr->note); + free(infoPtr->note); if (note) { infoPtr->note_length = lstrlenW(note); @@ -792,7 +791,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L if (!note || !infoPtr->note) { infoPtr->note_length = 0; - infoPtr->note = heap_alloc_zero(sizeof(WCHAR)); + infoPtr->note = calloc(1, sizeof(WCHAR)); }
SetLastError(NO_ERROR); @@ -1289,7 +1288,7 @@ static void BUTTON_GetTextIdealSize(BUTTON_INFO *infoPtr, LONG maxWidth, SIZE *s hdc = GetDC(infoPtr->hwnd); rect = BUTTON_GetTextRect(infoPtr, hdc, text, maxWidth); ReleaseDC(infoPtr->hwnd, hdc); - heap_free(text); + free(text);
size->cx = rect.right - rect.left + margin->left + margin->right; size->cy = rect.bottom - rect.top + margin->top + margin->bottom; @@ -1489,7 +1488,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size) RECT r; GetThemeTextExtent(theme, hdc, BP_COMMANDLINK, CMDLS_NORMAL, text, -1, flags, &text_bound, &r); - heap_free(text); + free(text); text_w = r.right - r.left; text_h = r.bottom - r.top; } @@ -1527,7 +1526,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size) RECT r = text_bound; old_font = SelectObject(hdc, font); DrawTextW(hdc, text, -1, &r, flags | DT_CALCRECT); - heap_free(text); + free(text);
text_w = r.right - r.left; text_h = r.bottom - r.top; @@ -1596,7 +1595,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la SetRectEmpty(labelRc); SetRectEmpty(imageRc); SetRectEmpty(textRc); - heap_free(text); + free(text); return (UINT)-1; }
@@ -1699,7 +1698,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la SetRectEmpty(&imageRect); } } - heap_free(text); + free(text);
CopyRect(labelRc, &labelRect); CopyRect(imageRc, &imageRect); @@ -1792,7 +1791,7 @@ static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, if (!(text = get_button_text(infoPtr))) return; DrawStateW(hdc, hbr, BUTTON_DrawTextCallback, (LPARAM)text, dtFlags, textRect->left, textRect->top, textRect->right - textRect->left, textRect->bottom - textRect->top, flags); - heap_free(text); + free(text); }
static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_flags, @@ -1824,7 +1823,7 @@ static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_f return;
DrawThemeText(theme, hdc, part, state, text, lstrlenW(text), text_flags, 0, text_rect); - heap_free(text); + free(text); }
/********************************************************************** @@ -2660,7 +2659,7 @@ static void CL_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) SelectObject(hDC, font); txt_h = DrawTextW(hDC, text, -1, &r, DT_TOP | DT_LEFT | DT_WORDBREAK | DT_END_ELLIPSIS); - heap_free(text); + free(text); } DeleteObject(font); } @@ -3153,7 +3152,7 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in DrawThemeText(theme, hDC, part, state, text, len, dtFlags | DT_END_ELLIPSIS, 0, &r);
txt_h = text_rect.bottom - text_rect.top; - heap_free(text); + free(text); }
/* Draw the note */
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 91 ++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 46 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index d060fd5c977..116c3c5cf94 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -485,7 +485,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW) if (!isW && is_text(text)) { INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, NULL, 0); - wstr = Alloc(len * sizeof(WCHAR)); + wstr = calloc(len, sizeof(WCHAR)); if (wstr) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, wstr, len); } TRACE(" wstr=%s\n", text == LPSTR_TEXTCALLBACKW ? "(callback)" : debugstr_w(wstr)); @@ -494,7 +494,7 @@ static inline LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
static inline void textfreeT(LPWSTR wstr, BOOL isW) { - if (!isW && is_text(wstr)) Free (wstr); + if (!isW && is_text(wstr)) free (wstr); }
/* @@ -507,7 +507,7 @@ static BOOL textsetptrT(LPWSTR *dest, LPCWSTR src, BOOL isW)
if (src == LPSTR_TEXTCALLBACKW) { - if (is_text(*dest)) Free(*dest); + if (is_text(*dest)) free(*dest); *dest = LPSTR_TEXTCALLBACKW; } else @@ -808,12 +808,12 @@ static LRESULT notify_forward_header(const LISTVIEW_INFO *infoPtr, NMHEADERW *lp /* cleanup */ if(text) { - Free(lpnmh->pitem->pszText); + free(lpnmh->pitem->pszText); lpnmh->pitem->pszText = (LPSTR)text; } if(filter) { - Free(((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText); + free(((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText); ((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText = (LPSTR)filter; }
@@ -958,7 +958,7 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISP *pdi->item.pszText = 0; /* make sure we don't process garbage */ }
- buffer = Alloc( (return_ansi ? sizeof(WCHAR) : sizeof(CHAR)) * length); + buffer = calloc( length, return_ansi ? sizeof(WCHAR) : sizeof(CHAR) ); if (!buffer) return FALSE;
if (return_ansi) @@ -1001,7 +1001,7 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISP pdi->item.pszText = ret_text; /* restores our buffer */ pdi->item.cchTextMax = ret_length;
- Free(buffer); + free(buffer); return ret; }
@@ -1010,14 +1010,14 @@ static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISP { length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
- buffer = Alloc(length * sizeof(CHAR)); + buffer = calloc(length, sizeof(CHAR)); if (!buffer) return FALSE;
WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) buffer, ret_length, NULL, NULL);
strcpy((LPSTR)pdi->item.pszText, (LPSTR)buffer); - Free(buffer); + free(buffer); }
return ret; @@ -3118,11 +3118,11 @@ static void ranges_assert(RANGES ranges, LPCSTR desc, const char *file, int line
static RANGES ranges_create(int count) { - RANGES ranges = Alloc(sizeof(struct tagRANGES)); + RANGES ranges = calloc(1, sizeof(*ranges)); if (!ranges) return NULL; ranges->hdpa = DPA_Create(count); if (ranges->hdpa) return ranges; - Free(ranges); + free(ranges); return NULL; }
@@ -3131,7 +3131,7 @@ static void ranges_clear(RANGES ranges) INT i; for(i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) - Free(DPA_GetPtr(ranges->hdpa, i)); + free(DPA_GetPtr(ranges->hdpa, i)); DPA_DeleteAllPtrs(ranges->hdpa); }
@@ -3141,7 +3141,7 @@ static void ranges_destroy(RANGES ranges) if (!ranges) return; ranges_clear(ranges); DPA_Destroy(ranges->hdpa); - Free(ranges); + free(ranges); }
static RANGES ranges_clone(RANGES ranges) @@ -3153,12 +3153,12 @@ static RANGES ranges_clone(RANGES ranges)
for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) { - RANGE *newrng = Alloc(sizeof(RANGE)); + RANGE *newrng = calloc(1, sizeof(*newrng)); if (!newrng) goto fail; *newrng = *((RANGE*)DPA_GetPtr(ranges->hdpa, i)); if (!DPA_SetPtr(clone->hdpa, i, newrng)) { - Free(newrng); + free(newrng); goto fail; } } @@ -3249,7 +3249,7 @@ static BOOL ranges_add(RANGES ranges, RANGE range) TRACE("Adding new range\n");
/* create the brand new range to insert */ - newrgn = Alloc(sizeof(RANGE)); + newrgn = calloc(1, sizeof(*newrgn)); if(!newrgn) goto fail; *newrgn = range; @@ -3261,7 +3261,7 @@ static BOOL ranges_add(RANGES ranges, RANGE range) /* and get it over with */ if (DPA_InsertPtr(ranges->hdpa, index, newrgn) == -1) { - Free(newrgn); + free(newrgn); goto fail; } } @@ -3298,7 +3298,7 @@ static BOOL ranges_add(RANGES ranges, RANGE range) mrgrgn = DPA_GetPtr(ranges->hdpa, mergeindex); chkrgn->lower = min(chkrgn->lower, mrgrgn->lower); chkrgn->upper = max(chkrgn->upper, mrgrgn->upper); - Free(mrgrgn); + free(mrgrgn); DPA_DeletePtr(ranges->hdpa, mergeindex); if (mergeindex < index) index --; } while(1); @@ -3334,7 +3334,7 @@ static BOOL ranges_del(RANGES ranges, RANGE range) (chkrgn->lower == range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); - Free(chkrgn); + free(chkrgn); break; } /* case 2: engulf */ @@ -3342,7 +3342,7 @@ static BOOL ranges_del(RANGES ranges, RANGE range) (chkrgn->lower >= range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); - Free(chkrgn); + free(chkrgn); } /* case 3: overlap upper */ else if ( (chkrgn->upper <= range.upper) && @@ -3362,13 +3362,13 @@ static BOOL ranges_del(RANGES ranges, RANGE range) { RANGE *newrgn;
- if (!(newrgn = Alloc(sizeof(RANGE)))) goto fail; + if (!(newrgn = calloc(1, sizeof(*newrgn)))) goto fail; newrgn->lower = chkrgn->lower; newrgn->upper = range.lower; chkrgn->lower = range.upper; if (DPA_InsertPtr(ranges->hdpa, index, newrgn) == -1) { - Free(newrgn); + free(newrgn); goto fail; } break; @@ -4422,7 +4422,7 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, SUBITEM_INFO *tmpSubItem; INT i;
- lpSubItem = Alloc(sizeof(SUBITEM_INFO)); + lpSubItem = calloc(1, sizeof(*lpSubItem)); if (!lpSubItem) return FALSE; /* we could binary search here, if need be...*/ for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) @@ -4432,7 +4432,7 @@ static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, } if (DPA_InsertPtr(hdpaSubItems, i, lpSubItem) == -1) { - Free(lpSubItem); + free(lpSubItem); return FALSE; } lpSubItem->iSubItem = lpLVItem->iSubItem; @@ -5568,13 +5568,13 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy) j = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id); lpID = DPA_GetPtr(infoPtr->hdpaItemIds, j); DPA_DeletePtr(infoPtr->hdpaItemIds, j); - Free(lpID); + free(lpID); /* both item and subitem start with ITEMHDR header */ for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++) { hdrItem = DPA_GetPtr(hdpaSubItems, j); - if (is_text(hdrItem->pszText)) Free(hdrItem->pszText); - Free(hdrItem); + if (is_text(hdrItem->pszText)) free(hdrItem->pszText); + free(hdrItem); } DPA_Destroy(hdpaSubItems); DPA_DeletePtr(infoPtr->hdpaItems, i); @@ -5683,7 +5683,7 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) if (!SendMessageW(infoPtr->hwndHeader, HDM_DELETEITEM, nColumn, 0)) return FALSE;
- Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn)); + free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn)); DPA_DeletePtr(infoPtr->hdpaColumns, nColumn);
if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn) @@ -5716,10 +5716,10 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) { /* free string */ if (is_text(lpDelItem->hdr.pszText)) - Free(lpDelItem->hdr.pszText); + free(lpDelItem->hdr.pszText);
/* free item */ - Free(lpDelItem); + free(lpDelItem);
/* free dpa memory */ DPA_DeletePtr(hdpaSubItems, nSubItem); @@ -5858,12 +5858,12 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem) i = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id); lpID = DPA_GetPtr(infoPtr->hdpaItemIds, i); DPA_DeletePtr(infoPtr->hdpaItemIds, i); - Free(lpID); + free(lpID); for (i = 0; i < DPA_GetPtrCount(hdpaSubItems); i++) { hdrItem = DPA_GetPtr(hdpaSubItems, i); - if (is_text(hdrItem->pszText)) Free(hdrItem->pszText); - Free(hdrItem); + if (is_text(hdrItem->pszText)) free(hdrItem->pszText); + free(hdrItem); } DPA_Destroy(hdpaSubItems); } @@ -5914,7 +5914,7 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL
if (len++) { - if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR))))) + if (!(pszText = calloc(len, isW ? sizeof(WCHAR) : sizeof(CHAR)))) return FALSE;
if (isW) @@ -5998,7 +5998,7 @@ static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *infoPtr, BOOL storeText, BOOL res = LISTVIEW_SetItemT(infoPtr, &dispInfo.item, isW);
cleanup: - Free(pszText); + free(pszText);
return res; } @@ -7788,14 +7788,14 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1;
- if (!(lpItem = Alloc(sizeof(ITEM_INFO)))) return -1; + if (!(lpItem = calloc(1, sizeof(*lpItem)))) return -1;
/* insert item in listview control data structure */ if ( !(hdpaSubItems = DPA_Create(8)) ) goto fail; if ( !DPA_SetPtr(hdpaSubItems, 0, lpItem) ) assert (FALSE);
/* link with id struct */ - if (!(lpID = Alloc(sizeof(ITEM_ID)))) goto fail; + if (!(lpID = calloc(1, sizeof(*lpID)))) goto fail; lpItem->id = lpID; lpID->item = hdpaSubItems; lpID->id = get_next_itemid(infoPtr); @@ -7923,7 +7923,7 @@ undo: fail: DPA_DeletePtr(hdpaSubItems, 0); DPA_Destroy (hdpaSubItems); - Free (lpItem); + free (lpItem); return -1; }
@@ -8248,7 +8248,7 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, if (nNewColumn != nColumn) ERR("nColumn=%d, nNewColumn=%d\n", nColumn, nNewColumn);
/* create our own column info */ - if (!(lpColumnInfo = Alloc(sizeof(COLUMN_INFO)))) goto fail; + if (!(lpColumnInfo = calloc(1, sizeof(*lpColumnInfo)))) goto fail; if (DPA_InsertPtr(infoPtr->hdpaColumns, nNewColumn, lpColumnInfo) == -1) goto fail;
if (lpColumn->mask & LVCF_FMT) lpColumnInfo->fmt = lpColumn->fmt; @@ -8296,8 +8296,8 @@ fail: if (nNewColumn != -1) SendMessageW(infoPtr->hwndHeader, HDM_DELETEITEM, nNewColumn, 0); if (lpColumnInfo) { - DPA_DeletePtr(infoPtr->hdpaColumns, nNewColumn); - Free(lpColumnInfo); + DPA_DeletePtr(infoPtr->hdpaColumns, nNewColumn); + free(lpColumnInfo); } return -1; } @@ -9546,7 +9546,7 @@ static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW * TRACE("(lpcs=%p)\n", lpcs);
/* initialize info pointer */ - infoPtr = Alloc(sizeof(LISTVIEW_INFO)); + infoPtr = calloc(1, sizeof(*infoPtr)); if (!infoPtr) return FALSE;
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); @@ -9609,7 +9609,7 @@ fail: DPA_Destroy(infoPtr->hdpaPosX); DPA_Destroy(infoPtr->hdpaPosY); DPA_Destroy(infoPtr->hdpaColumns); - Free(infoPtr); + free(infoPtr); return FALSE; }
@@ -10485,7 +10485,7 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr) DPA_Destroy(infoPtr->hdpaPosY); /* columns */ for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++) - Free(DPA_GetPtr(infoPtr->hdpaColumns, i)); + free(DPA_GetPtr(infoPtr->hdpaColumns, i)); DPA_Destroy(infoPtr->hdpaColumns); ranges_destroy(infoPtr->selectionRanges);
@@ -10505,8 +10505,7 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
- /* free listview info pointer*/ - Free(infoPtr); + free(infoPtr);
return 0; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126682
Your paranoid android.
=== debian11 (32 bit report) ===
comctl32: propsheet.c:1282: Test failed: Unexpected dlgproc 0. propsheet.c:1287: Test succeeded inside todo block: Wrong theme dialog texture status. propsheet.c:1345: Test failed: page was not created propsheet.c:1366: Test failed: PSM_ADDPAGE failed propsheet.c:1367: Test failed: no pages after PSM_ADDPAGE propsheet.c:1282: Test failed: Unexpected dlgproc 0. propsheet.c:1287: Test failed: Wrong theme dialog texture status. Unhandled exception: page fault on write access to 0xfffffdc8 in 32-bit code (0x6ab30fe4).
=== debian11 (32 bit zh:CN report) ===
comctl32: propsheet.c:1282: Test failed: Unexpected dlgproc 0. propsheet.c:1287: Test succeeded inside todo block: Wrong theme dialog texture status. propsheet.c:1345: Test failed: page was not created propsheet.c:1366: Test failed: PSM_ADDPAGE failed propsheet.c:1367: Test failed: no pages after PSM_ADDPAGE propsheet.c:1282: Test failed: Unexpected dlgproc 0. propsheet.c:1287: Test failed: Wrong theme dialog texture status. Unhandled exception: page fault on write access to 0xfffffdc8 in 32-bit code (0x6ab30fe4).
=== debian11b (64 bit WoW report) ===
comctl32: Unhandled exception: page fault on write access to 0xfffffffffffffdc8 in 64-bit code (0x000000687abf8a).
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/imagelist.c:
if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL))) return NULL;
- bits = heap_alloc_zero(bmi->bmiHeader.biSizeImage);
- bits = calloc( 1, bmi->bmiHeader.biSizeImage);
There is an extra space here.
Zhiyi Zhang (@zhiyi) commented about dlls/comctl32/propsheet.c:
if(psInfo->proppage[index].hpage) { if (HPSP_get_flags(psInfo->proppage[index].hpage) & PSP_USETITLE)
Free ((LPVOID)psInfo->proppage[index].pszText);
free( (LPVOID)psInfo->proppage[index].pszText);
Same here.