avifil32: Fix some gcc 4.1 warnings cause by windowsx.h macros.

This commit is contained in:
Mike McCormack 2006-03-11 00:21:42 +09:00 committed by Alexandre Julliard
parent e1ca87732b
commit 610fc08e8d
5 changed files with 92 additions and 108 deletions

View File

@ -30,7 +30,6 @@
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "windowsx.h"
#include "ole2.h"
#include "shellapi.h"
@ -215,7 +214,7 @@ HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
if (len <= 0)
return AVIERR_BADPARAM;
wszFile = (LPWSTR)LocalAlloc(LPTR, len * sizeof(WCHAR));
wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (wszFile == NULL)
return AVIERR_MEMORY;
@ -223,7 +222,7 @@ HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
LocalFree((HLOCAL)wszFile);
HeapFree(GetProcessHeap(), 0, wszFile);
return hr;
}
@ -1009,7 +1008,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
szFilter[0] = 0;
szFilter[1] = 0;
wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter * sizeof(WCHAR));
wszFilter = HeapAlloc(GetProcessHeap(), 0, cbFilter * sizeof(WCHAR));
if (wszFilter == NULL)
return AVIERR_MEMORY;
@ -1019,7 +1018,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
szFilter, cbFilter, NULL, NULL);
}
GlobalFreePtr(wszFilter);
HeapFree(GetProcessHeap(), 0, wszFilter);
return hr;
}
@ -1051,7 +1050,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
if (cbFilter < 2)
return AVIERR_BADSIZE;
lp = (AVIFilter*)GlobalAllocPtr(GHND, MAX_FILTERS * sizeof(AVIFilter));
lp = HeapAlloc(GetProcessHeap(), 0, MAX_FILTERS * sizeof(AVIFilter));
if (lp == NULL)
return AVIERR_MEMORY;
@ -1065,7 +1064,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
* collection of all possible extensions except "*.*".
*/
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) {
GlobalFreePtr(lp);
HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_ERROR;
}
for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)) == S_OK;n++) {
@ -1113,7 +1112,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
/* 2. get descriptions for the CLSIDs and fill out szFilter */
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != S_OK) {
GlobalFreePtr(lp);
HeapFree(GetProcessHeap(), 0, lp);
return AVIERR_ERROR;
}
for (n = 0; n <= count; n++) {
@ -1132,7 +1131,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
if (cbFilter < size + lstrlenW(lp[n].szExtensions) + 2) {
szFilter[0] = 0;
szFilter[1] = 0;
GlobalFreePtr(lp);
HeapFree(GetProcessHeap(), 0, lp);
RegCloseKey(hKey);
return AVIERR_BUFFERTOOSMALL;
}
@ -1147,7 +1146,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
}
RegCloseKey(hKey);
GlobalFreePtr(lp);
HeapFree(GetProcessHeap(), 0, lp);
/* add "All files" "*.*" filter if enough space left */
size = LoadStringW(AVIFILE_hModule, IDS_ALLFILES,
@ -1258,10 +1257,10 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size);
if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
pOptions->lpFormat = GlobalAllocPtr(GMEM_MOVEABLE, size);
pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
pOptions->cbFormat = size;
} else if (pOptions->cbFormat < (DWORD)size) {
pOptions->lpFormat = GlobalReAllocPtr(pOptions->lpFormat, size, GMEM_MOVEABLE);
pOptions->lpFormat = HeapReAlloc(GetProcessHeap(), 0, pOptions->lpFormat, size);
pOptions->cbFormat = size;
}
if (pOptions->lpFormat == NULL)
@ -1274,7 +1273,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
sInfo.dwStart, &size);
if (size < (LONG)sizeof(PCMWAVEFORMAT))
size = sizeof(PCMWAVEFORMAT);
afmtc.pwfxEnum = GlobalAllocPtr(GHND, size);
afmtc.pwfxEnum = HeapAlloc(GetProcessHeap(), 0, size);
if (afmtc.pwfxEnum != NULL) {
AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
sInfo.dwStart, afmtc.pwfxEnum, &size);
@ -1286,7 +1285,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
pOptions->dwFlags |= AVICOMPRESSF_VALID;
if (afmtc.pwfxEnum != NULL)
GlobalFreePtr(afmtc.pwfxEnum);
HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
return (ret == S_OK ? TRUE : FALSE);
} else {
@ -1319,7 +1318,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
szFormat[0] = 0;
/* read format to build format description string */
lpFormat = GlobalAllocPtr(GHND, size);
lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
if (lpFormat != NULL) {
if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
if (sInfo.fccType == streamtypeVIDEO) {
@ -1366,7 +1365,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
}
}
}
GlobalFreePtr(lpFormat);
HeapFree(GetProcessHeap(), 0, lpFormat);
}
/* set text for format description */
@ -1410,8 +1409,7 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
/* select first stream */
SendDlgItemMessageW(hWnd, IDC_STREAM, CB_SETCURSEL, 0, 0);
SendMessageW(hWnd, WM_COMMAND,
GET_WM_COMMAND_MPS(IDC_STREAM, hWnd, CBN_SELCHANGE));
SendMessageW(hWnd, WM_COMMAND, MAKELONG(IDC_STREAM, CBN_SELCHANGE), (LPARAM)hWnd);
/* initialize interleave */
if (SaveOpts.ppOptions[0] != NULL &&
@ -1427,7 +1425,7 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
break;
case WM_COMMAND:
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
switch (LOWORD(wParam)) {
case IDOK:
/* get data from controls and save them */
dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
@ -1443,14 +1441,14 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
}
/* fall through */
case IDCANCEL:
EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
EndDialog(hWnd, LOWORD(wParam) == IDOK);
break;
case IDC_INTERLEAVE:
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY),
IsDlgButtonChecked(hWnd, IDC_INTERLEAVE));
break;
case IDC_STREAM:
if (GET_WM_COMMAND_CMD(wParam, lParam) == CBN_SELCHANGE) {
if (HIWORD(wParam) == CBN_SELCHANGE) {
/* update control elements */
AVISaveOptionsUpdate(hWnd);
}
@ -1483,7 +1481,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
/* save options in case the user presses cancel */
if (ppOptions != NULL && nStreams > 1) {
pSavedOptions = GlobalAllocPtr(GHND,nStreams * sizeof(AVICOMPRESSOPTIONS));
pSavedOptions = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(AVICOMPRESSOPTIONS));
if (pSavedOptions == NULL)
return FALSE;
@ -1512,7 +1510,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
}
}
GlobalFreePtr(pSavedOptions);
HeapFree(GetProcessHeap(), 0, pSavedOptions);
}
return (BOOL)ret;
@ -1534,12 +1532,12 @@ HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions)
ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
if (ppOptions[nStreams]->lpParms != NULL) {
GlobalFreePtr(ppOptions[nStreams]->lpParms);
HeapFree(GetProcessHeap(), 0, ppOptions[nStreams]->lpParms);
ppOptions[nStreams]->lpParms = NULL;
ppOptions[nStreams]->cbParms = 0;
}
if (ppOptions[nStreams]->lpFormat != NULL) {
GlobalFreePtr(ppOptions[nStreams]->lpFormat);
HeapFree(GetProcessHeap(), 0, ppOptions[nStreams]->lpFormat);
ppOptions[nStreams]->lpFormat = NULL;
ppOptions[nStreams]->cbFormat = 0;
}
@ -1571,7 +1569,7 @@ HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
if (len <= 0)
return AVIERR_BADPARAM;
wszFile = LocalAlloc(LPTR, len * sizeof(WCHAR));
wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (wszFile == NULL)
return AVIERR_MEMORY;
@ -1580,7 +1578,7 @@ HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
nStream, ppavi, plpOptions);
LocalFree((HLOCAL)wszFile);
HeapFree(GetProcessHeap(), 0, wszFile);
return hr;
}
@ -1721,7 +1719,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
}
/* allocate buffer for formats, data, etc. of an initial size of 64 kBytes*/
lpBuffer = GlobalAllocPtr(GPTR, cbBuffer = 0x00010000);
lpBuffer = HeapAlloc(GetProcessHeap(), 0, cbBuffer = 0x00010000);
if (lpBuffer == NULL) {
hres = AVIERR_MEMORY;
goto error;
@ -1864,7 +1862,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
lFirstVideo - lStart[curStream], lpBuffer,
cbBuffer, &lReadBytes, &lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))
@ -1933,7 +1931,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))
@ -1979,7 +1977,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
if (lpBuffer == NULL)
hres = AVIERR_MEMORY;
if (FAILED(hres))
@ -2009,7 +2007,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
error:
if (lpBuffer != NULL)
GlobalFreePtr(lpBuffer);
HeapFree(GetProcessHeap(), 0, lpBuffer);
if (pfile != NULL) {
for (curStream = 0; curStream < nStreams; curStream++) {
if (pOutStreams[curStream] != NULL)

View File

@ -316,13 +316,13 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
}
if (This->idxRecords != NULL) {
GlobalFreePtr(This->idxRecords);
HeapFree(GetProcessHeap(), 0, This->idxRecords);
This->idxRecords = NULL;
This->nIdxRecords = 0;
}
if (This->fileextra.lp != NULL) {
GlobalFreePtr(This->fileextra.lp);
HeapFree(GetProcessHeap(), 0, This->fileextra.lp);
This->fileextra.lp = NULL;
This->fileextra.cb = 0;
}
@ -956,7 +956,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
if (This->paf->dwMoviChunkPos != 0)
return AVIERR_ERROR; /* user has used API in wrong sequnece! */
This->lpFormat = GlobalAllocPtr(GMEM_MOVEABLE, formatsize);
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, formatsize);
if (This->lpFormat == NULL)
return AVIERR_MEMORY;
This->cbFormat = formatsize;
@ -1007,7 +1007,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* simply say all colors have changed */
ck.ckid = MAKEAVICKID(cktypePALchange, This->nStream);
ck.cksize = 2 * sizeof(WORD) + lpbiOld->biClrUsed * sizeof(PALETTEENTRY);
lppc = (AVIPALCHANGE*)GlobalAllocPtr(GMEM_MOVEABLE, ck.cksize);
lppc = HeapAlloc(GetProcessHeap(), 0, ck.cksize);
if (lppc == NULL)
return AVIERR_MEMORY;
@ -1031,7 +1031,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
return AVIERR_FILEWRITE;
This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD);
GlobalFreePtr(lppc);
HeapFree(GetProcessHeap(), 0, lppc);
return AVIFILE_AddFrame(This, cktypePALchange, n, ck.dwDataOffset, 0);
}
@ -1390,11 +1390,11 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
This->nIdxFmtChanges += 16;
if (This->idxFmtChanges == NULL)
This->idxFmtChanges =
GlobalAllocPtr(GHND, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), 0, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
else
This->idxFmtChanges =
GlobalReAllocPtr(This->idxFmtChanges,
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
HeapReAlloc(GetProcessHeap(), 0, This->idxFmtChanges,
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
if (This->idxFmtChanges == NULL)
return AVIERR_MEMORY;
@ -1426,12 +1426,10 @@ static HRESULT AVIFILE_AddFrame(IAVIStreamImpl *This, DWORD ckid, DWORD size, DW
if (This->idxFrames == NULL || This->lLastFrame + 1 >= This->nIdxFrames) {
This->nIdxFrames += 512;
if (This->idxFrames == NULL)
This->idxFrames =
GlobalAllocPtr(GHND, This->nIdxFrames * sizeof(AVIINDEXENTRY));
This->idxFrames = HeapAlloc(GetProcessHeap(), 0, This->nIdxFrames * sizeof(AVIINDEXENTRY));
else
This->idxFrames =
GlobalReAllocPtr(This->idxFrames,
This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
This->idxFrames = HeapReAlloc(GetProcessHeap(), 0, This->idxFrames,
This->nIdxFrames * sizeof(AVIINDEXENTRY));
if (This->idxFrames == NULL)
return AVIERR_MEMORY;
}
@ -1456,7 +1454,7 @@ static HRESULT AVIFILE_AddRecord(IAVIFileImpl *This)
if (This->idxRecords == NULL || This->cbIdxRecords == 0) {
This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY);
This->idxRecords = GlobalAllocPtr(GHND, This->cbIdxRecords);
This->idxRecords = HeapAlloc(GetProcessHeap(), 0, This->cbIdxRecords);
if (This->idxRecords == NULL)
return AVIERR_MEMORY;
}
@ -1531,14 +1529,14 @@ static void AVIFILE_ConstructAVIStream(IAVIFileImpl *paf, DWORD nr, LPAVISTRE
if (asi->dwLength > 0) {
/* pre-allocate mem for frame-index structure */
pstream->idxFrames =
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, asi->dwLength * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), 0, asi->dwLength * sizeof(AVIINDEXENTRY));
if (pstream->idxFrames != NULL)
pstream->nIdxFrames = asi->dwLength;
}
if (asi->dwFormatChangeCount > 0) {
/* pre-allocate mem for formatchange-index structure */
pstream->idxFmtChanges =
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), 0, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
if (pstream->idxFmtChanges != NULL)
pstream->nIdxFmtChanges = asi->dwFormatChangeCount;
}
@ -1564,16 +1562,16 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
This->lLastFrame = -1;
This->paf = NULL;
if (This->idxFrames != NULL) {
GlobalFreePtr(This->idxFrames);
HeapFree(GetProcessHeap(), 0, This->idxFrames);
This->idxFrames = NULL;
This->nIdxFrames = 0;
}
if (This->idxFmtChanges != NULL) {
GlobalFreePtr(This->idxFmtChanges);
HeapFree(GetProcessHeap(), 0, This->idxFmtChanges);
This->idxFmtChanges = NULL;
}
if (This->lpBuffer != NULL) {
GlobalFreePtr(This->lpBuffer);
HeapFree(GetProcessHeap(), 0, This->lpBuffer);
This->lpBuffer = NULL;
This->cbBuffer = 0;
}
@ -1583,12 +1581,12 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
This->cbHandlerData = 0;
}
if (This->extra.lp != NULL) {
GlobalFreePtr(This->extra.lp);
HeapFree(GetProcessHeap(), 0, This->extra.lp);
This->extra.lp = NULL;
This->extra.cb = 0;
}
if (This->lpFormat != NULL) {
GlobalFreePtr(This->lpFormat);
HeapFree(GetProcessHeap(), 0, This->lpFormat);
This->lpFormat = NULL;
This->cbFormat = 0;
}
@ -1918,8 +1916,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
HRESULT hr = AVIERR_OK;
BOOL bAbsolute = TRUE;
lp = (AVIINDEXENTRY*)GlobalAllocPtr(GMEM_MOVEABLE,
IDX_PER_BLOCK * sizeof(AVIINDEXENTRY));
lp = HeapAlloc(GetProcessHeap(), 0, IDX_PER_BLOCK * sizeof(AVIINDEXENTRY));
if (lp == NULL)
return AVIERR_MEMORY;
@ -1930,7 +1927,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
pStream->lLastFrame = -1;
if (pStream->idxFrames != NULL) {
GlobalFreePtr(pStream->idxFrames);
HeapFree(GetProcessHeap(), 0, pStream->idxFrames);
pStream->idxFrames = NULL;
pStream->nIdxFrames = 0;
}
@ -1946,7 +1943,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
pStream->nIdxFrames = pStream->sInfo.dwLength;
pStream->idxFrames =
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
HeapAlloc(GetProcessHeap(), 0, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
pStream->nIdxFrames = 0;
return AVIERR_MEMORY;
@ -1971,7 +1968,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
}
if (lp != NULL)
GlobalFreePtr(lp);
HeapFree(GetProcessHeap(), 0, lp);
/* checking ... */
for (n = 0; n < This->fInfo.dwStreams; n++) {
@ -2040,10 +2037,9 @@ static HRESULT AVIFILE_ReadBlock(IAVIStreamImpl *This, DWORD pos,
DWORD maxSize = max(size, This->sInfo.dwSuggestedBufferSize);
if (This->lpBuffer == NULL)
This->lpBuffer = (LPDWORD)GlobalAllocPtr(GMEM_MOVEABLE, maxSize);
This->lpBuffer = HeapAlloc(GetProcessHeap(), 0, maxSize);
else
This->lpBuffer =
(LPDWORD)GlobalReAllocPtr(This->lpBuffer, maxSize, GMEM_MOVEABLE);
This->lpBuffer = HeapReAlloc(GetProcessHeap(), 0, This->lpBuffer, maxSize);
if (This->lpBuffer == NULL)
return AVIERR_MEMORY;
This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);

View File

@ -23,7 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "windowsx.h"
#include "wingdi.h"
#include "winuser.h"
#include "vfw.h"
@ -99,11 +98,11 @@ typedef struct _IGetFrameImpl {
static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
{
if (This->lpOutFormat != NULL && This->lpInFormat != This->lpOutFormat) {
GlobalFreePtr(This->lpOutFormat);
HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
This->lpOutFormat = NULL;
}
if (This->lpInFormat != NULL) {
GlobalFreePtr(This->lpInFormat);
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
This->lpInFormat = NULL;
}
if (This->hic != NULL) {
@ -124,7 +123,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream)
if (pStream == NULL)
return NULL;
pg = (IGetFrameImpl*)LocalAlloc(LPTR, sizeof(IGetFrameImpl));
pg = HeapAlloc(GetProcessHeap(), 0, sizeof(IGetFrameImpl));
if (pg != NULL) {
pg->lpVtbl = &igetframeVtbl;
pg->ref = 1;
@ -176,7 +175,7 @@ static ULONG WINAPI IGetFrame_fnRelease(IGetFrame *iface)
This->pStream = NULL;
}
LocalFree((HLOCAL)iface);
HeapFree(GetProcessHeap(), 0, iface);
return 0;
}
@ -266,7 +265,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos)
if (This->cbInBuffer >= readBytes)
break;
This->cbInBuffer = This->cbInFormat + readBytes;
This->lpInFormat = GlobalReAllocPtr(This->lpInFormat, This->cbInBuffer, 0);
This->lpInFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpInFormat, This->cbInBuffer);
if (This->lpInFormat == NULL)
return NULL; /* out of memory */
This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat;
@ -367,8 +366,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
NULL, &This->cbInFormat);
This->lpInFormat =
(LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, This->cbInFormat + This->cbInBuffer);
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat + This->cbInBuffer);
if (This->lpInFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
@ -408,8 +406,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
/* need memory for output format? */
if (This->lpOutFormat == NULL) {
This->lpOutFormat =
(LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, sizeof(BITMAPINFOHEADER)
+ 256 * sizeof(RGBQUAD));
HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;
@ -478,8 +475,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
register DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
This->lpOutFormat =
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpOutFormat, size, GMEM_MOVEABLE);
This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size);
if (This->lpOutFormat == NULL) {
AVIFILE_CloseCompressor(This);
return AVIERR_MEMORY;

View File

@ -26,7 +26,6 @@
#include "winuser.h"
#include "winnls.h"
#include "winerror.h"
#include "windowsx.h"
#include "mmsystem.h"
#include "vfw.h"
#include "msacm.h"
@ -128,7 +127,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pstream = (IAVIStreamImpl*)LocalAlloc(LPTR, sizeof(IAVIStreamImpl));
pstream = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIStreamImpl));
if (pstream == NULL)
return AVIERR_MEMORY;
@ -137,7 +136,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
if (FAILED(hr))
LocalFree((HLOCAL)pstream);
HeapFree(GetProcessHeap(), 0, pstream);
return hr;
}
@ -194,7 +193,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
if (This->hic != NULL) {
if (This->lpbiPrev != NULL) {
ICDecompressEnd(This->hic);
GlobalFreePtr(This->lpbiPrev);
HeapFree(GetProcessHeap(), 0, This->lpbiPrev);
This->lpbiPrev = NULL;
This->lpPrev = NULL;
}
@ -202,22 +201,22 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
This->hic = NULL;
}
if (This->lpbiCur != NULL) {
GlobalFreePtr(This->lpbiCur);
HeapFree(GetProcessHeap(), 0, This->lpbiCur);
This->lpbiCur = NULL;
This->lpCur = NULL;
}
if (This->lpbiOutput != NULL) {
GlobalFreePtr(This->lpbiOutput);
HeapFree(GetProcessHeap(), 0, This->lpbiOutput);
This->lpbiOutput = NULL;
This->cbOutput = 0;
}
if (This->lpbiInput != NULL) {
GlobalFreePtr(This->lpbiInput);
HeapFree(GetProcessHeap(), 0, This->lpbiInput);
This->lpbiInput = NULL;
This->cbInput = 0;
}
LocalFree((HLOCAL)This);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
@ -479,7 +478,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
assert(This->hic != NULL);
/* get memory for input format */
This->lpbiInput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, formatsize);
This->lpbiInput = HeapAlloc(GetProcessHeap(), 0, formatsize);
if (This->lpbiInput == NULL)
return AVIERR_MEMORY;
This->cbInput = formatsize;
@ -489,7 +488,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
if (size < sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
@ -508,8 +507,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* allocate memory for compressed frame */
size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput);
This->lpbiCur =
(LPBITMAPINFOHEADER)GlobalAllocPtr(GMEM_MOVEABLE, This->cbOutput + size);
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, This->cbOutput + size);
if (This->lpbiCur == NULL)
return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
@ -519,7 +517,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
@ -532,8 +530,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
/* get memory for format and picture */
size += This->lpbiPrev->biSizeImage;
This->lpbiPrev =
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpbiPrev,size,GMEM_MOVEABLE);
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev);
@ -916,7 +913,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
size = ICCompressGetFormatSize(This->hic, lpbi);
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
if (This->lpbiOutput == NULL)
return AVIERR_MEMORY;
This->cbOutput = size;
@ -938,7 +935,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* allocate memory for current frame */
size += This->sInfo.dwSuggestedBufferSize;
This->lpbiCur = (LPBITMAPINFOHEADER)GlobalAllocPtr(GMEM_MOVEABLE, size);
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, size);
if (This->lpbiCur == NULL)
return AVIERR_MEMORY;
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
@ -948,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
if (This->lKeyFrameEvery != 1 &&
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
This->lpbiPrev = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
@ -961,8 +958,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* get memory for format and picture */
size += This->lpbiPrev->biSizeImage;
This->lpbiPrev =
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpbiPrev,size,GMEM_MOVEABLE);
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size );
if (This->lpbiPrev == NULL)
return AVIERR_MEMORY;
This->lpPrev = DIBPTR(This->lpbiPrev);

