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] --- src/core/stdmsg/src/chat_options.cpp | 6 +++--- src/core/stdmsg/src/chat_window.cpp | 2 +- src/core/stdmsg/src/cmdlist.cpp | 2 +- src/core/stdmsg/src/msgdialog.cpp | 12 ++++++------ src/core/stdmsg/src/msgs.cpp | 2 +- src/core/stdmsg/src/msgtimedout.cpp | 2 +- src/core/stdmsg/src/statusicon.cpp | 2 +- src/core/stdmsg/src/tabs.cpp | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index e3d9e2dc9c..d907977a32 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -137,7 +137,7 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch { int iState; - if (hParent == 0) + if (hParent == nullptr) return; TVINSERTSTRUCT tvis; @@ -181,7 +181,7 @@ static void CheckHeading(HWND hwndTree, HTREEITEM hHeading) { BOOL bChecked = TRUE; - if (hHeading == 0) + if (hHeading == nullptr) return; TVITEM tvi; @@ -205,7 +205,7 @@ static void CheckBranches(HWND hwndTree, HTREEITEM hHeading) { BOOL bChecked = TRUE; - if (hHeading == 0) + if (hHeading == nullptr) return; TVITEM tvi; diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 3c130511ed..859fe50a79 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -1186,7 +1186,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetWindowRect((HWND)wParam, &rcNew); if (abs(rcThis.left - rcNew.left) < 3 && abs(rcThis.top - rcNew.top) < 3) { int offset = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME); - SetWindowPos((HWND)wParam, 0, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); + SetWindowPos((HWND)wParam, nullptr, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); *(int *)lParam = 1; } } diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index a63430bf1c..10213d8018 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -96,7 +96,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *sz dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0); dbei.szModule = GetContactProto(hContact); - dbei.timestamp = time(0); + dbei.timestamp = time(nullptr); dbei.cbBlob = (DWORD)(mir_strlen(p->szMsg) + 1); dbei.pBlob = (PBYTE)p->szMsg; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 77c69e8316..104b5fff31 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -103,7 +103,7 @@ void CSrmmWindow::OnInitDialog() CSuper::OnInitDialog(); m_bIsMeta = db_mc_isMeta(m_hContact) != 0; - m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY); + m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); m_wMinute = 61; NotifyEvent(MSG_WINDOW_EVT_OPENING); @@ -239,9 +239,9 @@ void CSrmmWindow::OnInitDialog() if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "", flag)) { if (g_dat.bSavePerContact) { if (Utils_RestoreWindowPosition(m_hwnd, 0, SRMMMOD, "", flag | RWPF_NOMOVE)) - SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } - else SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); + else SetWindowPos(m_hwnd, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } if (m_bNoActivate) { @@ -1051,7 +1051,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case DM_NEWTIMEZONE: - m_hTimeZone = TimeZone_CreateByContact(m_hContact, 0, TZF_KNOWNONLY); + m_hTimeZone = TimeZone_CreateByContact(m_hContact, nullptr, TZF_KNOWNONLY); m_wMinute = 61; Resize(); break; @@ -1063,7 +1063,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetWindowRect((HWND)wParam, &rcNew); if (abs(rcThis.left - rcNew.left) < 3 && abs(rcThis.top - rcNew.top) < 3) { int offset = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME); - SetWindowPos((HWND)wParam, 0, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); + SetWindowPos((HWND)wParam, nullptr, rcNew.left + offset, rcNew.top + offset, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); *(int *)lParam = 1; } } @@ -1295,7 +1295,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) ADDCONTACTSTRUCT acs = {}; acs.hContact = m_hContact; acs.handleType = HANDLE_CONTACT; - acs.szProto = 0; + acs.szProto = nullptr; CallService(MS_ADDCONTACT_SHOW, (WPARAM)m_hwnd, (LPARAM)&acs); } if (!db_get_b(m_hContact, "CList", "NotOnList", 0)) diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 32f51cd7c7..ae36b73a40 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -490,7 +490,7 @@ static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message int LoadSendRecvMessageModule(void) { if ((hMsftEdit = LoadLibrary(L"Msftedit.dll")) == nullptr) { - if (IDYES != MessageBox(0, TranslateW(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) + if (IDYES != MessageBox(nullptr, TranslateW(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; } diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index e0ce1ad97c..40a871e80b 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -53,7 +53,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar RECT rc, rcParent; if (GetWindowRect(hwndDlg, &rc)) if (GetWindowRect(hwndParent, &rcParent)) - SetWindowPos(hwndDlg, 0, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, + SetWindowPos(hwndDlg, nullptr, (rcParent.left + rcParent.right - (rc.right - rc.left)) / 2, (rcParent.top + rcParent.bottom - (rc.bottom - rc.top)) / 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index f467720907..ccd69b46ce 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -44,7 +44,7 @@ void DrawStatusIcons(MCONTACT hContact, HDC hDC, const RECT &rc, int gap) int nIcon = 0; StatusIconData *sid; - while ((sid = Srmm_GetNthIcon(hContact, nIcon++)) != 0 && x < rc.right) { + while ((sid = Srmm_GetNthIcon(hContact, nIcon++)) != nullptr && x < rc.right) { HICON hIcon = ((sid->flags & MBF_DISABLED) && sid->hIconDisabled) ? sid->hIconDisabled : sid->hIcon; SetBkMode(hDC, TRANSPARENT); diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 56b226614e..87b1e94670 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -282,9 +282,9 @@ void CTabbedWindow::SetWindowPosition() if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_pEmbed->m_hContact : 0, CHAT_MODULE, "room")) { if (g_dat.bSavePerContact) { if (Utils_RestoreWindowPosition(m_hwnd, 0, CHAT_MODULE, "room", RWPF_NOMOVE)) - SetWindowPos(m_hwnd, 0, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); + SetWindowPos(m_hwnd, nullptr, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } - else SetWindowPos(m_hwnd, 0, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); + else SetWindowPos(m_hwnd, nullptr, 0, 0, 550, 400, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } if (!g_dat.bSavePerContact && g_dat.bCascade) @@ -622,7 +622,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case ID_LOCKPOSITION: - if (si != 0) { + if (si != nullptr) { if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) { if (si->hContact) db_set_w(si->hContact, si->pszModule, "TabPosition", (WORD)(i + 1)); -- cgit v1.2.3