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
b1b231f3
Commit
b1b231f3
authored
Aug 25, 2023
by
Davide Beatrici
Committed by
Alexandre Julliard
Sep 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mmdevapi: Simplify load_driver_devices() by combining loops and removing unneeded allocation(s).
parent
516c6af5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
20 deletions
+8
-20
devenum.c
dlls/mmdevapi/devenum.c
+8
-20
No files found.
dlls/mmdevapi/devenum.c
View file @
b1b231f3
...
...
@@ -528,8 +528,6 @@ static HRESULT set_format(MMDevice *dev)
HRESULT
load_driver_devices
(
EDataFlow
flow
)
{
struct
get_endpoint_ids_params
params
;
WCHAR
**
ids
=
NULL
;
GUID
*
guids
=
NULL
;
UINT
i
;
params
.
flow
=
flow
;
...
...
@@ -544,38 +542,28 @@ HRESULT load_driver_devices(EDataFlow flow)
if
(
FAILED
(
params
.
result
))
goto
end
;
ids
=
malloc
(
params
.
num
*
sizeof
(
*
ids
));
guids
=
malloc
(
params
.
num
*
sizeof
(
*
guids
));
if
(
!
ids
||
!
guids
)
{
params
.
result
=
E_OUTOFMEMORY
;
goto
end
;
}
for
(
i
=
0
;
i
<
params
.
num
;
i
++
)
{
GUID
guid
;
WCHAR
*
id
;
MMDevice
*
dev
;
const
WCHAR
*
name
=
(
WCHAR
*
)((
char
*
)
params
.
endpoints
+
params
.
endpoints
[
i
].
name
);
const
char
*
dev_name
=
(
char
*
)
params
.
endpoints
+
params
.
endpoints
[
i
].
device
;
const
unsigned
int
size
=
(
wcslen
(
name
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
(
ids
[
i
]
=
malloc
(
size
)))
{
while
(
i
--
)
free
(
ids
[
i
]);
if
(
!
(
id
=
malloc
(
size
)))
{
params
.
result
=
E_OUTOFMEMORY
;
goto
end
;
}
memcpy
(
ids
[
i
],
name
,
size
);
drvs
.
pget_device_guid
(
flow
,
dev_name
,
&
guids
[
i
]);
}
memcpy
(
id
,
name
,
size
);
for
(
i
=
0
;
i
<
params
.
num
;
i
++
)
{
MMDevice
*
dev
;
dev
=
MMDevice_Create
(
ids
[
i
],
&
guids
[
i
],
flow
,
DEVICE_STATE_ACTIVE
,
params
.
default_idx
==
i
);
drvs
.
pget_device_guid
(
flow
,
dev_name
,
&
guid
);
dev
=
MMDevice_Create
(
id
,
&
guid
,
flow
,
DEVICE_STATE_ACTIVE
,
params
.
default_idx
==
i
);
set_format
(
dev
);
}
end:
free
(
params
.
endpoints
);
free
(
guids
);
free
(
ids
);
return
params
.
result
;
}
...
...
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