From 17a3d4fb3af78adc70b0dc8d0b8eafdb245b396f Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Fri, 7 Feb 2020 17:22:28 +0300
Subject: fixes #2204 (empty strings in StdPopup options)

---
 src/core/stdpopup/src/options.cpp | 12 ++++++------
 src/core/stdpopup/src/options.h   |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

(limited to 'src/core/stdpopup')

diff --git a/src/core/stdpopup/src/options.cpp b/src/core/stdpopup/src/options.cpp
index 0dbbaba995..103d6c9711 100644
--- a/src/core/stdpopup/src/options.cpp
+++ b/src/core/stdpopup/src/options.cpp
@@ -37,7 +37,7 @@ void LoadOptions()
 	options.time_layout = (PopupTimeLayout)g_plugin.getByte("TimeLayout", PT_RIGHT);
 
 	char buff[128];
-	for (int i = 0; i < 10; i++) {
+	for (int i = 0; i < _countof(options.disable_status); i++) {
 		mir_snprintf(buff, "DisableStatus%d", i - 1); // -1 because i forgot offline status earlier!
 		options.disable_status[i] = (g_plugin.getByte(buff, 0) == 1);
 	}
@@ -71,7 +71,7 @@ void SaveOptions()
 	g_plugin.setByte("TimeLayout", (BYTE)options.time_layout);
 
 	char buff[128];
-	for (int i = 0; i < 9; i++) {
+	for (int i = 0; i < _countof(options.disable_status); i++) {
 		mir_snprintf(buff, "DisableStatus%d", i - 1);
 		g_plugin.setByte(buff, options.disable_status[i] ? 1 : 0);
 	}
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
 			lvI.mask = LVIF_TEXT;
 
 			int i = 0;
-			for (; i < 10; i++) {
+			for (; i < _countof(options.disable_status); i++) {
 				lvI.pszText = Clist_GetStatusModeDescription(ID_STATUS_OFFLINE + i, 0);
 				lvI.iItem = i;
 				ListView_InsertItem(hwndList, &lvI);
@@ -335,7 +335,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
 			options.global_hover = IsDlgButtonChecked(hwndDlg, IDC_CHK_GLOBALHOVER) ? true : false;
 
 			int i = 0;
-			for (; i < 10; i++)
+			for (; i < _countof(options.disable_status); i++)
 				options.disable_status[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_LST_STATUS), i) == 1);
 			options.disable_full_screen = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_LST_STATUS), i) == 1);
 
@@ -433,7 +433,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
 						d.pszClassName = pc.pszName;
 						d.szTitle.w = L"Preview";
 						d.szText.w = L"The quick brown fox jumps over the lazy dog.";
-						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)& pc, (LPARAM)& d);
+						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
 					}
 					else {
 						POPUPCLASS pc = *arNewClasses[i];
@@ -442,7 +442,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
 						d.pszClassName = pc.pszName;
 						d.szTitle.a = "Preview";
 						d.szText.a = "The quick brown fox jumps over the lazy dog.";
-						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)& pc, (LPARAM)& d);
+						CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
 					}
 					break;
 				}
diff --git a/src/core/stdpopup/src/options.h b/src/core/stdpopup/src/options.h
index 53fb82dbd7..f80f179e14 100644
--- a/src/core/stdpopup/src/options.h
+++ b/src/core/stdpopup/src/options.h
@@ -18,7 +18,7 @@ struct Options
 	bool use_mim_monitor;
 	bool right_icon;
 	PopupAvLayout av_layout;
-	bool disable_status[10];
+	bool disable_status[MAX_STATUS_COUNT];
 	int text_indent;
 	bool global_hover;
 	PopupTimeLayout time_layout;
-- 
cgit v1.2.3