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
e52f5773
Commit
e52f5773
authored
Mar 09, 2011
by
Jörg Höhle
Committed by
Alexandre Julliard
Mar 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa: Favour HeapAlloc() over malloc().
parent
8df87253
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
30 deletions
+24
-30
wavein.c
dlls/winealsa.drv/wavein.c
+11
-11
waveout.c
dlls/winealsa.drv/waveout.c
+13
-19
No files found.
dlls/winealsa.drv/wavein.c
View file @
e52f5773
...
...
@@ -369,7 +369,6 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
return
MMSYSERR_ALLOCATED
;
}
wwi
->
pcm
=
0
;
flags
=
SND_PCM_NONBLOCK
;
if
(
(
err
=
snd_pcm_open
(
&
pcm
,
wwi
->
pcmname
,
SND_PCM_STREAM_CAPTURE
,
flags
))
<
0
)
...
...
@@ -393,7 +392,11 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
hw_params
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
snd_pcm_hw_params_sizeof
()
);
sw_params
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
snd_pcm_sw_params_sizeof
()
);
if
(
!
hw_params
||
!
sw_params
)
{
ret
=
MMSYSERR_NOMEM
;
goto
error
;
}
snd_pcm_hw_params_any
(
pcm
,
hw_params
);
#define EXIT_ON_ERROR(f,e,txt) do \
...
...
@@ -488,14 +491,9 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
ALSA_TraceParameters
(
hw_params
,
sw_params
,
FALSE
);
/* now, we can save all required data for later use... */
if
(
wwi
->
hw_params
)
snd_pcm_hw_params_free
(
wwi
->
hw_params
);
snd_pcm_hw_params_malloc
(
&
(
wwi
->
hw_params
));
snd_pcm_hw_params_copy
(
wwi
->
hw_params
,
hw_params
);
wwi
->
dwBufferSize
=
snd_pcm_frames_to_bytes
(
pcm
,
buffer_size
);
wwi
->
lpQueuePtr
=
wwi
->
lpPlayPtr
=
wwi
->
lpLoopPtr
=
NULL
;
wwi
->
pcm
=
pcm
;
ALSA_InitRingMessage
(
&
wwi
->
msgRing
);
...
...
@@ -519,8 +517,10 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
CloseHandle
(
wwi
->
hStartUpEvent
);
wwi
->
hStartUpEvent
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
hw_params
);
HeapFree
(
GetProcessHeap
(),
0
,
sw_params
);
wwi
->
hw_params
=
hw_params
;
wwi
->
pcm
=
pcm
;
widNotifyClient
(
wwi
,
WIM_OPEN
,
0L
,
0L
);
return
MMSYSERR_NOERROR
;
...
...
@@ -548,12 +548,12 @@ static DWORD widClose(WORD wDevID)
return
MMSYSERR_BADDEVICEID
;
}
if
(
WInDev
[
wDevID
].
pcm
==
NULL
)
{
wwi
=
&
WInDev
[
wDevID
];
if
(
wwi
->
pcm
==
NULL
)
{
WARN
(
"Requested to close already closed device %d!
\n
"
,
wDevID
);
return
MMSYSERR_BADDEVICEID
;
}
wwi
=
&
WInDev
[
wDevID
];
if
(
wwi
->
lpQueuePtr
)
{
WARN
(
"buffers still playing !
\n
"
);
return
WAVERR_STILLPLAYING
;
...
...
@@ -563,7 +563,7 @@ static DWORD widClose(WORD wDevID)
}
ALSA_DestroyRingMessage
(
&
wwi
->
msgRing
);
snd_pcm_hw_params_free
(
wwi
->
hw_params
);
HeapFree
(
GetProcessHeap
(),
0
,
wwi
->
hw_params
);
wwi
->
hw_params
=
NULL
;
snd_pcm_close
(
wwi
->
pcm
);
...
...
dlls/winealsa.drv/waveout.c
View file @
e52f5773
...
...
@@ -576,7 +576,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
WINE_WAVEDEV
*
wwo
;
snd_pcm_t
*
pcm
=
NULL
;
snd_hctl_t
*
hctl
=
NULL
;
snd_pcm_hw_params_t
*
hw_params
=
NULL
;
snd_pcm_hw_params_t
*
hw_params
;
snd_pcm_sw_params_t
*
sw_params
;
snd_pcm_access_t
access
;
snd_pcm_format_t
format
=
-
1
;
...
...
@@ -680,8 +680,8 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
} while(0)
sw_params
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
snd_pcm_sw_params_sizeof
()
);
snd_pcm_hw_params_malloc
(
&
hw_params
);
if
(
!
h
w_params
)
hw_params
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
snd_pcm_hw_params_sizeof
()
);
if
(
!
hw_params
||
!
s
w_params
)
{
retcode
=
MMSYSERR_NOMEM
;
goto
errexit
;
...
...
@@ -797,11 +797,9 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo
->
format
.
Format
.
nBlockAlign
);
HeapFree
(
GetProcessHeap
(),
0
,
sw_params
);
wwo
->
pcm
=
pcm
;
wwo
->
hctl
=
hctl
;
if
(
wwo
->
hw_params
)
snd_pcm_hw_params_free
(
wwo
->
hw_params
);
wwo
->
hw_params
=
hw_params
;
wwo
->
hctl
=
hctl
;
wwo
->
pcm
=
pcm
;
wodNotifyClient
(
wwo
,
WOM_OPEN
,
0L
,
0L
);
return
MMSYSERR_NOERROR
;
...
...
@@ -816,9 +814,7 @@ errexit:
snd_hctl_close
(
hctl
);
}
if
(
hw_params
)
snd_pcm_hw_params_free
(
hw_params
);
HeapFree
(
GetProcessHeap
(),
0
,
hw_params
);
HeapFree
(
GetProcessHeap
(),
0
,
sw_params
);
if
(
wwo
->
msgRing
.
ring_buffer_size
>
0
)
ALSA_DestroyRingMessage
(
&
wwo
->
msgRing
);
...
...
@@ -841,12 +837,12 @@ static DWORD wodClose(WORD wDevID)
return
MMSYSERR_BADDEVICEID
;
}
if
(
WOutDev
[
wDevID
].
pcm
==
NULL
)
{
wwo
=
&
WOutDev
[
wDevID
];
if
(
wwo
->
pcm
==
NULL
)
{
WARN
(
"Requested to close already closed device %d!
\n
"
,
wDevID
);
return
MMSYSERR_BADDEVICEID
;
}
wwo
=
&
WOutDev
[
wDevID
];
if
(
wwo
->
lpQueuePtr
)
{
WARN
(
"buffers still playing !
\n
"
);
return
WAVERR_STILLPLAYING
;
...
...
@@ -856,20 +852,18 @@ static DWORD wodClose(WORD wDevID)
}
ALSA_DestroyRingMessage
(
&
wwo
->
msgRing
);
if
(
wwo
->
hw_params
)
snd_pcm_hw_params_free
(
wwo
->
hw_params
);
HeapFree
(
GetProcessHeap
(),
0
,
wwo
->
hw_params
);
wwo
->
hw_params
=
NULL
;
if
(
wwo
->
pcm
)
snd_pcm_close
(
wwo
->
pcm
);
wwo
->
pcm
=
NULL
;
if
(
wwo
->
hctl
)
{
snd_hctl_free
(
wwo
->
hctl
);
snd_hctl_close
(
wwo
->
hctl
);
}
wwo
->
hctl
=
NULL
;
}
snd_pcm_close
(
wwo
->
pcm
);
wwo
->
pcm
=
NULL
;
wodNotifyClient
(
wwo
,
WOM_CLOSE
,
0L
,
0L
);
}
...
...
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