aboutsummaryrefslogtreecommitdiffhomepage
path: root/audio
diff options
context:
space:
mode:
authorGravatar Kevin Mitchell <kevmitch@gmail.com>2016-01-21 21:37:04 -0800
committerGravatar Kevin Mitchell <kevmitch@gmail.com>2016-01-22 03:21:21 -0800
commitce0b26c60ff31166b4b4317d269c52fe7d576c5c (patch)
tree99a94cc65e434af7dd9fa5297b7d47840c7ed5a3 /audio
parentff7884e635ca402e7ca8cd1ea230fb6792b81a65 (diff)
ao_wasapi: use correct UINT type for device enumeration
Notably, the address of the enumerator->count member is passed to IMMDeviceCollection::GetCount(), which expects a UINT variable, not an int. How did this ever work?
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi_utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 2768104cb4..6d2a707aac 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -749,7 +749,7 @@ struct enumerator {
struct mp_log *log;
IMMDeviceEnumerator *pEnumerator;
IMMDeviceCollection *pDevices;
- int count;
+ UINT count;
};
static void destroy_enumerator(struct enumerator *e)
@@ -784,7 +784,7 @@ exit_label:
return NULL;
}
-static struct device_desc *device_desc_for_num(struct enumerator *e, int i)
+static struct device_desc *device_desc_for_num(struct enumerator *e, UINT i)
{
IMMDevice *pDevice = NULL;
HRESULT hr = IMMDeviceCollection_Item(e->pDevices, i, &pDevice);
@@ -818,7 +818,7 @@ void wasapi_list_devs(struct ao *ao, struct ao_device_list *list)
if (!enumerator)
return;
- for (int i = 0; i < enumerator->count; i++) {
+ for (UINT i = 0; i < enumerator->count; i++) {
struct device_desc *d = device_desc_for_num(enumerator, i);
if (!d)
goto exit_label;
@@ -888,7 +888,7 @@ LPWSTR find_deviceID(struct ao *ao)
// try selecting by number
bstr rest;
long long devno = bstrtoll(device, &rest, 10);
- if (!rest.len && 0 <= devno && devno < enumerator->count) {
+ if (!rest.len && 0 <= devno && devno < (long long)enumerator->count) {
MP_VERBOSE(ao, "Selecting device by number: #%lld\n", devno);
d = device_desc_for_num(enumerator, devno);
deviceID = select_device(ao->log, d);
@@ -897,7 +897,7 @@ LPWSTR find_deviceID(struct ao *ao)
// select by id or name
bstr_eatstart0(&device, "{0.0.0.00000000}.");
- for (int i = 0; i < enumerator->count; i++) {
+ for (UINT i = 0; i < enumerator->count; i++) {
d = device_desc_for_num(enumerator, i);
if (!d)
goto exit_label;