aboutsummaryrefslogtreecommitdiffstats
path: root/alc/backends/wasapi.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-09-11 01:40:36 -0700
committerChris Robinson <[email protected]>2020-09-11 01:40:36 -0700
commit33d91ceeec2f0f8d7f248f97966357388115a995 (patch)
tree99732924dddb0f4afcb02523d3f6ed4789da560c /alc/backends/wasapi.cpp
parenta4bfba4cb56686860c3edd9d910703b1c0caf209 (diff)
Avoid repeating string literals
Diffstat (limited to 'alc/backends/wasapi.cpp')
-rw-r--r--alc/backends/wasapi.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/alc/backends/wasapi.cpp b/alc/backends/wasapi.cpp
index 76c249de..f1f027e6 100644
--- a/alc/backends/wasapi.cpp
+++ b/alc/backends/wasapi.cpp
@@ -251,6 +251,8 @@ al::vector<DevMap> CaptureDevices;
using NameGUIDPair = std::pair<std::string,std::string>;
NameGUIDPair get_device_name_and_guid(IMMDevice *device)
{
+ static constexpr char UnknownName[]{"Unknown Device Name"};
+ static constexpr char UnknownGuid[]{"Unknown Device GUID"};
std::string name{DEVNAME_HEAD};
std::string guid;
@@ -259,7 +261,7 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
- return std::make_pair("Unknown Device Name", "Unknown Device GUID");
+ return std::make_pair(UnknownName, UnknownGuid);
}
PropVariant pvprop;
@@ -267,14 +269,14 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
- name += "Unknown Device Name";
+ name += UnknownName;
}
else if(pvprop->vt == VT_LPWSTR)
name += wstr_to_utf8(pvprop->pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvprop->vt);
- name += "Unknown Device Name";
+ name += UnknownName;
}
pvprop.clear();
@@ -282,14 +284,14 @@ NameGUIDPair get_device_name_and_guid(IMMDevice *device)
if(FAILED(hr))
{
WARN("GetValue AudioEndpoint_GUID failed: 0x%08lx\n", hr);
- guid = "Unknown Device GUID";
+ guid = UnknownGuid;
}
else if(pvprop->vt == VT_LPWSTR)
guid = wstr_to_utf8(pvprop->pwszVal);
else
{
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvprop->vt);
- guid = "Unknown Device GUID";
+ guid = UnknownGuid;
}
return std::make_pair(std::move(name), std::move(guid));