From ce0b26c60ff31166b4b4317d269c52fe7d576c5c Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Thu, 21 Jan 2016 21:37:04 -0800 Subject: 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? --- audio/out/ao_wasapi_utils.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'audio') 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; -- cgit v1.2.3