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
bb6bcaf8
Commit
bb6bcaf8
authored
Nov 01, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm/tests: Use CRT allocation functions.
parent
0b7eed03
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
37 deletions
+33
-37
capture.c
dlls/winmm/tests/capture.c
+7
-8
midi.c
dlls/winmm/tests/midi.c
+8
-8
mixer.c
dlls/winmm/tests/mixer.c
+4
-6
wave.c
dlls/winmm/tests/wave.c
+14
-15
No files found.
dlls/winmm/tests/capture.c
View file @
bb6bcaf8
...
...
@@ -192,7 +192,7 @@ static void wave_in_test_deviceIn(int device, WAVEFORMATEX *pwfx, DWORD format,
/* Check that the position is 0 at start */
check_position
(
device
,
win
,
0
,
pwfx
);
frag
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pwfx
->
nAvgBytesPerSec
);
frag
.
lpData
=
malloc
(
pwfx
->
nAvgBytesPerSec
);
frag
.
dwBufferLength
=
pwfx
->
nAvgBytesPerSec
;
frag
.
dwBytesRecorded
=
0
;
frag
.
dwUser
=
0
;
...
...
@@ -298,7 +298,7 @@ static void wave_in_test_deviceIn(int device, WAVEFORMATEX *pwfx, DWORD format,
trace
(
"Unable to play back the recorded sound
\n
"
);
}
HeapFree
(
GetProcessHeap
(),
0
,
frag
.
lpData
);
free
(
frag
.
lpData
);
CloseHandle
(
hevent
);
}
...
...
@@ -379,7 +379,7 @@ static void wave_in_test_device(UINT_PTR device)
"waveInMessage(%s): failed to get interface size: rc=%s
\n
"
,
dev_name
(
device
),
wave_in_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
nameW
=
malloc
(
size
);
rc
=
waveInMessage
((
HWAVEIN
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
nameW
,
size
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveInMessage(%s): failed to get interface "
...
...
@@ -387,14 +387,13 @@ static void wave_in_test_device(UINT_PTR device)
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size %ld
\n
"
,
size
);
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
/
sizeof
(
WCHAR
));
nameA
=
malloc
(
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
}
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
"not supported"
));
strcpy
(
nameA
,
"not supported"
);
nameA
=
strdup
(
"not supported"
);
}
trace
(
" %s:
\"
%s
\"
(%s) %d.%d (%d:%d)
\n
"
,
dev_name
(
device
),
capsA
.
szPname
,
...
...
@@ -403,7 +402,7 @@ static void wave_in_test_device(UINT_PTR device)
trace
(
" channels=%d formats=%05lx
\n
"
,
capsA
.
wChannels
,
capsA
.
dwFormats
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
free
(
nameA
);
for
(
f
=
0
;
f
<
ARRAY_SIZE
(
win_formats
);
f
++
)
{
format
.
wFormatTag
=
WAVE_FORMAT_PCM
;
...
...
dlls/winmm/tests/midi.c
View file @
bb6bcaf8
...
...
@@ -136,7 +136,7 @@ static void test_midiIn_device(UINT udev, HWND hwnd)
mhdr
.
dwUser
=
0x56FA552C
;
mhdr
.
dwBufferLength
=
70000
;
/* > 64KB! */
mhdr
.
dwBytesRecorded
=
5
;
mhdr
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mhdr
.
dwBufferLength
);
mhdr
.
lpData
=
malloc
(
mhdr
.
dwBufferLength
);
ok
(
mhdr
.
lpData
!=
NULL
,
"No %ld bytes of memory!
\n
"
,
mhdr
.
dwBufferLength
);
if
(
mhdr
.
lpData
)
{
rc
=
midiInPrepareHeader
(
hm
,
&
mhdr
,
offsetof
(
MIDIHDR
,
dwOffset
)
-
1
);
...
...
@@ -204,7 +204,7 @@ static void test_midiIn_device(UINT udev, HWND hwnd)
ok
(
!
rc
,
"midiInClose rc=%s
\n
"
,
mmsys_error
(
rc
));
ok
(
mhdr
.
dwUser
==
0x56FA552C
,
"MIDIHDR.dwUser changed to %Ix
\n
"
,
mhdr
.
dwUser
);
HeapFree
(
GetProcessHeap
(),
0
,
mhdr
.
lpData
);
free
(
mhdr
.
lpData
);
test_notification
(
hwnd
,
"midiInClose"
,
MIM_CLOSE
,
0
);
test_notification
(
hwnd
,
"midiIn over"
,
0
,
WHATEVER
);
}
...
...
@@ -358,7 +358,7 @@ static void test_midiOut_device(UINT udev, HWND hwnd)
mhdr
.
dwUser
=
0x56FA552C
;
mhdr
.
dwOffset
=
0xDEADBEEF
;
mhdr
.
dwBufferLength
=
70000
;
/* > 64KB! */
mhdr
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mhdr
.
dwBufferLength
);
mhdr
.
lpData
=
malloc
(
mhdr
.
dwBufferLength
);
ok
(
mhdr
.
lpData
!=
NULL
,
"No %ld bytes of memory!
\n
"
,
mhdr
.
dwBufferLength
);
if
(
mhdr
.
lpData
)
{
rc
=
midiOutLongMsg
(
hm
,
&
mhdr
,
sizeof
(
mhdr
));
...
...
@@ -399,7 +399,7 @@ static void test_midiOut_device(UINT udev, HWND hwnd)
ok
(
!
rc
,
"midiOutUnprepare rc=%s
\n
"
,
mmsys_error
(
rc
));
ok
(
mhdr
.
dwFlags
==
(
MHDR_INQUEUE
|
MHDR_DONE
),
"dwFlags=%lx
\n
"
,
mhdr
.
dwFlags
);
HeapFree
(
GetProcessHeap
(),
0
,
mhdr
.
lpData
);
free
(
mhdr
.
lpData
);
}
ok
(
mhdr
.
dwUser
==
0x56FA552C
,
"MIDIHDR.dwUser changed to %Ix
\n
"
,
mhdr
.
dwUser
);
ok
(
mhdr
.
dwOffset
==
0xDEADBEEF
,
"MIDIHDR.dwOffset changed to %lx
\n
"
,
mhdr
.
dwOffset
);
...
...
@@ -810,7 +810,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
ok
(
0
==
strmNops
[
1
].
dwStreamID
,
"dwStreamID[1] set to %lx
\n
"
,
strmNops
[
1
].
dwStreamID
);
mhdr
.
dwBufferLength
=
70000
;
/* > 64KB! */
mhdr
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mhdr
.
dwBufferLength
);
mhdr
.
lpData
=
malloc
(
mhdr
.
dwBufferLength
);
ok
(
mhdr
.
lpData
!=
NULL
,
"No %ld bytes of memory!
\n
"
,
mhdr
.
dwBufferLength
);
if
(
mhdr
.
lpData
)
{
mhdr
.
dwFlags
=
0
;
...
...
@@ -821,7 +821,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
rc
=
midiOutUnprepareHeader
((
HMIDIOUT
)
hm
,
&
mhdr
,
sizeof
(
mhdr
));
ok
(
!
rc
,
"midiOutUnprepare rc=%s
\n
"
,
mmsys_error
(
rc
));
HeapFree
(
GetProcessHeap
(),
0
,
mhdr
.
lpData
);
free
(
mhdr
.
lpData
);
}
rc
=
midiStreamClose
(
hm
);
...
...
@@ -999,7 +999,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
memset
(
&
mhdr
,
0
,
sizeof
(
mhdr
));
mhdr
.
dwBufferLength
=
sizeof
(
MIDISHORTEVENT
)
*
5
+
ROUNDUP4
(
sizeof
(
SysEx_reset
))
+
ROUNDUP4
(
sizeof
(
SysEx_volume_off
))
+
ROUNDUP4
(
sizeof
(
SysEx_volume_full
));
mhdr
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mhdr
.
dwBufferLength
);
mhdr
.
lpData
=
calloc
(
1
,
mhdr
.
dwBufferLength
);
ok
(
mhdr
.
lpData
!=
NULL
,
"No %ld bytes of memory!
\n
"
,
mhdr
.
dwBufferLength
);
if
(
mhdr
.
lpData
)
{
MIDIEVENT
*
e
;
...
...
@@ -1042,7 +1042,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
rc
=
midiOutUnprepareHeader
((
HMIDIOUT
)
hm
,
&
mhdr
,
sizeof
(
mhdr
));
ok
(
!
rc
,
"midiOutUnprepare rc=%s
\n
"
,
mmsys_error
(
rc
));
HeapFree
(
GetProcessHeap
(),
0
,
mhdr
.
lpData
);
free
(
mhdr
.
lpData
);
}
rc
=
midiStreamClose
(
hm
);
ok
(
!
rc
,
"midiOutClose rc=%s
\n
"
,
mmsys_error
(
rc
));
...
...
dlls/winmm/tests/mixer.c
View file @
bb6bcaf8
...
...
@@ -512,8 +512,7 @@ static void mixer_test_deviceA(int device)
mixerlineA
.
Target
.
wMid
,
mixerlineA
.
Target
.
wPid
);
}
if
(
mixerlineA
.
cControls
)
{
array
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mixerlineA
.
cControls
*
sizeof
(
MIXERCONTROLA
));
array
=
calloc
(
mixerlineA
.
cControls
,
sizeof
(
MIXERCONTROLA
));
if
(
array
)
{
memset
(
&
controls
,
0
,
sizeof
(
controls
));
...
...
@@ -565,7 +564,7 @@ static void mixer_test_deviceA(int device)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
array
);
free
(
array
);
}
}
}
...
...
@@ -913,8 +912,7 @@ static void mixer_test_deviceW(int device)
mixerlineW
.
Target
.
wMid
,
mixerlineW
.
Target
.
wPid
);
}
if
(
mixerlineW
.
cControls
)
{
array
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mixerlineW
.
cControls
*
sizeof
(
MIXERCONTROLW
));
array
=
calloc
(
mixerlineW
.
cControls
,
sizeof
(
MIXERCONTROLW
));
if
(
array
)
{
rc
=
mixerGetLineControlsW
(
mix
,
0
,
MIXER_GETLINECONTROLSF_ALL
);
ok
(
rc
==
MMSYSERR_INVALPARAM
,
...
...
@@ -967,7 +965,7 @@ static void mixer_test_deviceW(int device)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
array
);
free
(
array
);
}
}
}
...
...
dlls/winmm/tests/wave.c
View file @
bb6bcaf8
...
...
@@ -98,7 +98,7 @@ static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
b
=
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
b
=
buf
=
malloc
(
*
size
);
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
double
y
=
sin
(
440
.
0
*
2
*
PI
*
i
/
wfx
->
nSamplesPerSec
);
if
(
wfx
->
wBitsPerSample
==
8
)
{
...
...
@@ -157,7 +157,7 @@ static char* wave_generate_silence(WAVEFORMATEX* wfx, double duration, DWORD* si
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
b
=
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
b
=
buf
=
malloc
(
*
size
);
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
if
(
wfx
->
wBitsPerSample
==
8
)
{
for
(
j
=
0
;
j
<
wfx
->
nChannels
;
j
++
)
...
...
@@ -671,7 +671,7 @@ static void wave_out_test_deviceOut(int device, double duration, int headers, in
pwfx
->
nSamplesPerSec
,
pwfx
->
wBitsPerSample
,
pwfx
->
nChannels
,
nSamplesPerSec
,
wBitsPerSample
,
nChannels
);
frags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
headers
*
sizeof
(
WAVEHDR
));
frags
=
malloc
(
headers
*
sizeof
(
WAVEHDR
));
if
(
sine
)
buffer
=
wave_generate_la
(
pwfx
,
duration
/
(
loops
+
1
),
&
length
);
...
...
@@ -855,14 +855,14 @@ static void wave_out_test_deviceOut(int device, double duration, int headers, in
ok
(
rc
==
WAIT_TIMEOUT
,
"Notification from %s rc=%x
\n
"
,
wave_open_flags
(
flags
|
WAVE_FORMAT_QUERY
),
rc
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
free
(
buffer
);
EXIT:
if
((
flags
&
CALLBACK_TYPEMASK
)
==
CALLBACK_THREAD
)
{
PostThreadMessageW
(
thread_id
,
WM_APP
,
0
,
0
);
WaitForSingleObject
(
hevent
,
10000
);
}
CloseHandle
(
hevent
);
HeapFree
(
GetProcessHeap
(),
0
,
frags
);
free
(
frags
);
}
static
void
wave_out_test_device
(
UINT_PTR
device
)
...
...
@@ -948,22 +948,21 @@ static void wave_out_test_device(UINT_PTR device)
"waveOutMessage(%s): failed to get interface size, rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
nameW
=
malloc
(
size
);
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
nameW
,
size
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutMessage(%s): failed to get interface "
"name, rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size %ld
\n
"
,
size
);
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
/
sizeof
(
WCHAR
));
nameA
=
malloc
(
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
}
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
free
(
nameW
);
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
"not supported"
));
strcpy
(
nameA
,
"not supported"
);
nameA
=
strdup
(
"not supported"
);
}
rc
=
waveOutGetDevCapsA
(
device
,
&
capsA
,
sizeof
(
capsA
));
...
...
@@ -972,7 +971,7 @@ static void wave_out_test_device(UINT_PTR device)
dev_name
(
device
),
wave_out_error
(
rc
));
if
(
rc
!=
MMSYSERR_NOERROR
)
{
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
free
(
nameA
);
return
;
}
...
...
@@ -982,7 +981,7 @@ static void wave_out_test_device(UINT_PTR device)
trace
(
" channels=%d formats=%05lx support=%04lx
\n
"
,
capsA
.
wChannels
,
capsA
.
dwFormats
,
capsA
.
dwSupport
);
trace
(
" %s
\n
"
,
wave_out_caps
(
capsA
.
dwSupport
));
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
free
(
nameA
);
if
(
winetest_interactive
&&
(
device
!=
WAVE_MAPPER
))
{
...
...
@@ -1622,7 +1621,7 @@ static void test_fragmentsize(void)
rc
=
waveOutClose
(
wout
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutClose failed: %s
\n
"
,
wave_out_error
(
rc
));
HeapFree
(
GetProcessHeap
(),
0
,
hdr
[
0
].
lpData
);
free
(
hdr
[
0
].
lpData
);
CloseHandle
(
hevent
);
}
...
...
@@ -1723,7 +1722,7 @@ static void test_reentrant_callback(void)
rc
=
waveOutClose
(
wout
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutClose failed: %s
\n
"
,
wave_out_error
(
rc
));
HeapFree
(
GetProcessHeap
(),
0
,
hdr
[
0
].
lpData
);
free
(
hdr
[
0
].
lpData
);
CloseHandle
(
hevent
);
}
...
...
@@ -1770,7 +1769,7 @@ static void create_wav_file(char *temp_file)
ok
(
written
==
length
,
"mmioWrite failed, got %ld
\n
"
,
written
);
rc
=
mmioAscend
(
h
,
&
chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioAscend failed, got %d
\n
"
,
rc
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
free
(
buffer
);
rc
=
mmioAscend
(
h
,
&
riff_chunk
,
0
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"mmioAscend failed, got %d
\n
"
,
rc
);
...
...
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