uxtheme: Use global memory allocation helpers.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-02-25 19:35:15 +03:00 committed by Alexandre Julliard
parent 4f35819843
commit d4cc71c5db
3 changed files with 18 additions and 15 deletions

View File

@ -32,6 +32,7 @@
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
@ -48,7 +49,7 @@ static void free_paintbuffer(struct paintbuffer *buffer)
{
DeleteObject(buffer->bitmap);
DeleteDC(buffer->memorydc);
HeapFree(GetProcessHeap(), 0, buffer);
heap_free(buffer);
}
static struct paintbuffer *get_buffer_obj(HPAINTBUFFER handle)
@ -98,7 +99,7 @@ HPAINTBUFFER WINAPI BeginBufferedPaint(HDC targetdc, const RECT *rect,
if (params)
FIXME("painting parameters are ignored\n");
buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer));
buffer = heap_alloc(sizeof(*buffer));
buffer->targetdc = targetdc;
buffer->rect = *rect;
buffer->memorydc = CreateCompatibleDC(targetdc);

View File

@ -36,6 +36,7 @@
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
@ -175,7 +176,7 @@ HRESULT MSSTYLES_OpenThemeFile(LPCWSTR lpThemeFile, LPCWSTR pszColorName, LPCWST
goto invalid_theme;
}
*tf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(THEME_FILE));
*tf = heap_alloc_zero(sizeof(THEME_FILE));
(*tf)->hTheme = hTheme;
GetFullPathNameW(lpThemeFile, MAX_PATH, (*tf)->szThemeFile, NULL);
@ -214,13 +215,13 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
while(ps->properties) {
PTHEME_PROPERTY prop = ps->properties;
ps->properties = prop->next;
HeapFree(GetProcessHeap(), 0, prop);
heap_free(prop);
}
pcls->partstate = ps->next;
HeapFree(GetProcessHeap(), 0, ps);
heap_free(ps);
}
HeapFree(GetProcessHeap(), 0, pcls);
heap_free(pcls);
}
}
while (tf->images)
@ -228,9 +229,9 @@ void MSSTYLES_CloseThemeFile(PTHEME_FILE tf)
PTHEME_IMAGE img = tf->images;
tf->images = img->next;
DeleteObject (img->image);
HeapFree (GetProcessHeap(), 0, img);
heap_free(img);
}
HeapFree(GetProcessHeap(), 0, tf);
heap_free(tf);
}
}
}
@ -450,7 +451,7 @@ static PTHEME_CLASS MSSTYLES_AddClass(PTHEME_FILE tf, LPCWSTR pszAppName, LPCWST
PTHEME_CLASS cur = MSSTYLES_FindClass(tf, pszAppName, pszClassName);
if(cur) return cur;
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_CLASS));
cur = heap_alloc(sizeof(*cur));
cur->hTheme = tf->hTheme;
lstrcpyW(cur->szAppName, pszAppName);
lstrcpyW(cur->szClassName, pszClassName);
@ -507,7 +508,7 @@ static PTHEME_PARTSTATE MSSTYLES_AddPartState(PTHEME_CLASS tc, int iPartId, int
PTHEME_PARTSTATE cur = MSSTYLES_FindPartState(tc, iPartId, iStateId, NULL);
if(cur) return cur;
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PARTSTATE));
cur = heap_alloc(sizeof(*cur));
cur->iPartId = iPartId;
cur->iStateId = iStateId;
cur->properties = NULL;
@ -624,7 +625,7 @@ static PTHEME_PROPERTY MSSTYLES_AddProperty(PTHEME_PARTSTATE ps, int iPropertyPr
/* Should duplicate properties overwrite the original, or be ignored? */
if(cur) return cur;
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PROPERTY));
cur = heap_alloc(sizeof(*cur));
cur->iPrimitiveType = iPropertyPrimitive;
cur->iPropertyId = iPropertyId;
cur->lpValue = lpValue;
@ -665,7 +666,7 @@ static PTHEME_PROPERTY MSSTYLES_AddMetric(PTHEME_FILE tf, int iPropertyPrimitive
/* Should duplicate properties overwrite the original, or be ignored? */
if(cur) return cur;
cur = HeapAlloc(GetProcessHeap(), 0, sizeof(THEME_PROPERTY));
cur = heap_alloc(sizeof(*cur));
cur->iPrimitiveType = iPropertyPrimitive;
cur->iPropertyId = iPropertyId;
cur->lpValue = lpValue;
@ -1140,7 +1141,7 @@ HBITMAP MSSTYLES_LoadBitmap (PTHEME_CLASS tc, LPCWSTR lpFilename, BOOL* hasAlpha
img = img->next;
}
/* Not found? Load from resources */
img = HeapAlloc (GetProcessHeap(), 0, sizeof (THEME_IMAGE));
img = heap_alloc(sizeof(*img));
img->image = LoadImageW(tc->hTheme, szFile, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
prepare_alpha (img->image, hasAlpha);
img->hasAlpha = *hasAlpha;

View File

@ -27,6 +27,7 @@
#include "winnls.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(uxtheme);
@ -75,7 +76,7 @@ PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) {
}
dwIniSize = SizeofResource(hTheme, hrsc) / sizeof(WCHAR);
uf = HeapAlloc(GetProcessHeap(), 0, sizeof(UXINI_FILE));
uf = heap_alloc(sizeof(*uf));
uf->lpIni = lpThemesIni;
uf->lpCurLoc = lpThemesIni;
uf->lpEnd = lpThemesIni + dwIniSize;
@ -92,7 +93,7 @@ PUXINI_FILE UXINI_LoadINI(HMODULE hTheme, LPCWSTR lpName) {
*/
void UXINI_CloseINI(PUXINI_FILE uf)
{
HeapFree(GetProcessHeap(), 0, uf);
heap_free(uf);
}
/**********************************************************************