View File

@ -26,7 +26,6 @@
#include "winuser.h"
#include "winnls.h"
#include "winerror.h"
#include "windowsx.h"
#include "mmsystem.h"
#include "vfw.h"
#include "msacm.h"
@ -225,7 +224,7 @@ HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv)
*ppv = NULL;
pfile = (IAVIFileImpl*)LocalAlloc(LPTR, sizeof(IAVIFileImpl));
pfile = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIFileImpl));
if (pfile == NULL)
return AVIERR_MEMORY;
@ -238,7 +237,7 @@ HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv)
hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv);
if (FAILED(hr))
LocalFree((HLOCAL)pfile);
HeapFree(GetProcessHeap(), 0, pfile);
return hr;
}
@ -289,17 +288,17 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
}
if (This->lpFormat != NULL) {
GlobalFreePtr(This->lpFormat);
HeapFree(GetProcessHeap(), 0, This->lpFormat);
This->lpFormat = NULL;
This->cbFormat = 0;
}
if (This->extra.lp != NULL) {
GlobalFreePtr(This->extra.lp);
HeapFree(GetProcessHeap(), 0, This->extra.lp);
This->extra.lp = NULL;
This->extra.cb = 0;
}
if (This->szFileName != NULL) {
LocalFree((HLOCAL)This->szFileName);
HeapFree(GetProcessHeap(), 0, This->szFileName);
This->szFileName = NULL;
}
if (This->hmmio != NULL) {
@ -307,7 +306,7 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
This->hmmio = NULL;
}
LocalFree((HLOCAL)This);
HeapFree(GetProcessHeap(), 0, This);
return 0;
}
return ref;
@ -485,7 +484,7 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType,
if ((This->uMode & MMIO_RWMODE) == 0)
return AVIERR_READONLY;
GlobalFreePtr(This->lpFormat);
HeapFree(GetProcessHeap(), 0, This->lpFormat);
This->lpFormat = NULL;
This->cbFormat = 0;
@ -582,7 +581,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
This->uMode = dwMode;
len = lstrlenW(pszFileName) + 1;
This->szFileName = LocalAlloc(LPTR, len * sizeof(WCHAR));
This->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (This->szFileName == NULL)
return AVIERR_MEMORY;
lstrcpyW(This->szFileName, pszFileName);
@ -594,7 +593,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
LPSTR szFileName;
len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1,
NULL, 0, NULL, NULL);
szFileName = LocalAlloc(LPTR, len * sizeof(CHAR));
szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR));
if (szFileName == NULL)
return AVIERR_MEMORY;
@ -602,7 +601,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
len, NULL, NULL);
This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
LocalFree((HLOCAL)szFileName);
HeapFree(GetProcessHeap(), 0, szFileName);
if (This->hmmio == NULL)
return AVIERR_FILEOPEN;
}
@ -826,7 +825,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
return AVIERR_READONLY;
/* get memory for format and copy it */
This->lpFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, formatsize);
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, formatsize);
if (This->lpFormat == NULL)
return AVIERR_MEMORY;
@ -1079,7 +1078,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
return AVIERR_FILEREAD;
/* get memory for format and read it */
This->lpFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, ck.cksize);
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, ck.cksize);
if (This->lpFormat == NULL)
return AVIERR_FILEREAD;
This->cbFormat = ck.cksize;
@ -1168,8 +1167,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
This->cbFormat = sizeof(WAVEFORMATEX); break;
};
This->lpFormat =
(LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, This->cbFormat);
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, This->cbFormat);
if (This->lpFormat == NULL)
return AVIERR_MEMORY;