Commit df65aee9 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32: Switch back to internal allocation function.

We are still using exported string functions internally, and that caused mismatches after recent incomplete switching to crt functions. There is also no evidence that crt functions are used at all there, so for now switch back to fix mismatching calls. Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com>
parent f44cd182
...@@ -187,20 +187,20 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr) ...@@ -187,20 +187,20 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
FreeResource(infoPtr->hRes); FreeResource(infoPtr->hRes);
infoPtr->hRes = 0; infoPtr->hRes = 0;
} }
free (infoPtr->lpIndex); Free (infoPtr->lpIndex);
infoPtr->lpIndex = NULL; infoPtr->lpIndex = NULL;
if (infoPtr->hic) if (infoPtr->hic)
{ {
fnIC.fnICClose(infoPtr->hic); fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0; infoPtr->hic = 0;
} }
free (infoPtr->inbih); Free (infoPtr->inbih);
infoPtr->inbih = NULL; infoPtr->inbih = NULL;
free (infoPtr->outbih); Free (infoPtr->outbih);
infoPtr->outbih = NULL; infoPtr->outbih = NULL;
free (infoPtr->indata); Free (infoPtr->indata);
infoPtr->indata = NULL; infoPtr->indata = NULL;
free (infoPtr->outdata); Free (infoPtr->outdata);
infoPtr->outdata = NULL; infoPtr->outdata = NULL;
if (infoPtr->hbmPrevFrame) if (infoPtr->hbmPrevFrame)
{ {
...@@ -564,7 +564,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) ...@@ -564,7 +564,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
return FALSE; return FALSE;
} }
infoPtr->inbih = calloc(1, mmckInfo.cksize); infoPtr->inbih = Alloc(mmckInfo.cksize);
if (!infoPtr->inbih) { if (!infoPtr->inbih) {
WARN("Can't alloc input BIH\n"); WARN("Can't alloc input BIH\n");
return FALSE; return FALSE;
...@@ -611,7 +611,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) ...@@ -611,7 +611,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
/* FIXME: should handle the 'rec ' LIST when present */ /* FIXME: should handle the 'rec ' LIST when present */
infoPtr->lpIndex = calloc(infoPtr->mah.dwTotalFrames, sizeof(DWORD)); infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex) if (!infoPtr->lpIndex)
return FALSE; return FALSE;
...@@ -635,7 +635,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr) ...@@ -635,7 +635,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
infoPtr->ash.dwSuggestedBufferSize = insize; infoPtr->ash.dwSuggestedBufferSize = insize;
} }
infoPtr->indata = calloc(1, infoPtr->ash.dwSuggestedBufferSize); infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata) if (!infoPtr->indata)
return FALSE; return FALSE;
...@@ -666,7 +666,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) ...@@ -666,7 +666,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD_PTR)infoPtr->inbih, 0L); (DWORD_PTR)infoPtr->inbih, 0L);
if (!(infoPtr->outbih = calloc(1, outSize))) if (!(infoPtr->outbih = Alloc(outSize)))
return FALSE; return FALSE;
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
...@@ -676,7 +676,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) ...@@ -676,7 +676,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return FALSE; return FALSE;
} }
if (!(infoPtr->outdata = calloc(1, infoPtr->outbih->biSizeImage))) if (!(infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage)))
return FALSE; return FALSE;
if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
...@@ -769,12 +769,12 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz ...@@ -769,12 +769,12 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName); return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
lpwszName = malloc(len * sizeof(WCHAR)); lpwszName = Alloc(len * sizeof(WCHAR));
if (!lpwszName) return FALSE; if (!lpwszName) return FALSE;
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len); MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName); result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
free (lpwszName); Free (lpwszName);
return result; return result;
} }
...@@ -806,7 +806,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs) ...@@ -806,7 +806,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
} }
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
if (!infoPtr) return FALSE; if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */ /* store crossref hWnd <-> info structure */
...@@ -836,7 +836,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr) ...@@ -836,7 +836,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
infoPtr->cs.DebugInfo->Spare[0] = 0; infoPtr->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&infoPtr->cs); DeleteCriticalSection(&infoPtr->cs);
free(infoPtr); Free(infoPtr);
return 0; return 0;
} }
......
...@@ -254,7 +254,7 @@ static inline void paint_button( BUTTON_INFO *infoPtr, LONG style, UINT action ) ...@@ -254,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 ) static inline WCHAR *get_button_text( const BUTTON_INFO *infoPtr )
{ {
INT len = GetWindowTextLengthW( infoPtr->hwnd ); INT len = GetWindowTextLengthW( infoPtr->hwnd );
WCHAR *buffer = malloc( (len + 1) * sizeof(WCHAR) ); WCHAR *buffer = Alloc( (len + 1) * sizeof(WCHAR) );
if (buffer) if (buffer)
GetWindowTextW( infoPtr->hwnd, buffer, len + 1 ); GetWindowTextW( infoPtr->hwnd, buffer, len + 1 );
return buffer; return buffer;
...@@ -334,7 +334,7 @@ HRGN set_control_clipping( HDC hdc, const RECT *rect ) ...@@ -334,7 +334,7 @@ HRGN set_control_clipping( HDC hdc, const RECT *rect )
static WCHAR *heap_strndupW(const WCHAR *src, size_t length) static WCHAR *heap_strndupW(const WCHAR *src, size_t length)
{ {
size_t size = (length + 1) * sizeof(WCHAR); size_t size = (length + 1) * sizeof(WCHAR);
WCHAR *dst = malloc(size); WCHAR *dst = Alloc(size);
if (dst) memcpy(dst, src, size); if (dst) memcpy(dst, src, size);
return dst; return dst;
} }
...@@ -503,7 +503,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L ...@@ -503,7 +503,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
{ {
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam; CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
infoPtr = calloc( 1, sizeof(*infoPtr) ); infoPtr = Alloc( sizeof(*infoPtr) );
SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr ); SetWindowLongPtrW( hWnd, 0, (LONG_PTR)infoPtr );
infoPtr->hwnd = hWnd; infoPtr->hwnd = hWnd;
infoPtr->parent = cs->hwndParent; infoPtr->parent = cs->hwndParent;
...@@ -520,8 +520,8 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L ...@@ -520,8 +520,8 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
DeleteObject(infoPtr->u.bitmap); DeleteObject(infoPtr->u.bitmap);
else if (infoPtr->image_type == IMAGE_ICON) else if (infoPtr->image_type == IMAGE_ICON)
DestroyIcon(infoPtr->u.icon); DestroyIcon(infoPtr->u.icon);
free(infoPtr->note); Free(infoPtr->note);
free(infoPtr); Free(infoPtr);
break; break;
case WM_CREATE: case WM_CREATE:
...@@ -781,7 +781,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L ...@@ -781,7 +781,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
return FALSE; return FALSE;
} }
free(infoPtr->note); Free(infoPtr->note);
if (note) if (note)
{ {
infoPtr->note_length = lstrlenW(note); infoPtr->note_length = lstrlenW(note);
...@@ -791,7 +791,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L ...@@ -791,7 +791,7 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
if (!note || !infoPtr->note) if (!note || !infoPtr->note)
{ {
infoPtr->note_length = 0; infoPtr->note_length = 0;
infoPtr->note = calloc(1, sizeof(WCHAR)); infoPtr->note = Alloc(sizeof(WCHAR));
} }
SetLastError(NO_ERROR); SetLastError(NO_ERROR);
...@@ -1288,7 +1288,7 @@ static void BUTTON_GetTextIdealSize(BUTTON_INFO *infoPtr, LONG maxWidth, SIZE *s ...@@ -1288,7 +1288,7 @@ static void BUTTON_GetTextIdealSize(BUTTON_INFO *infoPtr, LONG maxWidth, SIZE *s
hdc = GetDC(infoPtr->hwnd); hdc = GetDC(infoPtr->hwnd);
rect = BUTTON_GetTextRect(infoPtr, hdc, text, maxWidth); rect = BUTTON_GetTextRect(infoPtr, hdc, text, maxWidth);
ReleaseDC(infoPtr->hwnd, hdc); ReleaseDC(infoPtr->hwnd, hdc);
free(text); Free(text);
size->cx = rect.right - rect.left + margin->left + margin->right; size->cx = rect.right - rect.left + margin->left + margin->right;
size->cy = rect.bottom - rect.top + margin->top + margin->bottom; size->cy = rect.bottom - rect.top + margin->top + margin->bottom;
...@@ -1488,7 +1488,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size) ...@@ -1488,7 +1488,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size)
RECT r; RECT r;
GetThemeTextExtent(theme, hdc, BP_COMMANDLINK, CMDLS_NORMAL, GetThemeTextExtent(theme, hdc, BP_COMMANDLINK, CMDLS_NORMAL,
text, -1, flags, &text_bound, &r); text, -1, flags, &text_bound, &r);
free(text); Free(text);
text_w = r.right - r.left; text_w = r.right - r.left;
text_h = r.bottom - r.top; text_h = r.bottom - r.top;
} }
...@@ -1526,7 +1526,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size) ...@@ -1526,7 +1526,7 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size)
RECT r = text_bound; RECT r = text_bound;
old_font = SelectObject(hdc, font); old_font = SelectObject(hdc, font);
DrawTextW(hdc, text, -1, &r, flags | DT_CALCRECT); DrawTextW(hdc, text, -1, &r, flags | DT_CALCRECT);
free(text); Free(text);
text_w = r.right - r.left; text_w = r.right - r.left;
text_h = r.bottom - r.top; text_h = r.bottom - r.top;
...@@ -1595,7 +1595,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la ...@@ -1595,7 +1595,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
SetRectEmpty(labelRc); SetRectEmpty(labelRc);
SetRectEmpty(imageRc); SetRectEmpty(imageRc);
SetRectEmpty(textRc); SetRectEmpty(textRc);
free(text); Free(text);
return (UINT)-1; return (UINT)-1;
} }
...@@ -1698,7 +1698,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la ...@@ -1698,7 +1698,7 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la
SetRectEmpty(&imageRect); SetRectEmpty(&imageRect);
} }
} }
free(text); Free(text);
CopyRect(labelRc, &labelRect); CopyRect(labelRc, &labelRect);
CopyRect(imageRc, &imageRect); CopyRect(imageRc, &imageRect);
...@@ -1791,7 +1791,7 @@ static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags, ...@@ -1791,7 +1791,7 @@ static void BUTTON_DrawLabel(const BUTTON_INFO *infoPtr, HDC hdc, UINT dtFlags,
if (!(text = get_button_text(infoPtr))) return; if (!(text = get_button_text(infoPtr))) return;
DrawStateW(hdc, hbr, BUTTON_DrawTextCallback, (LPARAM)text, dtFlags, textRect->left, textRect->top, DrawStateW(hdc, hbr, BUTTON_DrawTextCallback, (LPARAM)text, dtFlags, textRect->left, textRect->top,
textRect->right - textRect->left, textRect->bottom - textRect->top, flags); textRect->right - textRect->left, textRect->bottom - textRect->top, flags);
free(text); Free(text);
} }
static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_flags, static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_flags,
...@@ -1823,7 +1823,7 @@ static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_f ...@@ -1823,7 +1823,7 @@ static void BUTTON_DrawThemedLabel(const BUTTON_INFO *info, HDC hdc, UINT text_f
return; return;
DrawThemeText(theme, hdc, part, state, text, lstrlenW(text), text_flags, 0, text_rect); DrawThemeText(theme, hdc, part, state, text, lstrlenW(text), text_flags, 0, text_rect);
free(text); Free(text);
} }
/********************************************************************** /**********************************************************************
...@@ -2659,7 +2659,7 @@ static void CL_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action ) ...@@ -2659,7 +2659,7 @@ static void CL_Paint( const BUTTON_INFO *infoPtr, HDC hDC, UINT action )
SelectObject(hDC, font); SelectObject(hDC, font);
txt_h = DrawTextW(hDC, text, -1, &r, txt_h = DrawTextW(hDC, text, -1, &r,
DT_TOP | DT_LEFT | DT_WORDBREAK | DT_END_ELLIPSIS); DT_TOP | DT_LEFT | DT_WORDBREAK | DT_END_ELLIPSIS);
free(text); Free(text);
} }
DeleteObject(font); DeleteObject(font);
} }
...@@ -3152,7 +3152,7 @@ static void CL_ThemedPaint(HTHEME theme, const BUTTON_INFO *infoPtr, HDC hDC, in ...@@ -3152,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); DrawThemeText(theme, hDC, part, state, text, len, dtFlags | DT_END_ELLIPSIS, 0, &r);
txt_h = text_rect.bottom - text_rect.top; txt_h = text_rect.bottom - text_rect.top;
free(text); Free(text);
} }
/* Draw the note */ /* Draw the note */
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "vssym32.h" #include "vssym32.h"
#include "commctrl.h" #include "commctrl.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "comctl32.h" #include "comctl32.h"
...@@ -125,7 +124,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style) ...@@ -125,7 +124,7 @@ static LRESULT COMBO_NCCreate(HWND hwnd, LONG style)
{ {
HEADCOMBO *lphc; HEADCOMBO *lphc;
if (COMBO_Init() && (lphc = heap_alloc_zero(sizeof(*lphc)))) if (COMBO_Init() && (lphc = Alloc(sizeof(*lphc))))
{ {
lphc->self = hwnd; lphc->self = hwnd;
SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)lphc );
...@@ -166,7 +165,7 @@ static LRESULT COMBO_NCDestroy( HEADCOMBO *lphc ) ...@@ -166,7 +165,7 @@ static LRESULT COMBO_NCDestroy( HEADCOMBO *lphc )
DestroyWindow( lphc->hWndLBox ); DestroyWindow( lphc->hWndLBox );
SetWindowLongPtrW( lphc->self, 0, 0 ); SetWindowLongPtrW( lphc->self, 0, 0 );
heap_free( lphc ); Free( lphc );
} }
return 0; return 0;
...@@ -635,7 +634,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint) ...@@ -635,7 +634,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0); size = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, id, 0);
if (size == LB_ERR) if (size == LB_ERR)
FIXME("LB_ERR probably not handled yet\n"); FIXME("LB_ERR probably not handled yet\n");
if ((pText = heap_alloc((size + 1) * sizeof(WCHAR)))) if ((pText = Alloc((size + 1) * sizeof(WCHAR))))
{ {
/* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */ /* size from LB_GETTEXTLEN may be too large, from LB_GETTEXT is accurate */
size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, id, (LPARAM)pText); size=SendMessageW(lphc->hWndLBox, LB_GETTEXT, id, (LPARAM)pText);
...@@ -731,7 +730,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint) ...@@ -731,7 +730,7 @@ static void CBPaintText(HEADCOMBO *lphc, HDC hdc_paint)
ReleaseDC( lphc->self, hdc ); ReleaseDC( lphc->self, hdc );
} }
heap_free(pText); Free(pText);
} }
/*********************************************************************** /***********************************************************************
...@@ -853,7 +852,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect ) ...@@ -853,7 +852,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 ); length = SendMessageW( lphc->hWndEdit, WM_GETTEXTLENGTH, 0, 0 );
if (length > 0) if (length > 0)
pText = heap_alloc((length + 1) * sizeof(WCHAR)); pText = Alloc((length + 1) * sizeof(WCHAR));
TRACE("\t edit text length %i\n", length ); TRACE("\t edit text length %i\n", length );
...@@ -861,7 +860,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect ) ...@@ -861,7 +860,7 @@ static INT CBUpdateLBox( LPHEADCOMBO lphc, BOOL bSelect )
{ {
GetWindowTextW( lphc->hWndEdit, pText, length + 1); GetWindowTextW( lphc->hWndEdit, pText, length + 1);
idx = SendMessageW(lphc->hWndLBox, LB_FINDSTRING, -1, (LPARAM)pText); idx = SendMessageW(lphc->hWndLBox, LB_FINDSTRING, -1, (LPARAM)pText);
heap_free( pText ); Free( pText );
} }
SendMessageW(lphc->hWndLBox, LB_SETCURSEL, bSelect ? idx : -1, 0); SendMessageW(lphc->hWndLBox, LB_SETCURSEL, bSelect ? idx : -1, 0);
...@@ -890,7 +889,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) ...@@ -890,7 +889,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, index, 0); length = SendMessageW(lphc->hWndLBox, LB_GETTEXTLEN, index, 0);
if( length != LB_ERR) if( length != LB_ERR)
{ {
if ((pText = heap_alloc((length + 1) * sizeof(WCHAR)))) if ((pText = Alloc((length + 1) * sizeof(WCHAR))))
SendMessageW(lphc->hWndLBox, LB_GETTEXT, index, (LPARAM)pText); SendMessageW(lphc->hWndLBox, LB_GETTEXT, index, (LPARAM)pText);
} }
} }
...@@ -905,7 +904,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) ...@@ -905,7 +904,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index )
if( lphc->wState & CBF_FOCUSED ) if( lphc->wState & CBF_FOCUSED )
SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1); SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, -1);
heap_free( pText ); Free( pText );
} }
/*********************************************************************** /***********************************************************************
...@@ -1319,7 +1318,7 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf ) ...@@ -1319,7 +1318,7 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf )
/* 'length' is without the terminating character */ /* 'length' is without the terminating character */
if (length >= count) if (length >= count)
{ {
WCHAR *lpBuffer = heap_alloc((length + 1) * sizeof(WCHAR)); WCHAR *lpBuffer = Alloc((length + 1) * sizeof(WCHAR));
if (!lpBuffer) goto error; if (!lpBuffer) goto error;
length = SendMessageW(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)lpBuffer); length = SendMessageW(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)lpBuffer);
...@@ -1329,7 +1328,7 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf ) ...@@ -1329,7 +1328,7 @@ static LRESULT COMBO_GetText( HEADCOMBO *lphc, INT count, LPWSTR buf )
lstrcpynW( buf, lpBuffer, count ); lstrcpynW( buf, lpBuffer, count );
length = count; length = count;
} }
heap_free( lpBuffer ); Free( lpBuffer );
} }
else length = SendMessageW(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)buf); else length = SendMessageW(lphc->hWndLBox, LB_GETTEXT, idx, (LPARAM)buf);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "commctrl.h" #include "commctrl.h"
#include "uxtheme.h" #include "uxtheme.h"
#include "vsstyle.h" #include "vsstyle.h"
#include "comctl32.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(edit); WINE_DEFAULT_DEBUG_CHANNEL(edit);
...@@ -238,7 +239,7 @@ static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT ...@@ -238,7 +239,7 @@ static INT EDIT_WordBreakProc(EDITSTATE *es, LPWSTR s, INT index, INT count, INT
memset(&psa,0,sizeof(SCRIPT_ANALYSIS)); memset(&psa,0,sizeof(SCRIPT_ANALYSIS));
psa.eScript = SCRIPT_UNDEFINED; psa.eScript = SCRIPT_UNDEFINED;
es->logAttr = malloc(sizeof(SCRIPT_LOGATTR) * get_text_length(es)); es->logAttr = Alloc(sizeof(SCRIPT_LOGATTR) * get_text_length(es));
ScriptBreak(es->text, get_text_length(es), &psa, es->logAttr); ScriptBreak(es->text, get_text_length(es), &psa, es->logAttr);
} }
...@@ -476,7 +477,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta ...@@ -476,7 +477,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
{ {
/* The buffer has been expanded, create a new line and /* The buffer has been expanded, create a new line and
insert it into the link list */ insert it into the link list */
LINEDEF *new_line = calloc(1, sizeof(*new_line)); LINEDEF *new_line = Alloc(sizeof(*new_line));
new_line->next = previous_line->next; new_line->next = previous_line->next;
previous_line->next = new_line; previous_line->next = new_line;
current_line = new_line; current_line = new_line;
...@@ -486,7 +487,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta ...@@ -486,7 +487,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
{ {
/* The previous line merged with this line so we delete this extra entry */ /* The previous line merged with this line so we delete this extra entry */
previous_line->next = current_line->next; previous_line->next = current_line->next;
free(current_line); Free(current_line);
current_line = previous_line->next; current_line = previous_line->next;
es->line_count--; es->line_count--;
continue; continue;
...@@ -586,7 +587,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta ...@@ -586,7 +587,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
if (current_line->ssa) if (current_line->ssa)
{ {
count = ScriptString_pcOutChars(current_line->ssa); count = ScriptString_pcOutChars(current_line->ssa);
piDx = malloc(sizeof(INT) * (*count)); piDx = Alloc(sizeof(INT) * (*count));
ScriptStringGetLogicalWidths(current_line->ssa,piDx); ScriptStringGetLogicalWidths(current_line->ssa,piDx);
prev = current_line->net_length-1; prev = current_line->net_length-1;
...@@ -596,7 +597,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta ...@@ -596,7 +597,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
} while ( prev > 0 && current_line->width > fw); } while ( prev > 0 && current_line->width > fw);
if (prev<=0) if (prev<=0)
prev = 1; prev = 1;
free(piDx); Free(piDx);
} }
else else
prev = (fw / es->char_width); prev = (fw / es->char_width);
...@@ -685,7 +686,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta ...@@ -685,7 +686,7 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
{ {
pnext = current_line->next; pnext = current_line->next;
EDIT_InvalidateUniscribeData_linedef(current_line); EDIT_InvalidateUniscribeData_linedef(current_line);
free(current_line); Free(current_line);
current_line = pnext; current_line = pnext;
es->line_count--; es->line_count--;
} }
...@@ -1173,7 +1174,7 @@ static inline void text_buffer_changed(EDITSTATE *es) ...@@ -1173,7 +1174,7 @@ static inline void text_buffer_changed(EDITSTATE *es)
{ {
es->text_length = (UINT)-1; es->text_length = (UINT)-1;
free(es->logAttr); Free(es->logAttr);
es->logAttr = NULL; es->logAttr = NULL;
EDIT_InvalidateUniscribeData(es); EDIT_InvalidateUniscribeData(es);
} }
...@@ -1299,7 +1300,7 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size) ...@@ -1299,7 +1300,7 @@ static BOOL EDIT_MakeUndoFit(EDITSTATE *es, UINT size)
TRACE("trying to ReAlloc to %d+1\n", size); TRACE("trying to ReAlloc to %d+1\n", size);
alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR)); alloc_size = ROUND_TO_GROW((size + 1) * sizeof(WCHAR));
if ((new_undo_text = realloc(es->undo_text, alloc_size))) { if ((new_undo_text = ReAlloc(es->undo_text, alloc_size))) {
memset(new_undo_text + es->undo_buffer_size, 0, alloc_size - es->undo_buffer_size * sizeof(WCHAR)); memset(new_undo_text + es->undo_buffer_size, 0, alloc_size - es->undo_buffer_size * sizeof(WCHAR));
es->undo_text = new_undo_text; es->undo_text = new_undo_text;
es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1; es->undo_buffer_size = alloc_size/sizeof(WCHAR) - 1;
...@@ -2473,7 +2474,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r ...@@ -2473,7 +2474,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r
/* there is something to be deleted */ /* there is something to be deleted */
TRACE("deleting stuff.\n"); TRACE("deleting stuff.\n");
bufl = e - s; bufl = e - s;
buf = malloc((bufl + 1) * sizeof(WCHAR)); buf = Alloc((bufl + 1) * sizeof(WCHAR));
if (!buf) return; if (!buf) return;
memcpy(buf, es->text + s, bufl * sizeof(WCHAR)); memcpy(buf, es->text + s, bufl * sizeof(WCHAR));
buf[bufl] = 0; /* ensure 0 termination */ buf[bufl] = 0; /* ensure 0 termination */
...@@ -2586,7 +2587,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r ...@@ -2586,7 +2587,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, const WCHAR *lpsz_r
EDIT_EM_EmptyUndoBuffer(es); EDIT_EM_EmptyUndoBuffer(es);
} }
free(buf); Free(buf);
s += strl; s += strl;
...@@ -2831,12 +2832,12 @@ static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, const INT *tabs) ...@@ -2831,12 +2832,12 @@ static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, const INT *tabs)
{ {
if (!(es->style & ES_MULTILINE)) if (!(es->style & ES_MULTILINE))
return FALSE; return FALSE;
free(es->tabs); Free(es->tabs);
es->tabs_count = count; es->tabs_count = count;
if (!count) if (!count)
es->tabs = NULL; es->tabs = NULL;
else { else {
es->tabs = malloc(count * sizeof(INT)); es->tabs = Alloc(count * sizeof(INT));
memcpy(es->tabs, tabs, count * sizeof(INT)); memcpy(es->tabs, tabs, count * sizeof(INT));
} }
EDIT_InvalidateUniscribeData(es); EDIT_InvalidateUniscribeData(es);
...@@ -2880,7 +2881,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es) ...@@ -2880,7 +2881,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
ulength = lstrlenW(es->undo_text); ulength = lstrlenW(es->undo_text);
utext = malloc((ulength + 1) * sizeof(WCHAR)); utext = Alloc((ulength + 1) * sizeof(WCHAR));
lstrcpyW(utext, es->undo_text); lstrcpyW(utext, es->undo_text);
...@@ -2894,7 +2895,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es) ...@@ -2894,7 +2895,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
/* send the notification after the selection start and end are set */ /* send the notification after the selection start and end are set */
if (!notify_parent(es, EN_CHANGE)) return TRUE; if (!notify_parent(es, EN_CHANGE)) return TRUE;
EDIT_EM_ScrollCaret(es); EDIT_EM_ScrollCaret(es);
free(utext); Free(utext);
TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n", TRACE("after UNDO:insertion length = %d, deletion buffer = %s\n",
es->undo_insert_count, debugstr_w(es->undo_text)); es->undo_insert_count, debugstr_w(es->undo_text));
...@@ -4213,7 +4214,7 @@ static BOOL EDIT_EM_SetCueBanner(EDITSTATE *es, BOOL draw_focused, const WCHAR * ...@@ -4213,7 +4214,7 @@ static BOOL EDIT_EM_SetCueBanner(EDITSTATE *es, BOOL draw_focused, const WCHAR *
if (es->style & ES_MULTILINE || !cue_text) if (es->style & ES_MULTILINE || !cue_text)
return FALSE; return FALSE;
free(es->cue_banner_text); Free(es->cue_banner_text);
es->cue_banner_text = wcsdup(cue_text); es->cue_banner_text = wcsdup(cue_text);
es->cue_banner_draw_focused = draw_focused; es->cue_banner_draw_focused = draw_focused;
...@@ -4264,7 +4265,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) ...@@ -4264,7 +4265,7 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
return; return;
} }
lpCompStr = malloc(buflen); lpCompStr = Alloc(buflen);
if (!lpCompStr) if (!lpCompStr)
{ {
ERR("Unable to allocate IME CompositionString\n"); ERR("Unable to allocate IME CompositionString\n");
...@@ -4284,11 +4285,11 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) ...@@ -4284,11 +4285,11 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
if (dwBufLenAttr) if (dwBufLenAttr)
{ {
dwBufLenAttr ++; dwBufLenAttr ++;
lpCompStrAttr = malloc(dwBufLenAttr + 1); lpCompStrAttr = Alloc(dwBufLenAttr + 1);
if (!lpCompStrAttr) if (!lpCompStrAttr)
{ {
ERR("Unable to allocate IME Attribute String\n"); ERR("Unable to allocate IME Attribute String\n");
free(lpCompStr); Free(lpCompStr);
return; return;
} }
ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr, ImmGetCompositionStringW(hIMC,GCS_COMPATTR, lpCompStrAttr,
...@@ -4315,8 +4316,8 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es) ...@@ -4315,8 +4316,8 @@ static void EDIT_GetCompositionStr(HIMC hIMC, LPARAM CompFlag, EDITSTATE *es)
es->selection_start = es->composition_start; es->selection_start = es->composition_start;
es->selection_end = es->selection_start + es->composition_len; es->selection_end = es->selection_start + es->composition_len;
free(lpCompStrAttr); Free(lpCompStrAttr);
free(lpCompStr); Free(lpCompStr);
} }
static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
...@@ -4330,7 +4331,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) ...@@ -4330,7 +4331,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
return; return;
} }
lpResultStr = malloc(buflen); lpResultStr = Alloc(buflen);
if (!lpResultStr) if (!lpResultStr)
{ {
ERR("Unable to alloc buffer for IME string\n"); ERR("Unable to alloc buffer for IME string\n");
...@@ -4349,7 +4350,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es) ...@@ -4349,7 +4350,7 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
es->composition_start = es->selection_end; es->composition_start = es->selection_end;
es->composition_len = 0; es->composition_len = 0;
free(lpResultStr); Free(lpResultStr);
} }
static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es) static void EDIT_ImeComposition(HWND hwnd, LPARAM CompFlag, EDITSTATE *es)
...@@ -4396,7 +4397,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -4396,7 +4397,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
TRACE("Creating edit control, style = %#lx\n", lpcs->style); TRACE("Creating edit control, style = %#lx\n", lpcs->style);
if (!(es = calloc(1, sizeof(*es)))) if (!(es = Alloc(sizeof(*es))))
return FALSE; return FALSE;
SetWindowLongPtrW( hwnd, 0, (LONG_PTR)es ); SetWindowLongPtrW( hwnd, 0, (LONG_PTR)es );
...@@ -4458,12 +4459,12 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -4458,12 +4459,12 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
goto cleanup; goto cleanup;
es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1; es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
if (!(es->undo_text = calloc(es->buffer_size + 1, sizeof(WCHAR)))) if (!(es->undo_text = Alloc((es->buffer_size + 1) * sizeof(WCHAR))))
goto cleanup; goto cleanup;
es->undo_buffer_size = es->buffer_size; es->undo_buffer_size = es->buffer_size;
if (es->style & ES_MULTILINE) if (es->style & ES_MULTILINE)
if (!(es->first_line_def = calloc(1, sizeof(LINEDEF)))) if (!(es->first_line_def = Alloc(sizeof(LINEDEF))))
goto cleanup; goto cleanup;
es->line_count = 1; es->line_count = 1;
...@@ -4488,11 +4489,11 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -4488,11 +4489,11 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs)
cleanup: cleanup:
SetWindowLongPtrW(es->hwndSelf, 0, 0); SetWindowLongPtrW(es->hwndSelf, 0, 0);
EDIT_InvalidateUniscribeData(es); EDIT_InvalidateUniscribeData(es);
free(es->first_line_def); Free(es->first_line_def);
free(es->undo_text); Free(es->undo_text);
if (es->hloc32W) LocalFree(es->hloc32W); if (es->hloc32W) LocalFree(es->hloc32W);
free(es->logAttr); Free(es->logAttr);
free(es); Free(es);
return FALSE; return FALSE;
} }
...@@ -4575,14 +4576,14 @@ static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es) ...@@ -4575,14 +4576,14 @@ static LRESULT EDIT_WM_NCDestroy(EDITSTATE *es)
while (pc) while (pc)
{ {
pp = pc->next; pp = pc->next;
free(pc); Free(pc);
pc = pp; pc = pp;
} }
SetWindowLongPtrW( es->hwndSelf, 0, 0 ); SetWindowLongPtrW( es->hwndSelf, 0, 0 );
free(es->undo_text); Free(es->undo_text);
free(es->cue_banner_text); Free(es->cue_banner_text);
free(es); Free(es);
return 0; return 0;
} }
......
...@@ -140,7 +140,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI ...@@ -140,7 +140,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
if (mask & HDI_TEXT) if (mask & HDI_TEXT)
{ {
free(lpItem->pszText); Free(lpItem->pszText);
lpItem->pszText = NULL; lpItem->pszText = NULL;
if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */ if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
...@@ -335,7 +335,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up ) ...@@ -335,7 +335,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
if (size > sizeof(buffer)) if (size > sizeof(buffer))
{ {
data = malloc( size ); data = Alloc( size );
if (!data) return NULL; if (!data) return NULL;
} }
data->rdh.dwSize = sizeof(data->rdh); data->rdh.dwSize = sizeof(data->rdh);
...@@ -361,7 +361,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up ) ...@@ -361,7 +361,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
data->rdh.nCount++; data->rdh.nCount++;
} }
rgn = ExtCreateRegion( NULL, size, data ); rgn = ExtCreateRegion( NULL, size, data );
if (data != (RGNDATA *)buffer) free( data ); if (data != (RGNDATA *)buffer) Free( data );
return rgn; return rgn;
} }
...@@ -960,7 +960,7 @@ HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem, ...@@ -960,7 +960,7 @@ HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem,
* (so we handle the two cases only doing a specific cast for pszText). * (so we handle the two cases only doing a specific cast for pszText).
* Checks if any of the required fields is a callback. If this is the case sends a * Checks if any of the required fields is a callback. If this is the case sends a
* NMHDISPINFO notify to retrieve these items. The items are stored in the * NMHDISPINFO notify to retrieve these items. The items are stored in the
* HEADER_ITEM pszText and iImage fields. They should be freed with * HEADER_ITEM pszText and iImage fields. They should be Freed with
* HEADER_FreeCallbackItems. * HEADER_FreeCallbackItems.
* *
* @param hwnd : hwnd header container handler * @param hwnd : hwnd header container handler
...@@ -982,7 +982,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) ...@@ -982,7 +982,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
if (mask&HDI_TEXT && lpItem->pszText != NULL) if (mask&HDI_TEXT && lpItem->pszText != NULL)
{ {
ERR("(): function called without a call to FreeCallbackItems\n"); ERR("(): function called without a call to FreeCallbackItems\n");
free(lpItem->pszText); Free(lpItem->pszText);
lpItem->pszText = NULL; lpItem->pszText = NULL;
} }
...@@ -993,13 +993,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) ...@@ -993,13 +993,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
{ {
dispInfo.hdr.code = HDN_GETDISPINFOW; dispInfo.hdr.code = HDN_GETDISPINFOW;
if (mask & HDI_TEXT) if (mask & HDI_TEXT)
pvBuffer = calloc(MAX_HEADER_TEXT_LEN, sizeof(WCHAR)); pvBuffer = Alloc(MAX_HEADER_TEXT_LEN * sizeof(WCHAR));
} }
else else
{ {
dispInfo.hdr.code = HDN_GETDISPINFOA; dispInfo.hdr.code = HDN_GETDISPINFOA;
if (mask & HDI_TEXT) if (mask & HDI_TEXT)
pvBuffer = calloc(MAX_HEADER_TEXT_LEN, sizeof(CHAR)); pvBuffer = Alloc(MAX_HEADER_TEXT_LEN * sizeof(CHAR));
} }
dispInfo.pszText = pvBuffer; dispInfo.pszText = pvBuffer;
dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0); dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0);
...@@ -1030,7 +1030,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask) ...@@ -1030,7 +1030,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
else else
{ {
Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText); Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText);
free(pvBuffer); Free(pvBuffer);
} }
} }
...@@ -1056,7 +1056,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem) ...@@ -1056,7 +1056,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
{ {
if (lpItem->callbackMask&HDI_TEXT) if (lpItem->callbackMask&HDI_TEXT)
{ {
free(lpItem->pszText); Free(lpItem->pszText);
lpItem->pszText = NULL; lpItem->pszText = NULL;
} }
...@@ -1178,15 +1178,15 @@ HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem) ...@@ -1178,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); 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; iOrder = infoPtr->items[iItem].iOrder;
free(infoPtr->items[iItem].pszText); Free(infoPtr->items[iItem].pszText);
infoPtr->uNumItem--; infoPtr->uNumItem--;
memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1], memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1],
(infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM)); (infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1], memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
(infoPtr->uNumItem - iOrder) * sizeof(INT)); (infoPtr->uNumItem - iOrder) * sizeof(INT));
infoPtr->items = realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem); infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* Correct the orders */ /* Correct the orders */
for (i = 0; i < infoPtr->uNumItem; i++) for (i = 0; i < infoPtr->uNumItem; i++)
...@@ -1416,8 +1416,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b ...@@ -1416,8 +1416,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b
iOrder = infoPtr->uNumItem; iOrder = infoPtr->uNumItem;
infoPtr->uNumItem++; infoPtr->uNumItem++;
infoPtr->items = realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem); infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
infoPtr->order = realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem); infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
/* make space for the new item */ /* make space for the new item */
memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem], memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem],
...@@ -1536,7 +1536,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni ...@@ -1536,7 +1536,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch); HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify)) if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify))
{ {
free(pvScratch); Free(pvScratch);
return FALSE; return FALSE;
} }
...@@ -1553,7 +1553,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni ...@@ -1553,7 +1553,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
free(pvScratch); Free(pvScratch);
return TRUE; return TRUE;
} }
...@@ -1576,7 +1576,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -1576,7 +1576,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
HFONT hOldFont; HFONT hOldFont;
HDC hdc; HDC hdc;
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
infoPtr->hwndSelf = hwnd; infoPtr->hwndSelf = hwnd;
...@@ -1631,14 +1631,14 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr) ...@@ -1631,14 +1631,14 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr)
if (infoPtr->items) { if (infoPtr->items) {
lpItem = infoPtr->items; lpItem = infoPtr->items;
for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++)
free(lpItem->pszText); Free(lpItem->pszText);
free(infoPtr->items); Free(infoPtr->items);
} }
free(infoPtr->order); Free(infoPtr->order);
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
free(infoPtr); Free(infoPtr);
return 0; return 0;
} }
......
...@@ -241,9 +241,9 @@ HOTKEY_Create (HOTKEY_INFO *infoPtr, const CREATESTRUCTW *lpcs) ...@@ -241,9 +241,9 @@ HOTKEY_Create (HOTKEY_INFO *infoPtr, const CREATESTRUCTW *lpcs)
static LRESULT static LRESULT
HOTKEY_Destroy (HOTKEY_INFO *infoPtr) HOTKEY_Destroy (HOTKEY_INFO *infoPtr)
{ {
/* free hotkey info data */ /* Free hotkey info data */
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
free (infoPtr); Free (infoPtr);
return 0; return 0;
} }
...@@ -412,7 +412,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -412,7 +412,7 @@ HOTKEY_NCCreate (HWND hwnd, const CREATESTRUCTW *lpcs)
dwExStyle | WS_EX_CLIENTEDGE); dwExStyle | WS_EX_CLIENTEDGE);
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize info structure */ /* initialize info structure */
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include "commoncontrols.h" #include "commoncontrols.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagelist); WINE_DEFAULT_DEBUG_CHANNEL(imagelist);
...@@ -269,7 +268,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count, ...@@ -269,7 +268,7 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
SelectObject( hdc, hbmImage ); SelectObject( hdc, hbmImage );
mask_width = (bm.bmWidth + 31) / 32 * 4; mask_width = (bm.bmWidth + 31) / 32 * 4;
if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; if (!(info = Alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info->bmiHeader.biWidth = bm.bmWidth; info->bmiHeader.biWidth = bm.bmWidth;
info->bmiHeader.biHeight = -height; info->bmiHeader.biHeight = -height;
...@@ -281,17 +280,17 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count, ...@@ -281,17 +280,17 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biYPelsPerMeter = 0;
info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrUsed = 0;
info->bmiHeader.biClrImportant = 0; info->bmiHeader.biClrImportant = 0;
if (!(bits = heap_alloc( info->bmiHeader.biSizeImage ))) goto done; if (!(bits = Alloc( info->bmiHeader.biSizeImage ))) goto done;
if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done; if (!GetDIBits( hdc, hbmImage, 0, height, bits, info, DIB_RGB_COLORS )) goto done;
if (hbmMask) if (hbmMask)
{ {
if (!(mask_info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] )))) if (!(mask_info = Alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[2] ))))
goto done; goto done;
mask_info->bmiHeader = info->bmiHeader; mask_info->bmiHeader = info->bmiHeader;
mask_info->bmiHeader.biBitCount = 1; mask_info->bmiHeader.biBitCount = 1;
mask_info->bmiHeader.biSizeImage = mask_width * height; mask_info->bmiHeader.biSizeImage = mask_width * height;
if (!(mask_bits = heap_alloc_zero( mask_info->bmiHeader.biSizeImage ))) if (!(mask_bits = Alloc( mask_info->bmiHeader.biSizeImage )))
goto done; goto done;
if (!GetDIBits( hdc, hbmMask, 0, height, mask_bits, mask_info, DIB_RGB_COLORS )) 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, ...@@ -300,10 +299,10 @@ static BOOL add_with_alpha( HIMAGELIST himl, HDC hdc, int pos, int count,
ret = TRUE; ret = TRUE;
done: done:
heap_free( info ); Free( info );
heap_free( mask_info ); Free( mask_info );
heap_free( bits ); Free( bits );
heap_free( mask_bits ); Free( mask_bits );
return ret; return ret;
} }
...@@ -848,7 +847,7 @@ ImageList_Create (INT cx, INT cy, UINT flags, ...@@ -848,7 +847,7 @@ ImageList_Create (INT cx, INT cy, UINT flags,
else else
himl->hbmMask = 0; himl->hbmMask = 0;
himl->item_flags = heap_alloc_zero( himl->cMaxImage * sizeof(*himl->item_flags) ); himl->item_flags = Alloc( himl->cMaxImage * sizeof(*himl->item_flags) );
/* create blending brushes */ /* create blending brushes */
hbmTemp = CreateBitmap (8, 8, 1, 1, aBitBlend25); 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 ...@@ -1260,7 +1259,7 @@ static BOOL alpha_blend_image( HIMAGELIST himl, HDC dest_dc, int dest_x, int des
func.AlphaFormat = AC_SRC_ALPHA; func.AlphaFormat = AC_SRC_ALPHA;
if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE; if (!(hdc = CreateCompatibleDC( 0 ))) return FALSE;
if (!(info = heap_alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done; if (!(info = Alloc( FIELD_OFFSET( BITMAPINFO, bmiColors[256] )))) goto done;
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info->bmiHeader.biWidth = cx; info->bmiHeader.biWidth = cx;
info->bmiHeader.biHeight = cy; info->bmiHeader.biHeight = cy;
...@@ -1371,7 +1370,7 @@ done: ...@@ -1371,7 +1370,7 @@ done:
DeleteDC( hdc ); DeleteDC( hdc );
if (bmp) DeleteObject( bmp ); if (bmp) DeleteObject( bmp );
if (mask) DeleteObject( mask ); if (mask) DeleteObject( mask );
heap_free( info ); Free( info );
return ret; return ret;
} }
...@@ -1981,11 +1980,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow, ...@@ -1981,11 +1980,11 @@ ImageList_LoadImageA (HINSTANCE hi, LPCSTR lpbmp, INT cx, INT cGrow,
uType, uFlags); uType, uFlags);
len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0);
lpbmpW = heap_alloc(len * sizeof(WCHAR)); lpbmpW = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len); MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len);
himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags); himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags);
heap_free (lpbmpW); Free (lpbmpW);
return himl; return himl;
} }
...@@ -2226,12 +2225,12 @@ static void *read_bitmap(IStream *pstm, BITMAPINFO *bmi) ...@@ -2226,12 +2225,12 @@ static void *read_bitmap(IStream *pstm, BITMAPINFO *bmi)
if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL))) if (palspace && FAILED(IStream_Read(pstm, bmi->bmiColors, palspace, NULL)))
return NULL; return NULL;
bits = heap_alloc_zero(bmi->bmiHeader.biSizeImage); bits = Alloc(bmi->bmiHeader.biSizeImage);
if (!bits) return NULL; if (!bits) return NULL;
if (FAILED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL))) if (FAILED(IStream_Read(pstm, bits, bmi->bmiHeader.biSizeImage, NULL)))
{ {
heap_free(bits); Free(bits);
return NULL; return NULL;
} }
return bits; return bits;
...@@ -2343,8 +2342,8 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm) ...@@ -2343,8 +2342,8 @@ HIMAGELIST WINAPI ImageList_Read(IStream *pstm)
0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight, 0, 0, mask_info->bmiHeader.biWidth, mask_info->bmiHeader.biHeight,
mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY); mask_bits, mask_info, DIB_RGB_COLORS, SRCCOPY);
} }
heap_free( image_bits ); Free( image_bits );
heap_free( mask_bits ); Free( mask_bits );
himl->cCurImage = ilHead.cCurImage; himl->cCurImage = ilHead.cCurImage;
himl->cMaxImage = ilHead.cMaxImage; himl->cMaxImage = ilHead.cMaxImage;
...@@ -2406,8 +2405,8 @@ ImageList_Remove (HIMAGELIST himl, INT i) ...@@ -2406,8 +2405,8 @@ ImageList_Remove (HIMAGELIST himl, INT i)
for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++) for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
himl->nOvlIdx[nCount] = -1; himl->nOvlIdx[nCount] = -1;
heap_free( himl->item_flags ); Free( himl->item_flags );
himl->item_flags = heap_alloc_zero( himl->cMaxImage * sizeof(*himl->item_flags) ); himl->item_flags = Alloc( himl->cMaxImage * sizeof(*himl->item_flags) );
hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage); hbmNewImage = ImageList_CreateImage(himl->hdcImage, himl, himl->cMaxImage);
SelectObject (himl->hdcImage, hbmNewImage); SelectObject (himl->hdcImage, hbmNewImage);
...@@ -3013,7 +3012,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm) ...@@ -3013,7 +3012,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm)
offBits = totalSize; offBits = totalSize;
totalSize += sizeImage; totalSize += sizeImage;
data = heap_alloc_zero(totalSize); data = Alloc(totalSize);
bmfh = (LPBITMAPFILEHEADER)data; bmfh = (LPBITMAPFILEHEADER)data;
bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER)); bmih = (LPBITMAPINFOHEADER)(data + sizeof(BITMAPFILEHEADER));
lpBits = data + offBits; lpBits = data + offBits;
...@@ -3054,7 +3053,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm) ...@@ -3054,7 +3053,7 @@ static BOOL _write_bitmap(HBITMAP hBitmap, IStream *pstm)
result = TRUE; result = TRUE;
failed: failed:
heap_free(data); Free(data);
return result; return result;
} }
...@@ -3299,8 +3298,8 @@ static ULONG WINAPI ImageListImpl_Release(IImageList2 *iface) ...@@ -3299,8 +3298,8 @@ static ULONG WINAPI ImageListImpl_Release(IImageList2 *iface)
if (This->hbrBlend50) DeleteObject (This->hbrBlend50); if (This->hbrBlend50) DeleteObject (This->hbrBlend50);
This->IImageList2_iface.lpVtbl = NULL; This->IImageList2_iface.lpVtbl = NULL;
heap_free(This->item_flags); Free(This->item_flags);
heap_free(This); Free(This);
} }
return ref; return ref;
...@@ -3834,7 +3833,7 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii ...@@ -3834,7 +3833,7 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii
if (pUnkOuter) return CLASS_E_NOAGGREGATION; if (pUnkOuter) return CLASS_E_NOAGGREGATION;
This = heap_alloc_zero(sizeof(struct _IMAGELIST)); This = Alloc(sizeof(struct _IMAGELIST));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->IImageList2_iface.lpVtbl = &ImageListImpl_Vtbl; This->IImageList2_iface.lpVtbl = &ImageListImpl_Vtbl;
......
...@@ -209,7 +209,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate) ...@@ -209,7 +209,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
SetWindowLongW (hwnd, GWL_STYLE, SetWindowLongW (hwnd, GWL_STYLE,
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER); GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);
infoPtr = calloc (1, sizeof(*infoPtr)); infoPtr = Alloc (sizeof(*infoPtr));
if (!infoPtr) return -1; if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
...@@ -272,7 +272,7 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr) ...@@ -272,7 +272,7 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
SetWindowLongPtrW (infoPtr->Self, 0, 0); SetWindowLongPtrW (infoPtr->Self, 0, 0);
theme = GetWindowTheme (infoPtr->Self); theme = GetWindowTheme (infoPtr->Self);
CloseThemeData (theme); CloseThemeData (theme);
free (infoPtr); Free (infoPtr);
return 0; return 0;
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "vssym32.h" #include "vssym32.h"
#include "wine/exception.h" #include "wine/exception.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include "comctl32.h" #include "comctl32.h"
...@@ -153,7 +152,7 @@ static BOOL resize_storage(LB_DESCR *descr, UINT items_size) ...@@ -153,7 +152,7 @@ static BOOL resize_storage(LB_DESCR *descr, UINT items_size)
items_size = (items_size + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1); items_size = (items_size + LB_ARRAY_GRANULARITY - 1) & ~(LB_ARRAY_GRANULARITY - 1);
if ((descr->style & (LBS_NODATA | LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != LBS_NODATA) if ((descr->style & (LBS_NODATA | LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) != LBS_NODATA)
{ {
items = heap_realloc(descr->u.items, items_size * get_sizeof_item(descr)); items = ReAlloc(descr->u.items, items_size * get_sizeof_item(descr));
if (!items) if (!items)
{ {
SEND_NOTIFICATION(descr, LBN_ERRSPACE); SEND_NOTIFICATION(descr, LBN_ERRSPACE);
......
...@@ -1945,7 +1945,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) ...@@ -1945,7 +1945,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr)
nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
nmds.nmhdr.code = MCN_GETDAYSTATE; nmds.nmhdr.code = MCN_GETDAYSTATE;
nmds.cDayState = MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0); nmds.cDayState = MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0);
nmds.prgDayState = state = calloc(nmds.cDayState, sizeof(MONTHDAYSTATE)); nmds.prgDayState = state = Alloc(nmds.cDayState * sizeof(MONTHDAYSTATE));
MONTHCAL_GetMinDate(infoPtr, &nmds.stStart); MONTHCAL_GetMinDate(infoPtr, &nmds.stStart);
nmds.stStart.wDay = 1; nmds.stStart.wDay = 1;
...@@ -1954,7 +1954,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) ...@@ -1954,7 +1954,7 @@ static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr)
memcpy(infoPtr->monthdayState, nmds.prgDayState, memcpy(infoPtr->monthdayState, nmds.prgDayState,
MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE)); MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE));
free(state); Free(state);
} }
/* no valid range check performed */ /* no valid range check performed */
...@@ -2592,9 +2592,9 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) ...@@ -2592,9 +2592,9 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
{ {
infoPtr->dim.cx = x; infoPtr->dim.cx = x;
infoPtr->dim.cy = y; infoPtr->dim.cy = y;
infoPtr->calendars = realloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO)); infoPtr->calendars = ReAlloc(infoPtr->calendars, MONTHCAL_GetCalCount(infoPtr)*sizeof(CALENDAR_INFO));
infoPtr->monthdayState = realloc(infoPtr->monthdayState, infoPtr->monthdayState = ReAlloc(infoPtr->monthdayState,
MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE)); MONTHCAL_GetMonthRange(infoPtr, GMR_DAYSTATE, 0)*sizeof(MONTHDAYSTATE));
MONTHCAL_NotifyDayState(infoPtr); MONTHCAL_NotifyDayState(infoPtr);
...@@ -2749,7 +2749,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -2749,7 +2749,7 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
MONTHCAL_INFO *infoPtr; MONTHCAL_INFO *infoPtr;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
if (infoPtr == NULL) { if (infoPtr == NULL) {
...@@ -2761,9 +2761,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -2761,9 +2761,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->hwndNotify = lpcs->hwndParent;
infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE); infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE);
infoPtr->dim.cx = infoPtr->dim.cy = 1; infoPtr->dim.cx = infoPtr->dim.cy = 1;
infoPtr->calendars = calloc(1, sizeof(*infoPtr->calendars)); infoPtr->calendars = Alloc(sizeof(*infoPtr->calendars));
if (!infoPtr->calendars) goto fail; if (!infoPtr->calendars) goto fail;
infoPtr->monthdayState = calloc(3, sizeof(*infoPtr->monthdayState)); infoPtr->monthdayState = Alloc(3 * sizeof(*infoPtr->monthdayState));
if (!infoPtr->monthdayState) goto fail; if (!infoPtr->monthdayState) goto fail;
/* initialize info structure */ /* initialize info structure */
...@@ -2804,9 +2804,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) ...@@ -2804,9 +2804,9 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs)
return 0; return 0;
fail: fail:
free(infoPtr->monthdayState); Free(infoPtr->monthdayState);
free(infoPtr->calendars); Free(infoPtr->calendars);
free(infoPtr); Free(infoPtr);
return 0; return 0;
} }
...@@ -2815,8 +2815,8 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr) ...@@ -2815,8 +2815,8 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr)
{ {
INT i; INT i;
free(infoPtr->monthdayState); Free(infoPtr->monthdayState);
free(infoPtr->calendars); Free(infoPtr->calendars);
SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0); SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
CloseThemeData (GetWindowTheme (infoPtr->hwndSelf)); CloseThemeData (GetWindowTheme (infoPtr->hwndSelf));
...@@ -2824,7 +2824,7 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr) ...@@ -2824,7 +2824,7 @@ MONTHCAL_Destroy(MONTHCAL_INFO *infoPtr)
for (i = 0; i < BrushLast; i++) DeleteObject(infoPtr->brushes[i]); for (i = 0; i < BrushLast; i++) DeleteObject(infoPtr->brushes[i]);
for (i = 0; i < PenLast; i++) DeleteObject(infoPtr->pens[i]); for (i = 0; i < PenLast; i++) DeleteObject(infoPtr->pens[i]);
free(infoPtr); Free(infoPtr);
return 0; return 0;
} }
......
...@@ -576,7 +576,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -576,7 +576,7 @@ PAGER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
INT ret; INT ret;
/* allocate memory for info structure */ /* allocate memory for info structure */
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
if (!infoPtr) return -1; if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
...@@ -611,8 +611,8 @@ static LRESULT ...@@ -611,8 +611,8 @@ static LRESULT
PAGER_Destroy (PAGER_INFO *infoPtr) PAGER_Destroy (PAGER_INFO *infoPtr)
{ {
SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
free (infoPtr->pwszBuffer); Free (infoPtr->pwszBuffer);
free (infoPtr); Free (infoPtr);
return 0; return 0;
} }
...@@ -1099,9 +1099,9 @@ static UINT PAGER_GetAnsiNtfCode(UINT code) ...@@ -1099,9 +1099,9 @@ static UINT PAGER_GetAnsiNtfCode(UINT code)
static BOOL PAGER_AdjustBuffer(PAGER_INFO *infoPtr, INT size) static BOOL PAGER_AdjustBuffer(PAGER_INFO *infoPtr, INT size)
{ {
if (!infoPtr->pwszBuffer) if (!infoPtr->pwszBuffer)
infoPtr->pwszBuffer = malloc(size); infoPtr->pwszBuffer = Alloc(size);
else if (infoPtr->nBufferSize < size) else if (infoPtr->nBufferSize < size)
infoPtr->pwszBuffer = realloc(infoPtr->pwszBuffer, size); infoPtr->pwszBuffer = ReAlloc(infoPtr->pwszBuffer, size);
if (!infoPtr->pwszBuffer) return FALSE; if (!infoPtr->pwszBuffer) return FALSE;
if (infoPtr->nBufferSize < size) infoPtr->nBufferSize = size; if (infoPtr->nBufferSize < size) infoPtr->nBufferSize = size;
...@@ -1153,7 +1153,7 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT * ...@@ -1153,7 +1153,7 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT *
if ((*text && flags & (CONVERT_SEND | ZERO_SEND)) || (!*text && flags & SEND_EMPTY_IF_NULL)) if ((*text && flags & (CONVERT_SEND | ZERO_SEND)) || (!*text && flags & SEND_EMPTY_IF_NULL))
{ {
bufferSize = textMax ? *textMax : lstrlenW(*text) + 1; bufferSize = textMax ? *textMax : lstrlenW(*text) + 1;
sendBuffer = calloc(1, bufferSize); sendBuffer = Alloc(bufferSize);
if (!sendBuffer) goto done; if (!sendBuffer) goto done;
if (!(flags & ZERO_SEND)) WideCharToMultiByte(CP_ACP, 0, *text, -1, sendBuffer, bufferSize, NULL, FALSE); if (!(flags & ZERO_SEND)) WideCharToMultiByte(CP_ACP, 0, *text, -1, sendBuffer, bufferSize, NULL, FALSE);
*text = (WCHAR *)sendBuffer; *text = (WCHAR *)sendBuffer;
...@@ -1167,18 +1167,18 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT * ...@@ -1167,18 +1167,18 @@ static LRESULT PAGER_SendConvertedNotify(PAGER_INFO *infoPtr, NMHDR *hdr, UINT *
if (*text == oldText) if (*text == oldText)
{ {
bufferSize = lstrlenA((CHAR *)*text) + 1; bufferSize = lstrlenA((CHAR *)*text) + 1;
receiveBuffer = malloc(bufferSize); receiveBuffer = Alloc(bufferSize);
if (!receiveBuffer) goto done; if (!receiveBuffer) goto done;
memcpy(receiveBuffer, *text, bufferSize); memcpy(receiveBuffer, *text, bufferSize);
MultiByteToWideChar(CP_ACP, 0, receiveBuffer, bufferSize, oldText, oldTextMax); MultiByteToWideChar(CP_ACP, 0, receiveBuffer, bufferSize, oldText, oldTextMax);
free(receiveBuffer); Free(receiveBuffer);
} }
else else
MultiByteToWideChar(CP_ACP, 0, (CHAR *)*text, -1, oldText, oldTextMax); MultiByteToWideChar(CP_ACP, 0, (CHAR *)*text, -1, oldText, oldTextMax);
} }
done: done:
free(sendBuffer); Free(sendBuffer);
*text = oldText; *text = oldText;
return ret; return ret;
} }
......
...@@ -554,7 +554,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message, ...@@ -554,7 +554,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
/* allocate memory for info struct */ /* allocate memory for info struct */
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
if (!infoPtr) return -1; if (!infoPtr) return -1;
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
......
...@@ -94,7 +94,7 @@ static struct static_extra_info *get_extra_ptr( HWND hwnd, BOOL force ) ...@@ -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 ); struct static_extra_info *extra = (struct static_extra_info *)GetWindowLongPtrW( hwnd, 0 );
if (!extra && force) if (!extra && force)
{ {
extra = calloc( 1, sizeof(*extra) ); extra = Alloc( sizeof(*extra) );
if (extra) if (extra)
SetWindowLongPtrW( hwnd, 0, (ULONG_PTR)extra ); SetWindowLongPtrW( hwnd, 0, (ULONG_PTR)extra );
} }
...@@ -470,7 +470,7 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, ...@@ -470,7 +470,7 @@ static LRESULT CALLBACK STATIC_WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam,
{ {
if (extra->image_has_alpha) if (extra->image_has_alpha)
DeleteObject( extra->image.hbitmap ); DeleteObject( extra->image.hbitmap );
free( extra ); Free( extra );
} }
/* /*
* FIXME * FIXME
...@@ -751,13 +751,13 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style ) ...@@ -751,13 +751,13 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style )
} }
buf_size = 256; buf_size = 256;
if (!(text = malloc( buf_size * sizeof(WCHAR) ))) if (!(text = Alloc( buf_size * sizeof(WCHAR) )))
goto no_TextOut; goto no_TextOut;
while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1) while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1)
{ {
buf_size *= 2; buf_size *= 2;
if (!(text = realloc( text, buf_size * sizeof(WCHAR) ))) if (!(text = ReAlloc( text, buf_size * sizeof(WCHAR) )))
goto no_TextOut; goto no_TextOut;
} }
...@@ -777,7 +777,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style ) ...@@ -777,7 +777,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, HBRUSH hbrush, DWORD style )
} }
no_TextOut: no_TextOut:
free( text ); Free( text );
if (hFont) if (hFont)
SelectObject( hdc, hOldFont ); SelectObject( hdc, hOldFont );
......
...@@ -548,7 +548,7 @@ TREEVIEW_TVItemFromItem(const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem ...@@ -548,7 +548,7 @@ TREEVIEW_TVItemFromItem(const TREEVIEW_INFO *infoPtr, UINT mask, TVITEMW *tvItem
if (!infoPtr->bNtfUnicode) if (!infoPtr->bNtfUnicode)
{ {
tvItem->cchTextMax = WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, NULL, 0, NULL, NULL ); tvItem->cchTextMax = WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, NULL, 0, NULL, NULL );
tvItem->pszText = malloc (tvItem->cchTextMax); tvItem->pszText = Alloc (tvItem->cchTextMax);
WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, (LPSTR)tvItem->pszText, tvItem->cchTextMax, 0, 0 ); WideCharToMultiByte( CP_ACP, 0, item->pszText, -1, (LPSTR)tvItem->pszText, tvItem->cchTextMax, 0, 0 );
} }
else else
...@@ -589,8 +589,8 @@ TREEVIEW_SendTreeviewNotify(const TREEVIEW_INFO *infoPtr, UINT code, UINT action ...@@ -589,8 +589,8 @@ TREEVIEW_SendTreeviewNotify(const TREEVIEW_INFO *infoPtr, UINT code, UINT action
ret = TREEVIEW_SendRealNotify(infoPtr, code, &nmhdr.hdr); ret = TREEVIEW_SendRealNotify(infoPtr, code, &nmhdr.hdr);
if (!infoPtr->bNtfUnicode) if (!infoPtr->bNtfUnicode)
{ {
free(nmhdr.itemOld.pszText); Free(nmhdr.itemOld.pszText);
free(nmhdr.itemNew.pszText); Free(nmhdr.itemNew.pszText);
} }
return ret; return ret;
} }
...@@ -689,7 +689,7 @@ TREEVIEW_BeginLabelEditNotify(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editI ...@@ -689,7 +689,7 @@ TREEVIEW_BeginLabelEditNotify(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *editI
ret = TREEVIEW_SendRealNotify(infoPtr, TVN_BEGINLABELEDITW, &tvdi.hdr); ret = TREEVIEW_SendRealNotify(infoPtr, TVN_BEGINLABELEDITW, &tvdi.hdr);
if (!infoPtr->bNtfUnicode) if (!infoPtr->bNtfUnicode)
free(tvdi.item.pszText); Free(tvdi.item.pszText);
return ret; return ret;
} }
...@@ -735,7 +735,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -735,7 +735,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1, (LPSTR)callback.item.pszText, -1,
NULL, 0); NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = realloc(item->pszText, buflen); newText = ReAlloc(item->pszText, buflen);
TRACE("returned str %s, len=%d, buflen=%d\n", TRACE("returned str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen); debugstr_a((LPSTR)callback.item.pszText), len, buflen);
...@@ -753,7 +753,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -753,7 +753,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
else { else {
int len = max(lstrlenW(callback.item.pszText) + 1, int len = max(lstrlenW(callback.item.pszText) + 1,
TEXT_CALLBACK_SIZE); TEXT_CALLBACK_SIZE);
LPWSTR newText = realloc(item->pszText, len*sizeof(WCHAR)); LPWSTR newText = ReAlloc(item->pszText, len*sizeof(WCHAR));
TRACE("returned wstr %s, len=%d\n", TRACE("returned wstr %s, len=%d\n",
debugstr_w(callback.item.pszText), len); debugstr_w(callback.item.pszText), len);
...@@ -776,7 +776,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -776,7 +776,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1, (LPSTR)callback.item.pszText, -1,
NULL, 0); NULL, 0);
buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE); buflen = max((len)*sizeof(WCHAR), TEXT_CALLBACK_SIZE);
newText = malloc(buflen); newText = Alloc(buflen);
TRACE("same buffer str %s, len=%d, buflen=%d\n", TRACE("same buffer str %s, len=%d, buflen=%d\n",
debugstr_a((LPSTR)callback.item.pszText), len, buflen); debugstr_a((LPSTR)callback.item.pszText), len, buflen);
...@@ -789,7 +789,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -789,7 +789,7 @@ TREEVIEW_UpdateDispInfo(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
(LPSTR)callback.item.pszText, -1, (LPSTR)callback.item.pszText, -1,
item->pszText, buflen/sizeof(WCHAR)); item->pszText, buflen/sizeof(WCHAR));
item->cchTextMax = buflen/sizeof(WCHAR); item->cchTextMax = buflen/sizeof(WCHAR);
free(oldText); Free(oldText);
} }
} }
} }
...@@ -997,7 +997,7 @@ TREEVIEW_UpdateSubTree(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root) ...@@ -997,7 +997,7 @@ TREEVIEW_UpdateSubTree(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *root)
static TREEVIEW_ITEM * static TREEVIEW_ITEM *
TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr) TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
{ {
TREEVIEW_ITEM *newItem = calloc(1, sizeof(*newItem)); TREEVIEW_ITEM *newItem = Alloc(sizeof(*newItem));
if (!newItem) if (!newItem)
return NULL; return NULL;
...@@ -1013,7 +1013,7 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr) ...@@ -1013,7 +1013,7 @@ TREEVIEW_AllocateItem(const TREEVIEW_INFO *infoPtr)
if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1) if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1)
{ {
free(newItem); Free(newItem);
return NULL; return NULL;
} }
...@@ -1038,7 +1038,7 @@ TREEVIEW_FreeItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) ...@@ -1038,7 +1038,7 @@ TREEVIEW_FreeItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
infoPtr->dropItem = NULL; infoPtr->dropItem = NULL;
if (infoPtr->insertMarkItem == item) if (infoPtr->insertMarkItem == item)
infoPtr->insertMarkItem = NULL; infoPtr->insertMarkItem = NULL;
free(item); Free(item);
} }
...@@ -1132,13 +1132,13 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -1132,13 +1132,13 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)tvItem->pszText, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)tvItem->pszText, -1, NULL, 0);
/* Allocate new block to make pointer comparison in item_changed() work. */ /* Allocate new block to make pointer comparison in item_changed() work. */
newText = malloc(len * sizeof(WCHAR)); newText = Alloc(len * sizeof(WCHAR));
if (newText == NULL) return FALSE; if (newText == NULL) return FALSE;
callbackClear |= TVIF_TEXT; callbackClear |= TVIF_TEXT;
free(item->pszText); Free(item->pszText);
item->pszText = newText; item->pszText = newText;
item->cchTextMax = len; item->cchTextMax = len;
if (isW) if (isW)
...@@ -1152,7 +1152,7 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item, ...@@ -1152,7 +1152,7 @@ TREEVIEW_DoSetItemT(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item,
else else
{ {
callbackSet |= TVIF_TEXT; callbackSet |= TVIF_TEXT;
item->pszText = realloc(item->pszText, TEXT_CALLBACK_SIZE * sizeof(WCHAR)); item->pszText = ReAlloc(item->pszText, TEXT_CALLBACK_SIZE * sizeof(WCHAR));
item->cchTextMax = TEXT_CALLBACK_SIZE; item->cchTextMax = TEXT_CALLBACK_SIZE;
TRACE("setting callback, item %p\n", item); TRACE("setting callback, item %p\n", item);
} }
...@@ -1497,7 +1497,7 @@ TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) ...@@ -1497,7 +1497,7 @@ TREEVIEW_RemoveItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item)
infoPtr->uNumItems--; infoPtr->uNumItems--;
if (item->pszText != LPSTR_TEXTCALLBACKW) if (item->pszText != LPSTR_TEXTCALLBACKW)
free(item->pszText); Free(item->pszText);
TREEVIEW_FreeItem(infoPtr, item); TREEVIEW_FreeItem(infoPtr, item);
} }
...@@ -4085,7 +4085,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel) ...@@ -4085,7 +4085,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
if (!infoPtr->bNtfUnicode) if (!infoPtr->bNtfUnicode)
{ {
DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)tvdi.item.pszText, -1, NULL, 0 ); DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)tvdi.item.pszText, -1, NULL, 0 );
newText = malloc(len * sizeof(WCHAR)); newText = Alloc(len * sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, (LPSTR)tvdi.item.pszText, -1, newText, len ); MultiByteToWideChar( CP_ACP, 0, (LPSTR)tvdi.item.pszText, -1, newText, len );
iLength = len - 1; iLength = len - 1;
} }
...@@ -4094,11 +4094,11 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel) ...@@ -4094,11 +4094,11 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
if (lstrcmpW(newText, editedItem->pszText) != 0) if (lstrcmpW(newText, editedItem->pszText) != 0)
{ {
WCHAR *ptr = realloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1)); WCHAR *ptr = ReAlloc(editedItem->pszText, sizeof(WCHAR)*(iLength + 1));
if (ptr == NULL) if (ptr == NULL)
{ {
ERR("OutOfMemory, cannot allocate space for label\n"); ERR("OutOfMemory, cannot allocate space for label\n");
if (newText != tmpText) free(newText); if (newText != tmpText) Free(newText);
DestroyWindow(infoPtr->hwndEdit); DestroyWindow(infoPtr->hwndEdit);
infoPtr->hwndEdit = 0; infoPtr->hwndEdit = 0;
infoPtr->editItem = NULL; infoPtr->editItem = NULL;
...@@ -4112,7 +4112,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel) ...@@ -4112,7 +4112,7 @@ TREEVIEW_EndEditLabelNow(TREEVIEW_INFO *infoPtr, BOOL bCancel)
TREEVIEW_ComputeTextWidth(infoPtr, editedItem, 0); TREEVIEW_ComputeTextWidth(infoPtr, editedItem, 0);
} }
} }
if (newText != tmpText) free(newText); if (newText != tmpText) Free(newText);
} }
ShowWindow(infoPtr->hwndEdit, SW_HIDE); ShowWindow(infoPtr->hwndEdit, SW_HIDE);
...@@ -5134,7 +5134,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs) ...@@ -5134,7 +5134,7 @@ TREEVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
TRACE("wnd %p, style %#lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE)); TRACE("wnd %p, style %#lx\n", hwnd, GetWindowLongW(hwnd, GWL_STYLE));
if (!(infoPtr = calloc(1, sizeof(*infoPtr)))) if (!(infoPtr = Alloc(sizeof(*infoPtr))))
{ {
ERR("could not allocate info memory!\n"); ERR("could not allocate info memory!\n");
return 0; return 0;
...@@ -5257,7 +5257,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr) ...@@ -5257,7 +5257,7 @@ TREEVIEW_Destroy(TREEVIEW_INFO *infoPtr)
DeleteObject(infoPtr->hUnderlineFont); DeleteObject(infoPtr->hUnderlineFont);
DeleteObject(infoPtr->hBoldUnderlineFont); DeleteObject(infoPtr->hBoldUnderlineFont);
DestroyWindow(infoPtr->hwndToolTip); DestroyWindow(infoPtr->hwndToolTip);
free(infoPtr); Free(infoPtr);
return 0; return 0;
} }
......
...@@ -901,7 +901,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -901,7 +901,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
{ {
CREATESTRUCTW *pcs = (CREATESTRUCTW*)lParam; CREATESTRUCTW *pcs = (CREATESTRUCTW*)lParam;
infoPtr = calloc(1, sizeof(*infoPtr)); infoPtr = Alloc(sizeof(*infoPtr));
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
/* initialize the info struct */ /* initialize the info struct */
...@@ -934,9 +934,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -934,9 +934,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
break; break;
case WM_DESTROY: case WM_DESTROY:
free (infoPtr->AccelVect); Free (infoPtr->AccelVect);
UPDOWN_ResetSubclass (infoPtr); UPDOWN_ResetSubclass (infoPtr);
free (infoPtr); Free (infoPtr);
SetWindowLongPtrW (hwnd, 0, 0); SetWindowLongPtrW (hwnd, 0, 0);
theme = GetWindowTheme (hwnd); theme = GetWindowTheme (hwnd);
CloseThemeData (theme); CloseThemeData (theme);
...@@ -1059,12 +1059,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1059,12 +1059,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
TRACE("UDM_SETACCEL\n"); TRACE("UDM_SETACCEL\n");
if(infoPtr->AccelVect) { if(infoPtr->AccelVect) {
free (infoPtr->AccelVect); Free (infoPtr->AccelVect);
infoPtr->AccelCount = 0; infoPtr->AccelCount = 0;
infoPtr->AccelVect = 0; infoPtr->AccelVect = 0;
} }
if(wParam==0) return TRUE; if(wParam==0) return TRUE;
infoPtr->AccelVect = malloc(wParam*sizeof(UDACCEL)); infoPtr->AccelVect = Alloc(wParam*sizeof(UDACCEL));
if(!infoPtr->AccelVect) return FALSE; if(!infoPtr->AccelVect) return FALSE;
memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL)); memcpy(infoPtr->AccelVect, (void*)lParam, wParam*sizeof(UDACCEL));
infoPtr->AccelCount = wParam; infoPtr->AccelCount = wParam;
......
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