Skip to content

Commit

Permalink
Use correct union member to access strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Jul 25, 2024
1 parent cf213c7 commit 6dbb08f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/platform/windows/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,10 +920,6 @@ namespace platf::audio {
prop->GetValue(PKEY_DeviceInterface_FriendlyName, &adapter_friendly_name.prop);
prop->GetValue(PKEY_Device_DeviceDesc, &device_desc.prop);

auto adapter_name = (LPWSTR) adapter_friendly_name.prop.pszVal;
auto device_name = (LPWSTR) device_friendly_name.prop.pszVal;
auto device_description = (LPWSTR) device_desc.prop.pszVal;

for (size_t i = 0; i < match_list.size(); i++) {
if (matched[i].empty()) {
const wchar_t *match_value = nullptr;

Check warning on line 925 in src/platform/windows/audio.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/windows/audio.cpp#L925

Added line #L925 was not covered by tests
Expand All @@ -933,15 +929,15 @@ namespace platf::audio {
break;

Check warning on line 929 in src/platform/windows/audio.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/windows/audio.cpp#L927-L929

Added lines #L927 - L929 were not covered by tests

case match_field_e::device_friendly_name:
match_value = device_name;
match_value = device_friendly_name.prop.pwszVal;
break;

Check warning on line 933 in src/platform/windows/audio.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/windows/audio.cpp#L931-L933

Added lines #L931 - L933 were not covered by tests

case match_field_e::adapter_friendly_name:
match_value = adapter_name;
match_value = adapter_friendly_name.prop.pwszVal;
break;

Check warning on line 937 in src/platform/windows/audio.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/windows/audio.cpp#L935-L937

Added lines #L935 - L937 were not covered by tests

case match_field_e::device_description:
match_value = device_description;
match_value = device_desc.prop.pwszVal;
break;

Check warning on line 941 in src/platform/windows/audio.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/windows/audio.cpp#L939-L941

Added lines #L939 - L941 were not covered by tests
}
if (match_value && std::wcscmp(match_value, match_list[i].second.c_str()) == 0) {
Expand Down

0 comments on commit 6dbb08f

Please sign in to comment.