comctl32/animate: Use the global HeapAlloc() helpers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bd4193ef9f
commit
61de79dcab
|
@ -45,6 +45,7 @@
|
||||||
#include "mmsystem.h"
|
#include "mmsystem.h"
|
||||||
#include "comctl32.h"
|
#include "comctl32.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include "wine/heap.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(animate);
|
WINE_DEFAULT_DEBUG_CHANNEL(animate);
|
||||||
|
|
||||||
|
@ -188,36 +189,39 @@ static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr)
|
||||||
|
|
||||||
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
|
static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
|
||||||
{
|
{
|
||||||
if (infoPtr->hMMio) {
|
if (infoPtr->hMMio)
|
||||||
ANIMATE_DoStop(infoPtr);
|
{
|
||||||
mmioClose(infoPtr->hMMio, 0);
|
ANIMATE_DoStop(infoPtr);
|
||||||
if (infoPtr->hRes) {
|
mmioClose(infoPtr->hMMio, 0);
|
||||||
FreeResource(infoPtr->hRes);
|
if (infoPtr->hRes)
|
||||||
infoPtr->hRes = 0;
|
|
||||||
}
|
|
||||||
Free (infoPtr->lpIndex);
|
|
||||||
infoPtr->lpIndex = NULL;
|
|
||||||
if (infoPtr->hic) {
|
|
||||||
fnIC.fnICClose(infoPtr->hic);
|
|
||||||
infoPtr->hic = 0;
|
|
||||||
}
|
|
||||||
Free (infoPtr->inbih);
|
|
||||||
infoPtr->inbih = NULL;
|
|
||||||
Free (infoPtr->outbih);
|
|
||||||
infoPtr->outbih = NULL;
|
|
||||||
Free (infoPtr->indata);
|
|
||||||
infoPtr->indata = NULL;
|
|
||||||
Free (infoPtr->outdata);
|
|
||||||
infoPtr->outdata = NULL;
|
|
||||||
if( infoPtr->hbmPrevFrame )
|
|
||||||
{
|
{
|
||||||
DeleteObject(infoPtr->hbmPrevFrame);
|
FreeResource(infoPtr->hRes);
|
||||||
|
infoPtr->hRes = 0;
|
||||||
|
}
|
||||||
|
heap_free (infoPtr->lpIndex);
|
||||||
|
infoPtr->lpIndex = NULL;
|
||||||
|
if (infoPtr->hic)
|
||||||
|
{
|
||||||
|
fnIC.fnICClose(infoPtr->hic);
|
||||||
|
infoPtr->hic = 0;
|
||||||
|
}
|
||||||
|
heap_free (infoPtr->inbih);
|
||||||
|
infoPtr->inbih = NULL;
|
||||||
|
heap_free (infoPtr->outbih);
|
||||||
|
infoPtr->outbih = NULL;
|
||||||
|
heap_free (infoPtr->indata);
|
||||||
|
infoPtr->indata = NULL;
|
||||||
|
heap_free (infoPtr->outdata);
|
||||||
|
infoPtr->outdata = NULL;
|
||||||
|
if (infoPtr->hbmPrevFrame)
|
||||||
|
{
|
||||||
|
DeleteObject(infoPtr->hbmPrevFrame);
|
||||||
infoPtr->hbmPrevFrame = 0;
|
infoPtr->hbmPrevFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
|
memset(&infoPtr->mah, 0, sizeof(infoPtr->mah));
|
||||||
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
|
memset(&infoPtr->ash, 0, sizeof(infoPtr->ash));
|
||||||
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
|
infoPtr->nFromFrame = infoPtr->nToFrame = infoPtr->nLoop = infoPtr->currFrame = 0;
|
||||||
}
|
}
|
||||||
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
|
infoPtr->transparentColor = ANIMATE_COLOR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -571,7 +575,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->inbih = Alloc(mmckInfo.cksize);
|
infoPtr->inbih = heap_alloc_zero(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;
|
||||||
|
@ -618,7 +622,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 = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
|
infoPtr->lpIndex = heap_alloc_zero(infoPtr->mah.dwTotalFrames * sizeof(DWORD));
|
||||||
if (!infoPtr->lpIndex)
|
if (!infoPtr->lpIndex)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -640,7 +644,7 @@ static BOOL ANIMATE_GetAviInfo(ANIMATE_INFO *infoPtr)
|
||||||
infoPtr->ash.dwSuggestedBufferSize = insize;
|
infoPtr->ash.dwSuggestedBufferSize = insize;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize);
|
infoPtr->indata = heap_alloc_zero(infoPtr->ash.dwSuggestedBufferSize);
|
||||||
if (!infoPtr->indata)
|
if (!infoPtr->indata)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -671,7 +675,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);
|
||||||
|
|
||||||
infoPtr->outbih = Alloc(outSize);
|
infoPtr->outbih = heap_alloc_zero(outSize);
|
||||||
if (!infoPtr->outbih)
|
if (!infoPtr->outbih)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -682,7 +686,7 @@ static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage);
|
infoPtr->outdata = heap_alloc_zero(infoPtr->outbih->biSizeImage);
|
||||||
if (!infoPtr->outdata)
|
if (!infoPtr->outdata)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -776,12 +780,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 = Alloc(len * sizeof(WCHAR));
|
lpwszName = heap_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);
|
heap_free (lpwszName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +818,7 @@ static BOOL ANIMATE_Create(HWND hWnd, const CREATESTRUCTW *lpcs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for info structure */
|
/* allocate memory for info structure */
|
||||||
infoPtr = Alloc(sizeof(ANIMATE_INFO));
|
infoPtr = heap_alloc_zero(sizeof(*infoPtr));
|
||||||
if (!infoPtr) return FALSE;
|
if (!infoPtr) return FALSE;
|
||||||
|
|
||||||
/* store crossref hWnd <-> info structure */
|
/* store crossref hWnd <-> info structure */
|
||||||
|
@ -844,7 +848,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);
|
heap_free(infoPtr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue