From 27256f195c41e483a12bd1506acbbde5dd1aa3ec Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jan 2021 13:41:49 +0300 Subject: minor code cleaning --- plugins/BuddyPounce/src/dialog.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'plugins/BuddyPounce/src') diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index d4fc86a852..129f8504bd 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -267,25 +267,25 @@ INT_PTR CALLBACK BuddyPounceDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case IDC_SIMPLE: case IDOK: - { - MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0); - int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1; - if (length > 1) { - wchar_t *text = (wchar_t*)mir_alloc(length * sizeof(wchar_t)); - if (!text) { - msg(TranslateT("Couldn't allocate enough memory"), L""); - break; + { + MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0); + int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_MESSAGE)) + 1; + if (length > 1) { + wchar_t *text = (wchar_t *)mir_alloc(length * sizeof(wchar_t)); + if (!text) { + msg(TranslateT("Couldn't allocate enough memory"), L""); + break; + } + GetDlgItemText(hwnd, IDC_MESSAGE, text, length); + g_plugin.setWString(hContact, "PounceMsg", text); + mir_free(text); } - GetDlgItemText(hwnd, IDC_MESSAGE, text, length); - g_plugin.setWString(hContact, "PounceMsg", text); - mir_free(text); + else g_plugin.delSetting(hContact, "PounceMsg"); + saveLastSetting(hContact, hwnd); } - else g_plugin.delSetting(hContact, "PounceMsg"); - saveLastSetting(hContact, hwnd); - } // fall through - if (LOWORD(wParam) == IDC_SIMPLE) - CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact); - // fall through + if (LOWORD(wParam) == IDC_SIMPLE) + CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POUNCE_SIMPLE), nullptr, BuddyPounceSimpleDlgProc, (LPARAM)((windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->hContact); + __fallthrough; case IDCANCEL: if (wi->SendIfMy) DestroyWindow(wi->SendIfMy); -- cgit v1.2.3