From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/wbOSD/src/events.cpp | 2 +- plugins/wbOSD/src/main.cpp | 2 +- plugins/wbOSD/src/options.cpp | 22 +++++++++++----------- plugins/wbOSD/src/wbOSD.cpp | 24 ++++++++++++------------ 4 files changed, 25 insertions(+), 25 deletions(-) (limited to 'plugins/wbOSD/src') diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index 5a1a11bf4c..2ab9f02e91 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -180,7 +180,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) pbuf++; } - wchar_t *c1 = 0, *c2 = 0; + wchar_t *c1 = nullptr, *c2 = nullptr; if ( i1 == 1 ) c1 = mir_wstrdup(pcli->pfnGetContactDisplayName(wParam, 0)); else if ( i1 == 2 ) diff --git a/plugins/wbOSD/src/main.cpp b/plugins/wbOSD/src/main.cpp index ad1213f930..def91cae53 100644 --- a/plugins/wbOSD/src/main.cpp +++ b/plugins/wbOSD/src/main.cpp @@ -11,7 +11,7 @@ Distributed under GNU's GPL 2 or later HINSTANCE hI; -HWND g_hWnd = 0; +HWND g_hWnd = nullptr; int hLangpack = 0; CLIST_INTERFACE *pcli; HANDLE hHookedInit, hProtoAck, hContactSettingChanged, hHookContactStatusChanged, hContactStatusChanged; diff --git a/plugins/wbOSD/src/options.cpp b/plugins/wbOSD/src/options.cpp index e779cea271..5c77d0390f 100644 --- a/plugins/wbOSD/src/options.cpp +++ b/plugins/wbOSD/src/options.cpp @@ -11,14 +11,14 @@ Distributed under GNU's GPL 2 or later COLORREF pencustcolors[16]; -const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), 0, 0 }; +const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), nullptr, 0 }; void FillCheckBoxTree(HWND hwndTree, DWORD style) { logmsg("FillCheckBoxTree"); - TVINSERTSTRUCT tvis = { 0 }; - tvis.hParent = NULL; + TVINSERTSTRUCT tvis = {}; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (WORD status = ID_STATUS_OFFLINE; status <= ID_STATUS_OUTTOLUNCH; status++) { @@ -226,7 +226,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) ps[1] = ps[0]; SetWindowLongPtr(hDlg, GWLP_USERDATA, (LONG_PTR)ps); SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP | WS_SIZEBOX); - SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED); + SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED); SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); SetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE2), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hDlg, IDC_TREE1), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); @@ -277,9 +277,9 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) saveDBSettings(&ps[0]); SetWindowLongPtr(g_hWnd, GWL_STYLE, WS_POPUP); - SetWindowPos(g_hWnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED); + SetWindowPos(g_hWnd, nullptr, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_FRAMECHANGED); - SetWindowPos(g_hWnd, 0, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(g_hWnd, nullptr, ps->winxpos, ps->winypos, ps->winx, ps->winy, SWP_NOZORDER | SWP_NOACTIVATE); SetLayeredWindowAttributes(g_hWnd, ps->bkclr, ps->alpha, (ps->transparent ? LWA_COLORKEY : 0) | LWA_ALPHA); free((void*)GetWindowLongPtr(hDlg, GWLP_USERDATA)); @@ -318,10 +318,10 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) case IDC_CHECK2: ps->showMsgWindow = IsDlgButtonChecked(hDlg, IDC_CHECK2); case IDC_EDIT1: - ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, 0, 0); + ps->distance = GetDlgItemInt(hDlg, IDC_EDIT1, nullptr, 0); break; case IDC_EDIT5: - ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, 0, 0); + ps->timeout = GetDlgItemInt(hDlg, IDC_EDIT5, nullptr, 0); break; case IDC_CHECK3: ps->transparent = IsDlgButtonChecked(hDlg, IDC_CHECK3); @@ -362,12 +362,12 @@ INT_PTR CALLBACK OptDlgProc(HWND hDlg, UINT msg, WPARAM wparam, LPARAM lparam) } xxx: saveDBSettings(ps); - SetWindowPos(g_hWnd, 0, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(g_hWnd, nullptr, 0, 0, ps->winx, ps->winy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA); - InvalidateRect(g_hWnd, 0, TRUE); + InvalidateRect(g_hWnd, nullptr, TRUE); SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0); return 0; @@ -398,7 +398,7 @@ xxx: saveDBSettings(ps); SetLayeredWindowAttributes(g_hWnd, db_get_dw(NULL, THIS_MODULE, "bkclr", DEFAULT_BKCLR), db_get_b(NULL, THIS_MODULE, "alpha", DEFAULT_ALPHA), (db_get_b(NULL, THIS_MODULE, "transparent", DEFAULT_TRANPARENT) ? LWA_COLORKEY : 0) | LWA_ALPHA); - InvalidateRect(g_hWnd, 0, TRUE); + InvalidateRect(g_hWnd, nullptr, TRUE); break; } break; diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index 5034133a09..7f10ac8ff3 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -10,7 +10,7 @@ Distributed under GNU's GPL 2 or later #include "stdafx.h" wchar_t szClassName[] = L"wbOSD"; -const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), 0, 0 }; +const static osdmsg defstr = { L"", 0, RGB(0, 0, 0), nullptr, 0 }; int DrawMe(HWND hwnd, wchar_t *string, COLORREF color) { @@ -165,7 +165,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM if (lParam == 0) lParam = db_get_dw(NULL, THIS_MODULE, "timeout", DEFAULT_TIMEOUT); ms->timeout = lParam; - ms->callback = 0; + ms->callback = nullptr; ms->color = db_get_dw(NULL, THIS_MODULE, "clr_msg", DEFAULT_CLRMSG); ms->param = 0; SendMessage(hwnd, WM_USER + 4, (WPARAM)ms, 0); @@ -196,7 +196,7 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM logmsg("WindowProcedure::USER+4"); ms = (osdmsg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (ms != 0) { + if (ms != nullptr) { logmsg("WindowProcedure::USER+4/old"); KillTimer(hwnd, (UINT_PTR)ms); mir_free(ms->text); @@ -209,8 +209,8 @@ LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM ms->text = mir_wstrdup(ms->text); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)ms); - SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, 0); - InvalidateRect(hwnd, 0, TRUE); + SetTimer(hwnd, (UINT_PTR)ms, (UINT)ms->timeout, nullptr); + InvalidateRect(hwnd, nullptr, TRUE); SendMessage(hwnd, WM_USER + 2, 0, 0); return 0; @@ -248,7 +248,7 @@ int pluginShutDown(WPARAM, LPARAM) logmsg("pluginShutDown/hwnd"); SendMessage(g_hWnd, WM_USER + 3, 0, 0); DestroyWindow(g_hWnd); - g_hWnd = NULL; + g_hWnd = nullptr; } return 0; } @@ -265,13 +265,13 @@ int MainInit(WPARAM, LPARAM) wincl.style = CS_DBLCLKS; wincl.cbSize = sizeof(WNDCLASSEX); - wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); - wincl.hCursor = LoadCursor(NULL, IDC_ARROW); - wincl.lpszMenuName = NULL; + wincl.hIcon = LoadIcon(nullptr, IDI_APPLICATION); + wincl.hIconSm = LoadIcon(nullptr, IDI_APPLICATION); + wincl.hCursor = LoadCursor(nullptr, IDC_ARROW); + wincl.lpszMenuName = nullptr; wincl.cbClsExtra = 0; wincl.cbWndExtra = 0; - wincl.hbrBackground = 0; + wincl.hbrBackground = nullptr; if (!RegisterClassEx(&wincl)) return 0; @@ -282,7 +282,7 @@ int MainInit(WPARAM, LPARAM) db_get_dw(NULL, THIS_MODULE, "winypos", DEFAULT_WINYPOS), db_get_dw(NULL, THIS_MODULE, "winx", DEFAULT_WINX), db_get_dw(NULL, THIS_MODULE, "winy", DEFAULT_WINY), - HWND_DESKTOP, NULL, hI, NULL); + HWND_DESKTOP, nullptr, hI, nullptr); SetWindowLongPtr(g_hWnd, GWLP_USERDATA, 0); -- cgit v1.2.3