[PATCH] uxtheme: Use global memory allocation helpers
Nikolay Sivov
nsivov at codeweavers.com
Sun Feb 25 10:35:15 CST 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/uxtheme/buffer.c | 5 +++--
dlls/uxtheme/msstyles.c | 23 ++++++++++++-----------
dlls/uxtheme/uxini.c | 5 +++--
3 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/dlls/uxtheme/buffer.c b/dlls/uxtheme/buffer.c
index 664515c278..32d341cb7f 100644
--- a/dlls/uxtheme/buffer.c
+++ b/dlls/uxtheme/buffer.c
@@ -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);
diff --git a/dlls/uxtheme/msstyles.c b/dlls/uxtheme/msstyles.c
index e471c3cc0c..fe91494afd 100644
--- a/dlls/uxtheme/msstyles.c
+++ b/dlls/uxtheme/msstyles.c
@@ -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;
diff --git a/dlls/uxtheme/uxini.c b/dlls/uxtheme/uxini.c
index a2dfabfd0d..1581ff469a 100644
--- a/dlls/uxtheme/uxini.c
+++ b/dlls/uxtheme/uxini.c
@@ -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);
}
/**********************************************************************
--
2.16.1
More information about the wine-devel
mailing list