avifil32: Fix a regression caused by patch removing GlobalAllocs by using HEAP_ZERO_INIT.

oldstable
Mike McCormack 2006-04-11 20:44:02 +09:00 committed by Alexandre Julliard
parent 819565be21
commit aebc88d54b
9 changed files with 42 additions and 42 deletions

View File

@ -115,7 +115,7 @@ HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIStreamImpl));
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl));
if (pstream == NULL)
return AVIERR_MEMORY;
@ -712,7 +712,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
if (This->lpOutFormat == NULL) {
/* we must decode to default format */
This->cbOutFormat = sizeof(PCMWAVEFORMAT);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
This->lpOutFormat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->cbOutFormat);
if (This->lpOutFormat == NULL)
return AVIERR_MEMORY;

View File

@ -1050,7 +1050,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
if (cbFilter < 2)
return AVIERR_BADSIZE;
lp = HeapAlloc(GetProcessHeap(), 0, MAX_FILTERS * sizeof(AVIFilter));
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_FILTERS * sizeof(AVIFilter));
if (lp == NULL)
return AVIERR_MEMORY;
@ -1273,7 +1273,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
sInfo.dwStart, &size);
if (size < (LONG)sizeof(PCMWAVEFORMAT))
size = sizeof(PCMWAVEFORMAT);
afmtc.pwfxEnum = HeapAlloc(GetProcessHeap(), 0, size);
afmtc.pwfxEnum = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (afmtc.pwfxEnum != NULL) {
AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
sInfo.dwStart, afmtc.pwfxEnum, &size);
@ -1318,7 +1318,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
szFormat[0] = 0;
/* read format to build format description string */
lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
lpFormat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (lpFormat != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
if (sInfo.fccType == streamtypeVIDEO) {
@ -1481,7 +1481,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
/* save options in case the user presses cancel */
if (ppOptions != NULL && nStreams > 1) {
pSavedOptions = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(AVICOMPRESSOPTIONS));
pSavedOptions = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nStreams * sizeof(AVICOMPRESSOPTIONS));
if (pSavedOptions == NULL)
return FALSE;
@ -1719,7 +1719,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
}
/* allocate buffer for formats, data, etc. of an initial size of 64 kBytes*/
lpBuffer = HeapAlloc(GetProcessHeap(), 0, cbBuffer = 0x00010000);
lpBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cbBuffer = 0x00010000);
if (lpBuffer == NULL) {
hres = AVIERR_MEMORY;
goto error;
@ -1862,7 +1862,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
lFirstVideo - lStart[curStream], lpBuffer,
cbBuffer, &lReadBytes, &lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))
@ -1931,7 +1931,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))
@ -1977,7 +1977,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))

View File

