avifil32: Use HeapAlloc instead of Global/LocalAlloc.

This commit is contained in:
Mike McCormack 2006-03-11 14:42:50 +09:00 committed by Alexandre Julliard
parent 15c5dc12e8
commit dfb5aaf31a
1 changed files with 13 additions and 20 deletions

View File

@ -187,7 +187,7 @@ PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream)
{
IAVIEditStreamImpl *pedit = NULL;
pedit = (IAVIEditStreamImpl*)LocalAlloc(LPTR,sizeof(IAVIEditStreamImpl));
pedit = HeapAlloc(GetProcessHeap(), 0, 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 = GlobalLock(GlobalAlloc(GHND, size1));
fmt1 = HeapAlloc(GetProcessHeap(), 0, size1);
if (fmt1 == NULL)
return FALSE;
if (SUCCEEDED(AVIStreamReadFormat(avi1, start1, fmt1, &size1))) {
fmt2 = GlobalLock(GlobalAlloc(GHND, size1));
fmt2 = HeapAlloc(GetProcessHeap(), 0, size1);
if (fmt2 != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(avi2, start2, fmt2, &size1)))
status = (memcmp(fmt1, fmt2, size1) == 0);
@ -341,12 +341,8 @@ static BOOL AVIFILE_FormatsEqual(PAVISTREAM avi1, PAVISTREAM avi2)
}
if (fmt2 != NULL)
{
GlobalUnlock(GlobalHandle(fmt2));
GlobalFree(GlobalHandle(fmt2));
}
GlobalUnlock(GlobalHandle(fmt1));
GlobalFree(GlobalHandle(fmt1));
HeapFree(GetProcessHeap(), 0, fmt2);
HeapFree(GetProcessHeap(), 0, fmt1);
return status;
}
@ -407,11 +403,10 @@ static ULONG WINAPI IAVIEditStream_fnRelease(IAVIEditStream*iface)
if (This->pStreams[i].pStream != NULL)
IAVIStream_Release(This->pStreams[i].pStream);
}
GlobalUnlock(GlobalHandle(This->pStreams));
GlobalFree(GlobalHandle(This->pStreams));
HeapFree(GetProcessHeap(), 0, This->pStreams);
}
LocalFree((HLOCAL)This);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return ref;
@ -474,8 +469,8 @@ static HRESULT WINAPI IAVIEditStream_fnCut(IAVIEditStream*iface,LONG*plStart,
} else {
/* splitting */
if (This->nStreams + 1 >= This->nTableSize) {
GlobalUnlock(GlobalHandle(This->pStreams));
This->pStreams = GlobalLock(GlobalReAlloc(GlobalHandle(This->pStreams), (This->nTableSize + 32) * sizeof(EditStreamTable), GMEM_SHARE|GHND));
This->pStreams = HeapReAlloc(GetProcessHeap(), 0, This->pStreams,
(This->nTableSize + 32) * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize += 32;
@ -666,8 +661,7 @@ static HRESULT WINAPI IAVIEditStream_fnPaste(IAVIEditStream*iface,LONG*plStart,
if (This->nStreams + nStreams + 1 > This->nTableSize) {
n = This->nStreams + nStreams + 33;
GlobalUnlock(GlobalHandle(This->pStreams));
This->pStreams = GlobalLock(GlobalReAlloc(GlobalHandle(This->pStreams), n * sizeof(EditStreamTable), GMEM_SHARE|GHND));
This->pStreams = HeapReAlloc(GetProcessHeap(), 0, This->pStreams, n * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = n;
@ -756,8 +750,8 @@ static HRESULT WINAPI IAVIEditStream_fnClone(IAVIEditStream*iface,
if (pEdit == NULL)
return AVIERR_MEMORY;
if (This->nStreams > pEdit->nTableSize) {
GlobalUnlock(GlobalHandle(pEdit->pStreams));
pEdit->pStreams = GlobalLock(GlobalReAlloc(GlobalHandle(pEdit->pStreams), This->nStreams * sizeof(EditStreamTable), GMEM_SHARE|GHND));
pEdit->pStreams = HeapReAlloc(GetProcessHeap(), 0, pEdit->pStreams,
This->nStreams * sizeof(EditStreamTable));
if (pEdit->pStreams == NULL)
return AVIERR_MEMORY;
pEdit->nTableSize = This->nStreams;
@ -845,8 +839,7 @@ static HRESULT WINAPI IEditAVIStream_fnCreate(IAVIStream*iface,
return AVIERR_ERROR;
if (This->pStreams == NULL) {
This->pStreams =
GlobalLock(GlobalAlloc(GMEM_SHARE|GHND, 256 * sizeof(EditStreamTable)));
This->pStreams = HeapAlloc(GetProcessHeap(), 0, 256 * sizeof(EditStreamTable));
if (This->pStreams == NULL)
return AVIERR_MEMORY;
This->nTableSize = 256;