1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

Rename "name" to "value" to be more consistent with Windows terminology.

This commit is contained in:
Martin Ling 2013-10-28 01:32:06 +00:00 committed by Uwe Hermann
parent ac74fdafca
commit bdfb5b8c08

View File

@ -81,28 +81,28 @@ char **sp_list_ports(void)
#ifdef _WIN32 #ifdef _WIN32
HKEY key; HKEY key;
TCHAR *name, *data; TCHAR *value, *data;
DWORD max_name_len, max_data_size, max_data_len; DWORD max_value_len, max_data_size, max_data_len;
DWORD name_len, data_size, data_len; DWORD value_len, data_size, data_len;
DWORD type, index = 0; DWORD type, index = 0;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DEVICEMAP\\SERIALCOMM"), if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("HARDWARE\\DEVICEMAP\\SERIALCOMM"),
0, KEY_QUERY_VALUE, &key) != ERROR_SUCCESS) 0, KEY_QUERY_VALUE, &key) != ERROR_SUCCESS)
return NULL; return NULL;
if (RegQueryInfoKey(key, NULL, NULL, NULL, NULL, NULL, NULL, NULL, if (RegQueryInfoKey(key, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
&max_name_len, &max_data_size, NULL, NULL) != ERROR_SUCCESS) &max_value_len, &max_data_size, NULL, NULL) != ERROR_SUCCESS)
goto out_close; goto out_close;
max_data_len = max_data_size / sizeof(TCHAR); max_data_len = max_data_size / sizeof(TCHAR);
if (!(name = malloc((max_name_len + 1) * sizeof(TCHAR)))) if (!(value = malloc((max_value_len + 1) * sizeof(TCHAR))))
goto out_close; goto out_close;
if (!(data = malloc((max_data_len + 1) * sizeof(TCHAR)))) if (!(data = malloc((max_data_len + 1) * sizeof(TCHAR))))
goto out_free_name; goto out_free_value;
if (!(list = sp_list_new())) if (!(list = sp_list_new()))
goto out; goto out;
while ( while (
name_len = max_name_len, value_len = max_value_len,
data_size = max_data_size, data_size = max_data_size,
RegEnumValue(key, index, name, &name_len, RegEnumValue(key, index, value, &value_len,
NULL, &type, (LPBYTE)data, &data_size) == ERROR_SUCCESS) NULL, &type, (LPBYTE)data, &data_size) == ERROR_SUCCESS)
{ {
data_len = data_size / sizeof(TCHAR); data_len = data_size / sizeof(TCHAR);
@ -115,8 +115,8 @@ char **sp_list_ports(void)
} }
out: out:
free(data); free(data);
out_free_name: out_free_value:
free(name); free(value);
out_close: out_close:
RegCloseKey(key); RegCloseKey(key);
return list; return list;