Module: wine Branch: refs/heads/master Commit: dfb5aaf31a26f82200f19dd7ba97805d27f5eee7 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=dfb5aaf31a26f82200f19dd7...
Author: Mike McCormack mike@codeweavers.com Date: Sat Mar 11 14:42:50 2006 +0900
avifil32: Use HeapAlloc instead of Global/LocalAlloc.
---
dlls/avifil32/editstream.c | 33 +++++++++++++-------------------- 1 files changed, 13 insertions(+), 20 deletions(-)
diff --git a/dlls/avifil32/editstream.c b/dlls/avifil32/editstream.c index 29f6a4d..858ddb7 100644 --- a/dlls/avifil32/editstream.c +++ b/dlls/avifil32/editstream.c @@ -187,7 +187,7 @@ PAVIEDITSTREAM AVIFILE_CreateEditStream( { 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(PAVISTR 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(PAVISTR }
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_fnR 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_fnC } 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_fnP 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_fnC 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_fnC 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;