Commit 7fdb828a authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

winecfg: Use the available ARRAY_SIZE() macro.

parent 8f420443
...@@ -174,8 +174,7 @@ init_comboboxes (HWND dialog) ...@@ -174,8 +174,7 @@ init_comboboxes (HWND dialog)
if (current_app) if (current_app)
{ {
WCHAR str[256]; WCHAR str[256];
LoadStringW (GetModuleHandleW(NULL), IDS_USE_GLOBAL_SETTINGS, str, LoadStringW(GetModuleHandleW(NULL), IDS_USE_GLOBAL_SETTINGS, str, ARRAY_SIZE(str));
sizeof(str)/sizeof(str[0]));
SendDlgItemMessageW (dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM)str); SendDlgItemMessageW (dialog, IDC_WINVER, CB_ADDSTRING, 0, (LPARAM)str);
} }
...@@ -216,21 +215,20 @@ static void init_appsheet(HWND dialog) ...@@ -216,21 +215,20 @@ static void init_appsheet(HWND dialog)
/* we use the lparam field of the item so we can alter the presentation later and not change code /* we use the lparam field of the item so we can alter the presentation later and not change code
* for instance, to use the tile view or to display the EXEs embedded 'display name' */ * for instance, to use the tile view or to display the EXEs embedded 'display name' */
LoadStringW (GetModuleHandleW(NULL), IDS_DEFAULT_SETTINGS, appname, LoadStringW(GetModuleHandleW(NULL), IDS_DEFAULT_SETTINGS, appname, ARRAY_SIZE(appname));
sizeof(appname)/sizeof(appname[0]));
add_listview_item(listview, appname, NULL); add_listview_item(listview, appname, NULL);
/* because this list is only populated once, it's safe to bypass the settings list here */ /* because this list is only populated once, it's safe to bypass the settings list here */
if (RegOpenKeyA(config_key, "AppDefaults", &key) == ERROR_SUCCESS) if (RegOpenKeyA(config_key, "AppDefaults", &key) == ERROR_SUCCESS)
{ {
i = 0; i = 0;
size = sizeof(appname)/sizeof(appname[0]); size = ARRAY_SIZE(appname);
while (RegEnumKeyExW (key, i, appname, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) while (RegEnumKeyExW (key, i, appname, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{ {
add_listview_item(listview, appname, strdupW(appname)); add_listview_item(listview, appname, strdupW(appname));
i++; i++;
size = sizeof(appname)/sizeof(appname[0]); size = ARRAY_SIZE(appname);
} }
RegCloseKey(key); RegCloseKey(key);
...@@ -331,19 +329,19 @@ static void on_add_app_click(HWND dialog) ...@@ -331,19 +329,19 @@ static void on_add_app_click(HWND dialog)
0, 0, NULL, 0, NULL }; 0, 0, NULL, 0, NULL };
LoadStringW (GetModuleHandleW(NULL), IDS_SELECT_EXECUTABLE, selectExecutableStr, LoadStringW (GetModuleHandleW(NULL), IDS_SELECT_EXECUTABLE, selectExecutableStr,
sizeof(selectExecutableStr)/sizeof(selectExecutableStr[0])); ARRAY_SIZE(selectExecutableStr));
LoadStringW (GetModuleHandleW(NULL), IDS_EXECUTABLE_FILTER, programsFilter, LoadStringW (GetModuleHandleW(NULL), IDS_EXECUTABLE_FILTER, programsFilter,
sizeof(programsFilter)/sizeof(programsFilter[0])); ARRAY_SIZE(programsFilter));
snprintfW( filter, MAX_PATH, filterW, programsFilter, 0, 0 ); snprintfW( filter, MAX_PATH, filterW, programsFilter, 0, 0 );
ofn.lpstrTitle = selectExecutableStr; ofn.lpstrTitle = selectExecutableStr;
ofn.lpstrFilter = filter; ofn.lpstrFilter = filter;
ofn.lpstrFileTitle = filetitle; ofn.lpstrFileTitle = filetitle;
ofn.lpstrFileTitle[0] = '\0'; ofn.lpstrFileTitle[0] = '\0';
ofn.nMaxFileTitle = sizeof(filetitle)/sizeof(filetitle[0]); ofn.nMaxFileTitle = ARRAY_SIZE(filetitle);
ofn.lpstrFile = file; ofn.lpstrFile = file;
ofn.lpstrFile[0] = '\0'; ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(file)/sizeof(file[0]); ofn.nMaxFile = ARRAY_SIZE(file);
if (GetOpenFileNameW (&ofn)) if (GetOpenFileNameW (&ofn))
{ {
......
...@@ -232,12 +232,11 @@ static void initAudioDlg (HWND hDlg) ...@@ -232,12 +232,11 @@ static void initAudioDlg (HWND hDlg)
WINE_TRACE("\n"); WINE_TRACE("\n");
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER, LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER, format_str, ARRAY_SIZE(format_str));
format_str, sizeof(format_str) / sizeof(*format_str)); LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER_NONE, disabled_str,
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DRIVER_NONE, ARRAY_SIZE(disabled_str));
disabled_str, sizeof(disabled_str) / sizeof(*disabled_str)); LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_SYSDEFAULT, sysdefault_str,
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_SYSDEFAULT, ARRAY_SIZE(sysdefault_str));
sysdefault_str, sizeof(sysdefault_str) / sizeof(*sysdefault_str));
hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL,
CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&devenum); CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, (void**)&devenum);
...@@ -250,8 +249,7 @@ static void initAudioDlg (HWND hDlg) ...@@ -250,8 +249,7 @@ static void initAudioDlg (HWND hDlg)
PropVariantInit(&pv); PropVariantInit(&pv);
if(get_driver_name(devenum, &pv) && pv.u.pwszVal[0] != '\0'){ if(get_driver_name(devenum, &pv) && pv.u.pwszVal[0] != '\0'){
have_driver = TRUE; have_driver = TRUE;
wnsprintfW(display_str, sizeof(display_str) / sizeof(*display_str), wnsprintfW(display_str, ARRAY_SIZE(display_str), format_str, pv.u.pwszVal);
format_str, pv.u.pwszVal);
lstrcatW(g_drv_keyW, pv.u.pwszVal); lstrcatW(g_drv_keyW, pv.u.pwszVal);
} }
PropVariantClear(&pv); PropVariantClear(&pv);
...@@ -275,8 +273,8 @@ static void initAudioDlg (HWND hDlg) ...@@ -275,8 +273,8 @@ static void initAudioDlg (HWND hDlg)
i = 0; i = 0;
while (speaker_configs[i].text_id != 0) { while (speaker_configs[i].text_id != 0) {
LoadStringW(GetModuleHandleW(NULL), speaker_configs[i].text_id, LoadStringW(GetModuleHandleW(NULL), speaker_configs[i].text_id, speaker_str,
speaker_str, sizeof(speaker_str) / sizeof(*speaker_str)); ARRAY_SIZE(speaker_str));
SendDlgItemMessageW(hDlg, IDC_SPEAKERCONFIG_SPEAKERS, CB_ADDSTRING, SendDlgItemMessageW(hDlg, IDC_SPEAKERCONFIG_SPEAKERS, CB_ADDSTRING,
0, (LPARAM)speaker_str); 0, (LPARAM)speaker_str);
...@@ -287,14 +285,14 @@ static void initAudioDlg (HWND hDlg) ...@@ -287,14 +285,14 @@ static void initAudioDlg (HWND hDlg)
GetClientRect(GetDlgItem(hDlg, IDC_LIST_AUDIO_DEVICES), &rect); GetClientRect(GetDlgItem(hDlg, IDC_LIST_AUDIO_DEVICES), &rect);
width = (rect.right - rect.left) * 3 / 5; width = (rect.right - rect.left) * 3 / 5;
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DEVICE, colW, sizeof(colW)/sizeof(*colW)); LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_DEVICE, colW, ARRAY_SIZE(colW));
lvcol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; lvcol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvcol.pszText = colW; lvcol.pszText = colW;
lvcol.cchTextMax = lstrlenW(colW); lvcol.cchTextMax = lstrlenW(colW);
lvcol.cx = width; lvcol.cx = width;
SendDlgItemMessageW(hDlg, IDC_LIST_AUDIO_DEVICES, LVM_INSERTCOLUMNW, 0, (LPARAM)&lvcol); SendDlgItemMessageW(hDlg, IDC_LIST_AUDIO_DEVICES, LVM_INSERTCOLUMNW, 0, (LPARAM)&lvcol);
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_SPEAKER_CONFIG, colW, sizeof(colW)/sizeof(*colW)); LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_SPEAKER_CONFIG, colW, ARRAY_SIZE(colW));
lvcol.pszText = colW; lvcol.pszText = colW;
lvcol.cchTextMax = lstrlenW(colW); lvcol.cchTextMax = lstrlenW(colW);
lvcol.cx = rect.right - rect.left - width; lvcol.cx = rect.right - rect.left - width;
...@@ -343,7 +341,7 @@ static void initAudioDlg (HWND hDlg) ...@@ -343,7 +341,7 @@ static void initAudioDlg (HWND hDlg)
SendDlgItemMessageW(hDlg, IDC_LIST_AUDIO_DEVICES, LVM_INSERTITEMW, 0, (LPARAM)&lvitem); SendDlgItemMessageW(hDlg, IDC_LIST_AUDIO_DEVICES, LVM_INSERTITEMW, 0, (LPARAM)&lvitem);
LoadStringW(GetModuleHandleW(NULL), speaker_configs[render_devs[i].speaker_config].text_id, LoadStringW(GetModuleHandleW(NULL), speaker_configs[render_devs[i].speaker_config].text_id,
speaker_str, sizeof(speaker_str) / sizeof(*speaker_str)); speaker_str, ARRAY_SIZE(speaker_str));
lvitem.mask = LVIF_TEXT; lvitem.mask = LVIF_TEXT;
lvitem.iItem = i; lvitem.iItem = i;
...@@ -378,8 +376,7 @@ static void initAudioDlg (HWND hDlg) ...@@ -378,8 +376,7 @@ static void initAudioDlg (HWND hDlg)
HeapFree(GetProcessHeap(), 0, reg_in_dev); HeapFree(GetProcessHeap(), 0, reg_in_dev);
HeapFree(GetProcessHeap(), 0, reg_vin_dev); HeapFree(GetProcessHeap(), 0, reg_vin_dev);
}else }else
wnsprintfW(display_str, sizeof(display_str) / sizeof(*display_str), wnsprintfW(display_str, ARRAY_SIZE(display_str), format_str, disabled_str);
format_str, disabled_str);
SetDlgItemTextW(hDlg, IDC_AUDIO_DRIVER, display_str); SetDlgItemTextW(hDlg, IDC_AUDIO_DRIVER, display_str);
} }
...@@ -405,10 +402,10 @@ static void test_sound(void) ...@@ -405,10 +402,10 @@ static void test_sound(void)
if(!PlaySoundW(MAKEINTRESOURCEW(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_ASYNC)){ if(!PlaySoundW(MAKEINTRESOURCEW(IDW_TESTSOUND), NULL, SND_RESOURCE | SND_ASYNC)){
WCHAR error_str[256], title_str[256]; WCHAR error_str[256], title_str[256];
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED, LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED, error_str,
error_str, sizeof(error_str) / sizeof(*error_str)); ARRAY_SIZE(error_str));
LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED_TITLE, LoadStringW(GetModuleHandleW(NULL), IDS_AUDIO_TEST_FAILED_TITLE, title_str,
title_str, sizeof(title_str) / sizeof(*title_str)); ARRAY_SIZE(title_str));
MessageBoxW(NULL, error_str, title_str, MB_OK | MB_ICONERROR); MessageBoxW(NULL, error_str, title_str, MB_OK | MB_ICONERROR);
} }
...@@ -527,7 +524,7 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) ...@@ -527,7 +524,7 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
render_devs[dev].speaker_config = idx; render_devs[dev].speaker_config = idx;
LoadStringW(GetModuleHandleW(NULL), speaker_configs[idx].text_id, LoadStringW(GetModuleHandleW(NULL), speaker_configs[idx].text_id,
speaker_str, sizeof(speaker_str) / sizeof(*speaker_str)); speaker_str, ARRAY_SIZE(speaker_str));
lvitem.mask = LVIF_TEXT; lvitem.mask = LVIF_TEXT;
lvitem.iItem = dev; lvitem.iItem = dev;
......
...@@ -284,7 +284,7 @@ BOOL load_drives(void) ...@@ -284,7 +284,7 @@ BOOL load_drives(void)
if (data->mount_point_offset) unixpath = (char *)data + data->mount_point_offset; if (data->mount_point_offset) unixpath = (char *)data + data->mount_point_offset;
if (data->device_offset) device = (char *)data + data->device_offset; if (data->device_offset) device = (char *)data + data->device_offset;
if (!GetVolumeInformationW( root, volname, sizeof(volname)/sizeof(WCHAR), if (!GetVolumeInformationW( root, volname, ARRAY_SIZE(volname),
&serial, NULL, NULL, NULL, 0 )) &serial, NULL, NULL, NULL, 0 ))
{ {
volname[0] = 0; volname[0] = 0;
......
...@@ -291,8 +291,7 @@ static void ensure_drive_c_is_mapped(void) ...@@ -291,8 +291,7 @@ static void ensure_drive_c_is_mapped(void)
if (stat(drive_c_dir, &buf) == 0) if (stat(drive_c_dir, &buf) == 0)
{ {
WCHAR label[64]; WCHAR label[64];
LoadStringW (GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, LoadStringW(GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, ARRAY_SIZE(label));
sizeof(label)/sizeof(label[0]));
add_drive('C', "../drive_c", NULL, label, 0, DRIVE_FIXED); add_drive('C', "../drive_c", NULL, label, 0, DRIVE_FIXED);
} }
else else
......
...@@ -340,8 +340,7 @@ static void on_add_click(HWND dialog) ...@@ -340,8 +340,7 @@ static void on_add_click(HWND dialog)
if (new == 'C') if (new == 'C')
{ {
WCHAR label[64]; WCHAR label[64];
LoadStringW (GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, LoadStringW(GetModuleHandleW(NULL), IDS_SYSTEM_DRIVE_LABEL, label, ARRAY_SIZE(label));
sizeof(label)/sizeof(label[0]));
add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED); add_drive(new, "../drive_c", NULL, label, 0, DRIVE_FIXED);
} }
else add_drive(new, "/", NULL, NULL, 0, DRIVE_UNKNOWN); else add_drive(new, "/", NULL, NULL, 0, DRIVE_UNKNOWN);
...@@ -444,8 +443,7 @@ static void update_controls(HWND dialog) ...@@ -444,8 +443,7 @@ static void update_controls(HWND dialog)
for (i = 0; i < sizeof(type_pairs) / sizeof(struct drive_typemap); i++) for (i = 0; i < sizeof(type_pairs) / sizeof(struct drive_typemap); i++)
{ {
WCHAR driveDesc[64]; WCHAR driveDesc[64];
LoadStringW (GetModuleHandleW(NULL), type_pairs[i].idDesc, driveDesc, LoadStringW(GetModuleHandleW(NULL), type_pairs[i].idDesc, driveDesc, ARRAY_SIZE(driveDesc));
sizeof(driveDesc)/sizeof(driveDesc[0]));
SendDlgItemMessageW (dialog, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)driveDesc); SendDlgItemMessageW (dialog, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)driveDesc);
if (type_pairs[i].sCode == type) if (type_pairs[i].sCode == type)
...@@ -633,8 +631,7 @@ static void init_listview_columns(HWND dialog) ...@@ -633,8 +631,7 @@ static void init_listview_columns(HWND dialog)
GetClientRect(GetDlgItem(dialog, IDC_LIST_DRIVES), &viewRect); GetClientRect(GetDlgItem(dialog, IDC_LIST_DRIVES), &viewRect);
width = (viewRect.right - viewRect.left) / 6 - 5; width = (viewRect.right - viewRect.left) / 6 - 5;
LoadStringW (GetModuleHandleW(NULL), IDS_COL_DRIVELETTER, column, LoadStringW(GetModuleHandleW(NULL), IDS_COL_DRIVELETTER, column, ARRAY_SIZE(column));
sizeof(column)/sizeof(column[0]));
listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; listColumn.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
listColumn.pszText = column; listColumn.pszText = column;
listColumn.cchTextMax = lstrlenW (listColumn.pszText); listColumn.cchTextMax = lstrlenW (listColumn.pszText);
...@@ -642,8 +639,7 @@ static void init_listview_columns(HWND dialog) ...@@ -642,8 +639,7 @@ static void init_listview_columns(HWND dialog)
SendDlgItemMessageW (dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn); SendDlgItemMessageW (dialog, IDC_LIST_DRIVES, LVM_INSERTCOLUMNW, 0, (LPARAM) &listColumn);
LoadStringW (GetModuleHandleW(NULL), IDS_COL_DRIVEMAPPING, column, LoadStringW(GetModuleHandleW(NULL), IDS_COL_DRIVEMAPPING, column, ARRAY_SIZE(column));
sizeof(column)/sizeof(column[0]));
listColumn.cx = viewRect.right - viewRect.left - width; listColumn.cx = viewRect.right - viewRect.left - width;
listColumn.pszText = column; listColumn.pszText = column;
listColumn.cchTextMax = lstrlenW (listColumn.pszText); listColumn.cchTextMax = lstrlenW (listColumn.pszText);
......
...@@ -208,7 +208,7 @@ static inline BOOL is_builtin_only( const char *name ) ...@@ -208,7 +208,7 @@ static inline BOOL is_builtin_only( const char *name )
!strcmp( ext, ".tlb" )) !strcmp( ext, ".tlb" ))
return TRUE; return TRUE;
} }
return bsearch( &name, builtin_only, sizeof(builtin_only)/sizeof(builtin_only[0]), return bsearch( &name, builtin_only, ARRAY_SIZE(builtin_only),
sizeof(builtin_only[0]), compare_dll ) != NULL; sizeof(builtin_only[0]), compare_dll ) != NULL;
} }
...@@ -414,7 +414,7 @@ static void on_add_combo_change(HWND dialog) ...@@ -414,7 +414,7 @@ static void on_add_combo_change(HWND dialog)
WCHAR buffer[1024]; WCHAR buffer[1024];
int sel, len; int sel, len;
SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer)/sizeof(WCHAR), (LPARAM) buffer); SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer);
/* if lib was chosen from combobox, we receive an empty buffer, check manually */ /* if lib was chosen from combobox, we receive an empty buffer, check manually */
sel=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETCURSEL, 0, 0); sel=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETCURSEL, 0, 0);
len=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0); len=SendDlgItemMessageW(dialog, IDC_DLLCOMBO, CB_GETLBTEXTLEN, sel, 0);
......
...@@ -299,8 +299,7 @@ static BOOL fill_theme_list (HWND comboTheme, HWND comboColor, HWND comboSize) ...@@ -299,8 +299,7 @@ static BOOL fill_theme_list (HWND comboTheme, HWND comboColor, HWND comboSize)
WCHAR currentSize[MAX_PATH]; WCHAR currentSize[MAX_PATH];
ThemeFile* theme = NULL; ThemeFile* theme = NULL;
LoadStringW (GetModuleHandleW(NULL), IDS_NOTHEME, textNoTheme, LoadStringW(GetModuleHandleW(NULL), IDS_NOTHEME, textNoTheme, ARRAY_SIZE(textNoTheme));
sizeof(textNoTheme) / sizeof(WCHAR));
SendMessageW (comboTheme, CB_RESETCONTENT, 0, 0); SendMessageW (comboTheme, CB_RESETCONTENT, 0, 0);
SendMessageW (comboTheme, CB_ADDSTRING, 0, (LPARAM)textNoTheme); SendMessageW (comboTheme, CB_ADDSTRING, 0, (LPARAM)textNoTheme);
...@@ -311,11 +310,9 @@ static BOOL fill_theme_list (HWND comboTheme, HWND comboColor, HWND comboSize) ...@@ -311,11 +310,9 @@ static BOOL fill_theme_list (HWND comboTheme, HWND comboColor, HWND comboSize)
SendMessageW (comboTheme, CB_ADDSTRING, 0, SendMessageW (comboTheme, CB_ADDSTRING, 0,
(LPARAM)item->fancyName); (LPARAM)item->fancyName);
} }
if (IsThemeActive () && SUCCEEDED (GetCurrentThemeName (currentTheme, if (IsThemeActive() && SUCCEEDED(GetCurrentThemeName(currentTheme, ARRAY_SIZE(currentTheme),
sizeof(currentTheme) / sizeof(WCHAR), currentColor, ARRAY_SIZE(currentColor), currentSize, ARRAY_SIZE(currentSize))))
currentColor, sizeof(currentColor) / sizeof(WCHAR),
currentSize, sizeof(currentSize) / sizeof(WCHAR))))
{ {
/* Determine the index of the currently active theme. */ /* Determine the index of the currently active theme. */
BOOL found = FALSE; BOOL found = FALSE;
...@@ -371,11 +368,9 @@ static BOOL update_color_and_size (int themeIndex, HWND comboColor, ...@@ -371,11 +368,9 @@ static BOOL update_color_and_size (int themeIndex, HWND comboColor,
ThemeFile* theme = DSA_GetItemPtr (themeFiles, themeIndex - 1); ThemeFile* theme = DSA_GetItemPtr (themeFiles, themeIndex - 1);
fill_color_size_combos (theme, comboColor, comboSize); fill_color_size_combos (theme, comboColor, comboSize);
if ((SUCCEEDED (GetCurrentThemeName (currentTheme, if ((SUCCEEDED(GetCurrentThemeName (currentTheme, ARRAY_SIZE(currentTheme),
sizeof(currentTheme) / sizeof(WCHAR), currentColor, ARRAY_SIZE(currentColor), currentSize, ARRAY_SIZE(currentSize))))
currentColor, sizeof(currentColor) / sizeof(WCHAR),
currentSize, sizeof(currentSize) / sizeof(WCHAR))))
&& (lstrcmpiW (currentTheme, theme->themeFileName) == 0)) && (lstrcmpiW (currentTheme, theme->themeFileName) == 0))
{ {
select_color_and_size (theme, currentColor, comboColor, select_color_and_size (theme, currentColor, comboColor,
...@@ -560,7 +555,7 @@ static void set_color_from_theme(WCHAR *keyName, COLORREF color) ...@@ -560,7 +555,7 @@ static void set_color_from_theme(WCHAR *keyName, COLORREF color)
keyNameA = HeapAlloc(GetProcessHeap(), 0, keyNameSize); keyNameA = HeapAlloc(GetProcessHeap(), 0, keyNameSize);
WideCharToMultiByte(CP_ACP, 0, keyName, -1, keyNameA, keyNameSize, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, keyName, -1, keyNameA, keyNameSize, NULL, NULL);
for (i=0; i<sizeof(metrics)/sizeof(metrics[0]); i++) for (i=0; i < ARRAY_SIZE(metrics); i++)
{ {
if (lstrcmpiA(metrics[i].color_reg, keyNameA)==0) if (lstrcmpiA(metrics[i].color_reg, keyNameA)==0)
{ {
...@@ -620,19 +615,16 @@ static void on_theme_install(HWND dialog) ...@@ -620,19 +615,16 @@ static void on_theme_install(HWND dialog)
static const WCHAR filterMask[] = {0,'*','.','m','s','s','t','y','l','e','s',';', static const WCHAR filterMask[] = {0,'*','.','m','s','s','t','y','l','e','s',';',
'*','.','t','h','e','m','e',0,0}; '*','.','t','h','e','m','e',0,0};
static const WCHAR themeExt[] = {'.','T','h','e','m','e',0}; static const WCHAR themeExt[] = {'.','T','h','e','m','e',0};
const int filterMaskLen = sizeof(filterMask)/sizeof(filterMask[0]); const int filterMaskLen = ARRAY_SIZE(filterMask);
OPENFILENAMEW ofn; OPENFILENAMEW ofn;
WCHAR filetitle[MAX_PATH]; WCHAR filetitle[MAX_PATH];
WCHAR file[MAX_PATH]; WCHAR file[MAX_PATH];
WCHAR filter[100]; WCHAR filter[100];
WCHAR title[100]; WCHAR title[100];
LoadStringW (GetModuleHandleW(NULL), IDS_THEMEFILE, LoadStringW(GetModuleHandleW(NULL), IDS_THEMEFILE, filter, ARRAY_SIZE(filter) - filterMaskLen);
filter, sizeof (filter) / sizeof (filter[0]) - filterMaskLen); memcpy(filter + lstrlenW (filter), filterMask, filterMaskLen * sizeof (WCHAR));
memcpy (filter + lstrlenW (filter), filterMask, LoadStringW(GetModuleHandleW(NULL), IDS_THEMEFILE_SELECT, title, ARRAY_SIZE(title));
filterMaskLen * sizeof (WCHAR));
LoadStringW (GetModuleHandleW(NULL), IDS_THEMEFILE_SELECT,
title, sizeof (title) / sizeof (title[0]));
ofn.lStructSize = sizeof(OPENFILENAMEW); ofn.lStructSize = sizeof(OPENFILENAMEW);
ofn.hwndOwner = dialog; ofn.hwndOwner = dialog;
...@@ -646,7 +638,7 @@ static void on_theme_install(HWND dialog) ...@@ -646,7 +638,7 @@ static void on_theme_install(HWND dialog)
ofn.nMaxFile = sizeof(file)/sizeof(filetitle[0]); ofn.nMaxFile = sizeof(file)/sizeof(filetitle[0]);
ofn.lpstrFileTitle = filetitle; ofn.lpstrFileTitle = filetitle;
ofn.lpstrFileTitle[0] = '\0'; ofn.lpstrFileTitle[0] = '\0';
ofn.nMaxFileTitle = sizeof(filetitle)/sizeof(filetitle[0]); ofn.nMaxFileTitle = ARRAY_SIZE(filetitle);
ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = NULL;
ofn.lpstrTitle = title; ofn.lpstrTitle = title;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING; ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING;
...@@ -746,8 +738,8 @@ static void init_shell_folder_listview_headers(HWND dialog) { ...@@ -746,8 +738,8 @@ static void init_shell_folder_listview_headers(HWND dialog) {
WCHAR szLinksTo[64] = {'L','i','n','k','s',' ','t','o',0}; WCHAR szLinksTo[64] = {'L','i','n','k','s',' ','t','o',0};
int width; int width;
LoadStringW(GetModuleHandleW(NULL), IDS_SHELL_FOLDER, szShellFolder, sizeof(szShellFolder)/sizeof(WCHAR)); LoadStringW(GetModuleHandleW(NULL), IDS_SHELL_FOLDER, szShellFolder, ARRAY_SIZE(szShellFolder));
LoadStringW(GetModuleHandleW(NULL), IDS_LINKS_TO, szLinksTo, sizeof(szLinksTo)/sizeof(WCHAR)); LoadStringW(GetModuleHandleW(NULL), IDS_LINKS_TO, szLinksTo, ARRAY_SIZE(szLinksTo));
GetClientRect(GetDlgItem(dialog, IDC_LIST_SFPATHS), &viewRect); GetClientRect(GetDlgItem(dialog, IDC_LIST_SFPATHS), &viewRect);
width = (viewRect.right - viewRect.left) / 3; width = (viewRect.right - viewRect.left) / 3;
...@@ -965,7 +957,7 @@ static void refresh_sysparams(HWND hDlg) ...@@ -965,7 +957,7 @@ static void refresh_sysparams(HWND hDlg)
{ {
int i; int i;
for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) for (i = 0; i < ARRAY_SIZE(metrics); i++)
{ {
if (metrics[i].sm_idx != -1) if (metrics[i].sm_idx != -1)
metrics[i].size = GetSystemMetrics(metrics[i].sm_idx); metrics[i].size = GetSystemMetrics(metrics[i].sm_idx);
...@@ -983,10 +975,9 @@ static void read_sysparams(HWND hDlg) ...@@ -983,10 +975,9 @@ static void read_sysparams(HWND hDlg)
NONCLIENTMETRICSW nonclient_metrics; NONCLIENTMETRICSW nonclient_metrics;
int i, idx; int i, idx;
for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) for (i = 0; i < ARRAY_SIZE(metrics); i++)
{ {
LoadStringW(GetModuleHandleW(NULL), i + IDC_SYSPARAMS_BUTTON, buffer, LoadStringW(GetModuleHandleW(NULL), i + IDC_SYSPARAMS_BUTTON, buffer, ARRAY_SIZE(buffer));
sizeof(buffer) / sizeof(buffer[0]));
idx = SendMessageW(list, CB_ADDSTRING, 0, (LPARAM)buffer); idx = SendMessageW(list, CB_ADDSTRING, 0, (LPARAM)buffer);
if (idx != CB_ERR) SendMessageW(list, CB_SETITEMDATA, idx, i); if (idx != CB_ERR) SendMessageW(list, CB_SETITEMDATA, idx, i);
...@@ -1013,8 +1004,8 @@ static void apply_sysparams(void) ...@@ -1013,8 +1004,8 @@ static void apply_sysparams(void)
{ {
NONCLIENTMETRICSW ncm; NONCLIENTMETRICSW ncm;
int i, cnt = 0; int i, cnt = 0;
int colors_idx[sizeof(metrics) / sizeof(metrics[0])]; int colors_idx[ARRAY_SIZE(metrics)];
COLORREF colors[sizeof(metrics) / sizeof(metrics[0])]; COLORREF colors[ARRAY_SIZE(metrics)];
HDC hdc; HDC hdc;
int dpi; int dpi;
...@@ -1049,7 +1040,7 @@ static void apply_sysparams(void) ...@@ -1049,7 +1040,7 @@ static void apply_sysparams(void)
SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(ncm), &ncm, SystemParametersInfoW(SPI_SETNONCLIENTMETRICS, sizeof(ncm), &ncm,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); SPIF_UPDATEINIFILE | SPIF_SENDCHANGE);
for (i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) for (i = 0; i < ARRAY_SIZE(metrics); i++)
if (metrics[i].color_idx != -1) if (metrics[i].color_idx != -1)
{ {
colors_idx[cnt] = metrics[i].color_idx; colors_idx[cnt] = metrics[i].color_idx;
......
...@@ -62,14 +62,12 @@ void set_window_title(HWND dialog) ...@@ -62,14 +62,12 @@ void set_window_title(HWND dialog)
if (current_app) if (current_app)
{ {
WCHAR apptitle[256]; WCHAR apptitle[256];
LoadStringW (GetModuleHandleW(NULL), IDS_WINECFG_TITLE_APP, apptitle, LoadStringW(GetModuleHandleW(NULL), IDS_WINECFG_TITLE_APP, apptitle, ARRAY_SIZE(apptitle));
sizeof(apptitle)/sizeof(apptitle[0]));
wsprintfW (newtitle, apptitle, current_app); wsprintfW (newtitle, apptitle, current_app);
} }
else else
{ {
LoadStringW (GetModuleHandleW(NULL), IDS_WINECFG_TITLE, newtitle, LoadStringW(GetModuleHandleW(NULL), IDS_WINECFG_TITLE, newtitle, ARRAY_SIZE(newtitle));
sizeof(newtitle)/sizeof(newtitle[0]));
} }
WINE_TRACE("setting title to %s\n", wine_dbgstr_w (newtitle)); WINE_TRACE("setting title to %s\n", wine_dbgstr_w (newtitle));
...@@ -83,7 +81,7 @@ WCHAR* load_string (UINT id) ...@@ -83,7 +81,7 @@ WCHAR* load_string (UINT id)
int len; int len;
WCHAR* newStr; WCHAR* newStr;
LoadStringW (GetModuleHandleW(NULL), id, buf, sizeof(buf)/sizeof(buf[0])); LoadStringW(GetModuleHandleW(NULL), id, buf, ARRAY_SIZE(buf));
len = lstrlenW (buf); len = lstrlenW (buf);
newStr = HeapAlloc (GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR)); newStr = HeapAlloc (GetProcessHeap(), 0, (len + 1) * sizeof (WCHAR));
...@@ -477,7 +475,7 @@ static WCHAR **enumerate_valuesW(HKEY root, WCHAR *path) ...@@ -477,7 +475,7 @@ static WCHAR **enumerate_valuesW(HKEY root, WCHAR *path)
while (TRUE) while (TRUE)
{ {
WCHAR name[1024]; WCHAR name[1024];
DWORD namesize = sizeof(name)/sizeof(name[0]); DWORD namesize = ARRAY_SIZE(name);
BOOL removed = FALSE; BOOL removed = FALSE;
/* find out the needed size, allocate a buffer, read the value */ /* find out the needed size, allocate a buffer, read the value */
......
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