Commit 41d6b67c authored by Michael Günnewig's avatar Michael Günnewig Committed by Alexandre Julliard

Fixed usage of GlobaReAlloc.

parent 9d2e0985
......@@ -467,6 +467,9 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
/* need bigger source buffer? */
if (This->acmStreamHdr.pbSrc == NULL ||
This->acmStreamHdr.dwSrcUser < size) {
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)
......@@ -568,6 +571,9 @@ static HRESULT WINAPI ACMStream_fnWrite(IAVIStream *iface, LONG start,
/* Need bigger destination buffer? */
if (This->acmStreamHdr.pbDst == NULL ||
This->acmStreamHdr.dwDstUser < size) {
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)
......
......@@ -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) {
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, max(size, This->sInfo.dwSuggestedBufferSize), GMEM_MOVEABLE);
(LPDWORD)GlobalReAllocPtr(This->lpBuffer, maxSize, GMEM_MOVEABLE);
if (This->lpBuffer == NULL)
return AVIERR_MEMORY;
This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);
......
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