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
90a5dc72
Commit
90a5dc72
authored
Sep 19, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mciwave: Use CRT allocation functions.
parent
7dc45bd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
mciwave.c
dlls/mciwave/mciwave.c
+18
-19
No files found.
dlls/mciwave/mciwave.c
View file @
90a5dc72
...
...
@@ -89,7 +89,7 @@ static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
ret
=
sca
->
cmd
(
sca
->
wDevID
,
sca
->
dwParam1
|
MCI_WAIT
,
sca
->
dwParam2
,
sca
->
evt
);
TRACE
(
"In thread after async command (%08x,%08Ix,%08Ix)
\n
"
,
sca
->
wDevID
,
sca
->
dwParam1
,
sca
->
dwParam2
);
HeapFree
(
GetProcessHeap
(),
0
,
sca
);
free
(
sca
);
return
ret
;
}
...
...
@@ -100,7 +100,7 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, async_cmd cmd, DWORD_PTR dwParam1
DWORD_PTR
dwParam2
,
UINT
size
)
{
HANDLE
handles
[
2
];
struct
SCA
*
sca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
SCA
)
+
size
);
struct
SCA
*
sca
=
malloc
(
sizeof
(
struct
SCA
)
+
size
);
if
(
sca
==
0
)
return
MCIERR_OUT_OF_MEMORY
;
...
...
@@ -182,7 +182,7 @@ static LRESULT WAVE_drvClose(MCIDEVICEID dwDevID)
WINE_MCIWAVE
*
wmw
=
(
WINE_MCIWAVE
*
)
mciGetDriverData
(
dwDevID
);
if
(
wmw
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wmw
);
free
(
wmw
);
mciSetDriverData
(
dwDevID
,
0
);
return
1
;
}
...
...
@@ -287,12 +287,12 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, const MMCKINFO* pckMainRIFF)
TRACE
(
"Chunk Found ckid=%.4s fccType=%.4s cksize=%08lX
\n
"
,
(
LPSTR
)
&
mmckInfo
.
ckid
,
(
LPSTR
)
&
mmckInfo
.
fccType
,
mmckInfo
.
cksize
);
pwfx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mmckInfo
.
cksize
);
pwfx
=
malloc
(
mmckInfo
.
cksize
);
if
(
!
pwfx
)
return
MCIERR_OUT_OF_MEMORY
;
r
=
mmioRead
(
wmw
->
hFile
,
(
HPSTR
)
pwfx
,
mmckInfo
.
cksize
);
if
(
r
<
0
||
r
<
sizeof
(
PCMWAVEFORMAT
))
{
HeapFree
(
GetProcessHeap
(),
0
,
pwfx
);
free
(
pwfx
);
return
MCIERR_INVALID_FILE
;
}
TRACE
(
"wFormatTag=%04X !
\n
"
,
pwfx
->
wFormatTag
);
...
...
@@ -305,7 +305,7 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, const MMCKINFO* pckMainRIFF)
TRACE
(
"cbSize=%u !
\n
"
,
pwfx
->
cbSize
);
if
((
pwfx
->
wFormatTag
!=
WAVE_FORMAT_PCM
)
&&
(
r
<
sizeof
(
WAVEFORMATEX
)
||
(
r
<
sizeof
(
WAVEFORMATEX
)
+
pwfx
->
cbSize
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
pwfx
);
free
(
pwfx
);
return
MCIERR_INVALID_FILE
;
}
wmw
->
lpWaveFormat
=
pwfx
;
...
...
@@ -437,7 +437,7 @@ static DWORD create_tmp_file(HMMIO* hFile, LPWSTR* pszTmpFileName)
MAX_PATH
*
sizeof
(
WCHAR
));
if
(
!
GetTempFileNameW
(
szTmpPath
,
szPrefix
,
0
,
*
pszTmpFileName
))
{
WARN
(
"can't retrieve temp file name!
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
*
pszTmpFileName
);
free
(
*
pszTmpFileName
);
return
MCIERR_FILE_NOT_FOUND
;
}
...
...
@@ -451,7 +451,7 @@ static DWORD create_tmp_file(HMMIO* hFile, LPWSTR* pszTmpFileName)
if
(
*
hFile
==
0
)
{
WARN
(
"can't create file=%s!
\n
"
,
debugstr_w
(
*
pszTmpFileName
));
/* temporary file could not be created. clean filename. */
HeapFree
(
GetProcessHeap
(),
0
,
*
pszTmpFileName
);
free
(
*
pszTmpFileName
);
dwRet
=
MCIERR_FILE_NOT_FOUND
;
}
}
...
...
@@ -463,10 +463,9 @@ static LRESULT WAVE_mciOpenFile(WINE_MCIWAVE* wmw, LPCWSTR filename)
LRESULT
dwRet
=
MMSYSERR_NOERROR
;
LPWSTR
fn
;
fn
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
filename
)
+
1
)
*
sizeof
(
WCHAR
)
);
fn
=
wcsdup
(
filename
);
if
(
!
fn
)
return
MCIERR_OUT_OF_MEMORY
;
lstrcpyW
(
fn
,
filename
);
HeapFree
(
GetProcessHeap
(),
0
,
wmw
->
lpFileName
);
free
(
wmw
->
lpFileName
);
wmw
->
lpFileName
=
fn
;
if
(
filename
[
0
])
{
...
...
@@ -569,7 +568,7 @@ static LRESULT WAVE_mciOpen(MCIDEVICEID wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_P
if
(
wmw
->
hFile
!=
0
)
mmioClose
(
wmw
->
hFile
,
0
);
wmw
->
hFile
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
wmw
->
lpFileName
);
free
(
wmw
->
lpFileName
);
wmw
->
lpFileName
=
NULL
;
}
return
dwRet
;
...
...
@@ -681,9 +680,9 @@ static DWORD WAVE_mciClose(MCIDEVICEID wDevID, DWORD dwFlags, LPMCI_GENERIC_PARM
}
if
(
wmw
->
lpWaveFormat
!=
&
wmw
->
wfxRef
)
HeapFree
(
GetProcessHeap
(),
0
,
wmw
->
lpWaveFormat
);
free
(
wmw
->
lpWaveFormat
);
wmw
->
lpWaveFormat
=
&
wmw
->
wfxRef
;
HeapFree
(
GetProcessHeap
(),
0
,
wmw
->
lpFileName
);
free
(
wmw
->
lpFileName
);
wmw
->
lpFileName
=
NULL
;
if
((
dwFlags
&
MCI_NOTIFY
)
&&
lpParms
)
{
...
...
@@ -854,7 +853,7 @@ static DWORD WAVE_mciPlay(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt,
/* make it so that 3 buffers per second are needed */
bufsize
=
WAVE_ALIGN_ON_BLOCK
(
wmw
,
wmw
->
lpWaveFormat
->
nAvgBytesPerSec
/
3
);
waveHdr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
WAVEHDR
)
+
2
*
bufsize
);
waveHdr
=
malloc
(
2
*
sizeof
(
WAVEHDR
)
+
2
*
bufsize
);
waveHdr
[
0
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
);
waveHdr
[
1
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
)
+
bufsize
;
waveHdr
[
0
].
dwUser
=
waveHdr
[
1
].
dwUser
=
0L
;
...
...
@@ -917,7 +916,7 @@ cleanUp:
if
(
dwFlags
&
MCI_NOTIFY
)
oldcb
=
InterlockedExchangePointer
(
&
wmw
->
hCallback
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
free
(
waveHdr
);
if
(
wmw
->
hWave
)
{
waveOutClose
(
wmw
->
hWave
);
...
...
@@ -1038,7 +1037,7 @@ static DWORD WAVE_mciRecord(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt
* we don't modify the wave part of an existing file (ie. we always erase an
* existing content, we don't overwrite)
*/
HeapFree
(
GetProcessHeap
(),
0
,
wmw
->
lpFileName
);
free
(
wmw
->
lpFileName
);
dwRet
=
create_tmp_file
(
&
wmw
->
hFile
,
(
WCHAR
**
)
&
wmw
->
lpFileName
);
if
(
dwRet
!=
0
)
return
dwRet
;
...
...
@@ -1092,7 +1091,7 @@ static DWORD WAVE_mciRecord(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt
/* make it so that 3 buffers per second are needed */
bufsize
=
WAVE_ALIGN_ON_BLOCK
(
wmw
,
wmw
->
lpWaveFormat
->
nAvgBytesPerSec
/
3
);
waveHdr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
2
*
sizeof
(
WAVEHDR
)
+
2
*
bufsize
);
waveHdr
=
malloc
(
2
*
sizeof
(
WAVEHDR
)
+
2
*
bufsize
);
waveHdr
[
0
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
);
waveHdr
[
1
].
lpData
=
(
char
*
)
waveHdr
+
2
*
sizeof
(
WAVEHDR
)
+
bufsize
;
waveHdr
[
0
].
dwUser
=
waveHdr
[
1
].
dwUser
=
0L
;
...
...
@@ -1143,7 +1142,7 @@ cleanUp:
if
(
dwFlags
&
MCI_NOTIFY
)
oldcb
=
InterlockedExchangePointer
(
&
wmw
->
hCallback
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
waveHdr
);
free
(
waveHdr
);
if
(
wmw
->
hWave
)
{
waveInClose
(
wmw
->
hWave
);
...
...
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