Commit 61de79dc authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/animate: Use the global HeapAlloc() helpers.

parent bd4193ef
......@@ -45,6 +45,7 @@
#include "mmsystem.h"
#include "comctl32.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(animate);
......@@ -188,36 +189,39 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
{
if (infoPtr->hMMio) {
ANIMATE_DoStop(infoPtr);
mmioClose(infoPtr->hMMio, 0);
if (infoPtr->hRes) {
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
Free (infoPtr->lpIndex);
if (infoPtr->hMMio)
{
ANIMATE_DoStop(infoPtr);
mmioClose(infoPtr->hMMio, 0);
if (infoPtr->hRes)
{
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
heap_free (infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
if (infoPtr->hic) {
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
Free (infoPtr->inbih);
if (infoPtr->hic)
{
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
heap_free (infoPtr->inbih);
infoPtr->inbih = NULL;
Free (infoPtr->outbih);
heap_free (infoPtr->outbih);
infoPtr->outbih = NULL;
Free (infoPtr->indata);
heap_free (infoPtr->indata);
infoPtr->indata = NULL;
Free (infoPtr->outdata);
heap_free (infoPtr->outdata);
infoPtr->outdata = NULL;
if( infoPtr->hbmPrevFrame )
if (infoPtr->hbmPrevFrame)
{
DeleteObject(infoPtr->hbmPrevFrame);
DeleteObject(infoPtr->hbmPrevFrame);
infoPtr->hbmPrevFrame = 0;
}
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
}
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
}
......@@ -571,7 +575,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
return FALSE;
}
infoPtr->inbih = Alloc(mmckInfo.cksize);
infoPtr->inbih = heap_alloc_zero(mmckInfo.cksize);
if (!infoPtr->inbih) {
WARN("Can't alloc input BIH\n");
return FALSE;
......@@ -618,7 +622,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
/* FIXME: should handle the 'rec ' LIST when present */
infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
if (!infoPtr->lpIndex)
return FALSE;
......@@ -640,7 +644,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
infoPtr->ash.dwSuggestedBufferSize = insize;
}
infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize);
infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize);
if (!infoPtr->indata)
return FALSE;
......@@ -671,7 +675,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
(DWORD_PTR)infoPtr->inbih, 0L);
infoPtr->outbih = Alloc(outSize);
infoPtr->outbih = heap_alloc_zero(outSize);
if (!infoPtr->outbih)
return FALSE;
......@@ -682,7 +686,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
return FALSE;
}
infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage);
infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage);
if (!infoPtr->outdata)
return FALSE;
......@@ -776,12 +780,12 @@ static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpsz
return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName);
len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0);
lpwszName = Alloc(len * sizeof(WCHAR));
lpwszName = heap_alloc(len * sizeof(WCHAR));
if (!lpwszName) return FALSE;
MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len);
result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName);
Free (lpwszName);
heap_free (lpwszName);
return result;
}
......@@ -814,7 +818,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
}
/* allocate memory for info structure */
infoPtr = Alloc(sizeof(ANIMATE_INFO));
infoPtr = heap_alloc_zero(sizeof(*infoPtr));
if (!infoPtr) return FALSE;
/* store crossref hWnd <-> info structure */
......@@ -844,7 +848,7 @@ static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr)
infoPtr->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&infoPtr->cs);
Free(infoPtr);
heap_free(infoPtr);
return 0;
}
......
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