@ -239,7 +239,7 @@ HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pfile = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIFileImpl));
pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl));
if (pfile == NULL)
return AVIERR_MEMORY;
@ -421,7 +421,7 @@ static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis,
/* now it seems to be save to add the stream */
assert(This->ppStreams[n] == NULL);
This->ppStreams[n] = HeapAlloc(GetProcessHeap(), 0,
This->ppStreams[n] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IAVIStreamImpl));
if (This->ppStreams[n] == NULL)
return AVIERR_MEMORY;
@ -1389,10 +1389,10 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
This->nIdxFmtChanges += 16;
if (This->idxFmtChanges == NULL)
This->idxFmtChanges =
HeapAlloc(GetProcessHeap(), 0, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
else
This->idxFmtChanges =
HeapReAlloc(GetProcessHeap(), 0, This->idxFmtChanges,
HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxFmtChanges,
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
if (This->idxFmtChanges == NULL)
return AVIERR_MEMORY;
@ -1425,9 +1425,9 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
if (This->idxFrames == NULL || This->lLastFrame + 1 >= This->nIdxFrames) {
This->nIdxFrames += 512;
if (This->idxFrames == NULL)
This->idxFrames = HeapAlloc(GetProcessHeap(), 0, This->nIdxFrames * sizeof(AVIINDEXENTRY));
This->idxFrames = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->nIdxFrames * sizeof(AVIINDEXENTRY));
else
This->idxFrames = HeapReAlloc(GetProcessHeap(), 0, This->idxFrames,
This->idxFrames = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->idxFrames,
This->nIdxFrames * sizeof(AVIINDEXENTRY));
if (This->idxFrames == NULL)
return AVIERR_MEMORY;
@ -1453,7 +1453,7 @@ static HRESULT AVIFILE_AddRecord(IAVIFileImpl *This)
if (This->idxRecords == NULL || This->cbIdxRecords == 0) {
This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY);
This->idxRecords = HeapAlloc(GetProcessHeap(), 0, This->cbIdxRecords);
This->idxRecords = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->cbIdxRecords);
if (This->idxRecords == NULL)
return AVIERR_MEMORY;
}
@ -1528,14 +1528,14 @@ static void AVIFILE_ConstructAVIStream(IAVIFileImpl *paf, DWORD nr, LPAVISTRE
if (asi->dwLength > 0) {
/* pre-allocate mem for frame-index structure */
pstream->idxFrames =
HeapAlloc(GetProcessHeap(), 0, asi->dwLength * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asi->dwLength * sizeof(AVIINDEXENTRY));
if (pstream->idxFrames != NULL)
pstream->nIdxFrames = asi->dwLength;
}
if (asi->dwFormatChangeCount > 0) {
/* pre-allocate mem for formatchange-index structure */
pstream->idxFmtChanges =
HeapAlloc(GetProcessHeap(), 0, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
if (pstream->idxFmtChanges != NULL)
pstream->nIdxFmtChanges = asi->dwFormatChangeCount;
}
@ -1675,7 +1675,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
if (ckLIST2.ckid == FOURCC_LIST &&
ckLIST2.fccType == listtypeSTREAMHEADER) {
pStream = This->ppStreams[nStream] =
HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIStreamImpl));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl));
if (pStream == NULL)
return AVIERR_MEMORY;
AVIFILE_ConstructAVIStream(This, nStream, NULL);
@ -1940,7 +1940,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
pStream->nIdxFrames = pStream->sInfo.dwLength;
pStream->idxFrames =
HeapAlloc(GetProcessHeap(), 0, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
pStream->nIdxFrames = 0;
return AVIERR_MEMORY;

View File

@ -187,7 +187,7 @@ PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream)
{
IAVIEditStreamImpl *pedit = NULL;
pedit = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIEditStreamImpl));
pedit = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIEditStreamImpl));
if (pedit == NULL)
return NULL;
@ -329,11 +329,11 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2)
return FALSE;
/* sizes match, now get formats and compare them */
fmt1 = HeapAlloc(GetProcessHeap(), 0, size1);
fmt1 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size1);
if (fmt1 == NULL)
return FALSE;
if (SUCCEEDED(AVIStreamReadFormat(avi1, start1, fmt1, &size1))) {
fmt2 = HeapAlloc(GetProcessHeap(), 0, size1);
fmt2 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size1);
if (fmt2 != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(avi2, start2, fmt2, &size1)))
status = (memcmp(fmt1, fmt2, size1) == 0);
@ -469,7 +469,7 @@ static HRESULT WINAPI IAVIEditStream_fnCut(IAVIEditStream*iface,LONG*plStart,
} else {
/* splitting */
if (This->nStreams + 1 >= This->nTableSize) {
This->pStreams = HeapReAlloc(GetProcessHeap(), 0, This->pStreams,
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams,
(This->nTableSize + 32) * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
@ -661,7 +661,7 @@ static HRESULT WINAPI IAVIEditStream_fnPaste(IAVIEditStream*iface,LONG*plStart,
if (This->nStreams + nStreams + 1 > This->nTableSize) {
n = This->nStreams + nStreams + 33;
This->pStreams = HeapReAlloc(GetProcessHeap(), 0, This->pStreams, n * sizeof(EditStreamTable));
This->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pStreams, n * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = n;
@ -750,7 +750,7 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
if (pEdit == NULL)
return AVIERR_MEMORY;
if (This->nStreams > pEdit->nTableSize) {
pEdit->pStreams = HeapReAlloc(GetProcessHeap(), 0, pEdit->pStreams,
pEdit->pStreams = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pEdit->pStreams,
This->nStreams * sizeof(EditStreamTable));
if (pEdit->pStreams == NULL)
return AVIERR_MEMORY;
@ -839,7 +839,7 @@ static HRESULT WINAPI IEditAVIStream_fnCreate(IAVIStream*iface,
return AVIERR_ERROR;
if (This->pStreams == NULL) {
This->pStreams = HeapAlloc(GetProcessHeap(), 0, 256 * sizeof(EditStreamTable));
This->pStreams = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 256 * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = 256;

View File

@ -80,9 +80,9 @@ HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPVOID lpData,
assert(size > 0);
if (extra->lp)
lp = HeapReAlloc(GetProcessHeap(), 0, extra->lp, extra->cb + size + 2 * sizeof(DWORD));
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + size + 2 * sizeof(DWORD));
else
lp = HeapAlloc(GetProcessHeap(), 0, size + 2 * sizeof(DWORD));
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + 2 * sizeof(DWORD));
if (lp == NULL)
return AVIERR_MEMORY;
@ -116,9 +116,9 @@ HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,MMCKINFO *lpck)
cb += (cb & 1);
if (extra->lp != NULL)
lp = HeapReAlloc(GetProcessHeap(), 0, extra->lp, extra->cb + cb);
lp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, extra->lp, extra->cb + cb);
else
lp = HeapAlloc(GetProcessHeap(), 0, cb);
lp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb);
if (lp == NULL)
return AVIERR_MEMORY;

View File

@ -123,7 +123,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream)
if (pStream == NULL)
return NULL;
pg = HeapAlloc(GetProcessHeap(), 0, sizeof(IGetFrameImpl));
pg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IGetFrameImpl));
if (pg != NULL) {
pg->lpVtbl = &igetframeVtbl;
pg->ref = 1;
@ -366,7 +366,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
NULL, &This->cbInFormat);
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat + This->cbInBuffer);
This->lpInFormat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->cbInFormat + This->cbInBuffer);
if (This->lpInFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
@ -406,7 +406,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
/* need memory for output format? */
if (This->lpOutFormat == NULL) {
This->lpOutFormat =
HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;

View File

@ -127,7 +127,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pstream = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIStreamImpl));
pstream = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIStreamImpl));
if (pstream == NULL)
return AVIERR_MEMORY;
@ -488,7 +488,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
if (size < sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiOutput = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
@ -517,7 +517,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
@ -913,7 +913,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
size = ICCompressGetFormatSize(This->hic, lpbi);
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiOutput = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
@ -945,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)

View File

@ -76,7 +76,7 @@ PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, PAVISTREAM *ppStreams) {
ITmpFileImpl *tmpFile;
int i;
tmpFile = HeapAlloc(GetProcessHeap(), 0, sizeof(ITmpFileImpl));
tmpFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ITmpFileImpl));
if (tmpFile == NULL)
return NULL;

View File

@ -224,7 +224,7 @@ HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pfile = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIFileImpl));
pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl));
if (pfile == NULL)
return AVIERR_MEMORY;