avifil32: Fix some gcc 4.1 warnings cause by windowsx.h macros.
This commit is contained in:
parent
e1ca87732b
commit
610fc08e8d
|
@ -30,7 +30,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "windowsx.h"
|
|
||||||
|
|
||||||
#include "ole2.h"
|
#include "ole2.h"
|
||||||
#include "shellapi.h"
|
#include "shellapi.h"
|
||||||
|
@ -215,7 +214,7 @@ HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return AVIERR_BADPARAM;
|
return AVIERR_BADPARAM;
|
||||||
|
|
||||||
wszFile = (LPWSTR)LocalAlloc(LPTR, len * sizeof(WCHAR));
|
wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
if (wszFile == NULL)
|
if (wszFile == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -223,7 +222,7 @@ HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
|
||||||
|
|
||||||
hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
|
hr = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
|
||||||
|
|
||||||
LocalFree((HLOCAL)wszFile);
|
HeapFree(GetProcessHeap(), 0, wszFile);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -1009,7 +1008,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
|
||||||
szFilter[0] = 0;
|
szFilter[0] = 0;
|
||||||
szFilter[1] = 0;
|
szFilter[1] = 0;
|
||||||
|
|
||||||
wszFilter = (LPWSTR)GlobalAllocPtr(GHND, cbFilter * sizeof(WCHAR));
|
wszFilter = HeapAlloc(GetProcessHeap(), 0, cbFilter * sizeof(WCHAR));
|
||||||
if (wszFilter == NULL)
|
if (wszFilter == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1019,7 +1018,7 @@ HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
|
||||||
szFilter, cbFilter, NULL, NULL);
|
szFilter, cbFilter, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalFreePtr(wszFilter);
|
HeapFree(GetProcessHeap(), 0, wszFilter);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1050,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
||||||
if (cbFilter < 2)
|
if (cbFilter < 2)
|
||||||
return AVIERR_BADSIZE;
|
return AVIERR_BADSIZE;
|
||||||
|
|
||||||
lp = (AVIFilter*)GlobalAllocPtr(GHND, MAX_FILTERS * sizeof(AVIFilter));
|
lp = HeapAlloc(GetProcessHeap(), 0, MAX_FILTERS * sizeof(AVIFilter));
|
||||||
if (lp == NULL)
|
if (lp == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1065,7 +1064,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
||||||
* collection of all possible extensions except "*.*".
|
* collection of all possible extensions except "*.*".
|
||||||
*/
|
*/
|
||||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) {
|
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) {
|
||||||
GlobalFreePtr(lp);
|
HeapFree(GetProcessHeap(), 0, lp);
|
||||||
return AVIERR_ERROR;
|
return AVIERR_ERROR;
|
||||||
}
|
}
|
||||||
for (n = 0;RegEnumKeyW(hKey, n, szFileExt, sizeof(szFileExt)) == S_OK;n++) {
|
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 */
|
/* 2. get descriptions for the CLSIDs and fill out szFilter */
|
||||||
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != S_OK) {
|
if (RegOpenKeyW(HKEY_CLASSES_ROOT, szClsid, &hKey) != S_OK) {
|
||||||
GlobalFreePtr(lp);
|
HeapFree(GetProcessHeap(), 0, lp);
|
||||||
return AVIERR_ERROR;
|
return AVIERR_ERROR;
|
||||||
}
|
}
|
||||||
for (n = 0; n <= count; n++) {
|
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) {
|
if (cbFilter < size + lstrlenW(lp[n].szExtensions) + 2) {
|
||||||
szFilter[0] = 0;
|
szFilter[0] = 0;
|
||||||
szFilter[1] = 0;
|
szFilter[1] = 0;
|
||||||
GlobalFreePtr(lp);
|
HeapFree(GetProcessHeap(), 0, lp);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
return AVIERR_BUFFERTOOSMALL;
|
return AVIERR_BUFFERTOOSMALL;
|
||||||
}
|
}
|
||||||
|
@ -1147,7 +1146,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
GlobalFreePtr(lp);
|
HeapFree(GetProcessHeap(), 0, lp);
|
||||||
|
|
||||||
/* add "All files" "*.*" filter if enough space left */
|
/* add "All files" "*.*" filter if enough space left */
|
||||||
size = LoadStringW(AVIFILE_hModule, IDS_ALLFILES,
|
size = LoadStringW(AVIFILE_hModule, IDS_ALLFILES,
|
||||||
|
@ -1258,10 +1257,10 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
|
||||||
|
|
||||||
acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size);
|
acmMetrics(NULL, ACM_METRIC_MAX_SIZE_FORMAT, &size);
|
||||||
if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
|
if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
|
||||||
pOptions->lpFormat = GlobalAllocPtr(GMEM_MOVEABLE, size);
|
pOptions->lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
pOptions->cbFormat = size;
|
pOptions->cbFormat = size;
|
||||||
} else if (pOptions->cbFormat < (DWORD)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;
|
pOptions->cbFormat = size;
|
||||||
}
|
}
|
||||||
if (pOptions->lpFormat == NULL)
|
if (pOptions->lpFormat == NULL)
|
||||||
|
@ -1274,7 +1273,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
|
||||||
sInfo.dwStart, &size);
|
sInfo.dwStart, &size);
|
||||||
if (size < (LONG)sizeof(PCMWAVEFORMAT))
|
if (size < (LONG)sizeof(PCMWAVEFORMAT))
|
||||||
size = sizeof(PCMWAVEFORMAT);
|
size = sizeof(PCMWAVEFORMAT);
|
||||||
afmtc.pwfxEnum = GlobalAllocPtr(GHND, size);
|
afmtc.pwfxEnum = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (afmtc.pwfxEnum != NULL) {
|
if (afmtc.pwfxEnum != NULL) {
|
||||||
AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
|
AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],
|
||||||
sInfo.dwStart, afmtc.pwfxEnum, &size);
|
sInfo.dwStart, afmtc.pwfxEnum, &size);
|
||||||
|
@ -1286,7 +1285,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
|
||||||
pOptions->dwFlags |= AVICOMPRESSF_VALID;
|
pOptions->dwFlags |= AVICOMPRESSF_VALID;
|
||||||
|
|
||||||
if (afmtc.pwfxEnum != NULL)
|
if (afmtc.pwfxEnum != NULL)
|
||||||
GlobalFreePtr(afmtc.pwfxEnum);
|
HeapFree(GetProcessHeap(), 0, afmtc.pwfxEnum);
|
||||||
|
|
||||||
return (ret == S_OK ? TRUE : FALSE);
|
return (ret == S_OK ? TRUE : FALSE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1319,7 +1318,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
|
||||||
szFormat[0] = 0;
|
szFormat[0] = 0;
|
||||||
|
|
||||||
/* read format to build format description string */
|
/* read format to build format description string */
|
||||||
lpFormat = GlobalAllocPtr(GHND, size);
|
lpFormat = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (lpFormat != NULL) {
|
if (lpFormat != NULL) {
|
||||||
if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
|
if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) {
|
||||||
if (sInfo.fccType == streamtypeVIDEO) {
|
if (sInfo.fccType == streamtypeVIDEO) {
|
||||||
|
@ -1366,7 +1365,7 @@ static void AVISaveOptionsUpdate(HWND hWnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GlobalFreePtr(lpFormat);
|
HeapFree(GetProcessHeap(), 0, lpFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set text for format description */
|
/* set text for format description */
|
||||||
|
@ -1410,8 +1409,7 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
|
||||||
|
|
||||||
/* select first stream */
|
/* select first stream */
|
||||||
SendDlgItemMessageW(hWnd, IDC_STREAM, CB_SETCURSEL, 0, 0);
|
SendDlgItemMessageW(hWnd, IDC_STREAM, CB_SETCURSEL, 0, 0);
|
||||||
SendMessageW(hWnd, WM_COMMAND,
|
SendMessageW(hWnd, WM_COMMAND, MAKELONG(IDC_STREAM, CBN_SELCHANGE), (LPARAM)hWnd);
|
||||||
GET_WM_COMMAND_MPS(IDC_STREAM, hWnd, CBN_SELCHANGE));
|
|
||||||
|
|
||||||
/* initialize interleave */
|
/* initialize interleave */
|
||||||
if (SaveOpts.ppOptions[0] != NULL &&
|
if (SaveOpts.ppOptions[0] != NULL &&
|
||||||
|
@ -1427,7 +1425,7 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
|
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDOK:
|
case IDOK:
|
||||||
/* get data from controls and save them */
|
/* get data from controls and save them */
|
||||||
dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
|
dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
|
||||||
|
@ -1443,14 +1441,14 @@ static INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
EndDialog(hWnd, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
|
EndDialog(hWnd, LOWORD(wParam) == IDOK);
|
||||||
break;
|
break;
|
||||||
case IDC_INTERLEAVE:
|
case IDC_INTERLEAVE:
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY),
|
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY),
|
||||||
IsDlgButtonChecked(hWnd, IDC_INTERLEAVE));
|
IsDlgButtonChecked(hWnd, IDC_INTERLEAVE));
|
||||||
break;
|
break;
|
||||||
case IDC_STREAM:
|
case IDC_STREAM:
|
||||||
if (GET_WM_COMMAND_CMD(wParam, lParam) == CBN_SELCHANGE) {
|
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||||
/* update control elements */
|
/* update control elements */
|
||||||
AVISaveOptionsUpdate(hWnd);
|
AVISaveOptionsUpdate(hWnd);
|
||||||
}
|
}
|
||||||
|
@ -1483,7 +1481,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
|
||||||
|
|
||||||
/* save options in case the user presses cancel */
|
/* save options in case the user presses cancel */
|
||||||
if (ppOptions != NULL && nStreams > 1) {
|
if (ppOptions != NULL && nStreams > 1) {
|
||||||
pSavedOptions = GlobalAllocPtr(GHND,nStreams * sizeof(AVICOMPRESSOPTIONS));
|
pSavedOptions = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(AVICOMPRESSOPTIONS));
|
||||||
if (pSavedOptions == NULL)
|
if (pSavedOptions == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -1512,7 +1510,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
|
||||||
memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
|
memcpy(ppOptions[n], pSavedOptions + n, sizeof(AVICOMPRESSOPTIONS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GlobalFreePtr(pSavedOptions);
|
HeapFree(GetProcessHeap(), 0, pSavedOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (BOOL)ret;
|
return (BOOL)ret;
|
||||||
|
@ -1534,12 +1532,12 @@ HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions)
|
||||||
ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
|
ppOptions[nStreams]->dwFlags &= ~AVICOMPRESSF_VALID;
|
||||||
|
|
||||||
if (ppOptions[nStreams]->lpParms != NULL) {
|
if (ppOptions[nStreams]->lpParms != NULL) {
|
||||||
GlobalFreePtr(ppOptions[nStreams]->lpParms);
|
HeapFree(GetProcessHeap(), 0, ppOptions[nStreams]->lpParms);
|
||||||
ppOptions[nStreams]->lpParms = NULL;
|
ppOptions[nStreams]->lpParms = NULL;
|
||||||
ppOptions[nStreams]->cbParms = 0;
|
ppOptions[nStreams]->cbParms = 0;
|
||||||
}
|
}
|
||||||
if (ppOptions[nStreams]->lpFormat != NULL) {
|
if (ppOptions[nStreams]->lpFormat != NULL) {
|
||||||
GlobalFreePtr(ppOptions[nStreams]->lpFormat);
|
HeapFree(GetProcessHeap(), 0, ppOptions[nStreams]->lpFormat);
|
||||||
ppOptions[nStreams]->lpFormat = NULL;
|
ppOptions[nStreams]->lpFormat = NULL;
|
||||||
ppOptions[nStreams]->cbFormat = 0;
|
ppOptions[nStreams]->cbFormat = 0;
|
||||||
}
|
}
|
||||||
|
@ -1571,7 +1569,7 @@ HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
return AVIERR_BADPARAM;
|
return AVIERR_BADPARAM;
|
||||||
|
|
||||||
wszFile = LocalAlloc(LPTR, len * sizeof(WCHAR));
|
wszFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
if (wszFile == NULL)
|
if (wszFile == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1580,7 +1578,7 @@ HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
|
||||||
hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
|
hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
|
||||||
nStream, ppavi, plpOptions);
|
nStream, ppavi, plpOptions);
|
||||||
|
|
||||||
LocalFree((HLOCAL)wszFile);
|
HeapFree(GetProcessHeap(), 0, wszFile);
|
||||||
|
|
||||||
return hr;
|
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*/
|
/* 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) {
|
if (lpBuffer == NULL) {
|
||||||
hres = AVIERR_MEMORY;
|
hres = AVIERR_MEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -1864,7 +1862,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
|
||||||
lFirstVideo - lStart[curStream], lpBuffer,
|
lFirstVideo - lStart[curStream], lpBuffer,
|
||||||
cbBuffer, &lReadBytes, &lReadSamples);
|
cbBuffer, &lReadBytes, &lReadSamples);
|
||||||
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
||||||
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
|
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
|
||||||
if (lpBuffer == NULL)
|
if (lpBuffer == NULL)
|
||||||
hres = AVIERR_MEMORY;
|
hres = AVIERR_MEMORY;
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
|
@ -1933,7 +1931,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
|
||||||
hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
|
hres = AVIStreamRead(pInStreams[curStream],sInfo.dwStart,lSamples,
|
||||||
lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
|
lpBuffer,cbBuffer,&lReadBytes,&lReadSamples);
|
||||||
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
||||||
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
|
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
|
||||||
if (lpBuffer == NULL)
|
if (lpBuffer == NULL)
|
||||||
hres = AVIERR_MEMORY;
|
hres = AVIERR_MEMORY;
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
|
@ -1979,7 +1977,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
|
||||||
hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
|
hres = AVIStreamRead(pInStreams[curStream], sInfo.dwStart, 1,
|
||||||
lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
|
lpBuffer, cbBuffer,&lReadBytes,&lReadSamples);
|
||||||
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
} while ((hres == AVIERR_BUFFERTOOSMALL) &&
|
||||||
(lpBuffer = GlobalReAllocPtr(lpBuffer, cbBuffer *= 2, GPTR)) != NULL);
|
(lpBuffer = HeapReAlloc(GetProcessHeap(), 0, lpBuffer, cbBuffer *= 2)) != NULL);
|
||||||
if (lpBuffer == NULL)
|
if (lpBuffer == NULL)
|
||||||
hres = AVIERR_MEMORY;
|
hres = AVIERR_MEMORY;
|
||||||
if (FAILED(hres))
|
if (FAILED(hres))
|
||||||
|
@ -2009,7 +2007,7 @@ HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (lpBuffer != NULL)
|
if (lpBuffer != NULL)
|
||||||
GlobalFreePtr(lpBuffer);
|
HeapFree(GetProcessHeap(), 0, lpBuffer);
|
||||||
if (pfile != NULL) {
|
if (pfile != NULL) {
|
||||||
for (curStream = 0; curStream < nStreams; curStream++) {
|
for (curStream = 0; curStream < nStreams; curStream++) {
|
||||||
if (pOutStreams[curStream] != NULL)
|
if (pOutStreams[curStream] != NULL)
|
||||||
|
|
|
@ -316,13 +316,13 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->idxRecords != NULL) {
|
if (This->idxRecords != NULL) {
|
||||||
GlobalFreePtr(This->idxRecords);
|
HeapFree(GetProcessHeap(), 0, This->idxRecords);
|
||||||
This->idxRecords = NULL;
|
This->idxRecords = NULL;
|
||||||
This->nIdxRecords = 0;
|
This->nIdxRecords = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->fileextra.lp != NULL) {
|
if (This->fileextra.lp != NULL) {
|
||||||
GlobalFreePtr(This->fileextra.lp);
|
HeapFree(GetProcessHeap(), 0, This->fileextra.lp);
|
||||||
This->fileextra.lp = NULL;
|
This->fileextra.lp = NULL;
|
||||||
This->fileextra.cb = 0;
|
This->fileextra.cb = 0;
|
||||||
}
|
}
|
||||||
|
@ -956,7 +956,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
if (This->paf->dwMoviChunkPos != 0)
|
if (This->paf->dwMoviChunkPos != 0)
|
||||||
return AVIERR_ERROR; /* user has used API in wrong sequnece! */
|
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)
|
if (This->lpFormat == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->cbFormat = formatsize;
|
This->cbFormat = formatsize;
|
||||||
|
@ -1007,7 +1007,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
/* simply say all colors have changed */
|
/* simply say all colors have changed */
|
||||||
ck.ckid = MAKEAVICKID(cktypePALchange, This->nStream);
|
ck.ckid = MAKEAVICKID(cktypePALchange, This->nStream);
|
||||||
ck.cksize = 2 * sizeof(WORD) + lpbiOld->biClrUsed * sizeof(PALETTEENTRY);
|
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)
|
if (lppc == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
return AVIERR_FILEWRITE;
|
return AVIERR_FILEWRITE;
|
||||||
This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD);
|
This->paf->dwNextFramePos += ck.cksize + 2 * sizeof(DWORD);
|
||||||
|
|
||||||
GlobalFreePtr(lppc);
|
HeapFree(GetProcessHeap(), 0, lppc);
|
||||||
|
|
||||||
return AVIFILE_AddFrame(This, cktypePALchange, n, ck.dwDataOffset, 0);
|
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;
|
This->nIdxFmtChanges += 16;
|
||||||
if (This->idxFmtChanges == NULL)
|
if (This->idxFmtChanges == NULL)
|
||||||
This->idxFmtChanges =
|
This->idxFmtChanges =
|
||||||
GlobalAllocPtr(GHND, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
|
HeapAlloc(GetProcessHeap(), 0, This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
|
||||||
else
|
else
|
||||||
This->idxFmtChanges =
|
This->idxFmtChanges =
|
||||||
GlobalReAllocPtr(This->idxFmtChanges,
|
HeapReAlloc(GetProcessHeap(), 0, This->idxFmtChanges,
|
||||||
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY), GHND);
|
This->nIdxFmtChanges * sizeof(AVIINDEXENTRY));
|
||||||
if (This->idxFmtChanges == NULL)
|
if (This->idxFmtChanges == NULL)
|
||||||
return AVIERR_MEMORY;
|
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) {
|
if (This->idxFrames == NULL || This->lLastFrame + 1 >= This->nIdxFrames) {
|
||||||
This->nIdxFrames += 512;
|
This->nIdxFrames += 512;
|
||||||
if (This->idxFrames == NULL)
|
if (This->idxFrames == NULL)
|
||||||
This->idxFrames =
|
This->idxFrames = HeapAlloc(GetProcessHeap(), 0, This->nIdxFrames * sizeof(AVIINDEXENTRY));
|
||||||
GlobalAllocPtr(GHND, This->nIdxFrames * sizeof(AVIINDEXENTRY));
|
|
||||||
else
|
else
|
||||||
This->idxFrames =
|
This->idxFrames = HeapReAlloc(GetProcessHeap(), 0, This->idxFrames,
|
||||||
GlobalReAllocPtr(This->idxFrames,
|
This->nIdxFrames * sizeof(AVIINDEXENTRY));
|
||||||
This->nIdxFrames * sizeof(AVIINDEXENTRY), GHND);
|
|
||||||
if (This->idxFrames == NULL)
|
if (This->idxFrames == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -1456,7 +1454,7 @@ static HRESULT AVIFILE_AddRecord(IAVIFileImpl *This)
|
||||||
|
|
||||||
if (This->idxRecords == NULL || This->cbIdxRecords == 0) {
|
if (This->idxRecords == NULL || This->cbIdxRecords == 0) {
|
||||||
This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY);
|
This->cbIdxRecords += 1024 * sizeof(AVIINDEXENTRY);
|
||||||
This->idxRecords = GlobalAllocPtr(GHND, This->cbIdxRecords);
|
This->idxRecords = HeapAlloc(GetProcessHeap(), 0, This->cbIdxRecords);
|
||||||
if (This->idxRecords == NULL)
|
if (This->idxRecords == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -1531,14 +1529,14 @@ static void AVIFILE_ConstructAVIStream(IAVIFileImpl *paf, DWORD nr, LPAVISTRE
|
||||||
if (asi->dwLength > 0) {
|
if (asi->dwLength > 0) {
|
||||||
/* pre-allocate mem for frame-index structure */
|
/* pre-allocate mem for frame-index structure */
|
||||||
pstream->idxFrames =
|
pstream->idxFrames =
|
||||||
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, asi->dwLength * sizeof(AVIINDEXENTRY));
|
HeapAlloc(GetProcessHeap(), 0, asi->dwLength * sizeof(AVIINDEXENTRY));
|
||||||
if (pstream->idxFrames != NULL)
|
if (pstream->idxFrames != NULL)
|
||||||
pstream->nIdxFrames = asi->dwLength;
|
pstream->nIdxFrames = asi->dwLength;
|
||||||
}
|
}
|
||||||
if (asi->dwFormatChangeCount > 0) {
|
if (asi->dwFormatChangeCount > 0) {
|
||||||
/* pre-allocate mem for formatchange-index structure */
|
/* pre-allocate mem for formatchange-index structure */
|
||||||
pstream->idxFmtChanges =
|
pstream->idxFmtChanges =
|
||||||
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
|
HeapAlloc(GetProcessHeap(), 0, asi->dwFormatChangeCount * sizeof(AVIINDEXENTRY));
|
||||||
if (pstream->idxFmtChanges != NULL)
|
if (pstream->idxFmtChanges != NULL)
|
||||||
pstream->nIdxFmtChanges = asi->dwFormatChangeCount;
|
pstream->nIdxFmtChanges = asi->dwFormatChangeCount;
|
||||||
}
|
}
|
||||||
|
@ -1564,16 +1562,16 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
|
||||||
This->lLastFrame = -1;
|
This->lLastFrame = -1;
|
||||||
This->paf = NULL;
|
This->paf = NULL;
|
||||||
if (This->idxFrames != NULL) {
|
if (This->idxFrames != NULL) {
|
||||||
GlobalFreePtr(This->idxFrames);
|
HeapFree(GetProcessHeap(), 0, This->idxFrames);
|
||||||
This->idxFrames = NULL;
|
This->idxFrames = NULL;
|
||||||
This->nIdxFrames = 0;
|
This->nIdxFrames = 0;
|
||||||
}
|
}
|
||||||
if (This->idxFmtChanges != NULL) {
|
if (This->idxFmtChanges != NULL) {
|
||||||
GlobalFreePtr(This->idxFmtChanges);
|
HeapFree(GetProcessHeap(), 0, This->idxFmtChanges);
|
||||||
This->idxFmtChanges = NULL;
|
This->idxFmtChanges = NULL;
|
||||||
}
|
}
|
||||||
if (This->lpBuffer != NULL) {
|
if (This->lpBuffer != NULL) {
|
||||||
GlobalFreePtr(This->lpBuffer);
|
HeapFree(GetProcessHeap(), 0, This->lpBuffer);
|
||||||
This->lpBuffer = NULL;
|
This->lpBuffer = NULL;
|
||||||
This->cbBuffer = 0;
|
This->cbBuffer = 0;
|
||||||
}
|
}
|
||||||
|
@ -1583,12 +1581,12 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
|
||||||
This->cbHandlerData = 0;
|
This->cbHandlerData = 0;
|
||||||
}
|
}
|
||||||
if (This->extra.lp != NULL) {
|
if (This->extra.lp != NULL) {
|
||||||
GlobalFreePtr(This->extra.lp);
|
HeapFree(GetProcessHeap(), 0, This->extra.lp);
|
||||||
This->extra.lp = NULL;
|
This->extra.lp = NULL;
|
||||||
This->extra.cb = 0;
|
This->extra.cb = 0;
|
||||||
}
|
}
|
||||||
if (This->lpFormat != NULL) {
|
if (This->lpFormat != NULL) {
|
||||||
GlobalFreePtr(This->lpFormat);
|
HeapFree(GetProcessHeap(), 0, This->lpFormat);
|
||||||
This->lpFormat = NULL;
|
This->lpFormat = NULL;
|
||||||
This->cbFormat = 0;
|
This->cbFormat = 0;
|
||||||
}
|
}
|
||||||
|
@ -1918,8 +1916,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
|
||||||
HRESULT hr = AVIERR_OK;
|
HRESULT hr = AVIERR_OK;
|
||||||
BOOL bAbsolute = TRUE;
|
BOOL bAbsolute = TRUE;
|
||||||
|
|
||||||
lp = (AVIINDEXENTRY*)GlobalAllocPtr(GMEM_MOVEABLE,
|
lp = HeapAlloc(GetProcessHeap(), 0, IDX_PER_BLOCK * sizeof(AVIINDEXENTRY));
|
||||||
IDX_PER_BLOCK * sizeof(AVIINDEXENTRY));
|
|
||||||
if (lp == NULL)
|
if (lp == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1930,7 +1927,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
|
||||||
pStream->lLastFrame = -1;
|
pStream->lLastFrame = -1;
|
||||||
|
|
||||||
if (pStream->idxFrames != NULL) {
|
if (pStream->idxFrames != NULL) {
|
||||||
GlobalFreePtr(pStream->idxFrames);
|
HeapFree(GetProcessHeap(), 0, pStream->idxFrames);
|
||||||
pStream->idxFrames = NULL;
|
pStream->idxFrames = NULL;
|
||||||
pStream->nIdxFrames = 0;
|
pStream->nIdxFrames = 0;
|
||||||
}
|
}
|
||||||
|
@ -1946,7 +1943,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
|
||||||
pStream->nIdxFrames = pStream->sInfo.dwLength;
|
pStream->nIdxFrames = pStream->sInfo.dwLength;
|
||||||
|
|
||||||
pStream->idxFrames =
|
pStream->idxFrames =
|
||||||
(AVIINDEXENTRY*)GlobalAllocPtr(GHND, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
|
HeapAlloc(GetProcessHeap(), 0, pStream->nIdxFrames * sizeof(AVIINDEXENTRY));
|
||||||
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
|
if (pStream->idxFrames == NULL && pStream->nIdxFrames > 0) {
|
||||||
pStream->nIdxFrames = 0;
|
pStream->nIdxFrames = 0;
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
@ -1971,7 +1968,7 @@ static HRESULT AVIFILE_LoadIndex(IAVIFileImpl *This, DWORD size, DWORD offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lp != NULL)
|
if (lp != NULL)
|
||||||
GlobalFreePtr(lp);
|
HeapFree(GetProcessHeap(), 0, lp);
|
||||||
|
|
||||||
/* checking ... */
|
/* checking ... */
|
||||||
for (n = 0; n < This->fInfo.dwStreams; n++) {
|
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);
|
DWORD maxSize = max(size, This->sInfo.dwSuggestedBufferSize);
|
||||||
|
|
||||||
if (This->lpBuffer == NULL)
|
if (This->lpBuffer == NULL)
|
||||||
This->lpBuffer = (LPDWORD)GlobalAllocPtr(GMEM_MOVEABLE, maxSize);
|
This->lpBuffer = HeapAlloc(GetProcessHeap(), 0, maxSize);
|
||||||
else
|
else
|
||||||
This->lpBuffer =
|
This->lpBuffer = HeapReAlloc(GetProcessHeap(), 0, This->lpBuffer, maxSize);
|
||||||
(LPDWORD)GlobalReAllocPtr(This->lpBuffer, maxSize, GMEM_MOVEABLE);
|
|
||||||
if (This->lpBuffer == NULL)
|
if (This->lpBuffer == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);
|
This->cbBuffer = max(size, This->sInfo.dwSuggestedBufferSize);
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
#include "windowsx.h"
|
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "vfw.h"
|
#include "vfw.h"
|
||||||
|
@ -99,11 +98,11 @@ typedef struct _IGetFrameImpl {
|
||||||
static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
|
static void AVIFILE_CloseCompressor(IGetFrameImpl *This)
|
||||||
{
|
{
|
||||||
if (This->lpOutFormat != NULL && This->lpInFormat != This->lpOutFormat) {
|
if (This->lpOutFormat != NULL && This->lpInFormat != This->lpOutFormat) {
|
||||||
GlobalFreePtr(This->lpOutFormat);
|
HeapFree(GetProcessHeap(), 0, This->lpOutFormat);
|
||||||
This->lpOutFormat = NULL;
|
This->lpOutFormat = NULL;
|
||||||
}
|
}
|
||||||
if (This->lpInFormat != NULL) {
|
if (This->lpInFormat != NULL) {
|
||||||
GlobalFreePtr(This->lpInFormat);
|
HeapFree(GetProcessHeap(), 0, This->lpInFormat);
|
||||||
This->lpInFormat = NULL;
|
This->lpInFormat = NULL;
|
||||||
}
|
}
|
||||||
if (This->hic != NULL) {
|
if (This->hic != NULL) {
|
||||||
|
@ -124,7 +123,7 @@ PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pStream)
|
||||||
if (pStream == NULL)
|
if (pStream == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pg = (IGetFrameImpl*)LocalAlloc(LPTR, sizeof(IGetFrameImpl));
|
pg = HeapAlloc(GetProcessHeap(), 0, sizeof(IGetFrameImpl));
|
||||||
if (pg != NULL) {
|
if (pg != NULL) {
|
||||||
pg->lpVtbl = &igetframeVtbl;
|
pg->lpVtbl = &igetframeVtbl;
|
||||||
pg->ref = 1;
|
pg->ref = 1;
|
||||||
|
@ -176,7 +175,7 @@ static ULONG WINAPI IGetFrame_fnRelease(IGetFrame *iface)
|
||||||
This->pStream = NULL;
|
This->pStream = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalFree((HLOCAL)iface);
|
HeapFree(GetProcessHeap(), 0, iface);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +265,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos)
|
||||||
if (This->cbInBuffer >= readBytes)
|
if (This->cbInBuffer >= readBytes)
|
||||||
break;
|
break;
|
||||||
This->cbInBuffer = This->cbInFormat + readBytes;
|
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)
|
if (This->lpInFormat == NULL)
|
||||||
return NULL; /* out of memory */
|
return NULL; /* out of memory */
|
||||||
This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat;
|
This->lpInBuffer = (BYTE*)This->lpInFormat + This->cbInFormat;
|
||||||
|
@ -367,8 +366,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
|
||||||
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
|
IAVIStream_ReadFormat(This->pStream, sInfo.dwStart,
|
||||||
NULL, &This->cbInFormat);
|
NULL, &This->cbInFormat);
|
||||||
|
|
||||||
This->lpInFormat =
|
This->lpInFormat = HeapAlloc(GetProcessHeap(), 0, This->cbInFormat + This->cbInBuffer);
|
||||||
(LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, This->cbInFormat + This->cbInBuffer);
|
|
||||||
if (This->lpInFormat == NULL) {
|
if (This->lpInFormat == NULL) {
|
||||||
AVIFILE_CloseCompressor(This);
|
AVIFILE_CloseCompressor(This);
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
@ -408,8 +406,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
|
||||||
/* need memory for output format? */
|
/* need memory for output format? */
|
||||||
if (This->lpOutFormat == NULL) {
|
if (This->lpOutFormat == NULL) {
|
||||||
This->lpOutFormat =
|
This->lpOutFormat =
|
||||||
(LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, sizeof(BITMAPINFOHEADER)
|
HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
|
||||||
+ 256 * sizeof(RGBQUAD));
|
|
||||||
if (This->lpOutFormat == NULL) {
|
if (This->lpOutFormat == NULL) {
|
||||||
AVIFILE_CloseCompressor(This);
|
AVIFILE_CloseCompressor(This);
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
@ -478,8 +475,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
|
||||||
register DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
|
register DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD);
|
||||||
|
|
||||||
size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
|
size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage;
|
||||||
This->lpOutFormat =
|
This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size);
|
||||||
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpOutFormat, size, GMEM_MOVEABLE);
|
|
||||||
if (This->lpOutFormat == NULL) {
|
if (This->lpOutFormat == NULL) {
|
||||||
AVIFILE_CloseCompressor(This);
|
AVIFILE_CloseCompressor(This);
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "windowsx.h"
|
|
||||||
#include "mmsystem.h"
|
#include "mmsystem.h"
|
||||||
#include "vfw.h"
|
#include "vfw.h"
|
||||||
#include "msacm.h"
|
#include "msacm.h"
|
||||||
|
@ -128,7 +127,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
|
||||||
|
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
|
|
||||||
pstream = (IAVIStreamImpl*)LocalAlloc(LPTR, sizeof(IAVIStreamImpl));
|
pstream = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIStreamImpl));
|
||||||
if (pstream == NULL)
|
if (pstream == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -137,7 +136,7 @@ HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
|
||||||
|
|
||||||
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
|
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
LocalFree((HLOCAL)pstream);
|
HeapFree(GetProcessHeap(), 0, pstream);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +193,7 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
|
||||||
if (This->hic != NULL) {
|
if (This->hic != NULL) {
|
||||||
if (This->lpbiPrev != NULL) {
|
if (This->lpbiPrev != NULL) {
|
||||||
ICDecompressEnd(This->hic);
|
ICDecompressEnd(This->hic);
|
||||||
GlobalFreePtr(This->lpbiPrev);
|
HeapFree(GetProcessHeap(), 0, This->lpbiPrev);
|
||||||
This->lpbiPrev = NULL;
|
This->lpbiPrev = NULL;
|
||||||
This->lpPrev = NULL;
|
This->lpPrev = NULL;
|
||||||
}
|
}
|
||||||
|
@ -202,22 +201,22 @@ static ULONG WINAPI ICMStream_fnRelease(IAVIStream* iface)
|
||||||
This->hic = NULL;
|
This->hic = NULL;
|
||||||
}
|
}
|
||||||
if (This->lpbiCur != NULL) {
|
if (This->lpbiCur != NULL) {
|
||||||
GlobalFreePtr(This->lpbiCur);
|
HeapFree(GetProcessHeap(), 0, This->lpbiCur);
|
||||||
This->lpbiCur = NULL;
|
This->lpbiCur = NULL;
|
||||||
This->lpCur = NULL;
|
This->lpCur = NULL;
|
||||||
}
|
}
|
||||||
if (This->lpbiOutput != NULL) {
|
if (This->lpbiOutput != NULL) {
|
||||||
GlobalFreePtr(This->lpbiOutput);
|
HeapFree(GetProcessHeap(), 0, This->lpbiOutput);
|
||||||
This->lpbiOutput = NULL;
|
This->lpbiOutput = NULL;
|
||||||
This->cbOutput = 0;
|
This->cbOutput = 0;
|
||||||
}
|
}
|
||||||
if (This->lpbiInput != NULL) {
|
if (This->lpbiInput != NULL) {
|
||||||
GlobalFreePtr(This->lpbiInput);
|
HeapFree(GetProcessHeap(), 0, This->lpbiInput);
|
||||||
This->lpbiInput = NULL;
|
This->lpbiInput = NULL;
|
||||||
This->cbInput = 0;
|
This->cbInput = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalFree((HLOCAL)This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +478,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
assert(This->hic != NULL);
|
assert(This->hic != NULL);
|
||||||
|
|
||||||
/* get memory for input format */
|
/* get memory for input format */
|
||||||
This->lpbiInput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, formatsize);
|
This->lpbiInput = HeapAlloc(GetProcessHeap(), 0, formatsize);
|
||||||
if (This->lpbiInput == NULL)
|
if (This->lpbiInput == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->cbInput = formatsize;
|
This->cbInput = formatsize;
|
||||||
|
@ -489,7 +488,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
|
size = ICCompressGetFormatSize(This->hic, This->lpbiInput);
|
||||||
if (size < sizeof(BITMAPINFOHEADER))
|
if (size < sizeof(BITMAPINFOHEADER))
|
||||||
return AVIERR_COMPRESSOR;
|
return AVIERR_COMPRESSOR;
|
||||||
This->lpbiOutput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
|
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (This->lpbiOutput == NULL)
|
if (This->lpbiOutput == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->cbOutput = size;
|
This->cbOutput = size;
|
||||||
|
@ -508,8 +507,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
|
|
||||||
/* allocate memory for compressed frame */
|
/* allocate memory for compressed frame */
|
||||||
size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput);
|
size = ICCompressGetSize(This->hic, This->lpbiInput, This->lpbiOutput);
|
||||||
This->lpbiCur =
|
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, This->cbOutput + size);
|
||||||
(LPBITMAPINFOHEADER)GlobalAllocPtr(GMEM_MOVEABLE, This->cbOutput + size);
|
|
||||||
if (This->lpbiCur == NULL)
|
if (This->lpbiCur == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
|
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
|
||||||
|
@ -519,7 +517,7 @@ static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
if (This->lKeyFrameEvery != 1 &&
|
if (This->lKeyFrameEvery != 1 &&
|
||||||
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
|
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
|
||||||
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
|
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
|
||||||
This->lpbiPrev = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
|
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (This->lpbiPrev == NULL)
|
if (This->lpbiPrev == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
|
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 */
|
/* get memory for format and picture */
|
||||||
size += This->lpbiPrev->biSizeImage;
|
size += This->lpbiPrev->biSizeImage;
|
||||||
This->lpbiPrev =
|
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size);
|
||||||
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpbiPrev,size,GMEM_MOVEABLE);
|
|
||||||
if (This->lpbiPrev == NULL)
|
if (This->lpbiPrev == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->lpPrev = DIBPTR(This->lpbiPrev);
|
This->lpPrev = DIBPTR(This->lpbiPrev);
|
||||||
|
@ -916,7 +913,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
|
||||||
size = ICCompressGetFormatSize(This->hic, lpbi);
|
size = ICCompressGetFormatSize(This->hic, lpbi);
|
||||||
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
|
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
|
||||||
return AVIERR_COMPRESSOR;
|
return AVIERR_COMPRESSOR;
|
||||||
This->lpbiOutput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
|
This->lpbiOutput = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (This->lpbiOutput == NULL)
|
if (This->lpbiOutput == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->cbOutput = size;
|
This->cbOutput = size;
|
||||||
|
@ -938,7 +935,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
|
||||||
|
|
||||||
/* allocate memory for current frame */
|
/* allocate memory for current frame */
|
||||||
size += This->sInfo.dwSuggestedBufferSize;
|
size += This->sInfo.dwSuggestedBufferSize;
|
||||||
This->lpbiCur = (LPBITMAPINFOHEADER)GlobalAllocPtr(GMEM_MOVEABLE, size);
|
This->lpbiCur = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (This->lpbiCur == NULL)
|
if (This->lpbiCur == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
|
memcpy(This->lpbiCur, This->lpbiOutput, This->cbOutput);
|
||||||
|
@ -948,7 +945,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
|
||||||
if (This->lKeyFrameEvery != 1 &&
|
if (This->lKeyFrameEvery != 1 &&
|
||||||
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
|
(This->dwICMFlags & VIDCF_FASTTEMPORALC) == 0) {
|
||||||
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
|
size = ICDecompressGetFormatSize(This->hic, This->lpbiOutput);
|
||||||
This->lpbiPrev = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
|
This->lpbiPrev = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
if (This->lpbiPrev == NULL)
|
if (This->lpbiPrev == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
if (ICDecompressGetFormat(This->hic, This->lpbiOutput, This->lpbiPrev) < S_OK)
|
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 */
|
/* get memory for format and picture */
|
||||||
size += This->lpbiPrev->biSizeImage;
|
size += This->lpbiPrev->biSizeImage;
|
||||||
This->lpbiPrev =
|
This->lpbiPrev = HeapReAlloc(GetProcessHeap(), 0, This->lpbiPrev, size );
|
||||||
(LPBITMAPINFOHEADER)GlobalReAllocPtr(This->lpbiPrev,size,GMEM_MOVEABLE);
|
|
||||||
if (This->lpbiPrev == NULL)
|
if (This->lpbiPrev == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
This->lpPrev = DIBPTR(This->lpbiPrev);
|
This->lpPrev = DIBPTR(This->lpbiPrev);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
#include "windowsx.h"
|
|
||||||
#include "mmsystem.h"
|
#include "mmsystem.h"
|
||||||
#include "vfw.h"
|
#include "vfw.h"
|
||||||
#include "msacm.h"
|
#include "msacm.h"
|
||||||
|
@ -225,7 +224,7 @@ HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv)
|
||||||
|
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
|
|
||||||
pfile = (IAVIFileImpl*)LocalAlloc(LPTR, sizeof(IAVIFileImpl));
|
pfile = HeapAlloc(GetProcessHeap(), 0, sizeof(IAVIFileImpl));
|
||||||
if (pfile == NULL)
|
if (pfile == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -238,7 +237,7 @@ HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv)
|
||||||
|
|
||||||
hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv);
|
hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
LocalFree((HLOCAL)pfile);
|
HeapFree(GetProcessHeap(), 0, pfile);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -289,17 +288,17 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->lpFormat != NULL) {
|
if (This->lpFormat != NULL) {
|
||||||
GlobalFreePtr(This->lpFormat);
|
HeapFree(GetProcessHeap(), 0, This->lpFormat);
|
||||||
This->lpFormat = NULL;
|
This->lpFormat = NULL;
|
||||||
This->cbFormat = 0;
|
This->cbFormat = 0;
|
||||||
}
|
}
|
||||||
if (This->extra.lp != NULL) {
|
if (This->extra.lp != NULL) {
|
||||||
GlobalFreePtr(This->extra.lp);
|
HeapFree(GetProcessHeap(), 0, This->extra.lp);
|
||||||
This->extra.lp = NULL;
|
This->extra.lp = NULL;
|
||||||
This->extra.cb = 0;
|
This->extra.cb = 0;
|
||||||
}
|
}
|
||||||
if (This->szFileName != NULL) {
|
if (This->szFileName != NULL) {
|
||||||
LocalFree((HLOCAL)This->szFileName);
|
HeapFree(GetProcessHeap(), 0, This->szFileName);
|
||||||
This->szFileName = NULL;
|
This->szFileName = NULL;
|
||||||
}
|
}
|
||||||
if (This->hmmio != NULL) {
|
if (This->hmmio != NULL) {
|
||||||
|
@ -307,7 +306,7 @@ static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface)
|
||||||
This->hmmio = NULL;
|
This->hmmio = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalFree((HLOCAL)This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -485,7 +484,7 @@ static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType,
|
||||||
if ((This->uMode & MMIO_RWMODE) == 0)
|
if ((This->uMode & MMIO_RWMODE) == 0)
|
||||||
return AVIERR_READONLY;
|
return AVIERR_READONLY;
|
||||||
|
|
||||||
GlobalFreePtr(This->lpFormat);
|
HeapFree(GetProcessHeap(), 0, This->lpFormat);
|
||||||
This->lpFormat = NULL;
|
This->lpFormat = NULL;
|
||||||
This->cbFormat = 0;
|
This->cbFormat = 0;
|
||||||
|
|
||||||
|
@ -582,7 +581,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
|
||||||
This->uMode = dwMode;
|
This->uMode = dwMode;
|
||||||
|
|
||||||
len = lstrlenW(pszFileName) + 1;
|
len = lstrlenW(pszFileName) + 1;
|
||||||
This->szFileName = LocalAlloc(LPTR, len * sizeof(WCHAR));
|
This->szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||||
if (This->szFileName == NULL)
|
if (This->szFileName == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
lstrcpyW(This->szFileName, pszFileName);
|
lstrcpyW(This->szFileName, pszFileName);
|
||||||
|
@ -594,7 +593,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
|
||||||
LPSTR szFileName;
|
LPSTR szFileName;
|
||||||
len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1,
|
len = WideCharToMultiByte(CP_ACP, 0, This->szFileName, -1,
|
||||||
NULL, 0, NULL, NULL);
|
NULL, 0, NULL, NULL);
|
||||||
szFileName = LocalAlloc(LPTR, len * sizeof(CHAR));
|
szFileName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(CHAR));
|
||||||
if (szFileName == NULL)
|
if (szFileName == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -602,7 +601,7 @@ static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface,
|
||||||
len, NULL, NULL);
|
len, NULL, NULL);
|
||||||
|
|
||||||
This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
|
This->hmmio = mmioOpenA(szFileName, NULL, MMIO_ALLOCBUF | dwMode);
|
||||||
LocalFree((HLOCAL)szFileName);
|
HeapFree(GetProcessHeap(), 0, szFileName);
|
||||||
if (This->hmmio == NULL)
|
if (This->hmmio == NULL)
|
||||||
return AVIERR_FILEOPEN;
|
return AVIERR_FILEOPEN;
|
||||||
}
|
}
|
||||||
|
@ -826,7 +825,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
|
||||||
return AVIERR_READONLY;
|
return AVIERR_READONLY;
|
||||||
|
|
||||||
/* get memory for format and copy it */
|
/* get memory for format and copy it */
|
||||||
This->lpFormat = (LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, formatsize);
|
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, formatsize);
|
||||||
if (This->lpFormat == NULL)
|
if (This->lpFormat == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
@ -1079,7 +1078,7 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
|
||||||
return AVIERR_FILEREAD;
|
return AVIERR_FILEREAD;
|
||||||
|
|
||||||
/* get memory for format and read it */
|
/* 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)
|
if (This->lpFormat == NULL)
|
||||||
return AVIERR_FILEREAD;
|
return AVIERR_FILEREAD;
|
||||||
This->cbFormat = ck.cksize;
|
This->cbFormat = ck.cksize;
|
||||||
|
@ -1168,8 +1167,7 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This)
|
||||||
This->cbFormat = sizeof(WAVEFORMATEX); break;
|
This->cbFormat = sizeof(WAVEFORMATEX); break;
|
||||||
};
|
};
|
||||||
|
|
||||||
This->lpFormat =
|
This->lpFormat = HeapAlloc(GetProcessHeap(), 0, This->cbFormat);
|
||||||
(LPWAVEFORMATEX)GlobalAllocPtr(GMEM_MOVEABLE, This->cbFormat);
|
|
||||||
if (This->lpFormat == NULL)
|
if (This->lpFormat == NULL)
|
||||||
return AVIERR_MEMORY;
|
return AVIERR_MEMORY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue