Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
0f3c4eb3
Commit
0f3c4eb3
authored
Aug 23, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Aug 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mciavi32: Use CRT allocation functions.
parent
19b7d1db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
44 deletions
+38
-44
mciavi.c
dlls/mciavi32/mciavi.c
+30
-31
mmoutput.c
dlls/mciavi32/mmoutput.c
+8
-13
No files found.
dlls/mciavi32/mciavi.c
View file @
0f3c4eb3
...
...
@@ -79,7 +79,7 @@ static DWORD MCIAVI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
if
(
!
MCIAVI_RegisterClass
())
return
0
;
wma
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
WINE_MCIAVI
));
wma
=
calloc
(
1
,
sizeof
(
WINE_MCIAVI
));
if
(
!
wma
)
return
0
;
...
...
@@ -124,8 +124,8 @@ static DWORD MCIAVI_drvClose(DWORD dwDevID)
wma
->
cs
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
wma
->
cs
);
HeapFree
(
GetProcessHeap
(),
0
,
wma
);
return
1
;
free
(
wma
);
return
1
;
}
return
(
dwDevID
==
0xFFFFFFFF
)
?
1
:
0
;
}
...
...
@@ -172,30 +172,30 @@ static void MCIAVI_CleanUp(WINE_MCIAVI* wma)
mmioClose
(
wma
->
hFile
,
0
);
wma
->
hFile
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
lpFileName
);
free
(
wma
->
lpFileName
);
wma
->
lpFileName
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
lpVideoIndex
);
wma
->
lpVideoIndex
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
lpAudioIndex
);
wma
->
lpAudioIndex
=
NULL
;
if
(
wma
->
hic
)
ICClose
(
wma
->
hic
);
wma
->
hic
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
inbih
);
wma
->
inbih
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
outbih
);
wma
->
outbih
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
indata
);
wma
->
indata
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
outdata
);
wma
->
outdata
=
NULL
;
if
(
wma
->
hbmFrame
)
DeleteObject
(
wma
->
hbmFrame
);
wma
->
hbmFrame
=
0
;
if
(
wma
->
hWnd
)
DestroyWindow
(
wma
->
hWnd
);
wma
->
hWnd
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
lpWaveFormat
);
wma
->
lpWaveFormat
=
0
;
free
(
wma
->
lpVideoIndex
);
wma
->
lpVideoIndex
=
NULL
;
free
(
wma
->
lpAudioIndex
);
wma
->
lpAudioIndex
=
NULL
;
if
(
wma
->
hic
)
ICClose
(
wma
->
hic
);
wma
->
hic
=
0
;
free
(
wma
->
inbih
);
wma
->
inbih
=
NULL
;
free
(
wma
->
outbih
);
wma
->
outbih
=
NULL
;
free
(
wma
->
indata
);
wma
->
indata
=
NULL
;
free
(
wma
->
outdata
);
wma
->
outdata
=
NULL
;
if
(
wma
->
hbmFrame
)
DeleteObject
(
wma
->
hbmFrame
);
wma
->
hbmFrame
=
0
;
if
(
wma
->
hWnd
)
DestroyWindow
(
wma
->
hWnd
);
wma
->
hWnd
=
0
;
free
(
wma
->
lpWaveFormat
);
wma
->
lpWaveFormat
=
0
;
memset
(
&
wma
->
mah
,
0
,
sizeof
(
wma
->
mah
));
memset
(
&
wma
->
ash_video
,
0
,
sizeof
(
wma
->
ash_video
));
...
...
@@ -251,8 +251,7 @@ static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
/* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
TRACE
(
"MCI_OPEN_ELEMENT %s!
\n
"
,
debugstr_w
(
lpOpenParms
->
lpstrElementName
));
wma
->
lpFileName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpOpenParms
->
lpstrElementName
)
+
1
)
*
sizeof
(
WCHAR
));
lstrcpyW
(
wma
->
lpFileName
,
lpOpenParms
->
lpstrElementName
);
wma
->
lpFileName
=
wcsdup
(
lpOpenParms
->
lpstrElementName
);
if
(
lpOpenParms
->
lpstrElementName
[
0
]
==
'@'
)
{
/* The file name @11223344 encodes an AVIFile handle in decimal notation
...
...
@@ -366,7 +365,7 @@ static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpP
if
(
MCIAVI_OpenAudio
(
wma
,
&
nHdr
,
&
waveHdr
)
!=
0
)
{
/* can't play audio */
HeapFree
(
GetProcessHeap
(),
0
,
wma
->
lpWaveFormat
);
free
(
wma
->
lpWaveFormat
);
wma
->
lpWaveFormat
=
NULL
;
}
else
...
...
@@ -462,7 +461,7 @@ static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpP
dwRet
=
0
;
if
(
wma
->
lpWaveFormat
)
{
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
free
(
waveHdr
);
if
(
wma
->
hWave
)
{
LeaveCriticalSection
(
&
wma
->
cs
);
...
...
@@ -507,7 +506,7 @@ static DWORD WINAPI MCIAVI_mciPlay_thread(LPVOID arg)
ret
=
MCIAVI_player
(
data
->
wma
,
data
->
flags
,
&
data
->
params
);
TRACE
(
"In thread after async play command (id %u, flags %08lx)
\n
"
,
data
->
wma
->
wDevID
,
data
->
flags
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
ret
;
}
...
...
@@ -517,7 +516,7 @@ static DWORD WINAPI MCIAVI_mciPlay_thread(LPVOID arg)
static
DWORD
MCIAVI_mciPlay_async
(
WINE_MCIAVI
*
wma
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParams
)
{
HANDLE
handle
;
struct
MCIAVI_play_data
*
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
MCIAVI_play_data
));
struct
MCIAVI_play_data
*
data
=
malloc
(
sizeof
(
struct
MCIAVI_play_data
));
if
(
!
data
)
return
MCIERR_OUT_OF_MEMORY
;
...
...
dlls/mciavi32/mmoutput.c
View file @
0f3c4eb3
...
...
@@ -65,7 +65,7 @@ static BOOL MCIAVI_GetInfoAudio(WINE_MCIAVI* wma, const MMCKINFO* mmckList, MMCK
WARN
(
"Size of strf chunk (%ld) < audio format struct
\n
"
,
mmckInfo
.
cksize
);
return
FALSE
;
}
wma
->
lpWaveFormat
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mmckInfo
.
cksize
);
wma
->
lpWaveFormat
=
malloc
(
mmckInfo
.
cksize
);
if
(
!
wma
->
lpWaveFormat
)
{
WARN
(
"Can't alloc WaveFormat
\n
"
);
return
FALSE
;
...
...
@@ -120,7 +120,7 @@ static BOOL MCIAVI_GetInfoVideo(WINE_MCIAVI* wma, const MMCKINFO* mmckList, MMCK
return
FALSE
;
}
wma
->
inbih
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mmckInfo
.
cksize
);
wma
->
inbih
=
malloc
(
mmckInfo
.
cksize
);
if
(
!
wma
->
inbih
)
{
WARN
(
"Can't alloc input BIH
\n
"
);
return
FALSE
;
...
...
@@ -228,10 +228,7 @@ static BOOL MCIAVI_AddFrame(WINE_MCIAVI* wma, LPMMCKINFO mmck,
DWORD
newsize
=
alb
->
numAudioAllocated
+
32
;
struct
MMIOPos
*
newindex
;
if
(
!
wma
->
lpAudioIndex
)
newindex
=
HeapAlloc
(
GetProcessHeap
(),
0
,
newsize
*
sizeof
(
struct
MMIOPos
));
else
newindex
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
wma
->
lpAudioIndex
,
newsize
*
sizeof
(
struct
MMIOPos
));
newindex
=
realloc
(
wma
->
lpAudioIndex
,
newsize
*
sizeof
(
struct
MMIOPos
));
if
(
!
newindex
)
return
FALSE
;
alb
->
numAudioAllocated
=
newsize
;
wma
->
lpAudioIndex
=
newindex
;
...
...
@@ -371,8 +368,7 @@ BOOL MCIAVI_GetInfo(WINE_MCIAVI* wma)
}
wma
->
dwPlayableVideoFrames
=
wma
->
mah
.
dwTotalFrames
;
wma
->
lpVideoIndex
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
wma
->
dwPlayableVideoFrames
*
sizeof
(
struct
MMIOPos
));
wma
->
lpVideoIndex
=
calloc
(
wma
->
dwPlayableVideoFrames
,
sizeof
(
struct
MMIOPos
));
if
(
!
wma
->
lpVideoIndex
)
{
WARN
(
"Can't alloc video index array
\n
"
);
return
FALSE
;
...
...
@@ -414,7 +410,7 @@ BOOL MCIAVI_GetInfo(WINE_MCIAVI* wma)
wma
->
ash_audio
.
dwSuggestedBufferSize
=
alb
.
inAudioSize
;
}
wma
->
indata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
wma
->
ash_video
.
dwSuggestedBufferSize
);
wma
->
indata
=
malloc
(
wma
->
ash_video
.
dwSuggestedBufferSize
);
if
(
!
wma
->
indata
)
{
WARN
(
"Can't alloc input buffer
\n
"
);
return
FALSE
;
...
...
@@ -453,7 +449,7 @@ BOOL MCIAVI_OpenVideo(WINE_MCIAVI* wma)
outSize
=
sizeof
(
BITMAPINFOHEADER
)
+
256
*
sizeof
(
RGBQUAD
);
wma
->
outbih
=
HeapAlloc
(
GetProcessHeap
(),
0
,
outSize
);
wma
->
outbih
=
malloc
(
outSize
);
if
(
!
wma
->
outbih
)
{
WARN
(
"Can't alloc output BIH
\n
"
);
return
FALSE
;
...
...
@@ -475,7 +471,7 @@ BOOL MCIAVI_OpenVideo(WINE_MCIAVI* wma)
TRACE
(
"bih.biClrUsed=%ld
\n
"
,
wma
->
outbih
->
biClrUsed
);
TRACE
(
"bih.biClrImportant=%ld
\n
"
,
wma
->
outbih
->
biClrImportant
);
wma
->
outdata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
wma
->
outbih
->
biSizeImage
);
wma
->
outdata
=
malloc
(
wma
->
outbih
->
biSizeImage
);
if
(
!
wma
->
outdata
)
{
WARN
(
"Can't alloc output buffer
\n
"
);
return
FALSE
;
...
...
@@ -541,8 +537,7 @@ DWORD MCIAVI_OpenAudio(WINE_MCIAVI* wma, unsigned* nHdr, LPWAVEHDR* pWaveHdr)
* to be used...
*/
*
nHdr
=
7
;
waveHdr
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
*
nHdr
*
(
sizeof
(
WAVEHDR
)
+
wma
->
ash_audio
.
dwSuggestedBufferSize
));
waveHdr
=
calloc
(
*
nHdr
,
sizeof
(
WAVEHDR
)
+
wma
->
ash_audio
.
dwSuggestedBufferSize
);
if
(
!
waveHdr
)
{
TRACE
(
"Can't alloc wave headers
\n
"
);
dwRet
=
MCIERR_DEVICE_OPEN
;
...
...
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