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