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
d14da076
Commit
d14da076
authored
Jun 26, 2007
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm: Replace malloc with HeapAlloc.
parent
da1f67a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
capture.c
dlls/winmm/tests/capture.c
+6
-6
wave.c
dlls/winmm/tests/wave.c
+9
-9
No files found.
dlls/winmm/tests/capture.c
View file @
d14da076
...
@@ -191,7 +191,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
...
@@ -191,7 +191,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
/* Check that the position is 0 at start */
/* Check that the position is 0 at start */
check_position
(
device
,
win
,
0
,
pwfx
);
check_position
(
device
,
win
,
0
,
pwfx
);
frag
.
lpData
=
malloc
(
pwfx
->
nAvgBytesPerSec
);
frag
.
lpData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
pwfx
->
nAvgBytesPerSec
);
frag
.
dwBufferLength
=
pwfx
->
nAvgBytesPerSec
;
frag
.
dwBufferLength
=
pwfx
->
nAvgBytesPerSec
;
frag
.
dwBytesRecorded
=
0
;
frag
.
dwBytesRecorded
=
0
;
frag
.
dwUser
=
0
;
frag
.
dwUser
=
0
;
...
@@ -291,7 +291,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
...
@@ -291,7 +291,7 @@ static void wave_in_test_deviceIn(int device, LPWAVEFORMATEX pwfx, DWORD format,
trace
(
"Unable to play back the recorded sound
\n
"
);
trace
(
"Unable to play back the recorded sound
\n
"
);
}
}
free
(
frag
.
lpData
);
HeapFree
(
GetProcessHeap
(),
0
,
frag
.
lpData
);
CloseHandle
(
hevent
);
CloseHandle
(
hevent
);
}
}
...
@@ -371,7 +371,7 @@ static void wave_in_test_device(int device)
...
@@ -371,7 +371,7 @@ static void wave_in_test_device(int device)
"waveInMessage(%s): failed to get interface size: rc=%s
\n
"
,
"waveInMessage(%s): failed to get interface size: rc=%s
\n
"
,
dev_name
(
device
),
wave_in_error
(
rc
));
dev_name
(
device
),
wave_in_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameW
=
(
WCHAR
*
)
malloc
(
size
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
rc
=
waveInMessage
((
HWAVEIN
)
device
,
DRV_QUERYDEVICEINTERFACE
,
rc
=
waveInMessage
((
HWAVEIN
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
nameW
,
size
);
(
DWORD_PTR
)
nameW
,
size
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveInMessage(%s): failed to get interface "
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveInMessage(%s): failed to get interface "
...
@@ -379,11 +379,11 @@ static void wave_in_test_device(int device)
...
@@ -379,11 +379,11 @@ static void wave_in_test_device(int device)
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size %d
\n
"
,
size
);
"got an incorrect size %d
\n
"
,
size
);
if
(
rc
==
MMSYSERR_NOERROR
)
{
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameA
=
malloc
(
size
/
sizeof
(
WCHAR
));
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
}
}
free
(
nameW
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
nameA
=
strdup
(
"not supported"
);
nameA
=
strdup
(
"not supported"
);
}
}
...
@@ -394,7 +394,7 @@ static void wave_in_test_device(int device)
...
@@ -394,7 +394,7 @@ static void wave_in_test_device(int device)
trace
(
" channels=%d formats=%05x
\n
"
,
trace
(
" channels=%d formats=%05x
\n
"
,
capsA
.
wChannels
,
capsA
.
dwFormats
);
capsA
.
wChannels
,
capsA
.
dwFormats
);
free
(
nameA
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
for
(
f
=
0
;
f
<
NB_WIN_FORMATS
;
f
++
)
{
for
(
f
=
0
;
f
<
NB_WIN_FORMATS
;
f
++
)
{
format
.
wFormatTag
=
WAVE_FORMAT_PCM
;
format
.
wFormatTag
=
WAVE_FORMAT_PCM
;
...
...
dlls/winmm/tests/wave.c
View file @
d14da076
...
@@ -58,7 +58,7 @@ static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
...
@@ -58,7 +58,7 @@ static char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size)
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
b
=
buf
=
malloc
(
*
size
);
b
=
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
double
y
=
sin
(
440
.
0
*
2
*
PI
*
i
/
wfx
->
nSamplesPerSec
);
double
y
=
sin
(
440
.
0
*
2
*
PI
*
i
/
wfx
->
nSamplesPerSec
);
if
(
wfx
->
wBitsPerSample
==
8
)
{
if
(
wfx
->
wBitsPerSample
==
8
)
{
...
@@ -117,7 +117,7 @@ static char* wave_generate_silence(WAVEFORMATEX* wfx, double duration, DWORD* si
...
@@ -117,7 +117,7 @@ static char* wave_generate_silence(WAVEFORMATEX* wfx, double duration, DWORD* si
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
nb_samples
=
(
int
)(
duration
*
wfx
->
nSamplesPerSec
);
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
*
size
=
nb_samples
*
wfx
->
nBlockAlign
;
b
=
buf
=
malloc
(
*
size
);
b
=
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
size
);
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
for
(
i
=
0
;
i
<
nb_samples
;
i
++
)
{
if
(
wfx
->
wBitsPerSample
==
8
)
{
if
(
wfx
->
wBitsPerSample
==
8
)
{
for
(
j
=
0
;
j
<
wfx
->
nChannels
;
j
++
)
for
(
j
=
0
;
j
<
wfx
->
nChannels
;
j
++
)
...
@@ -656,7 +656,7 @@ static void wave_out_test_deviceOut(int device, double duration,
...
@@ -656,7 +656,7 @@ static void wave_out_test_deviceOut(int device, double duration,
pwfx
->
nSamplesPerSec
,
pwfx
->
wBitsPerSample
,
pwfx
->
nSamplesPerSec
,
pwfx
->
wBitsPerSample
,
pwfx
->
nChannels
,
nSamplesPerSec
,
wBitsPerSample
,
nChannels
);
pwfx
->
nChannels
,
nSamplesPerSec
,
wBitsPerSample
,
nChannels
);
frags
=
malloc
(
headers
*
sizeof
(
WAVEHDR
));
frags
=
HeapAlloc
(
GetProcessHeap
(),
0
,
headers
*
sizeof
(
WAVEHDR
));
if
(
sine
)
if
(
sine
)
buffer
=
wave_generate_la
(
pwfx
,
duration
/
(
loops
+
1
),
&
length
);
buffer
=
wave_generate_la
(
pwfx
,
duration
/
(
loops
+
1
),
&
length
);
...
@@ -779,7 +779,7 @@ static void wave_out_test_deviceOut(int device, double duration,
...
@@ -779,7 +779,7 @@ static void wave_out_test_deviceOut(int device, double duration,
"waveOutUnprepareHeader(%s): rc=%s
\n
"
,
dev_name
(
device
),
"waveOutUnprepareHeader(%s): rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
wave_out_error
(
rc
));
}
}
free
(
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
rc
=
waveOutClose
(
wout
);
rc
=
waveOutClose
(
wout
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutClose(%s): rc=%s
\n
"
,
dev_name
(
device
),
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutClose(%s): rc=%s
\n
"
,
dev_name
(
device
),
...
@@ -791,7 +791,7 @@ EXIT:
...
@@ -791,7 +791,7 @@ EXIT:
WaitForSingleObject
(
hevent
,
INFINITE
);
WaitForSingleObject
(
hevent
,
INFINITE
);
}
}
CloseHandle
(
hevent
);
CloseHandle
(
hevent
);
free
(
frags
);
HeapFree
(
GetProcessHeap
(),
0
,
frags
);
}
}
static
void
wave_out_test_device
(
int
device
)
static
void
wave_out_test_device
(
int
device
)
...
@@ -870,18 +870,18 @@ static void wave_out_test_device(int device)
...
@@ -870,18 +870,18 @@ static void wave_out_test_device(int device)
"waveOutMessage(%s): failed to get interface size, rc=%s
\n
"
,
"waveOutMessage(%s): failed to get interface size, rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
dev_name
(
device
),
wave_out_error
(
rc
));
if
(
rc
==
MMSYSERR_NOERROR
)
{
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameW
=
(
WCHAR
*
)
malloc
(
size
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACE
,
rc
=
waveOutMessage
((
HWAVEOUT
)
device
,
DRV_QUERYDEVICEINTERFACE
,
(
DWORD_PTR
)
nameW
,
size
);
(
DWORD_PTR
)
nameW
,
size
);
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutMessage(%s): failed to get interface "
ok
(
rc
==
MMSYSERR_NOERROR
,
"waveOutMessage(%s): failed to get interface "
"name, rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
"name, rc=%s
\n
"
,
dev_name
(
device
),
wave_out_error
(
rc
));
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size %d
\n
"
,
size
);
ok
(
lstrlenW
(
nameW
)
+
1
==
size
/
sizeof
(
WCHAR
),
"got an incorrect size %d
\n
"
,
size
);
if
(
rc
==
MMSYSERR_NOERROR
)
{
if
(
rc
==
MMSYSERR_NOERROR
)
{
nameA
=
malloc
(
size
/
sizeof
(
WCHAR
));
nameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
/
sizeof
(
WCHAR
));
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
WideCharToMultiByte
(
CP_ACP
,
0
,
nameW
,
size
/
sizeof
(
WCHAR
),
nameA
,
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
size
/
sizeof
(
WCHAR
),
NULL
,
NULL
);
}
}
free
(
nameW
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
}
}
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
else
if
(
rc
==
MMSYSERR_NOTSUPPORTED
)
{
nameA
=
strdup
(
"not supported"
);
nameA
=
strdup
(
"not supported"
);
...
@@ -893,7 +893,7 @@ static void wave_out_test_device(int device)
...
@@ -893,7 +893,7 @@ static void wave_out_test_device(int device)
trace
(
" channels=%d formats=%05x support=%04x
\n
"
,
trace
(
" channels=%d formats=%05x support=%04x
\n
"
,
capsA
.
wChannels
,
capsA
.
dwFormats
,
capsA
.
dwSupport
);
capsA
.
wChannels
,
capsA
.
dwFormats
,
capsA
.
dwSupport
);
trace
(
" %s
\n
"
,
wave_out_caps
(
capsA
.
dwSupport
));
trace
(
" %s
\n
"
,
wave_out_caps
(
capsA
.
dwSupport
));
free
(
nameA
);
HeapFree
(
GetProcessHeap
(),
0
,
nameA
);
if
(
winetest_interactive
&&
(
device
!=
WAVE_MAPPER
))
if
(
winetest_interactive
&&
(
device
!=
WAVE_MAPPER
))
{
{
...
...
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