Commit dfb5aaf3 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

avifil32: Use HeapAlloc instead of Global/LocalAlloc.

parent 15c5dc12
......@@ -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;
......
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