Commit 05a6b304 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

winealsa.drv: Use the ARRAY_SIZE() macro.

parent 53a3c77c
...@@ -1177,9 +1177,8 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t* ...@@ -1177,9 +1177,8 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
} else { } else {
lstrcpynA(midiPortName, snd_seq_port_info_get_name(pinfo), MAXPNAMELEN); lstrcpynA(midiPortName, snd_seq_port_info_get_name(pinfo), MAXPNAMELEN);
} }
MultiByteToWideChar(CP_UNIXCP, 0, midiPortName, -1, MultiByteToWideChar(CP_UNIXCP, 0, midiPortName, -1, MidiOutDev[MODM_NumDevs].caps.szPname,
MidiOutDev[MODM_NumDevs].caps.szPname, ARRAY_SIZE(MidiOutDev[MODM_NumDevs].caps.szPname));
sizeof(MidiOutDev[MODM_NumDevs].caps.szPname) / sizeof(WCHAR));
MidiOutDev[MODM_NumDevs].caps.wTechnology = MIDI_AlsaToWindowsDeviceType(type); MidiOutDev[MODM_NumDevs].caps.wTechnology = MIDI_AlsaToWindowsDeviceType(type);
...@@ -1244,9 +1243,8 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t* ...@@ -1244,9 +1243,8 @@ static void ALSA_AddMidiPort(snd_seq_client_info_t* cinfo, snd_seq_port_info_t*
} else { } else {
lstrcpynA(midiPortName, snd_seq_port_info_get_name(pinfo), MAXPNAMELEN); lstrcpynA(midiPortName, snd_seq_port_info_get_name(pinfo), MAXPNAMELEN);
} }
MultiByteToWideChar(CP_UNIXCP, 0, midiPortName, -1, MultiByteToWideChar(CP_UNIXCP, 0, midiPortName, -1, MidiInDev[MIDM_NumDevs].caps.szPname,
MidiInDev[MIDM_NumDevs].caps.szPname, ARRAY_SIZE(MidiInDev[MIDM_NumDevs].caps.szPname));
sizeof(MidiInDev[MIDM_NumDevs].caps.szPname) / sizeof(WCHAR));
MidiInDev[MIDM_NumDevs].state = 0; MidiInDev[MIDM_NumDevs].state = 0;
TRACE("MidiIn [%d]\tname='%s' support=%d\n" TRACE("MidiIn [%d]\tname='%s' support=%d\n"
......
...@@ -311,8 +311,7 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid) ...@@ -311,8 +311,7 @@ static void get_device_guid(EDataFlow flow, const char *device, GUID *guid)
else else
key_name[0] = '0'; key_name[0] = '0';
key_name[1] = ','; key_name[1] = ',';
MultiByteToWideChar(CP_UNIXCP, 0, device, -1, key_name + 2, MultiByteToWideChar(CP_UNIXCP, 0, device, -1, key_name + 2, ARRAY_SIZE(key_name) - 2);
(sizeof(key_name) / sizeof(*key_name)) - 2);
if(RegOpenKeyExW(HKEY_CURRENT_USER, drv_key_devicesW, 0, KEY_WRITE|KEY_READ, &key) == ERROR_SUCCESS){ if(RegOpenKeyExW(HKEY_CURRENT_USER, drv_key_devicesW, 0, KEY_WRITE|KEY_READ, &key) == ERROR_SUCCESS){
if(RegOpenKeyExW(key, key_name, 0, KEY_READ, &dev_key) == ERROR_SUCCESS){ if(RegOpenKeyExW(key, key_name, 0, KEY_READ, &dev_key) == ERROR_SUCCESS){
...@@ -362,17 +361,17 @@ static WCHAR *construct_device_id(EDataFlow flow, const WCHAR *chunk1, const cha ...@@ -362,17 +361,17 @@ static WCHAR *construct_device_id(EDataFlow flow, const WCHAR *chunk1, const cha
DWORD len_wchars = 0, chunk1_len = 0, copied = 0, prefix_len; DWORD len_wchars = 0, chunk1_len = 0, copied = 0, prefix_len;
static const WCHAR dashW[] = {' ','-',' ',0}; static const WCHAR dashW[] = {' ','-',' ',0};
static const size_t dashW_len = (sizeof(dashW) / sizeof(*dashW)) - 1; static const size_t dashW_len = ARRAY_SIZE(dashW) - 1;
static const WCHAR outW[] = {'O','u','t',':',' ',0}; static const WCHAR outW[] = {'O','u','t',':',' ',0};
static const WCHAR inW[] = {'I','n',':',' ',0}; static const WCHAR inW[] = {'I','n',':',' ',0};
if(flow == eRender){ if(flow == eRender){
prefix = outW; prefix = outW;
prefix_len = (sizeof(outW) / sizeof(*outW)) - 1; prefix_len = ARRAY_SIZE(outW) - 1;
len_wchars += prefix_len; len_wchars += prefix_len;
}else{ }else{
prefix = inW; prefix = inW;
prefix_len = (sizeof(inW) / sizeof(*inW)) - 1; prefix_len = ARRAY_SIZE(inW) - 1;
len_wchars += prefix_len; len_wchars += prefix_len;
} }
if(chunk1){ if(chunk1){
...@@ -724,7 +723,7 @@ static BOOL get_alsa_name_by_guid(GUID *guid, char *name, DWORD name_size, EData ...@@ -724,7 +723,7 @@ static BOOL get_alsa_name_by_guid(GUID *guid, char *name, DWORD name_size, EData
DWORD size, type; DWORD size, type;
GUID reg_guid; GUID reg_guid;
key_name_size = sizeof(key_name)/sizeof(WCHAR); key_name_size = ARRAY_SIZE(key_name);
if(RegEnumKeyExW(devices_key, i++, key_name, &key_name_size, NULL, if(RegEnumKeyExW(devices_key, i++, key_name, &key_name_size, NULL,
NULL, NULL, NULL) != ERROR_SUCCESS) NULL, NULL, NULL) != ERROR_SUCCESS)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment