Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
45c6da65
Commit
45c6da65
authored
Sep 19, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvfw32: Use CRT allocation functions.
parent
90a5dc72
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
53 deletions
+50
-53
drawdib.c
dlls/msvfw32/drawdib.c
+11
-11
mciwnd.c
dlls/msvfw32/mciwnd.c
+13
-15
msvideo_main.c
dlls/msvfw32/msvideo_main.c
+26
-27
No files found.
dlls/msvfw32/drawdib.c
View file @
45c6da65
...
...
@@ -82,8 +82,8 @@ HDRAWDIB VFWAPI DrawDibOpen(void)
WINE_HDD
*
whdd
;
TRACE
(
"(void)
\n
"
);
whdd
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINE_HDD
));
whdd
=
calloc
(
1
,
sizeof
(
WINE_HDD
));
TRACE
(
"=> %p
\n
"
,
whdd
);
while
(
MSVIDEO_GetHddPtr
((
HDRAWDIB
)
HDD_HandleRef
)
!=
NULL
)
HDD_HandleRef
++
;
...
...
@@ -118,7 +118,7 @@ BOOL VFWAPI DrawDibClose(HDRAWDIB hdd)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
whdd
);
free
(
whdd
);
return
TRUE
;
}
...
...
@@ -137,15 +137,15 @@ BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd)
whdd
->
hpal
=
0
;
/* Do not free this */
whdd
->
hdc
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
whdd
->
lpbi
);
free
(
whdd
->
lpbi
);
whdd
->
lpbi
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
whdd
->
lpbiOut
);
free
(
whdd
->
lpbiOut
);
whdd
->
lpbiOut
=
NULL
;
whdd
->
begun
=
FALSE
;
/*if (whdd->lpvbits)
HeapFree(GetProcessHeap(), 0,
whdd->lpvbuf);*/
free(
whdd->lpvbuf);*/
if
(
whdd
->
hMemDC
)
{
...
...
@@ -224,7 +224,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
if
(
ret
)
{
whdd
->
lpbiOut
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
whdd
->
lpbiOut
=
malloc
(
size
);
if
(
ICDecompressGetFormat
(
whdd
->
hic
,
lpbi
,
whdd
->
lpbiOut
)
!=
ICERR_OK
)
ret
=
FALSE
;
...
...
@@ -255,14 +255,14 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
else
{
dwSize
=
lpbi
->
biSize
+
num_colours
(
lpbi
)
*
sizeof
(
RGBQUAD
);
whdd
->
lpbiOut
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwSize
);
whdd
->
lpbiOut
=
malloc
(
dwSize
);
memcpy
(
whdd
->
lpbiOut
,
lpbi
,
dwSize
);
}
}
if
(
ret
)
{
/*whdd->lpvbuf =
HeapAlloc(GetProcessHeap(), 0,
whdd->lpbiOut->biSizeImage);*/
/*whdd->lpvbuf =
malloc(
whdd->lpbiOut->biSizeImage);*/
whdd
->
hMemDC
=
CreateCompatibleDC
(
hdc
);
TRACE
(
"Creating: %ld, %p
\n
"
,
whdd
->
lpbiOut
->
biSize
,
whdd
->
lpvbits
);
...
...
@@ -284,7 +284,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
whdd
->
hdc
=
hdc
;
whdd
->
dxDst
=
dxDst
;
whdd
->
dyDst
=
dyDst
;
whdd
->
lpbi
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lpbi
->
biSize
);
whdd
->
lpbi
=
malloc
(
lpbi
->
biSize
);
memcpy
(
whdd
->
lpbi
,
lpbi
,
lpbi
->
biSize
);
whdd
->
dxSrc
=
dxSrc
;
whdd
->
dySrc
=
dySrc
;
...
...
@@ -295,7 +295,7 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
{
if
(
whdd
->
hic
)
ICClose
(
whdd
->
hic
);
HeapFree
(
GetProcessHeap
(),
0
,
whdd
->
lpbiOut
);
free
(
whdd
->
lpbiOut
);
whdd
->
lpbiOut
=
NULL
;
}
...
...
dlls/msvfw32/mciwnd.c
View file @
45c6da65
...
...
@@ -254,7 +254,7 @@ static LRESULT MCIWND_Create(HWND hWnd, LPCREATESTRUCTW cs)
MCIWndInfo
*
mwi
;
static
const
WCHAR
buttonW
[]
=
{
'b'
,
'u'
,
't'
,
't'
,
'o'
,
'n'
,
0
};
mwi
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
mwi
));
mwi
=
calloc
(
1
,
sizeof
(
*
mwi
));
if
(
!
mwi
)
return
-
1
;
SetWindowLongW
(
hWnd
,
0
,
(
LPARAM
)
mwi
);
...
...
@@ -388,12 +388,12 @@ static void MCIWND_notify_media(MCIWndInfo *mwi)
int
len
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
mwi
->
lpName
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ansi_name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
ansi_name
=
malloc
(
len
);
WideCharToMultiByte
(
CP_ACP
,
0
,
mwi
->
lpName
,
-
1
,
ansi_name
,
len
,
NULL
,
NULL
);
SendMessageW
(
mwi
->
hwndOwner
,
MCIWNDM_NOTIFYMEDIA
,
(
WPARAM
)
mwi
->
hWnd
,
(
LPARAM
)
ansi_name
);
HeapFree
(
GetProcessHeap
(),
0
,
ansi_name
);
free
(
ansi_name
);
}
else
SendMessageW
(
mwi
->
hwndOwner
,
MCIWNDM_NOTIFYMEDIA
,
(
WPARAM
)
mwi
->
hWnd
,
(
LPARAM
)
mwi
->
lpName
);
...
...
@@ -468,7 +468,7 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
if
(
mwi
->
mci
)
SendMessageW
(
hWnd
,
MCI_CLOSE
,
0
,
0
);
HeapFree
(
GetProcessHeap
(),
0
,
mwi
);
free
(
mwi
);
DestroyWindow
(
GetDlgItem
(
hWnd
,
CTL_MENU
));
DestroyWindow
(
GetDlgItem
(
hWnd
,
CTL_PLAYSTOP
));
...
...
@@ -591,9 +591,7 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
mwi
->
mci
=
mci_open
.
wDeviceID
;
mwi
->
alias
=
HandleToLong
(
hWnd
)
+
1
;
mwi
->
lpName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
((
LPWSTR
)
lParam
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
mwi
->
lpName
,
(
LPWSTR
)
lParam
);
mwi
->
lpName
=
wcsdup
((
WCHAR
*
)
lParam
);
MCIWND_UpdateState
(
mwi
);
...
...
@@ -660,7 +658,7 @@ static LRESULT WINAPI MCIWndProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lPa
end_of_mci_open:
if
(
wMsg
==
MCIWNDM_OPENA
)
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
lParam
);
free
(
(
void
*
)
lParam
);
return
mwi
->
lasterror
;
}
...
...
@@ -998,7 +996,7 @@ end_of_mci_open:
pos
=
p
-
(
WCHAR
*
)
lParam
+
1
;
len
=
lstrlenW
((
LPCWSTR
)
lParam
)
+
64
;
cmdW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
cmdW
=
malloc
(
len
*
sizeof
(
WCHAR
));
memcpy
(
cmdW
,
(
void
*
)
lParam
,
pos
*
sizeof
(
WCHAR
));
wsprintfW
(
cmdW
+
pos
,
formatW
,
mwi
->
alias
);
...
...
@@ -1013,10 +1011,10 @@ end_of_mci_open:
MCIWND_notify_error
(
mwi
);
if
(
cmdW
!=
(
LPWSTR
)
lParam
)
HeapFree
(
GetProcessHeap
(),
0
,
cmdW
);
free
(
cmdW
);
if
(
wMsg
==
MCIWNDM_SENDSTRINGA
)
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
lParam
);
free
(
(
void
*
)
lParam
);
MCIWND_UpdateState
(
mwi
);
return
mwi
->
lasterror
;
...
...
@@ -1182,7 +1180,7 @@ end_of_mci_open:
if
(
mwi
->
mci
)
{
cmdW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
((
LPCWSTR
)
lParam
)
+
64
)
*
sizeof
(
WCHAR
));
cmdW
=
malloc
((
wcslen
((
WCHAR
*
)
lParam
)
+
64
)
*
sizeof
(
WCHAR
));
wsprintfW
(
cmdW
,
formatW
,
mwi
->
alias
);
lstrcatW
(
cmdW
,
(
WCHAR
*
)
lParam
);
...
...
@@ -1193,11 +1191,11 @@ end_of_mci_open:
SendDlgItemMessageW
(
hWnd
,
CTL_TRACKBAR
,
TBM_SETRANGEMAX
,
1
,
SendMessageW
(
hWnd
,
MCIWNDM_GETLENGTH
,
0
,
0
));
HeapFree
(
GetProcessHeap
(),
0
,
cmdW
);
free
(
cmdW
);
}
if
(
wMsg
==
MCIWNDM_SETTIMEFORMATA
)
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
lParam
);
free
(
(
void
*
)
lParam
);
return
0
;
}
...
...
@@ -1347,7 +1345,7 @@ end_of_mci_open:
mwi
->
mode
=
MCI_MODE_NOT_READY
;
mwi
->
position
=
-
1
;
HeapFree
(
GetProcessHeap
(),
0
,
mwi
->
lpName
);
free
(
mwi
->
lpName
);
mwi
->
lpName
=
NULL
;
MCIWND_UpdateState
(
mwi
);
...
...
dlls/msvfw32/msvideo_main.c
View file @
45c6da65
...
...
@@ -41,7 +41,6 @@
#include "vfw.h"
#include "msvideo_private.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
/* Drivers32 settings */
...
...
@@ -365,7 +364,7 @@ BOOL VFWAPI ICInstall(DWORD type, DWORD handler, LPARAM lparam, char *desc, UINT
switch
(
flags
)
{
case
ICINSTALL_FUNCTION
:
if
(
!
(
driver
=
heap_alloc_zero
(
sizeof
(
*
driver
))))
if
(
!
(
driver
=
calloc
(
1
,
sizeof
(
*
driver
))))
return
FALSE
;
driver
->
fccType
=
type
;
driver
->
fccHandler
=
handler
;
...
...
@@ -414,7 +413,7 @@ BOOL VFWAPI ICRemove(DWORD type, DWORD handler, UINT flags)
&&
!
compare_fourcc
(
handler
,
driver
->
fccHandler
))
{
list_remove
(
&
driver
->
entry
);
heap_
free
(
driver
);
free
(
driver
);
return
TRUE
;
}
}
...
...
@@ -511,7 +510,7 @@ HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
return
0
;
}
if
(
!
(
whic
=
heap_
alloc
(
sizeof
(
*
whic
))))
if
(
!
(
whic
=
m
alloc
(
sizeof
(
*
whic
))))
{
CloseDriver
(
hdrv
,
0
,
0
);
return
FALSE
;
...
...
@@ -550,7 +549,7 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO
icopen
.
pV2Reserved
=
NULL
;
icopen
.
dnDevNode
=
0
;
/* FIXME */
if
(
!
(
whic
=
heap_
alloc
(
sizeof
(
*
whic
))))
if
(
!
(
whic
=
m
alloc
(
sizeof
(
*
whic
))))
return
NULL
;
whic
->
driverproc
=
lpfnHandler
;
...
...
@@ -566,7 +565,7 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO
{
WARN
(
"DRV_LOAD failed for hic %p
\n
"
,
whic
->
hic
);
MSVIDEO_FirstHic
=
whic
->
next
;
heap_
free
(
whic
);
free
(
whic
);
return
0
;
}
/* return value is not checked */
...
...
@@ -580,7 +579,7 @@ HIC VFWAPI ICOpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, DRIVERPRO
{
WARN
(
"DRV_OPEN failed for hic %p
\n
"
,
whic
->
hic
);
MSVIDEO_FirstHic
=
whic
->
next
;
heap_
free
(
whic
);
free
(
whic
);
return
0
;
}
...
...
@@ -898,7 +897,7 @@ static BOOL enum_compressors(HWND list, COMPVARS *pcv, BOOL enum_all)
idx
=
SendMessageW
(
list
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
icinfo
.
szDescription
);
ic
=
heap_
alloc
(
sizeof
(
*
ic
));
ic
=
m
alloc
(
sizeof
(
*
ic
));
ic
->
icinfo
=
icinfo
;
ic
->
hic
=
hic
;
SendMessageW
(
list
,
CB_SETITEMDATA
,
idx
,
(
LPARAM
)
ic
);
...
...
@@ -951,7 +950,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA
LoadStringW
(
MSVFW32_hModule
,
IDS_FULLFRAMES
,
buf
,
128
);
SendDlgItemMessageW
(
hdlg
,
IDC_COMP_LIST
,
CB_ADDSTRING
,
0
,
(
LPARAM
)
buf
);
ic
=
heap_
alloc
(
sizeof
(
*
ic
));
ic
=
m
alloc
(
sizeof
(
*
ic
));
ic
->
icinfo
.
fccType
=
streamtypeVIDEO
;
ic
->
icinfo
.
fccHandler
=
comptypeDIB
;
ic
->
hic
=
0
;
...
...
@@ -1072,7 +1071,7 @@ static INT_PTR CALLBACK icm_choose_compressor_dlgproc(HWND hdlg, UINT msg, WPARA
if
(
!
ic
||
(
LONG_PTR
)
ic
==
CB_ERR
)
break
;
if
(
ic
->
hic
)
ICClose
(
ic
->
hic
);
heap_
free
(
ic
);
free
(
ic
);
}
EndDialog
(
hdlg
,
LOWORD
(
wparam
)
==
IDOK
);
...
...
@@ -1153,13 +1152,13 @@ void VFWAPI ICCompressorFree(PCOMPVARS pc)
ICClose
(
pc
->
hic
);
pc
->
hic
=
NULL
;
}
heap_
free
(
pc
->
lpbiIn
);
free
(
pc
->
lpbiIn
);
pc
->
lpbiIn
=
NULL
;
heap_
free
(
pc
->
lpBitsOut
);
free
(
pc
->
lpBitsOut
);
pc
->
lpBitsOut
=
NULL
;
heap_
free
(
pc
->
lpBitsPrev
);
free
(
pc
->
lpBitsPrev
);
pc
->
lpBitsPrev
=
NULL
;
heap_
free
(
pc
->
lpState
);
free
(
pc
->
lpState
);
pc
->
lpState
=
NULL
;
pc
->
dwFlags
=
0
;
}
...
...
@@ -1272,7 +1271,7 @@ LRESULT WINAPI ICClose(HIC hic)
}
}
heap_
free
(
whic
);
free
(
whic
);
return
0
;
}
...
...
@@ -1357,7 +1356,7 @@ HANDLE VFWAPI ICImageDecompress(
cbHdr
=
ICDecompressGetFormatSize
(
hic
,
lpbiIn
);
if
(
cbHdr
<
sizeof
(
BITMAPINFOHEADER
)
)
goto
err
;
if
(
!
(
pHdr
=
heap_alloc_zero
(
cbHdr
+
sizeof
(
RGBQUAD
)
*
256
)))
if
(
!
(
pHdr
=
calloc
(
1
,
cbHdr
+
sizeof
(
RGBQUAD
)
*
256
)))
goto
err
;
if
(
ICDecompressGetFormat
(
hic
,
lpbiIn
,
pHdr
)
!=
ICERR_OK
)
goto
err
;
...
...
@@ -1412,7 +1411,7 @@ err:
ICDecompressEnd
(
hic
);
if
(
bReleaseIC
)
ICClose
(
hic
);
heap_
free
(
pHdr
);
free
(
pHdr
);
if
(
pMem
!=
NULL
)
GlobalUnlock
(
hMem
);
if
(
!
bSucceeded
&&
hMem
!=
NULL
)
...
...
@@ -1483,14 +1482,14 @@ LPVOID VFWAPI ICSeqCompressFrame(PCOMPVARS pc, UINT uiFlags, LPVOID lpBits, BOOL
static
void
clear_compvars
(
PCOMPVARS
pc
)
{
heap_
free
(
pc
->
lpbiIn
);
heap_
free
(
pc
->
lpBitsPrev
);
heap_
free
(
pc
->
lpBitsOut
);
heap_
free
(
pc
->
lpState
);
free
(
pc
->
lpbiIn
);
free
(
pc
->
lpBitsPrev
);
free
(
pc
->
lpBitsOut
);
free
(
pc
->
lpState
);
pc
->
lpbiIn
=
pc
->
lpBitsPrev
=
pc
->
lpBitsOut
=
pc
->
lpState
=
NULL
;
if
(
pc
->
dwFlags
&
0x80000000
)
{
heap_
free
(
pc
->
lpbiOut
);
free
(
pc
->
lpbiOut
);
pc
->
lpbiOut
=
NULL
;
pc
->
dwFlags
&=
~
0x80000000
;
}
...
...
@@ -1521,7 +1520,7 @@ static BITMAPINFO *copy_bitmapinfo(const BITMAPINFO *src)
if
(
src
->
bmiHeader
.
biCompression
==
BI_BITFIELDS
)
size
+=
3
*
sizeof
(
DWORD
);
if
(
!
(
dst
=
heap_
alloc
(
size
)))
if
(
!
(
dst
=
m
alloc
(
size
)))
return
NULL
;
memcpy
(
dst
,
src
,
size
);
...
...
@@ -1542,7 +1541,7 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
if
(
!
(
pc
->
lpbiIn
=
copy_bitmapinfo
(
lpbiIn
)))
return
FALSE
;
if
(
!
(
pc
->
lpState
=
heap_
alloc
(
sizeof
(
ICCOMPRESS
)
+
sizeof
(
*
icComp
->
lpckid
)
+
sizeof
(
*
icComp
->
lpdwFlags
))))
if
(
!
(
pc
->
lpState
=
m
alloc
(
sizeof
(
ICCOMPRESS
)
+
sizeof
(
*
icComp
->
lpckid
)
+
sizeof
(
*
icComp
->
lpdwFlags
))))
goto
error
;
pc
->
cbState
=
sizeof
(
ICCOMPRESS
);
...
...
@@ -1555,7 +1554,7 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
if
(
size
<=
0
)
goto
error
;
if
(
!
(
pc
->
lpbiOut
=
heap_alloc_zero
(
size
)))
if
(
!
(
pc
->
lpbiOut
=
calloc
(
1
,
size
)))
goto
error
;
/* Flag to show that we allocated lpbiOut for proper cleanup */
pc
->
dwFlags
|=
0x80000000
;
...
...
@@ -1591,11 +1590,11 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
pc
->
lpbiOut
->
bmiHeader
.
biSizeImage
);
/* Buffer for compressed frame data */
if
(
!
(
pc
->
lpBitsOut
=
heap_
alloc
(
pc
->
lpbiOut
->
bmiHeader
.
biSizeImage
)))
if
(
!
(
pc
->
lpBitsOut
=
m
alloc
(
pc
->
lpbiOut
->
bmiHeader
.
biSizeImage
)))
goto
error
;
/* Buffer for previous compressed frame data */
if
(
!
(
pc
->
lpBitsPrev
=
heap_
alloc
(
pc
->
lpbiOut
->
bmiHeader
.
biSizeImage
)))
if
(
!
(
pc
->
lpBitsPrev
=
m
alloc
(
pc
->
lpbiOut
->
bmiHeader
.
biSizeImage
)))
goto
error
;
TRACE
(
"Compvars:
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment