Commit 6b7689cb authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

avifil32: Use CRT allocation functions.

parent 4059c6ec
...@@ -86,7 +86,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This) ...@@ -86,7 +86,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
hr = AVIStreamFormatSize(This->pStream, This->sInfo.dwStart, &This->cbInFormat); hr = AVIStreamFormatSize(This->pStream, This->sInfo.dwStart, &This->cbInFormat);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat); This->lpInFormat = malloc(This->cbInFormat);
if (This->lpInFormat == NULL) if (This->lpInFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -98,7 +98,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This) ...@@ -98,7 +98,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
if (This->lpOutFormat == NULL) { if (This->lpOutFormat == NULL) {
/* we must decode to default format */ /* we must decode to default format */
This->cbOutFormat = sizeof(WAVEFORMATEX); This->cbOutFormat = sizeof(WAVEFORMATEX);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat); This->lpOutFormat = malloc(This->cbOutFormat);
if (This->lpOutFormat == NULL) if (This->lpOutFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -181,17 +181,17 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) ...@@ -181,17 +181,17 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
acmStreamClose(This->has, 0); acmStreamClose(This->has, 0);
This->has = NULL; This->has = NULL;
} }
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc); free(This->acmStreamHdr.pbSrc);
This->acmStreamHdr.pbSrc = NULL; This->acmStreamHdr.pbSrc = NULL;
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst); free(This->acmStreamHdr.pbDst);
This->acmStreamHdr.pbDst = NULL; This->acmStreamHdr.pbDst = NULL;
if (This->lpInFormat != NULL) { if (This->lpInFormat != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpInFormat); free(This->lpInFormat);
This->lpInFormat = NULL; This->lpInFormat = NULL;
This->cbInFormat = 0; This->cbInFormat = 0;
} }
if (This->lpOutFormat != NULL) { if (This->lpOutFormat != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpOutFormat); free(This->lpOutFormat);
This->lpOutFormat = NULL; This->lpOutFormat = NULL;
This->cbOutFormat = 0; This->cbOutFormat = 0;
} }
...@@ -199,7 +199,7 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface) ...@@ -199,7 +199,7 @@ static ULONG WINAPI ACMStream_fnRelease(IAVIStream* iface)
IAVIStream_Release(This->pStream); IAVIStream_Release(This->pStream);
This->pStream = NULL; This->pStream = NULL;
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
return 0; return 0;
} }
...@@ -251,7 +251,7 @@ static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1, ...@@ -251,7 +251,7 @@ static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
else else
This->cbOutFormat = sizeof(WAVEFORMATEX); This->cbOutFormat = sizeof(WAVEFORMATEX);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat); This->lpOutFormat = malloc(This->cbOutFormat);
if (This->lpOutFormat == NULL) if (This->lpOutFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -384,7 +384,7 @@ static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -384,7 +384,7 @@ static HRESULT WINAPI ACMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0) if ((This->sInfo.dwCaps & AVIFILECAPS_CANWRITE) == 0)
return AVIERR_READONLY; return AVIERR_READONLY;
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, formatsize); This->lpInFormat = malloc(formatsize);
if (This->lpInFormat == NULL) if (This->lpInFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->cbInFormat = formatsize; This->cbInFormat = formatsize;
...@@ -464,7 +464,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start, ...@@ -464,7 +464,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* Need to free destination buffer used for writing? */ /* Need to free destination buffer used for writing? */
if (This->acmStreamHdr.pbDst != NULL) { if (This->acmStreamHdr.pbDst != NULL) {
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbDst); free(This->acmStreamHdr.pbDst);
This->acmStreamHdr.pbDst = NULL; This->acmStreamHdr.pbDst = NULL;
This->acmStreamHdr.dwDstUser = 0; This->acmStreamHdr.dwDstUser = 0;
} }
...@@ -472,10 +472,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start, ...@@ -472,10 +472,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* need bigger source buffer? */ /* need bigger source buffer? */
if (This->acmStreamHdr.pbSrc == NULL || if (This->acmStreamHdr.pbSrc == NULL ||
This->acmStreamHdr.dwSrcUser < size) { This->acmStreamHdr.dwSrcUser < size) {
if (This->acmStreamHdr.pbSrc == NULL) This->acmStreamHdr.pbSrc = realloc(This->acmStreamHdr.pbSrc, size);
This->acmStreamHdr.pbSrc = HeapAlloc(GetProcessHeap(), 0, size);
else
This->acmStreamHdr.pbSrc = HeapReAlloc(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc, size);
if (This->acmStreamHdr.pbSrc == NULL) if (This->acmStreamHdr.pbSrc == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->acmStreamHdr.dwSrcUser = size; This->acmStreamHdr.dwSrcUser = size;
...@@ -567,7 +564,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start, ...@@ -567,7 +564,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need to free source buffer used for reading? */ /* Need to free source buffer used for reading? */
if (This->acmStreamHdr.pbSrc != NULL) { if (This->acmStreamHdr.pbSrc != NULL) {
HeapFree(GetProcessHeap(), 0, This->acmStreamHdr.pbSrc); free(This->acmStreamHdr.pbSrc);
This->acmStreamHdr.pbSrc = NULL; This->acmStreamHdr.pbSrc = NULL;
This->acmStreamHdr.dwSrcUser = 0; This->acmStreamHdr.dwSrcUser = 0;
} }
...@@ -575,10 +572,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start, ...@@ -575,10 +572,7 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need bigger destination buffer? */ /* Need bigger destination buffer? */
if (This->acmStreamHdr.pbDst == NULL || if (This->acmStreamHdr.pbDst == NULL ||
This->acmStreamHdr.dwDstUser < size) { This->acmStreamHdr.dwDstUser < size) {
if (This->acmStreamHdr.pbDst == NULL) This->acmStreamHdr.pbDst = realloc(This->acmStreamHdr.pbDst, size);
This->acmStreamHdr.pbDst = HeapAlloc(GetProcessHeap(), 0, size);
else
This->acmStreamHdr.pbDst = HeapReAlloc(GetProcessHeap(), 0, This->acmStreamHdr.pbDst, size);
if (This->acmStreamHdr.pbDst == NULL) if (This->acmStreamHdr.pbDst == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->acmStreamHdr.dwDstUser = size; This->acmStreamHdr.dwDstUser = size;
...@@ -710,7 +704,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv) ...@@ -710,7 +704,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL; *ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl)); pstream = calloc(1, sizeof(IAVIStreamImpl));
if (pstream == NULL) if (pstream == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -718,7 +712,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv) ...@@ -718,7 +712,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv); hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr)) if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream); free(pstream);
return hr; return hr;
} }
...@@ -209,19 +209,19 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2) ...@@ -209,19 +209,19 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2)
return FALSE; return FALSE;
/* sizes match, now get formats and compare them */ /* sizes match, now get formats and compare them */
fmt1 = HeapAlloc(GetProcessHeap(), 0, size1); fmt1 = malloc(size1);
if (fmt1 == NULL) if (fmt1 == NULL)
return FALSE; return FALSE;
if (SUCCEEDED(AVIStreamReadFormat(avi1, start1, fmt1, &size1))) { if (SUCCEEDED(AVIStreamReadFormat(avi1, start1, fmt1, &size1))) {
fmt2 = HeapAlloc(GetProcessHeap(), 0, size1); fmt2 = malloc(size1);
if (fmt2 != NULL) { if (fmt2 != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(avi2, start2, fmt2, &size1))) if (SUCCEEDED(AVIStreamReadFormat(avi2, start2, fmt2, &size1)))
status = (memcmp(fmt1, fmt2, size1) == 0); status = (memcmp(fmt1, fmt2, size1) == 0);
} }
} }
HeapFree(GetProcessHeap(), 0, fmt2); free(fmt2);
HeapFree(GetProcessHeap(), 0, fmt1); free(fmt1);
return status; return status;
} }
...@@ -278,10 +278,10 @@ static ULONG WINAPI IAVIEditStream_fnRelease(IAVIEditStream*iface) ...@@ -278,10 +278,10 @@ static ULONG WINAPI IAVIEditStream_fnRelease(IAVIEditStream*iface)
if (This->pStreams[i].pStream != NULL) if (This->pStreams[i].pStream != NULL)
IAVIStream_Release(This->pStreams[i].pStream); IAVIStream_Release(This->pStreams[i].pStream);
} }
HeapFree(GetProcessHeap(), 0, This->pStreams); free(This->pStreams);
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -343,8 +343,7 @@ static HRESULT WINAPI IAVIEditStream_fnCut(IAVIEditStream*iface,LONG*plStart, ...@@ -343,8 +343,7 @@ static HRESULT WINAPI IAVIEditStream_fnCut(IAVIEditStream*iface,LONG*plStart,
} else { } else {
/* splitting */ /* splitting */
if (This->nStreams + 1 >= This->nTableSize) { if (This->nStreams + 1 >= This->nTableSize) {
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams, This->pStreams = _recalloc(This->pStreams, This->nTableSize + 32, sizeof(EditStreamTable));
(This->nTableSize + 32) * sizeof(EditStreamTable));
if (This->pStreams == NULL) if (This->pStreams == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->nTableSize += 32; This->nTableSize += 32;
...@@ -530,7 +529,7 @@ static HRESULT WINAPI IAVIEditStream_fnPaste(IAVIEditStream*iface,LONG*plStart, ...@@ -530,7 +529,7 @@ static HRESULT WINAPI IAVIEditStream_fnPaste(IAVIEditStream*iface,LONG*plStart,
if (This->nStreams + nStreams + 1 > This->nTableSize) { if (This->nStreams + nStreams + 1 > This->nTableSize) {
n = This->nStreams + nStreams + 33; n = This->nStreams + nStreams + 33;
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams, n * sizeof(EditStreamTable)); This->pStreams = _recalloc(This->pStreams, n, sizeof(EditStreamTable));
if (This->pStreams == NULL) if (This->pStreams == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->nTableSize = n; This->nTableSize = n;
...@@ -619,8 +618,7 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface, ...@@ -619,8 +618,7 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
if (pEdit == NULL) if (pEdit == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
if (This->nStreams > pEdit->nTableSize) { if (This->nStreams > pEdit->nTableSize) {
pEdit->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pEdit->pStreams, pEdit->pStreams = _recalloc(pEdit->pStreams, This->nStreams, sizeof(EditStreamTable));
This->nStreams * sizeof(EditStreamTable));
if (pEdit->pStreams == NULL) if (pEdit->pStreams == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
pEdit->nTableSize = This->nStreams; pEdit->nTableSize = This->nStreams;
...@@ -702,7 +700,7 @@ static HRESULT WINAPI IEditAVIStream_fnCreate(IAVIStream*iface, ...@@ -702,7 +700,7 @@ static HRESULT WINAPI IEditAVIStream_fnCreate(IAVIStream*iface,
return AVIERR_ERROR; return AVIERR_ERROR;
if (This->pStreams == NULL) { if (This->pStreams == NULL) {
This->pStreams = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 256 * sizeof(EditStreamTable)); This->pStreams = calloc(256, sizeof(EditStreamTable));
if (This->pStreams == NULL) if (This->pStreams == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->nTableSize = 256; This->nTableSize = 256;
...@@ -1010,7 +1008,7 @@ static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream) ...@@ -1010,7 +1008,7 @@ static IAVIEditStreamImpl *AVIFILE_CreateEditStream(IAVIStream *pstream)
{ {
IAVIEditStreamImpl *pedit = NULL; IAVIEditStreamImpl *pedit = NULL;
pedit = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIEditStreamImpl)); pedit = calloc(1, sizeof(IAVIEditStreamImpl));
if (pedit == NULL) if (pedit == NULL)
return NULL; return NULL;
......
...@@ -76,11 +76,7 @@ HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPCVOID lpData, LONG siz ...@@ -76,11 +76,7 @@ HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPCVOID lpData, LONG siz
assert(lpData != NULL); assert(lpData != NULL);
assert(size > 0); assert(size > 0);
if (extra->lp) lp = _recalloc(extra->lp, 1, extra->cb + size + 2 * sizeof(DWORD));
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + size + 2 * sizeof(DWORD));
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 2 * sizeof(DWORD));
if (lp == NULL) if (lp == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -112,11 +108,7 @@ HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO *lpck) ...@@ -112,11 +108,7 @@ HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,const MMCKINFO *lpck)
cb = lpck->cksize + 2 * sizeof(DWORD); cb = lpck->cksize + 2 * sizeof(DWORD);
cb += (cb & 1); cb += (cb & 1);
if (extra->lp != NULL) lp = _recalloc(extra->lp, 1, extra->cb + cb);
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + cb);
else
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
if (lp == NULL) if (lp == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
......
...@@ -82,7 +82,7 @@ static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface) ...@@ -82,7 +82,7 @@ static ULONG WINAPI IClassFactory_fnRelease(IClassFactory *iface)
TRACE("(%p) ref = %lu\n", This, ref); TRACE("(%p) ref = %lu\n", This, ref);
if(!ref) if(!ref)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -140,7 +140,7 @@ static HRESULT AVIFILE_CreateClassFactory(const CLSID *clsid, const IID *riid, v ...@@ -140,7 +140,7 @@ static HRESULT AVIFILE_CreateClassFactory(const CLSID *clsid, const IID *riid, v
*ppv = NULL; *ppv = NULL;
cf = HeapAlloc(GetProcessHeap(), 0, sizeof(*cf)); cf = malloc(sizeof(*cf));
if (!cf) if (!cf)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -77,10 +77,10 @@ static inline IGetFrameImpl *impl_from_IGetFrame(IGetFrame *iface) ...@@ -77,10 +77,10 @@ static inline IGetFrameImpl *impl_from_IGetFrame(IGetFrame *iface)
static void AVIFILE_CloseCompressor(IGetFrameImpl *This) static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
{ {
if (This->lpInFormat != This->lpOutFormat) { if (This->lpInFormat != This->lpOutFormat) {
HeapFree(GetProcessHeap(), 0, This->lpOutFormat); free(This->lpOutFormat);
This->lpOutFormat = NULL; This->lpOutFormat = NULL;
} }
HeapFree(GetProcessHeap(), 0, This->lpInFormat); free(This->lpInFormat);
This->lpInFormat = NULL; This->lpInFormat = NULL;
if (This->hic != NULL) { if (This->hic != NULL) {
if (This->bResize) if (This->bResize)
...@@ -133,7 +133,7 @@ static ULONG WINAPI IGetFrame_fnRelease(IGetFrame *iface) ...@@ -133,7 +133,7 @@ static ULONG WINAPI IGetFrame_fnRelease(IGetFrame *iface)
This->pStream = NULL; This->pStream = NULL;
} }
HeapFree(GetProcessHeap(), 0, iface); free(iface);
} }
return ref; return ref;
...@@ -222,7 +222,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos) ...@@ -222,7 +222,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos)
if (This->cbInBuffer >= readBytes) if (This->cbInBuffer >= readBytes)
break; break;
This->cbInBuffer = This->cbInFormat + readBytes; This->cbInBuffer = This->cbInFormat + readBytes;
This->lpInFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpInFormat, This->cbInBuffer); This->lpInFormat = realloc(This->lpInFormat, This->cbInBuffer);
if (This->lpInFormat == NULL) if (This->lpInFormat == NULL)
return NULL; /* out of memory */ return NULL; /* out of memory */
This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat; This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat;
...@@ -322,7 +322,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, ...@@ -322,7 +322,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart, IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
NULL, &This->cbInFormat); NULL, &This->cbInFormat);
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat + This->cbInBuffer); This->lpInFormat = malloc(This->cbInFormat + This->cbInBuffer);
if (This->lpInFormat == NULL) { if (This->lpInFormat == NULL) {
AVIFILE_CloseCompressor(This); AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -361,8 +361,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, ...@@ -361,8 +361,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
/* need memory for output format? */ /* need memory for output format? */
if (This->lpOutFormat == NULL) { if (This->lpOutFormat == NULL) {
This->lpOutFormat = This->lpOutFormat = malloc(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
if (This->lpOutFormat == NULL) { if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This); AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -430,7 +429,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, ...@@ -430,7 +429,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD); DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage; size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size); This->lpOutFormat = realloc(This->lpOutFormat, size);
if (This->lpOutFormat == NULL) { if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This); AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -492,7 +491,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream) ...@@ -492,7 +491,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream)
if (pStream == NULL) if (pStream == NULL)
return NULL; return NULL;
pg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGetFrameImpl)); pg = calloc(1, sizeof(IGetFrameImpl));
if (pg != NULL) { if (pg != NULL) {
pg->IGetFrame_iface.lpVtbl = &igetframeVtbl; pg->IGetFrame_iface.lpVtbl = &igetframeVtbl;
pg->ref = 1; pg->ref = 1;
......
...@@ -140,7 +140,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface) ...@@ -140,7 +140,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
if (This->hic != NULL) { if (This->hic != NULL) {
if (This->lpbiPrev != NULL) { if (This->lpbiPrev != NULL) {
ICDecompressEnd(This->hic); ICDecompressEnd(This->hic);
HeapFree(GetProcessHeap(), 0, This->lpbiPrev); free(This->lpbiPrev);
This->lpbiPrev = NULL; This->lpbiPrev = NULL;
This->lpPrev = NULL; This->lpPrev = NULL;
} }
...@@ -148,22 +148,22 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface) ...@@ -148,22 +148,22 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
This->hic = NULL; This->hic = NULL;
} }
if (This->lpbiCur != NULL) { if (This->lpbiCur != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiCur); free(This->lpbiCur);
This->lpbiCur = NULL; This->lpbiCur = NULL;
This->lpCur = NULL; This->lpCur = NULL;
} }
if (This->lpbiOutput != NULL) { if (This->lpbiOutput != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiOutput); free(This->lpbiOutput);
This->lpbiOutput = NULL; This->lpbiOutput = NULL;
This->cbOutput = 0; This->cbOutput = 0;
} }
if (This->lpbiInput != NULL) { if (This->lpbiInput != NULL) {
HeapFree(GetProcessHeap(), 0, This->lpbiInput); free(This->lpbiInput);
This->lpbiInput = NULL; This->lpbiInput = NULL;
This->cbInput = 0; This->cbInput = 0;
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
return 0; return 0;
} }
...@@ -425,7 +425,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -425,7 +425,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
assert(This->hic != NULL); assert(This->hic != NULL);
/* get memory for input format */ /* get memory for input format */
This->lpbiInput = HeapAlloc(GetProcessHeap(), 0, formatsize); This->lpbiInput = malloc(formatsize);
if (This->lpbiInput == NULL) if (This->lpbiInput == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->cbInput = formatsize; This->cbInput = formatsize;
...@@ -435,7 +435,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -435,7 +435,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
size = ICCompressGetFormatSize(This->hic, This->lpbiInput); size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
if (size < sizeof(BITMAPINFOHEADER)) if (size < sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR; return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size); This->lpbiOutput = malloc(size);
if (This->lpbiOutput == NULL) if (This->lpbiOutput == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->cbOutput = size; This->cbOutput = size;
...@@ -454,7 +454,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -454,7 +454,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* allocate memory for compressed frame */ /* allocate memory for compressed frame */
size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput); size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput);
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, This->cbOutput + size); This->lpbiCur = malloc(This->cbOutput + size);
if (This->lpbiCur == NULL) if (This->lpbiCur == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput); memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
...@@ -464,7 +464,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -464,7 +464,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if (This->lKeyFrameEvery != 1 && if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) { (This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput); size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size); This->lpbiPrev = malloc(size);
if (This->lpbiPrev == NULL) if (This->lpbiPrev == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK) if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
...@@ -477,7 +477,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, ...@@ -477,7 +477,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* get memory for format and picture */ /* get memory for format and picture */
size += This->lpbiPrev->biSizeImage; size += This->lpbiPrev->biSizeImage;
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size); This->lpbiPrev = realloc(This->lpbiPrev, size);
if (This->lpbiPrev == NULL) if (This->lpbiPrev == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev); This->lpPrev = DIBPTR(This->lpbiPrev);
...@@ -733,7 +733,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv) ...@@ -733,7 +733,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL; *ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl)); pstream = calloc(1, sizeof(IAVIStreamImpl));
if (pstream == NULL) if (pstream == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -742,7 +742,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv) ...@@ -742,7 +742,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv); hr = IAVIStream_QueryInterface(&pstream->IAVIStream_iface, riid, ppv);
if (FAILED(hr)) if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, pstream); free(pstream);
return hr; return hr;
} }
...@@ -900,7 +900,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This) ...@@ -900,7 +900,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
size = ICCompressGetFormatSize(This->hic, lpbi); size = ICCompressGetFormatSize(This->hic, lpbi);
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER)) if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR; return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size); This->lpbiOutput = malloc(size);
if (This->lpbiOutput == NULL) if (This->lpbiOutput == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->cbOutput = size; This->cbOutput = size;
...@@ -922,7 +922,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This) ...@@ -922,7 +922,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* allocate memory for current frame */ /* allocate memory for current frame */
size += This->sInfo.dwSuggestedBufferSize; size += This->sInfo.dwSuggestedBufferSize;
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, size); This->lpbiCur = malloc(size);
if (This->lpbiCur == NULL) if (This->lpbiCur == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput); memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
...@@ -932,7 +932,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This) ...@@ -932,7 +932,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
if (This->lKeyFrameEvery != 1 && if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) { (This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput); size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size); This->lpbiPrev = malloc(size);
if (This->lpbiPrev == NULL) if (This->lpbiPrev == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK) if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
...@@ -945,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This) ...@@ -945,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* get memory for format and picture */ /* get memory for format and picture */
size += This->lpbiPrev->biSizeImage; size += This->lpbiPrev->biSizeImage;
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size ); This->lpbiPrev = realloc(This->lpbiPrev, size);
if (This->lpbiPrev == NULL) if (This->lpbiPrev == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev); This->lpPrev = DIBPTR(This->lpbiPrev);
......
...@@ -93,7 +93,7 @@ static ULONG WINAPI ITmpFile_fnRelease(IAVIFile *iface) ...@@ -93,7 +93,7 @@ static ULONG WINAPI ITmpFile_fnRelease(IAVIFile *iface)
} }
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -222,7 +222,7 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams) ...@@ -222,7 +222,7 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
ITmpFileImpl *tmpFile; ITmpFileImpl *tmpFile;
int i; int i;
tmpFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ITmpFileImpl)); tmpFile = calloc(1, sizeof(ITmpFileImpl));
if (tmpFile == NULL) if (tmpFile == NULL)
return NULL; return NULL;
...@@ -231,9 +231,9 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams) ...@@ -231,9 +231,9 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, const PAVISTREAM *ppStreams)
memset(&tmpFile->fInfo, 0, sizeof(tmpFile->fInfo)); memset(&tmpFile->fInfo, 0, sizeof(tmpFile->fInfo));
tmpFile->fInfo.dwStreams = nStreams; tmpFile->fInfo.dwStreams = nStreams;
tmpFile->ppStreams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(PAVISTREAM)); tmpFile->ppStreams = malloc(nStreams * sizeof(PAVISTREAM));
if (tmpFile->ppStreams == NULL) { if (tmpFile->ppStreams == NULL) {
HeapFree(GetProcessHeap(), 0, tmpFile); free(tmpFile);
return NULL; return NULL;
} }
......
...@@ -169,19 +169,19 @@ static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface) ...@@ -169,19 +169,19 @@ static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface)
if (This->fDirty) if (This->fDirty)
AVIFILE_SaveFile(This); AVIFILE_SaveFile(This);
HeapFree(GetProcessHeap(), 0, This->lpFormat); free(This->lpFormat);
This->lpFormat = NULL; This->lpFormat = NULL;
This->cbFormat = 0; This->cbFormat = 0;
HeapFree(GetProcessHeap(), 0, This->extra.lp); free(This->extra.lp);
This->extra.lp = NULL; This->extra.lp = NULL;
This->extra.cb = 0; This->extra.cb = 0;
HeapFree(GetProcessHeap(), 0, This->szFileName); free(This->szFileName);
This->szFileName = NULL; This->szFileName = NULL;
if (This->hmmio) { if (This->hmmio) {
mmioClose(This->hmmio, 0); mmioClose(This->hmmio, 0);
This->hmmio = NULL; This->hmmio = NULL;
} }
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
...@@ -388,7 +388,7 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO ...@@ -388,7 +388,7 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LO
if ((This->uMode & MMIO_RWMODE) == 0) if ((This->uMode & MMIO_RWMODE) == 0)
return AVIERR_READONLY; return AVIERR_READONLY;
HeapFree(GetProcessHeap(), 0, This->lpFormat); free(This->lpFormat);
This->lpFormat = NULL; This->lpFormat = NULL;
This->cbFormat = 0; This->cbFormat = 0;
...@@ -492,7 +492,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile ...@@ -492,7 +492,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
This->uMode = dwMode; This->uMode = dwMode;
len = lstrlenW(pszFileName) + 1; len = lstrlenW(pszFileName) + 1;
This->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); This->szFileName = malloc(len * sizeof(WCHAR));
if (This->szFileName == NULL) if (This->szFileName == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
lstrcpyW(This->szFileName, pszFileName); lstrcpyW(This->szFileName, pszFileName);
...@@ -504,7 +504,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile ...@@ -504,7 +504,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
LPSTR szFileName; LPSTR szFileName;
len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1, len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1,
NULL, 0, NULL, NULL); NULL, 0, NULL, NULL);
szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR)); szFileName = malloc(len * sizeof(CHAR));
if (szFileName == NULL) if (szFileName == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -512,7 +512,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile ...@@ -512,7 +512,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFile
len, NULL, NULL); len, NULL, NULL);
This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode); This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
HeapFree(GetProcessHeap(), 0, szFileName); free(szFileName);
if (This->hmmio == NULL) if (This->hmmio == NULL)
return AVIERR_FILEOPEN; return AVIERR_FILEOPEN;
} }
...@@ -741,7 +741,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void * ...@@ -741,7 +741,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *
return AVIERR_READONLY; return AVIERR_READONLY;
/* get memory for format and copy it */ /* get memory for format and copy it */
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, formatsize); This->lpFormat = malloc(formatsize);
if (This->lpFormat == NULL) if (This->lpFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -982,7 +982,7 @@ HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface ...@@ -982,7 +982,7 @@ HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface
*ret_iface = NULL; *ret_iface = NULL;
pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pfile)); pfile = calloc(1, sizeof(*pfile));
if (!pfile) if (!pfile)
return AVIERR_MEMORY; return AVIERR_MEMORY;
...@@ -1028,7 +1028,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This) ...@@ -1028,7 +1028,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
return AVIERR_FILEREAD; return AVIERR_FILEREAD;
/* get memory for format and read it */ /* get memory for format and read it */
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, ck.cksize); This->lpFormat = malloc(ck.cksize);
if (This->lpFormat == NULL) if (This->lpFormat == NULL)
return AVIERR_FILEREAD; return AVIERR_FILEREAD;
This->cbFormat = ck.cksize; This->cbFormat = ck.cksize;
...@@ -1117,7 +1117,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This) ...@@ -1117,7 +1117,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
This->cbFormat = sizeof(WAVEFORMATEX); break; This->cbFormat = sizeof(WAVEFORMATEX); break;
}; };
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, This->cbFormat); This->lpFormat = malloc(This->cbFormat);
if (This->lpFormat == NULL) if (This->lpFormat == NULL)
return AVIERR_MEMORY; return AVIERR_MEMORY;
......
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