Fixed usage of GlobaReAlloc.

This commit is contained in:
Michael Günnewig 2003-10-14 20:06:23 +00:00 committed by Alexandre Julliard
parent 9d2e09851b
commit 41d6b67c7f
2 changed files with 31 additions and 8 deletions

View File

@ -467,8 +467,11 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* need bigger source buffer? */
if (This->acmStreamHdr.pbSrc == NULL ||
This->acmStreamHdr.dwSrcUser < size) {
This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc,
size, GMEM_MOVEABLE);
if (This->acmStreamHdr.pbSrc == NULL)
This->acmStreamHdr.pbSrc = GlobalAllocPtr(GMEM_MOVEABLE, size);
else
This->acmStreamHdr.pbSrc = GlobalReAllocPtr(This->acmStreamHdr.pbSrc,
size, GMEM_MOVEABLE);
if (This->acmStreamHdr.pbSrc == NULL)
return AVIERR_MEMORY;
This->acmStreamHdr.dwSrcUser = size;
@ -568,8 +571,11 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need bigger destination buffer? */
if (This->acmStreamHdr.pbDst == NULL ||
This->acmStreamHdr.dwDstUser < size) {
This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst,
size, GMEM_MOVEABLE);
if (This->acmStreamHdr.pbDst == NULL)
This->acmStreamHdr.pbDst = GlobalAllocPtr(GMEM_MOVEABLE, size);
else
This->acmStreamHdr.pbDst = GlobalReAllocPtr(This->acmStreamHdr.pbDst,
size, GMEM_MOVEABLE);
if (This->acmStreamHdr.pbDst == NULL)
return AVIERR_MEMORY;
This->acmStreamHdr.dwDstUser = size;

View File

@ -1382,7 +1382,13 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
UINT n = This->sInfo.dwFormatChangeCount;
This->nIdxFmtChanges += 16;
This->idxFmtChanges = GlobalReAllocPtr(This->idxFmtChanges, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
if (This->idxFmtChanges == NULL)
This->idxFmtChanges =
GlobalAllocPtr(GHND, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
else
This->idxFmtChanges =
GlobalReAllocPtr(This->idxFmtChanges,
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
if (This->idxFmtChanges == NULL)
return AVIERR_MEMORY;
@ -1413,7 +1419,13 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
/* get memory for index */
if (This->idxFrames == NULL || This->lLastFrame + 1 >= This->nIdxFrames) {
This->nIdxFrames += 512;
This->idxFrames = GlobalReAllocPtr(This->idxFrames, This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
if (This->idxFrames == NULL)
This->idxFrames =
GlobalAllocPtr(GHND, This->nIdxFrames * sizeof(AVIINDEXENTRY));
else
This->idxFrames =
GlobalReAllocPtr(This->idxFrames,
This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
if (This->idxFrames == NULL)
return AVIERR_MEMORY;
}
@ -2016,8 +2028,13 @@ static HRESULT AVIFILE_ReadBlock(IAVIStreamImpl *This, DWORD pos,
/* check that buffer is big enough -- don't trust dwSuggestedBufferSize */
if (This->lpBuffer == NULL || size < This->cbBuffer) {
This->lpBuffer =
(LPDWORD)GlobalReAllocPtr(This->lpBuffer, max(size, This->sInfo.dwSuggestedBufferSize), GMEM_MOVEABLE);
DWORD maxSize = max(size, This->sInfo.dwSuggestedBufferSize);
if (This->lpBuffer == NULL)
This->lpBuffer = (LPDWORD)GlobalAllocPtr(GMEM_MOVEABLE, maxSize);
else
This->lpBuffer =
(LPDWORD)GlobalReAllocPtr(This->lpBuffer, maxSize, GMEM_MOVEABLE);
if (This->lpBuffer == NULL)
return AVIERR_MEMORY;
This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);