From 4dde6e6a9b6176050f31df13e91d248b5d7c62b2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 7 Mar 2017 23:14:08 +0300 Subject: code cleaning --- plugins/Scriver/src/chat/log.cpp | 10 +-- plugins/Scriver/src/chat/main.cpp | 6 +- plugins/Scriver/src/chat/manager.cpp | 12 ++-- plugins/Scriver/src/chat/options.cpp | 128 +++++++++++++++++------------------ plugins/Scriver/src/chat/tools.cpp | 6 +- plugins/Scriver/src/chat/window.cpp | 116 +++++++++++++++---------------- plugins/Scriver/src/cmdlist.cpp | 14 ++-- plugins/Scriver/src/globals.cpp | 44 ++++++------ plugins/Scriver/src/infobar.cpp | 16 ++--- plugins/Scriver/src/input.cpp | 22 +++--- plugins/Scriver/src/msgdialog.cpp | 120 ++++++++++++++++---------------- plugins/Scriver/src/msglog.cpp | 60 ++++++++-------- plugins/Scriver/src/msgoptions.cpp | 8 +-- plugins/Scriver/src/msgs.cpp | 52 +++++++------- plugins/Scriver/src/msgs.h | 4 +- plugins/Scriver/src/msgtimedout.cpp | 4 +- plugins/Scriver/src/richutil.cpp | 10 +-- plugins/Scriver/src/sendqueue.cpp | 48 ++++++------- plugins/Scriver/src/srmm.cpp | 2 +- plugins/Scriver/src/statusicon.cpp | 10 +-- plugins/Scriver/src/tabs.cpp | 114 +++++++++++++++---------------- plugins/Scriver/src/utils.cpp | 32 ++++----- 22 files changed, 419 insertions(+), 419 deletions(-) diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index 1f0cf0f7f4..c3c716981d 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -30,7 +30,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG LOGSTREAMDATA *lstrdat = (LOGSTREAMDATA*)dwCookie; if (lstrdat) { // create the RTF - if (lstrdat->buffer == NULL) { + if (lstrdat->buffer == nullptr) { lstrdat->bufferOffset = 0; lstrdat->buffer = pci->Log_CreateRTF(lstrdat); lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer); @@ -44,7 +44,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG // free stuff if the streaming operation is complete if (lstrdat->bufferOffset == lstrdat->bufferLen) { mir_free(lstrdat->buffer); - lstrdat->buffer = NULL; + lstrdat->buffer = nullptr; } } @@ -124,7 +124,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra SMADD_RICHEDIT3 sm = { sizeof(sm) }; sm.hwndRichEditControl = hwndRich; sm.Protocolname = si->pszModule; - sm.rangeToReplace = bRedraw ? NULL : &newsel; + sm.rangeToReplace = bRedraw ? nullptr : &newsel; sm.flags = 0; sm.disableRedraw = TRUE; sm.hContact = si->hContact; @@ -141,7 +141,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra if (oldsel.cpMax != oldsel.cpMin) { SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); + InvalidateRect(hwndRich, nullptr, TRUE); } // need to invalidate the window @@ -149,6 +149,6 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, BOOL bRedra sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich, CP_ACP, FALSE); SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); + InvalidateRect(hwndRich, nullptr, TRUE); } } diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 15356fcef1..dc416bf42c 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // globals CHAT_MANAGER *pci, saveCI; -HMENU g_hMenu = NULL; +HMENU g_hMenu = nullptr; GlobalLogSettings g_Settings; @@ -48,7 +48,7 @@ void LoadModuleIcons(MODULEINFO *mi) static void OnReplaceSession(SESSION_INFO *si) { if (si->hWnd) - RedrawWindow(GetDlgItem(si->hWnd, IDC_CHAT_LIST), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(si->hWnd, IDC_CHAT_LIST), nullptr, nullptr, RDW_INVALIDATE); } static void OnNewUser(SESSION_INFO *si, USERINFO*) @@ -109,7 +109,7 @@ static void OnLoadSettings() DeleteObject(g_Settings.MessageBoxFont); LOGFONT lf; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, nullptr); g_Settings.MessageBoxFont = CreateFontIndirect(&lf); } diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 1d4e61c90a..cb8f50589a 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -25,27 +25,27 @@ HWND SM_FindWindowByContact(MCONTACT hContact) { SESSION_INFO *pTemp = pci->wndList; - while (pTemp != NULL) { + while (pTemp != nullptr) { if (pTemp->hContact == hContact) return pTemp->hWnd; pTemp = pTemp->next; } - return NULL; + return nullptr; } SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent) { - SESSION_INFO* pResult = NULL; - if (prevSession == NULL && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName) + SESSION_INFO* pResult = nullptr; + if (prevSession == nullptr && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName) pResult = currSession; else { - wchar_t* pszName = NULL; + wchar_t* pszName = nullptr; SESSION_INFO* pTemp = pci->wndList; if (currSession == prevSession) pszCurrent = pszOriginal; - while (pTemp != NULL) { + while (pTemp != nullptr) { if (pTemp != currSession && !mir_strcmpi(pszModule, pTemp->pszModule)) { if (my_strstri(pTemp->ptszName, pszOriginal) == pTemp->ptszName) { if (prevSession != pTemp && mir_wstrcmpi(pTemp->ptszName, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(pTemp->ptszName, pszName) < 0)) { diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 8893f699dd..2f81c012e2 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -35,82 +35,82 @@ struct branch_t }; static struct branch_t branch1[] = { - { LPGENW("Flash when someone speaks"), "FlashWindow", 0, 0, NULL }, - { LPGENW("Flash when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL }, - { LPGENW("Show chat nick list"), "ShowNicklist", 0, 1, NULL }, - { LPGENW("Enable button context menus"), "RightClickFilter", 0, 0, NULL }, - { LPGENW("Show topic on your contact list (if supported)"), "TopicOnClist", 0, 0, NULL }, - { LPGENW("Do not play sounds when focused"), "SoundsFocus", 0, 0, NULL }, - { LPGENW("Do not pop up when joining"), "PopupOnJoin", 0, 0, NULL }, - { LPGENW("Show and hide by double clicking in the contact list"), "ToggleVisibility", 0, 0, NULL }, - { LPGENW("Show contact statuses (if supported)"), "ShowContactStatus", 0, 0, NULL }, - { LPGENW("Display contact status icon before role icon"), "ContactStatusFirst", 0, 0, NULL }, - { LPGENW("Add ':' to auto-completed names"), "AddColonToAutoComplete", 0, 1, NULL } + { LPGENW("Flash when someone speaks"), "FlashWindow", 0, 0, nullptr }, + { LPGENW("Flash when a word is highlighted"), "FlashWindowHighlight", 0, 1, nullptr }, + { LPGENW("Show chat nick list"), "ShowNicklist", 0, 1, nullptr }, + { LPGENW("Enable button context menus"), "RightClickFilter", 0, 0, nullptr }, + { LPGENW("Show topic on your contact list (if supported)"), "TopicOnClist", 0, 0, nullptr }, + { LPGENW("Do not play sounds when focused"), "SoundsFocus", 0, 0, nullptr }, + { LPGENW("Do not pop up when joining"), "PopupOnJoin", 0, 0, nullptr }, + { LPGENW("Show and hide by double clicking in the contact list"), "ToggleVisibility", 0, 0, nullptr }, + { LPGENW("Show contact statuses (if supported)"), "ShowContactStatus", 0, 0, nullptr }, + { LPGENW("Display contact status icon before role icon"), "ContactStatusFirst", 0, 0, nullptr }, + { LPGENW("Add ':' to auto-completed names"), "AddColonToAutoComplete", 0, 1, nullptr } }; static struct branch_t branch2[] = { { LPGENW("Show icons"), "IconFlags", GC_EVENT_TOPIC | GC_EVENT_JOIN | GC_EVENT_QUIT | GC_EVENT_MESSAGE | GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT | GC_EVENT_PART | - GC_EVENT_KICK | GC_EVENT_NOTICE | GC_EVENT_NICK | GC_EVENT_INFORMATION | GC_EVENT_ADDSTATUS, 0, NULL }, - { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL }, - { LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0, NULL }, - { LPGENW("Timestamp has same color as event"), "TimeStampEventColour", 0, 0, NULL }, - { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL }, - { LPGENW("Limit user names to 20 characters"), "LogLimitNames", 0, 1, NULL }, - { LPGENW("Strip colors from messages"), "StripFormatting", 0, 0, NULL }, - { LPGENW("Enable 'event filter' for new rooms"), "FilterEnabled", 0, 0, NULL } + GC_EVENT_KICK | GC_EVENT_NOTICE | GC_EVENT_NICK | GC_EVENT_INFORMATION | GC_EVENT_ADDSTATUS, 0, nullptr }, + { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, nullptr }, + { LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0, nullptr }, + { LPGENW("Timestamp has same color as event"), "TimeStampEventColour", 0, 0, nullptr }, + { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1, nullptr }, + { LPGENW("Limit user names to 20 characters"), "LogLimitNames", 0, 1, nullptr }, + { LPGENW("Strip colors from messages"), "StripFormatting", 0, 0, nullptr }, + { LPGENW("Enable 'event filter' for new rooms"), "FilterEnabled", 0, 0, nullptr } }; static struct branch_t branch3[] = { - { LPGENW("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENW("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENW("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENW("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1, NULL }, - { LPGENW("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1, NULL }, - { LPGENW("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0, NULL }, - { LPGENW("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1, NULL }, - { LPGENW("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1, NULL }, - { LPGENW("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENW("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1, NULL }, - { LPGENW("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0, nullptr }, + { LPGENW("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0, nullptr }, + { LPGENW("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0, nullptr }, + { LPGENW("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1, nullptr }, + { LPGENW("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1, nullptr }, + { LPGENW("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0, nullptr }, + { LPGENW("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1, nullptr }, + { LPGENW("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1, nullptr }, + { LPGENW("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0, nullptr }, + { LPGENW("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1, nullptr }, + { LPGENW("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0, nullptr }, }; static struct branch_t branch4[] = { - { LPGENW("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1, NULL }, - { LPGENW("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENW("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENW("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENW("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0, NULL }, - { LPGENW("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0, NULL }, - { LPGENW("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1, NULL }, - { LPGENW("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0, NULL }, - { LPGENW("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0, NULL }, - { LPGENW("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0, NULL }, - { LPGENW("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENW("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0, NULL }, - { LPGENW("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1, nullptr }, + { LPGENW("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0, nullptr }, + { LPGENW("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0, nullptr }, + { LPGENW("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0, nullptr }, + { LPGENW("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0, nullptr }, + { LPGENW("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0, nullptr }, + { LPGENW("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1, nullptr }, + { LPGENW("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0, nullptr }, + { LPGENW("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0, nullptr }, + { LPGENW("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0, nullptr }, + { LPGENW("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0, nullptr }, + { LPGENW("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0, nullptr }, + { LPGENW("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0, nullptr }, }; static struct branch_t branch6[] = { - { LPGENW("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1, NULL }, - { LPGENW("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENW("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENW("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENW("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0, NULL }, - { LPGENW("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0, NULL }, - { LPGENW("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0, NULL }, - { LPGENW("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0, NULL }, - { LPGENW("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0, NULL }, - { LPGENW("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0, NULL }, - { LPGENW("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENW("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0, NULL }, - { LPGENW("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1, nullptr }, + { LPGENW("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0, nullptr }, + { LPGENW("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0, nullptr }, + { LPGENW("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0, nullptr }, + { LPGENW("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0, nullptr }, + { LPGENW("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0, nullptr }, + { LPGENW("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0, nullptr }, + { LPGENW("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0, nullptr }, + { LPGENW("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0, nullptr }, + { LPGENW("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0, nullptr }, + { LPGENW("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0, nullptr }, + { LPGENW("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0, nullptr }, + { LPGENW("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0, nullptr }, }; static HTREEITEM InsertBranch(HWND hwndTree, wchar_t* pszDescr, BOOL bExpanded) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_STATE; tvis.item.pszText = TranslateW(pszDescr); @@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000); SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0); { - wchar_t* pszGroup = NULL; + wchar_t* pszGroup = nullptr; InitSetting(&pszGroup, "AddToGroup", L"Chat rooms"); SetDlgItemText(hwndDlg, IDC_CHAT_GROUP, pszGroup); mir_free(pszGroup); @@ -327,7 +327,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM SaveBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), branch4, _countof(branch4)); pci->ReloadSettings(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); } return TRUE; } @@ -399,7 +399,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM GetClientRect(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), &rect); rect.left = -85; hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), tszTooltipText, TranslateT("Variables"), &rect); - SetTimer(hwndDlg, 0, 3000, NULL); + SetTimer(hwndDlg, 0, 3000, nullptr); SetDlgItemText(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS, g_Settings.pszHighlightWords); SetDlgItemText(hwndDlg, IDC_CHAT_LOGTIMESTAMP, g_Settings.pszTimeStampLog); @@ -514,13 +514,13 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } } else if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { - char *pszText = NULL; + char *pszText = nullptr; int iLen; iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS)); if (iLen > 0) { wchar_t *ptszText = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); - wchar_t *p2 = NULL; + wchar_t *p2 = nullptr; if (ptszText) { GetDlgItemText(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS, ptszText, iLen + 1); @@ -606,7 +606,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM pci->MM_FontsChanged(); pci->ReloadSettings(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); return TRUE; } break; @@ -654,7 +654,7 @@ INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_SETRANGE, 0, MAKELONG(100, -1)); SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN1, UDM_SETPOS, 0, MAKELONG(g_Settings.iPopupTimeout, 0)); - FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), NULL, branch6, _countof(branch6), 0x0000); + FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), nullptr, branch6, _countof(branch6), 0x0000); break; case WM_COMMAND: diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 7b002430ff..148410d125 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -28,7 +28,7 @@ wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) if (!s2[k + 1]) return (wchar_t*)(s1 + i); - return NULL; + return nullptr; } UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText) @@ -103,7 +103,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s else if (gcmi.Item[i].uType == MENU_CHECK) AppendMenu(*hMenu, dwState | MF_CHECKED | MF_STRING, gcmi.Item[i].dwID, ptszText); } - return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); } void DestroyGCMenu(HMENU *hMenu, int iIndex) @@ -113,7 +113,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) mii.fMask = MIIM_SUBMENU; while(GetMenuItemInfo(*hMenu, iIndex, TRUE, &mii)) { - if (mii.hSubMenu != NULL) + if (mii.hSubMenu != nullptr) DestroyMenu(mii.hSubMenu); RemoveMenu(*hMenu, iIndex, MF_BYPOSITION); } diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 896457b7f6..54de76822b 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -42,7 +42,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) return; bool isTopic = false, isRoom = false; - wchar_t *pszName = NULL; + wchar_t *pszName = nullptr; wchar_t* pszText = (wchar_t*)mir_alloc(iLen + 100 * sizeof(wchar_t)); gt.cb = iLen + 99 * sizeof(wchar_t); gt.flags = GT_DEFAULT; @@ -51,7 +51,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) if (start > 1 && pszText[start - 1] == ' ' && pszText[start - 2] == ':') start -= 2; - if (dat->szSearchResult != NULL) { + if (dat->szSearchResult != nullptr) { int cbResult = (int)mir_wstrlen(dat->szSearchResult); if (start >= cbResult && !wcsnicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; @@ -76,31 +76,31 @@ LBL_SkipEnd: isTopic = true; } - if (dat->szSearchQuery == NULL) { + if (dat->szSearchQuery == nullptr) { dat->szSearchQuery = (wchar_t*)mir_alloc(sizeof(wchar_t)*(end - start + 1)); mir_wstrncpy(dat->szSearchQuery, pszText + start, end - start + 1); dat->szSearchResult = mir_wstrdup(dat->szSearchQuery); - dat->lastSession = NULL; + dat->lastSession = nullptr; } if (isTopic) pszName = si->ptszTopic; else if (isRoom) { dat->lastSession = SM_FindSessionAutoComplete(si->pszModule, si, dat->lastSession, dat->szSearchQuery, dat->szSearchResult); - if (dat->lastSession != NULL) + if (dat->lastSession != nullptr) pszName = dat->lastSession->ptszName; } else pszName = pci->UM_FindUserAutoComplete(si->pUsers, dat->szSearchQuery, dat->szSearchResult); mir_free(pszText); - replaceStrW(dat->szSearchResult, NULL); + replaceStrW(dat->szSearchResult, nullptr); - if (pszName == NULL) { + if (pszName == nullptr) { if (end != start) { SendMessage(hwnd, EM_SETSEL, start, end); SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM)dat->szSearchQuery); } - replaceStrW(dat->szSearchQuery, NULL); + replaceStrW(dat->szSearchQuery, nullptr); } else { dat->szSearchResult = mir_wstrdup(pszName); @@ -155,16 +155,16 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_KEYDOWN: if (wParam == VK_RETURN) { mir_free(dat->szSearchQuery); - dat->szSearchQuery = NULL; + dat->szSearchQuery = nullptr; mir_free(dat->szSearchResult); - dat->szSearchResult = NULL; + dat->szSearchResult = nullptr; if ((isCtrl != 0) ^ (0 != db_get_b(0, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))) { PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0); return 0; } if (db_get_b(0, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)) { - if (dat->lastEnterTime + 2 < time(NULL)) - dat->lastEnterTime = time(NULL); + if (dat->lastEnterTime + 2 < time(nullptr)) + dat->lastEnterTime = time(nullptr); else { SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0); SendMessage(hwnd, WM_KEYUP, VK_BACK, 0); @@ -184,14 +184,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); TabAutoComplete(hwnd, dat, pDlg->m_si); SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE); return 0; } if (wParam != VK_RIGHT && wParam != VK_LEFT) { mir_free(dat->szSearchQuery); - dat->szSearchQuery = NULL; + dat->szSearchQuery = nullptr; mir_free(dat->szSearchResult); - dat->szSearchResult = NULL; + dat->szSearchResult = nullptr; } if (wParam == 0x49 && isCtrl && !isAlt) { // ctrl-i (italics) CheckDlgButton(GetParent(hwnd), IDC_ITALICS, IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); @@ -292,7 +292,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, COLORREF cr; SESSION_INFO *si = pDlg->m_si; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &cr); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -373,7 +373,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static SESSION_INFO *si = NULL; + static SESSION_INFO *si = nullptr; switch (uMsg) { case WM_INITDIALOG: si = (SESSION_INFO *)lParam; @@ -480,7 +480,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_SETCURSOR: if (inMenu) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return TRUE; } break; @@ -526,8 +526,8 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR SESSION_INFO *si = pDlg->m_si; CHARRANGE all = { 0, -1 }; - HMENU hMenu = NULL; - UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, NULL, pszWord); + HMENU hMenu = nullptr; + UINT uID = CreateGCMenu(hwnd, &hMenu, 1, pt, si, nullptr, pszWord); inMenu = FALSE; switch (uID) { case 0: @@ -566,7 +566,7 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR default: PostMessage(GetParent(hwnd), WM_MOUSEACTIVATE, 0, 0); - pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, uID); + pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, uID); break; } DestroyGCMenu(&hMenu, 5); @@ -678,11 +678,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; case ID_MESS: - pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); break; default: - pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, uID); + pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID); break; } DestroyGCMenu(&hMenu, 1); @@ -697,7 +697,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt; LPMSG lpmsg; - if ((lpmsg = (LPMSG)lParam) != NULL) { + if ((lpmsg = (LPMSG)lParam) != nullptr) { if (lpmsg->message == WM_KEYDOWN && (lpmsg->wParam == VK_RETURN || lpmsg->wParam == VK_ESCAPE || (lpmsg->wParam == VK_TAB && (isAlt || isCtrl)))) return DLGC_WANTALLKEYS; @@ -710,7 +710,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, int index = SendMessage(hwnd, LB_GETCURSEL, 0, 0); if (index != LB_ERR) { USERINFO *ui = pci->SM_GetUserFromIndex(pDlg->m_si->ptszID, pDlg->m_si->pszModule, index); - pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + pci->DoEventHookAsync(GetParent(hwnd), pDlg->m_si->ptszID, pDlg->m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); } break; } @@ -753,7 +753,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (ui) { if (!wcsnicmp(ui->pszNick, pDlg->m_wszSearch, mir_wstrlen(pDlg->m_wszSearch))) { SendMessage(hwnd, LB_SETCURSEL, i, 0); - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return 0; } } @@ -778,13 +778,13 @@ int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth) if (!pszText || !hFont) return 0; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HFONT hOldFont = (HFONT)SelectObject(hdc, hFont); RECT rc = { 0 }; DrawText(hdc, pszText, -1, &rc, DT_CALCRECT); SelectObject(hdc, hOldFont); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); return bWidth ? rc.right - rc.left : rc.bottom - rc.top; } @@ -831,7 +831,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) } int toolbarTopY = bToolbar ? h - m_pParent->iSplitterY - toolbarHeight : h - m_pParent->iSplitterY; - int logBottom = (m_hwndIeview != NULL) ? toolbarTopY / 2 : toolbarTopY; + int logBottom = (m_hwndIeview != nullptr) ? toolbarTopY / 2 : toolbarTopY; HDWP hdwp = BeginDeferWindowPos(5); hdwp = DeferWindowPos(hdwp, m_log.GetHwnd(), 0, 1, 0, bNick ? w - m_pParent->iSplitterX - 1 : w - 2, logBottom, SWP_NOZORDER); @@ -843,7 +843,7 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) SetButtonsPos(m_hwnd, m_hContact, bToolbar); - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWWINDOW ieWindow; ieWindow.cbSize = sizeof(IEVIEWWINDOW); ieWindow.iType = IEW_SETPOS; @@ -855,10 +855,10 @@ void CChatRoomDlg::MessageDialogResize(int w, int h) ieWindow.cy = logBottom; CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); } - else RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + else RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); - RedrawWindow(m_nickList.GetHwnd(), NULL, NULL, RDW_INVALIDATE); - RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(m_nickList.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); + RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } CChatRoomDlg::CChatRoomDlg(SESSION_INFO *si) @@ -982,11 +982,11 @@ void CChatRoomDlg::OnDestroy() { NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING); - m_si->hWnd = NULL; + m_si->hWnd = nullptr; SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd); - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWWINDOW ieWindow; ieWindow.cbSize = sizeof(IEVIEWWINDOW); ieWindow.iType = IEW_DESTROY; @@ -1039,7 +1039,7 @@ void CChatRoomDlg::onDblClick_List(CCtrlListBox*) m_message.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)pszName); PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); } - else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + else pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); } } @@ -1049,15 +1049,15 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) return; char *pszRtf = GetRichTextRTF(m_message.GetHwnd()); - if (pszRtf == NULL) + if (pszRtf == nullptr) return; MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); - if (mi == NULL) + if (mi == nullptr) return; TCmdList *cmdListNew = tcmdlist_last(cmdList); - while (cmdListNew != NULL && cmdListNew->temporary) { + while (cmdListNew != nullptr && cmdListNew->temporary) { cmdList = tcmdlist_remove(cmdList, cmdListNew); cmdListNew = tcmdlist_last(cmdList); } @@ -1078,7 +1078,7 @@ void CChatRoomDlg::onClick_Ok(CCtrlButton *pButton) EnableWindow(m_btnOk.GetHwnd(), FALSE); - pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0); SetFocus(m_message.GetHwnd()); } @@ -1089,13 +1089,13 @@ void CChatRoomDlg::onClick_History(CCtrlButton *pButton) MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule); if (pInfo) - ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(m_si, 0), NULL, NULL, SW_SHOW); + ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW); } void CChatRoomDlg::onClick_ChanMgr(CCtrlButton *pButton) { if (pButton->Enabled()) - pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); + pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0); } void CChatRoomDlg::onClick_ShowList(CCtrlButton *pButton) @@ -1169,7 +1169,7 @@ void CChatRoomDlg::onClick_Color(CCtrlButton *pButton) } else { COLORREF cr; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &cr); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &cr); cf.dwMask = CFM_COLOR; cf.crTextColor = cr; if (pInfo->bSingleFormat) @@ -1213,7 +1213,7 @@ void CChatRoomDlg::onClick_BkColor(CCtrlButton *pButton) void CChatRoomDlg::onChange_Message(CCtrlEdit *pEdit) { - cmdListCurrent = NULL; + cmdListCurrent = nullptr; m_btnOk.Enable(GetRichTextLength(pEdit->GetHwnd(), 1200, FALSE) != 0); } @@ -1252,7 +1252,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // messagebox COLORREF crFore; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, NULL, &crFore); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, nullptr, &crFore); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -1274,7 +1274,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) font = font > 16 ? font : 16; m_nickList.SendMsg(LB_SETITEMHEIGHT, 0, height > font ? height : font); - InvalidateRect(m_nickList.GetHwnd(), NULL, TRUE); + InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE); } m_message.SendMsg(EM_REQUESTRESIZE, 0, 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); @@ -1291,7 +1291,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) tbd.hIcon = GetCachedIcon("chat_window"); tbd.hIconBig = g_dat.hIconChatBig; } - tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : NULL; + tbd.hIconNot = (m_si->wState & (GC_EVENT_HIGHLIGHT | STATE_TALK)) ? GetCachedIcon("chat_overlay") : nullptr; switch (m_si->iType) { case GCW_CHATROOM: @@ -1328,7 +1328,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd); sbd.iItem = 1; - sbd.hIcon = NULL; + sbd.hIcon = nullptr; sbd.pszText = L""; SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd); @@ -1357,7 +1357,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case GC_REDRAWWINDOW: - InvalidateRect(m_hwnd, NULL, TRUE); + InvalidateRect(m_hwnd, nullptr, TRUE); break; case GC_REDRAWLOG: @@ -1367,7 +1367,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_si->iEventCount > 60) { int index = 0; while (index < 59) { - if (pLog->next == NULL) + if (pLog->next == nullptr) break; pLog = pLog->next; @@ -1499,15 +1499,15 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); x_offset += 18; } - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL); x_offset += 12; if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); x_offset += 18; } @@ -1537,7 +1537,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } } m_nickList.SendMsg(WM_SETREDRAW, TRUE, 0); - InvalidateRect(m_nickList.GetHwnd(), NULL, FALSE); + InvalidateRect(m_nickList.GetHwnd(), nullptr, FALSE); UpdateWindow(m_nickList.GetHwnd()); SendMessage(m_hwnd, DM_UPDATETITLEBAR, 0, 0); break; @@ -1685,7 +1685,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) ScreenToClient(m_nickList.GetHwnd(), &p); int item = LOWORD(m_nickList.SendMsg(LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y))); USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); - if (ui != NULL) { + if (ui != nullptr) { static wchar_t ptszBuf[1024]; mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui->pszNick, @@ -1733,7 +1733,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_hwndParent == (HWND)wParam) { HMENU hMenu = Menu_BuildContactMenu(m_hContact); GetCursorPos(&pt); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, nullptr); DestroyMenu(hMenu); } break; @@ -1747,11 +1747,11 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) void ShowRoom(SESSION_INFO *si) { - if (si == NULL) + if (si == nullptr) return; // Do we need to create a window? - if (si->hWnd == NULL) { + if (si->hWnd == nullptr) { HWND hParent = GetParentWindow(si->hContact, TRUE); CChatRoomDlg *pDlg = new CChatRoomDlg(si); diff --git a/plugins/Scriver/src/cmdlist.cpp b/plugins/Scriver/src/cmdlist.cpp index 16dbfa3b06..dbeed95eec 100644 --- a/plugins/Scriver/src/cmdlist.cpp +++ b/plugins/Scriver/src/cmdlist.cpp @@ -32,11 +32,11 @@ TCmdList* tcmdlist_append(TCmdList *list, char *data, int maxSize, BOOL temporar new_list->temporary = temporary; new_list->szCmd = data; - TCmdList *attach_to = NULL; - for (TCmdList *n = list; n != NULL; n = n->next) + TCmdList *attach_to = nullptr; + for (TCmdList *n = list; n != nullptr; n = n->next) attach_to = n; - if (attach_to == NULL) + if (attach_to == nullptr) return new_list; new_list->prev = attach_to; @@ -70,7 +70,7 @@ TCmdList *tcmdlist_remove(TCmdList *list, TCmdList *n) int tcmdlist_len(TCmdList *list) { int i = 0; - for (TCmdList *n = list; n != NULL; n = n->next) + for (TCmdList *n = list; n != nullptr; n = n->next) i++; return i; @@ -78,18 +78,18 @@ int tcmdlist_len(TCmdList *list) TCmdList* tcmdlist_last(TCmdList *list) { - for (TCmdList *n = list; n != NULL; n = n->next) + for (TCmdList *n = list; n != nullptr; n = n->next) if (!n->next) return n; - return NULL; + return nullptr; } void tcmdlist_free(TCmdList *list) { TCmdList *n = list, *next; - while (n != NULL) { + while (n != nullptr) { next = n->next; mir_free(n->szCmd); mir_free(n); diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 70eec0952d..4e0cb78bf4 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -27,7 +27,7 @@ GlobalMessageData g_dat; static const char *buttonIcons[] = { - "scriver_CLOSEX", "scriver_QUOTE", "scriver_ADD", NULL, + "scriver_CLOSEX", "scriver_QUOTE", "scriver_ADD", nullptr, "scriver_USERDETAILS", "scriver_HISTORY", "scriver_SEND" }; @@ -114,18 +114,18 @@ static int ackevent(WPARAM, LPARAM lParam) MCONTACT hContact = pAck->hContact; MessageSendQueueItem *item = FindSendQueueItem(hContact, (HANDLE)pAck->hProcess); - if (item == NULL) + if (item == nullptr) item = FindSendQueueItem(hContact = db_mc_getMeta(pAck->hContact), (HANDLE)pAck->hProcess); - if (item == NULL) + if (item == nullptr) return 0; HWND hwndSender = item->hwndSender; if (pAck->result == ACKRESULT_FAILED) { - if (item->hwndErrorDlg != NULL) + if (item->hwndErrorDlg != nullptr) item = FindOldestPendingSendQueueItem(hwndSender, hContact); - if (item != NULL && item->hwndErrorDlg == NULL) { - if (hwndSender != NULL) { + if (item != nullptr && item->hwndErrorDlg == nullptr) { + if (hwndSender != nullptr) { SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0); ErrorWindowData *ewd = (ErrorWindowData*)mir_alloc(sizeof(ErrorWindowData)); @@ -147,7 +147,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT | ((item->flags & PREF_RTL) ? DBEF_RTL : 0); dbei.szModule = GetContactProto(hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1; dbei.pBlob = (PBYTE)item->sendBuffer; @@ -157,14 +157,14 @@ static int ackevent(WPARAM, LPARAM lParam) item->sendBuffer = (char *)dbei.pBlob; db_event_add(hContact, &dbei); - if (item->hwndErrorDlg != NULL) + if (item->hwndErrorDlg != nullptr) DestroyWindow(item->hwndErrorDlg); if (RemoveSendQueueItem(item) && db_get_b(0, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) { - if (hwndSender != NULL) + if (hwndSender != nullptr) DestroyWindow(hwndSender); } - else if (hwndSender != NULL) { + else if (hwndSender != nullptr) { SendMessage(hwndSender, DM_STOPMESSAGESENDING, 0, 0); SkinPlaySound("SendMsg"); } @@ -218,7 +218,7 @@ HICON GetCachedIcon(const char *name) if (!mir_strcmp(iconList[i].szName, name)) return IcoLib_GetIconByHandle(iconList[i].hIcolib); - return NULL; + return nullptr; } void LoadGlobalIcons() @@ -234,8 +234,8 @@ void LoadGlobalIcons() ImageList_RemoveAll(g_dat.hHelperIconList); ImageList_RemoveAll(g_dat.hSearchEngineIconList); for (i = 0; i < _countof(buttonIcons); i++) { - if (buttonIcons[i] == NULL) - ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, NULL, ID_STATUS_OFFLINE); + if (buttonIcons[i] == nullptr) + ImageList_AddIcon_ProtoEx(g_dat.hButtonIconList, nullptr, ID_STATUS_OFFLINE); else ImageList_AddIcon(g_dat.hButtonIconList, GetCachedIcon(buttonIcons[i])); } @@ -274,27 +274,27 @@ static struct { UINT cpId; const wchar_t *cpName; } cpTable[] = void LoadInfobarFonts() { LOGFONT lf; - LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, NULL); + LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, nullptr); g_dat.minInputAreaHeight = db_get_dw(0, SRMMMOD, SRMSGSET_AUTORESIZELINES, SRMSGDEFSET_AUTORESIZELINES) * abs(lf.lfHeight) * g_dat.logPixelSY / 72; - if (g_dat.hInfobarBrush != NULL) + if (g_dat.hInfobarBrush != nullptr) DeleteObject(g_dat.hInfobarBrush); g_dat.hInfobarBrush = CreateSolidBrush(db_get_dw(0, SRMMMOD, SRMSGSET_INFOBARBKGCOLOUR, SRMSGDEFSET_INFOBARBKGCOLOUR)); } void InitGlobals() { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); memset(&g_dat, 0, sizeof(struct GlobalMessageData)); g_dat.hParentWindowList = WindowList_Create(); HookEvent(ME_PROTO_ACK, ackevent); ReloadGlobals(); - g_dat.lastParent = NULL; - g_dat.lastChatParent = NULL; - g_dat.hTabIconList = NULL; - g_dat.tabIconListUsage = NULL; + g_dat.lastParent = nullptr; + g_dat.lastChatParent = nullptr; + g_dat.hTabIconList = nullptr; + g_dat.tabIconListUsage = nullptr; g_dat.tabIconListUsageSize = 0; g_dat.hButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); g_dat.hChatButtonIconList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0); @@ -304,12 +304,12 @@ void InitGlobals() g_dat.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); g_dat.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); LoadInfobarFonts(); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); } void FreeGlobals() { - if (g_dat.hInfobarBrush != NULL) + if (g_dat.hInfobarBrush != nullptr) DeleteObject(g_dat.hInfobarBrush); if (g_dat.hTabIconList) ImageList_Destroy(g_dat.hTabIconList); diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 87729d895b..f9f8c4e226 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -72,7 +72,7 @@ static HICON GetExtraStatusIcon(InfobarWindowData* idat) if (bXStatus > 0) return (HICON)CallProtoService(idat->mwd->m_szProto, PS_GETCUSTOMSTATUSICON, bXStatus, 0); - return NULL; + return nullptr; } void RefreshInfobar(InfobarWindowData* idat) @@ -97,10 +97,10 @@ void RefreshInfobar(InfobarWindowData* idat) if (hIcon) DestroyIcon(hIcon); - SetToolTipText(hwnd, idat->hXStatusTip, szText, NULL); + SetToolTipText(hwnd, idat->hXStatusTip, szText, nullptr); SendMessage(hwnd, WM_SIZE, 0, 0); - InvalidateRect(hwnd, NULL, TRUE); - RedrawWindow(GetDlgItem(hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE); + InvalidateRect(hwnd, nullptr, TRUE); + RedrawWindow(GetDlgItem(hwnd, IDC_AVATAR), nullptr, nullptr, RDW_INVALIDATE); } static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -117,7 +117,7 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA idat->hWnd = hwnd; { RECT rect = { 0 }; - idat->hXStatusTip = CreateToolTip(hwnd, NULL, NULL, &rect); + idat->hXStatusTip = CreateToolTip(hwnd, nullptr, nullptr, &rect); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)idat); SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_AUTOURLDETECT, TRUE, 0); SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_LINK | ENM_KEYEVENTS); @@ -258,15 +258,15 @@ static INT_PTR CALLBACK InfobarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA POINT pt; GetCursorPos(&pt); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, GetParent(hwnd), NULL); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, GetParent(hwnd), nullptr); DestroyMenu(hMenu); } break; case WM_DESTROY: - if (idat->hXStatusTip != NULL) { + if (idat->hXStatusTip != nullptr) { DestroyWindow(idat->hXStatusTip); - idat->hXStatusTip = NULL; + idat->hXStatusTip = nullptr; } mir_free(idat); } diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 844210c8fe..751c5891f5 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -75,7 +75,7 @@ void InputAreaContextMenu(HWND hwnd, WPARAM, LPARAM lParam, MCONTACT hContact) mwpd.pt = pt; NotifyEventHooks(hHookWinPopup, 0, (LPARAM)&mwpd); - int selection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL); + int selection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), nullptr); // Second notification mwpd.selection = selection; @@ -201,40 +201,40 @@ int InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, CScriv if ((wParam == VK_UP || wParam == VK_DOWN) && isCtrl && !db_get_b(0, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)) { if (windowData->cmdList) { - TCmdList *cmdListNew = NULL; + TCmdList *cmdListNew = nullptr; if (wParam == VK_UP) { - if (windowData->cmdListCurrent == NULL) { + if (windowData->cmdListCurrent == nullptr) { cmdListNew = tcmdlist_last(windowData->cmdList); - while (cmdListNew != NULL && cmdListNew->temporary) { + while (cmdListNew != nullptr && cmdListNew->temporary) { windowData->cmdList = tcmdlist_remove(windowData->cmdList, cmdListNew); cmdListNew = tcmdlist_last(windowData->cmdList); } - if (cmdListNew != NULL) { + if (cmdListNew != nullptr) { char *textBuffer = GetRichTextUtf(hwnd); - if (textBuffer != NULL) + if (textBuffer != nullptr) // takes textBuffer to a queue, no leak here windowData->cmdList = tcmdlist_append(windowData->cmdList, textBuffer, 20, TRUE); } } - else if (windowData->cmdListCurrent->prev != NULL) + else if (windowData->cmdListCurrent->prev != nullptr) cmdListNew = windowData->cmdListCurrent->prev; } else { - if (windowData->cmdListCurrent != NULL) { - if (windowData->cmdListCurrent->next != NULL) + if (windowData->cmdListCurrent != nullptr) { + if (windowData->cmdListCurrent->next != nullptr) cmdListNew = windowData->cmdListCurrent->next; else if (!windowData->cmdListCurrent->temporary) SetWindowText(hwnd, L""); } } - if (cmdListNew != NULL) { + if (cmdListNew != nullptr) { SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); int iLen = SetRichTextRTF(hwnd, cmdListNew->szCmd); SendMessage(hwnd, EM_SCROLLCARET, 0, 0); SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE); SendMessage(hwnd, EM_SETSEL, iLen, iLen); windowData->cmdListCurrent = cmdListNew; } diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 0cb9a93153..e62ceba616 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -93,7 +93,7 @@ static wchar_t* GetQuotedTextW(wchar_t *text) void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type) { - if (hContact == 0 || hwnd == NULL) + if (hContact == 0 || hwnd == nullptr) return; MessageWindowEventData mwe = { sizeof(mwe) }; @@ -129,7 +129,7 @@ int RTL_Detect(WCHAR *pszwText) static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* szFilename) { *pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*)); - (*pppFiles)[*totalCount] = NULL; + (*pppFiles)[*totalCount] = nullptr; (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename); if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) { @@ -161,7 +161,7 @@ void CSrmmWindow::SetDialogToType() ShowWindow(m_pInfobarData->hWnd, SW_HIDE); ShowWindow(m_message.GetHwnd(), SW_SHOW); - if (m_hwndIeview != NULL) + if (m_hwndIeview != nullptr) ShowWindow(m_log.GetHwnd(), SW_HIDE); else ShowWindow(m_log.GetHwnd(), SW_SHOW); @@ -175,7 +175,7 @@ void CSrmmWindow::SetDialogToType() void CSrmmWindow::SetStatusIcon() { - if (m_szProto == NULL) + if (m_szProto == nullptr) return; MCONTACT hContact = db_mc_getSrmmSub(m_hContact); @@ -186,7 +186,7 @@ void CSrmmWindow::SetStatusIcon() m_hStatusIcon = Skin_LoadProtoIcon(szProto, m_wStatus, false); m_hStatusIconBig = Skin_LoadProtoIcon(szProto, m_wStatus, true); - if (m_hStatusIconOverlay != NULL) + if (m_hStatusIconOverlay != nullptr) DestroyIcon(m_hStatusIconOverlay); int index = ImageList_ReplaceIcon(g_dat.hHelperIconList, 0, m_hStatusIcon); @@ -203,7 +203,7 @@ void CSrmmWindow::GetTitlebarIcon(TitleBarData *tbd) } else { tbd->hIcon = (g_dat.flags & SMF_STATUSICON) ? m_hStatusIcon : g_dat.hMsgIcon; - tbd->hIconNot = NULL; + tbd->hIconNot = nullptr; } tbd->hIconBig = (g_dat.flags & SMF_STATUSICON) ? m_hStatusIconBig : g_dat.hMsgIconBig; } @@ -232,7 +232,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_SETCURSOR: if (inMenu) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return TRUE; } break; @@ -269,7 +269,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, else ModifyMenu(hSubMenu, 5, MF_STRING | MF_GRAYED | MF_BYPOSITION, 5, TranslateT("No word to look up")); inMenu = TRUE; - int uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL); + int uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr); inMenu = FALSE; switch (uID) { @@ -486,7 +486,7 @@ void CSrmmWindow::MessageDialogResize(int w, int h) SetButtonsPos(m_hwnd, m_hContact, bToolbar); - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_SETPOS; ieWindow.parent = m_hwnd; @@ -497,13 +497,13 @@ void CSrmmWindow::MessageDialogResize(int w, int h) ieWindow.cy = logH; CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); } - else RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + else RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); - RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); RefreshInfobar(m_pInfobarData); - RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), nullptr, nullptr, RDW_INVALIDATE); } void CSrmmWindow::UpdateReadChars() @@ -515,7 +515,7 @@ void CSrmmWindow::UpdateReadChars() StatusBarData sbd; sbd.iItem = 1; sbd.iFlags = SBDF_TEXT | SBDF_ICON; - sbd.hIcon = NULL; + sbd.hIcon = nullptr; sbd.pszText = szText; mir_snwprintf(szText, L"%d", len); SendMessage(m_hwndParent, CM_UPDATESTATUSBAR, (WPARAM)&sbd, (LPARAM)m_hwnd); @@ -525,13 +525,13 @@ void CSrmmWindow::UpdateReadChars() void CSrmmWindow::ShowAvatar() { INT_PTR res = CallService(MS_AV_GETAVATARBITMAP, m_hContact, 0); - m_ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : NULL; - m_hbmpAvatarPic = (m_ace != NULL && (m_ace->dwFlags & AVS_HIDEONCLIST) == 0) ? m_ace->hbmPic : NULL; + m_ace = res != CALLSERVICE_NOTFOUND ? (AVATARCACHEENTRY*)res : nullptr; + m_hbmpAvatarPic = (m_ace != nullptr && (m_ace->dwFlags & AVS_HIDEONCLIST) == 0) ? m_ace->hbmPic : nullptr; SendMessage(m_hwnd, WM_SIZE, 0, 0); RefreshInfobar(m_pInfobarData); - RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), nullptr, nullptr, RDW_INVALIDATE); } bool CSrmmWindow::IsTypingNotificationSupported() @@ -664,17 +664,17 @@ void CSrmmWindow::OnInitDialog() m_pParent = (ParentWindowData *)GetWindowLongPtr(m_hwndParent, GWLP_USERDATA); m_szProto = GetContactProto(m_hContact); - if (m_hContact && m_szProto != NULL) + if (m_hContact && m_szProto != nullptr) m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); else m_wStatus = ID_STATUS_OFFLINE; m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); + SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); m_lastEventType = -1; - m_lastEventTime = time(NULL); - m_startTime = time(NULL); + m_lastEventTime = time(nullptr); + m_startTime = time(nullptr); m_bUseRtl = db_get_b(m_hContact, SRMMMOD, "UseRTL", 0) != 0; m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false; @@ -765,7 +765,7 @@ void CSrmmWindow::OnInitDialog() ieWindow.cy = 300; CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); m_hwndIeview = ieWindow.hwnd; - if (m_hwndIeview == NULL) + if (m_hwndIeview == nullptr) m_bUseIEView = false; } @@ -802,7 +802,7 @@ void CSrmmWindow::OnInitDialog() case LOADHISTORY_TIME: if (m_hDbEventFirst == 0) { - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); hPrevEvent = db_event_last(m_hContact); } else { @@ -844,7 +844,7 @@ void CSrmmWindow::OnInitDialog() if (GetForegroundWindow() != m_hwndParent || m_pParent->hwndActive != m_hwnd) { m_iShowUnread = 1; SendMessage(m_hwnd, DM_UPDATEICON, 0, 0); - SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, NULL); + SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, nullptr); } SendMessage(m_hwndParent, CM_STARTFLASHING, 0, 0); } @@ -862,11 +862,11 @@ void CSrmmWindow::OnDestroy() if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) NotifyTyping(PROTOTYPE_SELFTYPING_OFF); - IcoLib_ReleaseIcon(m_hStatusIcon); m_hStatusIcon = NULL; - IcoLib_ReleaseIcon(m_hStatusIconBig); m_hStatusIconBig = NULL; - if (m_hStatusIconOverlay != NULL) { + IcoLib_ReleaseIcon(m_hStatusIcon); m_hStatusIcon = nullptr; + IcoLib_ReleaseIcon(m_hStatusIconBig); m_hStatusIconBig = nullptr; + if (m_hStatusIconOverlay != nullptr) { DestroyIcon(m_hStatusIconOverlay); - m_hStatusIconOverlay = NULL; + m_hStatusIconOverlay = nullptr; } ReleaseSendQueueItems(m_hwnd); @@ -882,7 +882,7 @@ void CSrmmWindow::OnDestroy() WindowList_Remove(pci->hWindowList, m_hwnd); HFONT hFont = (HFONT)m_message.SendMsg(WM_GETFONT, 0, 0); - if (hFont != NULL && hFont != (HFONT)m_btnOk.SendMsg(WM_GETFONT, 0, 0)) + if (hFont != nullptr && hFont != (HFONT)m_btnOk.SendMsg(WM_GETFONT, 0, 0)) DeleteObject(hFont); db_set_b(m_hContact, SRMMMOD, "UseRTL", m_bUseRtl); @@ -892,7 +892,7 @@ void CSrmmWindow::OnDestroy() SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); SendMessage(m_hwndParent, CM_REMOVECHILD, 0, (LPARAM)m_hwnd); - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_DESTROY; ieWindow.hwnd = m_hwndIeview; @@ -934,14 +934,14 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) /* Store messaging history */ TCmdList *cmdListNew = tcmdlist_last(cmdList); - while (cmdListNew != NULL && cmdListNew->temporary) { + while (cmdListNew != nullptr && cmdListNew->temporary) { cmdList = tcmdlist_remove(cmdList, cmdListNew); cmdListNew = tcmdlist_last(cmdList); } - if (msi.sendBuffer != NULL) + if (msi.sendBuffer != nullptr) cmdList = tcmdlist_append(cmdList, rtrim(msi.sendBuffer), 20, FALSE); - cmdListCurrent = NULL; + cmdListCurrent = nullptr; if (m_nTypeMode == PROTOTYPE_SELFTYPING_ON) NotifyTyping(PROTOTYPE_SELFTYPING_OFF); @@ -951,7 +951,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) if (db_get_b(0, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN)) ShowWindow(m_hwndParent, SW_MINIMIZE); - if (pButton == NULL) + if (pButton == nullptr) SendMessage(m_hwndParent, DM_SENDMESSAGE, 0, (LPARAM)&msi); else SendMessage(m_hwnd, DM_SENDMESSAGE, 0, (LPARAM)&msi); @@ -965,7 +965,7 @@ void CSrmmWindow::onClick_UserMenu(CCtrlButton *pButton) RECT rc; HMENU hMenu = Menu_BuildContactMenu(m_hContact); GetWindowRect(pButton->GetHwnd(), &rc); - TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, m_hwnd, NULL); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, m_hwnd, nullptr); DestroyMenu(hMenu); } } @@ -979,8 +979,8 @@ void CSrmmWindow::onClick_Quote(CCtrlButton*) st.flags = ST_SELECTION; st.codepage = 1200; - wchar_t *buffer = NULL; - if (m_hwndIeview != NULL) { + wchar_t *buffer = nullptr; + if (m_hwndIeview != nullptr) { IEVIEWEVENT evt = { sizeof(evt) }; evt.hwnd = m_hwndIeview; evt.hContact = m_hContact; @@ -989,7 +989,7 @@ void CSrmmWindow::onClick_Quote(CCtrlButton*) } else buffer = GetRichEditSelection(m_log.GetHwnd()); - if (buffer != NULL) { + if (buffer != nullptr) { wchar_t *quotedBuffer = GetQuotedTextW(buffer); m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer); mir_free(quotedBuffer); @@ -1004,7 +1004,7 @@ void CSrmmWindow::onClick_Quote(CCtrlButton*) db_event_get(m_hDbEventLast, &dbei); if (DbEventIsMessageOrCustom(&dbei)) { buffer = DbEvent_GetTextW(&dbei, CP_ACP); - if (buffer != NULL) { + if (buffer != nullptr) { wchar_t *quotedBuffer = GetQuotedTextW(buffer); m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer); mir_free(quotedBuffer); @@ -1040,7 +1040,7 @@ void CSrmmWindow::onClick_History(CCtrlButton*) void CSrmmWindow::onChange_Message(CCtrlEdit*) { int len = GetRichTextLength(m_message.GetHwnd(), 1200, FALSE); - cmdListCurrent = NULL; + cmdListCurrent = nullptr; UpdateReadChars(); EnableWindow(GetDlgItem(m_hwnd, IDOK), len != 0); if (!(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) { @@ -1079,7 +1079,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) POINT pt; HMENU hMenu = Menu_BuildContactMenu(m_hContact); GetCursorPos(&pt); - TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, NULL); + TrackPopupMenu(hMenu, 0, pt.x, pt.y, 0, m_hwnd, nullptr); DestroyMenu(hMenu); } break; @@ -1089,14 +1089,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_DROPFILES: - if (m_szProto == NULL) break; + if (m_szProto == nullptr) break; if (!(CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break; if (m_wStatus == ID_STATUS_OFFLINE) break; if (m_hContact != 0) { wchar_t szFilename[MAX_PATH]; HDROP hDrop = (HDROP)wParam; - int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i; - wchar_t** ppFiles = NULL; + int fileCount = DragQueryFile(hDrop, -1, nullptr, 0), totalCount = 0, i; + wchar_t** ppFiles = nullptr; for (i = 0; i < fileCount; i++) { DragQueryFile(hDrop, i, szFilename, _countof(szFilename)); AddToFileList(&ppFiles, &totalCount, szFilename); @@ -1185,7 +1185,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_OPTIONSAPPLIED: m_bUseIEView = g_dat.ieviewInstalled ? (g_dat.flags & SMF_USEIEVIEW) != 0 : false; - if (m_bUseIEView && m_hwndIeview == NULL) { + if (m_bUseIEView && m_hwndIeview == nullptr) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_CREATE; ieWindow.dwMode = IEWM_SCRIVER; @@ -1194,17 +1194,17 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ieWindow.cy = 300; CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); m_hwndIeview = ieWindow.hwnd; - if (m_hwndIeview == NULL) + if (m_hwndIeview == nullptr) m_bUseIEView = false; } - else if (!m_bUseIEView && m_hwndIeview != NULL) { - if (m_hwndIeview != NULL) { + else if (!m_bUseIEView && m_hwndIeview != nullptr) { + if (m_hwndIeview != nullptr) { IEVIEWWINDOW ieWindow = { sizeof(ieWindow) }; ieWindow.iType = IEW_DESTROY; ieWindow.hwnd = m_hwndIeview; CallService(MS_IEVIEW_WINDOW, 0, (LPARAM)&ieWindow); } - m_hwndIeview = NULL; + m_hwndIeview = nullptr; } SendMessage(m_hwnd, DM_GETAVATAR, 0, 0); @@ -1214,7 +1214,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour); colour = db_get_dw(0, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR); m_message.SendMsg(EM_SETBKGNDCOLOR, 0, colour); - InvalidateRect(m_message.GetHwnd(), NULL, FALSE); + InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); LOGFONT lf; LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &colour); @@ -1352,7 +1352,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) HWND hLog; POINT pt; GetCursorPos(&pt); - if (m_hwndIeview != NULL) + if (m_hwndIeview != nullptr) hLog = m_hwndIeview; else hLog = m_log.GetHwnd(); @@ -1399,7 +1399,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (wParam == 0 || wParam == m_hContact) StreamInEvents(m_hDbEventFirst, -1, 0); - InvalidateRect(m_log.GetHwnd(), NULL, FALSE); + InvalidateRect(m_log.GetHwnd(), nullptr, FALSE); break; case DM_APPENDTOLOG: //takes wParam=hDbEvent @@ -1407,7 +1407,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case DM_SCROLLLOGTOBOTTOM: - if (m_hwndIeview == NULL) { + if (m_hwndIeview == nullptr) { if ((GetWindowLongPtr(m_log.GetHwnd(), GWL_STYLE) & WS_VSCROLL) == 0) break; @@ -1421,7 +1421,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) PostMessage(m_log.GetHwnd(), WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); } } - RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } else { IEVIEWWINDOW ieWindow; @@ -1462,7 +1462,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (GetActiveWindow() != m_hwndParent || GetForegroundWindow() != m_hwndParent || m_pParent->hwndActive != m_hwnd) { m_iShowUnread = 1; SendMessage(m_hwnd, DM_UPDATEICON, 0, 0); - SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, NULL); + SetTimer(m_hwnd, TIMERID_UNREAD, TIMEOUT_UNREAD, nullptr); } SendMessage(m_hwndParent, CM_STARTFLASHING, 0, 0); } @@ -1488,8 +1488,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } else if (m_lastMessage) { wchar_t date[64], time[64]; - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"d", date, _countof(date), 0); - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"t", time, _countof(time), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"d", date, _countof(date), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"t", time, _countof(time), 0); mir_snwprintf(szText, TranslateT("Last message received on %s at %s."), date, time); sbd.pszText = szText; } @@ -1514,7 +1514,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; case DM_CLEARLOG: - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWEVENT evt = { sizeof(evt) }; evt.iType = IEE_CLEAR_LOG; evt.dwFlags = (m_bUseRtl) ? IEEF_RTL : 0; @@ -1582,7 +1582,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_STARTMESSAGESENDING: m_iMessagesInProgress++; case DM_SHOWMESSAGESENDING: - SetTimer(m_hwnd, TIMERID_MSGSEND, 1000, NULL); + SetTimer(m_hwnd, TIMERID_MSGSEND, 1000, nullptr); if (g_dat.flags & SMF_SHOWPROGRESS) SendMessage(GetHwnd(), GC_UPDATESTATUSBAR, 0, 0); break; @@ -1608,7 +1608,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) case DM_ERRORDECIDED: { MessageSendQueueItem *item = (MessageSendQueueItem *)lParam; - item->hwndErrorDlg = NULL; + item->hwndErrorDlg = nullptr; switch (wParam) { case MSGERROR_CANCEL: RemoveSendQueueItem(item); @@ -1686,7 +1686,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) else result = m_iSendAllConfirm; if (LOWORD(result) == IDYES) - onClick_Ok(NULL); + onClick_Ok(nullptr); break; } break; diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 795ffbb0cc..71fbab8539 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -117,12 +117,12 @@ EventData* getEventFromDB(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent) DBEVENTINFO dbei = {}; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) - return NULL; + return nullptr; dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); db_event_get(hDbEvent, &dbei); if (!DbEventIsShown(dbei)) { mir_free(dbei.pBlob); - return NULL; + return nullptr; } EventData *evt = (EventData*)mir_calloc(sizeof(EventData)); @@ -142,7 +142,7 @@ EventData* getEventFromDB(CSrmmWindow *dat, MCONTACT hContact, MEVENT hDbEvent) evt->dwFlags |= IEEDF_RTL; evt->time = dbei.timestamp; - evt->pszNick = NULL; + evt->pszNick = nullptr; if (evt->dwFlags & IEEDF_SENT) evt->pszNickT = Contact_GetInfo(CNF_DISPLAY, 0, dat->m_szProto); else @@ -170,7 +170,7 @@ static EventData* GetTestEvent(DWORD flags) evt->eventType = EVENTTYPE_MESSAGE; evt->dwFlags = IEEDF_READ | flags; evt->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2; - evt->time = time(NULL); + evt->time = time(nullptr); return evt; } @@ -271,26 +271,26 @@ static int AppendUnicodeToBuffer(CMStringA &buf, const WCHAR *line) // mir_free() the return value static char* CreateRTFHeader() { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); CMStringA buf; buf.Append("{\\rtf1\\ansi\\deff0{\\fonttbl"); for (int i = 0; i < fontOptionsListSize; i++) { LOGFONT lf; - LoadMsgDlgFont(i, &lf, NULL); + LoadMsgDlgFont(i, &lf, nullptr); buf.AppendFormat("{\\f%u\\fnil\\fcharset%u %S;}", i, lf.lfCharSet, lf.lfFaceName); } buf.Append("}{\\colortbl "); COLORREF colour; for (int i = 0; i < fontOptionsListSize; i++) { - LoadMsgDlgFont(i, NULL, &colour); + LoadMsgDlgFont(i, nullptr, &colour); buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour)); } - if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) + if (GetSysColorBrush(COLOR_HOTLIGHT) == nullptr) colour = RGB(0, 0, 255); else colour = GetSysColor(COLOR_HOTLIGHT); @@ -318,7 +318,7 @@ static char* SetToStyle(int style) { static char szStyle[128]; LOGFONT lf; - LoadMsgDlgFont(style, &lf, NULL); + LoadMsgDlgFont(style, &lf, nullptr); mir_snprintf(szStyle, "\\f%u\\cf%u\\b%d\\i%d\\fs%u", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); return szStyle; } @@ -334,7 +334,7 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode) format[0] = '\0'; if ((mode == 0 || mode == 1) && (dwFlags & SMF_SHOWDATE)) { struct tm tm_now, tm_today; - time_t now = time(NULL); + time_t now = time(nullptr); time_t today; tm_now = *localtime(&now); tm_today = tm_now; @@ -365,7 +365,7 @@ wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode) mir_wstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? L"s" : L"t"); } if (format[0] != '\0') { - TimeZone_PrintTimeStamp(NULL, check, format, str, _countof(str), 0); + TimeZone_PrintTimeStamp(nullptr, check, format, str, _countof(str), 0); mir_wstrncat(szResult, str, _countof(szResult) - mir_wstrlen(szResult)); } return szResult; @@ -429,7 +429,7 @@ static int DetectURL(wchar_t *text, BOOL firstChar) static void AppendWithCustomLinks(EventData *evt, int style, CMStringA &buf) { - if (evt->pszText == NULL) + if (evt->pszText == nullptr) return; BOOL isAnsii = (evt->dwFlags & IEEDF_UNICODE_TEXT) == 0; @@ -547,7 +547,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD if (gdat->flags & SMF_SHOWTIME && (evt->eventType != EVENTTYPE_MESSAGE || (gdat->flags & SMF_MARKFOLLOWUPS || isGroupBreak || !(gdat->flags & SMF_GROUPMESSAGES)))) { - wchar_t *timestampString = NULL; + wchar_t *timestampString = nullptr; if (gdat->flags & SMF_GROUPMESSAGES && evt->eventType == EVENTTYPE_MESSAGE) { if (isGroupBreak) { if (!(gdat->flags & SMF_MARKFOLLOWUPS)) @@ -560,7 +560,7 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD } else timestampString = TimestampToString(gdat->flags, evt->time, 0); - if (timestampString != NULL) { + if (timestampString != nullptr) { buf.AppendFormat("%s ", SetToStyle(evt->dwFlags & IEEDF_SENT ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME)); AppendUnicodeToBuffer(buf, timestampString); } @@ -626,14 +626,14 @@ static char* CreateRTFFromEvent(CSrmmWindow *dat, EventData *evt, GlobalMessageD } AppendUnicodeToBuffer(buf, L" "); - if (evt->pszTextW != NULL) { + if (evt->pszTextW != nullptr) { if (evt->dwFlags & IEEDF_UNICODE_TEXT) AppendUnicodeToBuffer(buf, evt->pszTextW); else AppendAnsiToBuffer(buf, evt->pszText); } - if (evt->pszText2W != NULL) { + if (evt->pszText2W != nullptr) { AppendUnicodeToBuffer(buf, L" ("); if (evt->dwFlags & IEEDF_UNICODE_TEXT2) AppendUnicodeToBuffer(buf, evt->pszText2W); @@ -662,7 +662,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG { LogStreamData *dat = (LogStreamData*)dwCookie; - if (dat->buffer == NULL) { + if (dat->buffer == nullptr) { dat->bufferOffset = 0; switch (dat->stage) { case STREAMSTAGE_HEADER: @@ -670,9 +670,9 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->stage = STREAMSTAGE_EVENTS; break; case STREAMSTAGE_EVENTS: - if (dat->events != NULL) { + if (dat->events != nullptr) { EventData *evt = dat->events; - dat->buffer = NULL; + dat->buffer = nullptr; dat->buffer = CreateRTFFromEvent(dat->dlgDat, evt, dat->gdat, dat); dat->events = evt->next; freeEvent(evt); @@ -680,8 +680,8 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG else if (dat->eventsToInsert) { do { EventData *evt = getEventFromDB(dat->dlgDat, dat->hContact, dat->hDbEvent); - dat->buffer = NULL; - if (evt != NULL) { + dat->buffer = nullptr; + if (evt != nullptr) { dat->buffer = CreateRTFFromEvent(dat->dlgDat, evt, dat->gdat, dat); freeEvent(evt); } @@ -690,7 +690,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->hDbEvent = db_event_next(dat->hContact, dat->hDbEvent); if (--dat->eventsToInsert == 0) break; - } while (dat->buffer == NULL && dat->hDbEvent); + } while (dat->buffer == nullptr && dat->hDbEvent); } if (dat->buffer) break; @@ -712,7 +712,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->bufferOffset += *pcb; if (dat->bufferOffset == dat->bufferLen) { mir_free(dat->buffer); - dat->buffer = NULL; + dat->buffer = nullptr; } return 0; } @@ -739,7 +739,7 @@ void StreamInTestEvents(HWND hEditWnd, GlobalMessageData *gdat) void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) { // IEVIew MOD Begin - if (m_hwndIeview != NULL) { + if (m_hwndIeview != nullptr) { IEVIEWEVENT evt; IEVIEWWINDOW ieWindow; memset(&evt, 0, sizeof(evt)); @@ -821,7 +821,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) sel.cpMax = -1; smre.rangeToReplace = &sel; } - else smre.rangeToReplace = NULL; + else smre.rangeToReplace = nullptr; smre.disableRedraw = TRUE; smre.hContact = m_hContact; @@ -843,7 +843,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend) void LoadMsgLogIcons(void) { - HICON hIcon = NULL; + HICON hIcon = nullptr; RECT rc; g_hImageList = ImageList_Create(10, 10, ILC_COLOR32 | ILC_MASK, _countof(pLogIconBmpBits), 0); @@ -861,7 +861,7 @@ void LoadMsgLogIcons(void) rc.top = rc.left = 0; rc.right = bih.biWidth; rc.bottom = bih.biHeight; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight); HDC hdcMem = CreateCompatibleDC(hdc); PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight); @@ -890,7 +890,7 @@ void LoadMsgLogIcons(void) HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); FillRect(hdcMem, &rc, hBrush); - DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL); SelectObject(hdcMem, hoBmp); GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO *)& bih, DIB_RGB_COLORS); DestroyIcon(hIcon); @@ -903,7 +903,7 @@ void LoadMsgLogIcons(void) mir_free(pBmpBits); DeleteDC(hdcMem); DeleteObject(hBmp); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); DeleteObject(hBkgBrush); DeleteObject(hInBkgBrush); DeleteObject(hOutBkgBrush); diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 7559605967..0888246fb5 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -170,7 +170,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) mir_snprintf(str, "%s%d", "SRMFont", i); ptrW tszFace(db_get_wsa(0, SRMMMOD, str)); - if (tszFace == NULL) + if (tszFace == nullptr) mir_wstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else wcsncpy(lf->lfFaceName, tszFace, _countof(lf->lfFaceName)); @@ -203,7 +203,7 @@ static const struct CheckBoxValues_t statusValues[] = static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (int i = 0; i < nValues; i++) { @@ -239,7 +239,7 @@ static void ApplyChanges(int i) ReloadGlobals(); WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); } } @@ -971,7 +971,7 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.szGroup.a = LPGEN("Message sessions"); odp.szTitle.a = LPGEN("Typing notify"); odp.pfnDlgProc = DlgProcTypeOptions; - odp.szTab.a = NULL; + odp.szTab.a = nullptr; Options_AddPage(wParam, &odp); if (g_dat.popupInstalled) { diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 85b00b23f8..2292031904 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -79,7 +79,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) MCONTACT hContact = db_mc_tryMeta(pcle->hContact); HWND hwndExisting = WindowList_Find(pci->hWindowList, hContact); - if (hwndExisting == NULL) + if (hwndExisting == nullptr) (new CSrmmWindow(hContact))->Show(); else SendMessage(GetParent(hwndExisting), CM_POPUPWINDOW, 0, (LPARAM)hwndExisting); @@ -95,7 +95,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) return 0; HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd == NULL) + if (hwnd == nullptr) hwnd = WindowList_Find(pci->hWindowList, hContact = db_event_getContact(hDbEvent)); if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, hContact, lParam); @@ -105,7 +105,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) pcli->pfnRemoveEvent(hContact, 1); /* does a window for the contact exist? */ - if (hwnd == NULL) { + if (hwnd == nullptr) { /* new message */ SkinPlaySound("AlertMsg"); if (IsAutoPopup(hContact)) { @@ -113,7 +113,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) return 0; } } - if (hwnd == NULL || !IsWindowVisible(GetParent(hwnd))) { + if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) { wchar_t toolTip[256]; mir_snwprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); @@ -137,14 +137,14 @@ static INT_PTR SendMessageCommandWorker(MCONTACT hContact, LPCSTR pszMsg, bool i /* does the MCONTACT's protocol support IM messages? */ char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return 1; /* unknown contact */ if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 1; HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd != NULL) { + if (hwnd != nullptr) { if (pszMsg) { HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); SendMessage(hEdit, EM_SETSEL, -1, GetWindowTextLength(hEdit)); @@ -195,7 +195,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); - Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); + Clist_TrayNotifyW(nullptr, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); } return 0; } @@ -203,7 +203,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; - char *szProto = GetContactProto(hContact); // szProto maybe NULL + char *szProto = GetContactProto(hContact); // szProto maybe nullptr if (!strcmp(cws->szModule, "CList") || !mir_strcmp(cws->szModule, szProto)) WindowList_Broadcast(pci->hWindowList, DM_CLISTSETTINGSCHANGED, hContact, lParam); return 0; @@ -243,7 +243,7 @@ static void RestoreUnreadMessageAlerts(void) if ((dbei.flags & (DBEF_SENT | DBEF_READ)) || !DbEventIsMessageOrCustom(&dbei)) continue; - int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != NULL; + int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != nullptr; if (windowAlreadyExists) continue; @@ -287,15 +287,15 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) { MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; - if (mwid == NULL || mwid->cbSize != sizeof(MessageWindowInputData) || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) + if (mwid == nullptr || mwid->cbSize != sizeof(MessageWindowInputData) || mwid->hContact == 0 || mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH) return 1; MessageWindowData *mwd = (MessageWindowData*)lParam; - if (mwd == NULL || mwd->cbSize != sizeof(MessageWindowData)) + if (mwd == nullptr || mwd->cbSize != sizeof(MessageWindowData)) return 1; HWND hwnd = WindowList_Find(pci->hWindowList, mwid->hContact); - if (hwnd == NULL) + if (hwnd == nullptr) hwnd = SM_FindWindowByContact(mwid->hContact); mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwd->hwndWindow = hwnd; @@ -307,24 +307,24 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) { StatusTextData *st = (StatusTextData*)lParam; - if (st != NULL && st->cbSize != sizeof(StatusTextData)) + if (st != nullptr && st->cbSize != sizeof(StatusTextData)) return 1; HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd == NULL) { + if (hwnd == nullptr) { hwnd = SM_FindWindowByContact(hContact); - if (hwnd == NULL) + if (hwnd == nullptr) return 1; } CScriverWindow *dat = (CScriverWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == NULL || dat->m_pParent == NULL) + if (dat == nullptr || dat->m_pParent == nullptr) return 1; ParentWindowData *pdat = dat->m_pParent; - SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon)); - SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? L"" : st->tszText)); + SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == nullptr ? 0 : st->hIcon)); + SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == nullptr ? L"" : st->tszText)); return 0; } @@ -414,10 +414,10 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) return 0; HWND hwnd = WindowList_Find(pci->hWindowList, wParam); - if (hwnd == NULL) + if (hwnd == nullptr) hwnd = SM_FindWindowByContact(wParam); - if (hwnd != NULL) + if (hwnd != nullptr) SendMessage(hwnd, DM_SWITCHTYPING, 0, 0); return 0; } @@ -550,7 +550,7 @@ static int MetaContactChanged(WPARAM hMeta, LPARAM) { if (hMeta) { HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); - if (hwnd != NULL) + if (hwnd != nullptr) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } return 0; @@ -615,7 +615,7 @@ int OnUnloadModule(void) int OnLoadModule(void) { hMsftEdit = LoadLibrary(L"Msftedit.dll"); - if (hMsftEdit == NULL) { + if (hMsftEdit == nullptr) { if (IDYES != MessageBox(0, TranslateT("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) @@ -680,14 +680,14 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj) AddRef(); return S_OK; } - *ppvObj = NULL; + *ppvObj = nullptr; return E_NOINTERFACE; } STDMETHODIMP_(ULONG) CREOleCallback::AddRef() { if (refCount == 0) - StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg); + StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg); return ++refCount; } @@ -697,7 +697,7 @@ STDMETHODIMP_(ULONG) CREOleCallback::Release() if (--refCount == 0) { if (pictStg) { pictStg->Release(); - pictStg = NULL; + pictStg = nullptr; } } return refCount; @@ -737,7 +737,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg) { wchar_t sztName[64]; mir_snwprintf(sztName, L"s%u", nextStgId++); - if (pictStg == NULL) + if (pictStg == nullptr) return STG_E_MEDIUMFULL; return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); } diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 57be735d37..8e04ec88d5 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -146,7 +146,7 @@ public: AVATARCACHEENTRY *m_ace; public: - CSrmmWindow(MCONTACT hContact, bool bIncoming = false, const char *szInitialText = NULL, bool bIsUnicode = false); + CSrmmWindow(MCONTACT hContact, bool bIncoming = false, const char *szInitialText = nullptr, bool bIsUnicode = false); virtual void OnInitDialog() override; virtual void OnDestroy() override; @@ -249,7 +249,7 @@ public: struct CREOleCallback : public IRichEditOleCallback { - CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {} + CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {} unsigned refCount; IStorage *pictStg; int nextStgId; diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index 61c930800a..19dbca5900 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { ErrorWindowData *ewd = (ErrorWindowData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - //if (ewd==NULL && msg!=WM_INITDIALOG) return FALSE; + //if (ewd==nullptr && msg!=WM_INITDIALOG) return FALSE; switch (msg) { case WM_INITDIALOG: { @@ -35,7 +35,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ewd = (ErrorWindowData *) lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) ewd); TranslateDialogDefault(hwndDlg); - if (ewd != NULL) { + if (ewd != nullptr) { ShowWindow(GetParent(ewd->hwndParent), SW_RESTORE); if (ewd->szDescription) SetDlgItemText(hwndDlg, IDC_ERRORTEXT, ewd->szDescription); diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp index 702e875320..c9a640a102 100644 --- a/plugins/Scriver/src/richutil.cpp +++ b/plugins/Scriver/src/richutil.cpp @@ -84,7 +84,7 @@ int RichUtil_SubClass(HWND hwndEdit) static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TRichUtil *ru = NULL, tru; + TRichUtil *ru = nullptr, tru; int idx; LRESULT ret; @@ -132,7 +132,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM nState = ETS_READONLY; else nState = ETS_NORMAL; - DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL); + DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, nullptr); CloseThemeData(hTheme); ReleaseDC(hwnd, hdc); return 0; @@ -170,7 +170,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return ret; case WM_ENABLE: - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME); break; case WM_GETDLGCODE: @@ -196,6 +196,6 @@ static void RichUtil_ClearUglyBorder(TRichUtil *ru) } // Redraw window since the style may have changed - SetWindowPos(ru->hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - RedrawWindow(ru->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME); + SetWindowPos(ru->hwnd, nullptr, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); + RedrawWindow(ru->hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_NOCHILDREN | RDW_UPDATENOW | RDW_FRAME); } diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index 46159a9919..dde4e2270d 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -static MessageSendQueueItem *global_sendQueue = NULL; +static MessageSendQueueItem *global_sendQueue = nullptr; static mir_cs queueMutex; wchar_t* GetSendBufferMsg(MessageSendQueueItem *item) @@ -38,7 +38,7 @@ MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender) mir_cslock lck(queueMutex); item->hwndSender = hwndSender; item->next = global_sendQueue; - if (global_sendQueue != NULL) + if (global_sendQueue != nullptr) global_sendQueue->prev = item; global_sendQueue = item; @@ -48,21 +48,21 @@ MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender) MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, MCONTACT hContact) { mir_cslock lck(queueMutex); - for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) - if (item->hwndSender == hwndSender && item->hContact == hContact && item->hwndErrorDlg == NULL) + for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) + if (item->hwndSender == hwndSender && item->hContact == hContact && item->hwndErrorDlg == nullptr) return item; - return NULL; + return nullptr; } MessageSendQueueItem* FindSendQueueItem(MCONTACT hContact, HANDLE hSendId) { mir_cslock lock(queueMutex); - for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) + for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) if (item->hContact == hContact && item->hSendId == hSendId) return item; - return NULL; + return nullptr; } BOOL RemoveSendQueueItem(MessageSendQueueItem* item) @@ -70,19 +70,19 @@ BOOL RemoveSendQueueItem(MessageSendQueueItem* item) HWND hwndSender = item->hwndSender; mir_cslock lock(queueMutex); - if (item->prev != NULL) + if (item->prev != nullptr) item->prev->next = item->next; else global_sendQueue = item->next; - if (item->next != NULL) + if (item->next != nullptr) item->next->prev = item->prev; mir_free(item->sendBuffer); mir_free(item->proto); mir_free(item); - for (item = global_sendQueue; item != NULL; item = item->next) + for (item = global_sendQueue; item != nullptr; item = item->next) if (item->hwndSender == hwndSender) return FALSE; @@ -96,13 +96,13 @@ void ReportSendQueueTimeouts(HWND hwndSender) mir_cslock lock(queueMutex); - for (item = global_sendQueue; item != NULL; item = item2) { + for (item = global_sendQueue; item != nullptr; item = item2) { item2 = item->next; if (item->timeout < timeout) { item->timeout += 1000; if (item->timeout >= timeout) { - if (item->hwndSender == hwndSender && item->hwndErrorDlg == NULL) { - if (hwndSender != NULL) { + if (item->hwndSender == hwndSender && item->hwndErrorDlg == nullptr) { + if (hwndSender != nullptr) { ErrorWindowData *ewd = (ErrorWindowData *)mir_alloc(sizeof(ErrorWindowData)); ewd->szName = mir_wstrdup(pcli->pfnGetContactDisplayName(item->hContact, 0)); ewd->szDescription = mir_wstrdup(TranslateT("The message send timed out.")); @@ -125,13 +125,13 @@ void ReleaseSendQueueItems(HWND hwndSender) { mir_cslock lock(queueMutex); - for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) { + for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) { if (item->hwndSender == hwndSender) { - item->hwndSender = NULL; - if (item->hwndErrorDlg != NULL) + item->hwndSender = nullptr; + if (item->hwndErrorDlg != nullptr) DestroyWindow(item->hwndErrorDlg); - item->hwndErrorDlg = NULL; + item->hwndErrorDlg = nullptr; } } } @@ -142,8 +142,8 @@ int ReattachSendQueueItems(HWND hwndSender, MCONTACT hContact) mir_cslock lock(queueMutex); - for (MessageSendQueueItem *item = global_sendQueue; item != NULL; item = item->next) { - if (item->hContact == hContact && item->hwndSender == NULL) { + for (MessageSendQueueItem *item = global_sendQueue; item != nullptr; item = item->next) { + if (item->hContact == hContact && item->hwndSender == nullptr) { item->hwndSender = hwndSender; item->timeout = 0; count++; @@ -156,7 +156,7 @@ void RemoveAllSendQueueItems() { MessageSendQueueItem *item, *item2; mir_cslock lock(queueMutex); - for (item = global_sendQueue; item != NULL; item = item2) { + for (item = global_sendQueue; item != nullptr; item = item2) { item2 = item->next; RemoveSendQueueItem(item); } @@ -167,14 +167,14 @@ void SendSendQueueItem(MessageSendQueueItem* item) mir_cslockfull lock(queueMutex); item->timeout = 0; - if (item->prev != NULL) { + if (item->prev != nullptr) { item->prev->next = item->next; - if (item->next != NULL) + if (item->next != nullptr) item->next->prev = item->prev; item->next = global_sendQueue; - item->prev = NULL; - if (global_sendQueue != NULL) + item->prev = nullptr; + if (global_sendQueue != nullptr) global_sendQueue->prev = item; global_sendQueue = item; diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp index 4d23a86f27..d3fdd9ed67 100644 --- a/plugins/Scriver/src/srmm.cpp +++ b/plugins/Scriver/src/srmm.cpp @@ -66,7 +66,7 @@ extern "C" __declspec(dllexport) int Load(void) pcli = Clist_GetInterface(); if (IsWinVer7Plus()) - CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface); + CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&pTaskbarInterface); return OnLoadModule(); } diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index 4dcc165563..401ef8335f 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -36,7 +36,7 @@ void DrawStatusIcons(MCONTACT hContact, HDC hDC, const RECT &r, int gap) HICON hIcon = ((si->flags & MBF_DISABLED) && si->hIconDisabled) ? si->hIconDisabled : si->hIcon; SetBkMode(hDC, TRANSPARENT); - DrawIconEx(hDC, x, (r.top + r.bottom - cy_icon) >> 1, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL); + DrawIconEx(hDC, x, (r.top + r.bottom - cy_icon) >> 1, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL); x += cx_icon + gap; } @@ -46,7 +46,7 @@ void CheckStatusIconClick(MCONTACT hContact, HWND hwndFrom, POINT pt, const RECT { unsigned int iconNum = (pt.x - rc.left) / (GetSystemMetrics(SM_CXSMICON) + gap); StatusIconData *si = Srmm_GetNthIcon(hContact, iconNum); - if (si == NULL) + if (si == nullptr) return; ClientToScreen(hwndFrom, &pt); @@ -65,9 +65,9 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0); else { HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd == NULL) + if (hwnd == nullptr) hwnd = SM_FindWindowByContact(hContact); - if (hwnd != NULL) + if (hwnd != nullptr) PostMessage(GetParent(hwnd), DM_STATUSICONCHANGE, 0, 0); } return 0; @@ -90,7 +90,7 @@ int DeinitStatusIcons() int GetStatusIconsCount(MCONTACT hContact) { int nIcon = 0; - while (Srmm_GetNthIcon(hContact, nIcon) != NULL) + while (Srmm_GetNthIcon(hContact, nIcon) != nullptr) nIcon++; return nIcon; } diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index 3454b0ef05..63ece38006 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -50,14 +50,14 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) tokens[2] = tszStatus; char *accModule = Proto_GetBaseAccountName(hContact); - if (accModule != NULL) { + if (accModule != nullptr) { PROTOACCOUNT* proto = Proto_GetAccount(accModule); - if (proto != NULL) + if (proto != nullptr) tokens[3] = mir_wstrdup(proto->tszAccountName); } tmplt = db_get_wsa(0, SRMMMOD, SRMSGSET_WINDOWTITLE); - if (tmplt != NULL) + if (tmplt != nullptr) tszTemplate = tmplt; else { if (g_dat.flags & SMF_STATUSICON) @@ -73,7 +73,7 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) for (i = 0; i < _countof(titleTokenNames); i++) { size_t tnlen = mir_wstrlen(titleTokenNames[i]); if (!wcsncmp(p, titleTokenNames[i], tnlen)) { - if (tokens[i] != NULL) + if (tokens[i] != nullptr) tszTitle.Append(tokens[i]); p += tnlen - 1; @@ -86,7 +86,7 @@ wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) tszTitle.AppendChar(*p); } - if (tmplt == NULL) + if (tmplt == nullptr) tszTitle.Append(TranslateT("Message session")); return tszTitle.Detach(); @@ -147,7 +147,7 @@ static CScriverWindow* GetChildFromTab(HWND hwndTabs, int tabId) if (TabCtrl_GetItem(hwndTabs, tabId, &tci)) return (CScriverWindow *)tci.lParam; - return NULL; + return nullptr; } static CScriverWindow* GetChildFromHWND(ParentWindowData *dat, HWND hwnd) @@ -161,7 +161,7 @@ static CScriverWindow* GetChildFromHWND(ParentWindowData *dat, HWND hwnd) if (pDlg->GetHwnd() == hwnd) return pDlg; } - return NULL; + return nullptr; } static void GetMinimunWindowSize(ParentWindowData *dat, SIZE *size) @@ -244,7 +244,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child) return; CScriverWindow *pDlg = GetChildFromTab(dat->hwndTabs, i); - if (pDlg == NULL) + if (pDlg == nullptr) return; dat->hContact = pDlg->m_hContact; @@ -257,7 +257,7 @@ static void ActivateChild(ParentWindowData *dat, HWND child) SendMessage(dat->hwndActive, WM_SIZE, 0, 0); ShowWindow(dat->hwndActive, SW_SHOWNOACTIVATE); SendMessage(dat->hwndActive, DM_SCROLLLOGTOBOTTOM, 0, 0); - if (prev != NULL) + if (prev != nullptr) ShowWindow(prev, SW_HIDE); } else SendMessage(dat->hwnd, WM_SIZE, 0, 0); @@ -296,7 +296,7 @@ static void RemoveChild(ParentWindowData *dat, HWND child) if (tab >= 0) ActivateChild(dat, GetChildFromTab(dat->hwndTabs, tab)->GetHwnd()); else - dat->hwndActive = NULL; + dat->hwndActive = nullptr; } ReleaseIcon(tci.iImage); } @@ -307,7 +307,7 @@ static void CloseOtherChilden(ParentWindowData *dat, HWND child) ActivateChild(dat, child); for (int i = dat->childrenCount - 1; i >= 0; i--) { CScriverWindow *pDlg = GetChildFromTab(dat->hwndTabs, i); - if (pDlg != NULL && pDlg->GetHwnd() != child) + if (pDlg != nullptr && pDlg->GetHwnd() != child) pDlg->Close(); } ActivateChild(dat, child); @@ -334,7 +334,7 @@ static void ActivateChildByIndex(ParentWindowData *dat, int index) int l = TabCtrl_GetItemCount(dat->hwndTabs); if (index < l) { CScriverWindow *pDlg = GetChildFromTab(dat->hwndTabs, index); - if (pDlg != NULL) + if (pDlg != nullptr) ActivateChild(dat, pDlg->GetHwnd()); } } @@ -401,7 +401,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) tci.mask = TCIF_PARAM; TabCtrl_GetItem(hwnd, tabId, &tci); CScriverWindow *pDlg = (CScriverWindow *)tci.lParam; - if (pDlg != NULL) { + if (pDlg != nullptr) { SendMessage(pDlg->GetHwnd(), WM_CLOSE, 0, 0); dat->srcTab = -1; } @@ -450,7 +450,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ImageList_DragLeave(GetDesktopWindow()); ImageList_EndDrag(); ImageList_Destroy(dat->hDragImageList); - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); dat->destTab = TabCtrl_HitTest(hwnd, &thinfo); if (thinfo.flags != TCHT_NOWHERE && dat->destTab != dat->srcTab) { NMHDR nmh; @@ -488,19 +488,19 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) tci.mask = TCIF_PARAM; TabCtrl_GetItem(hwnd, dat->srcTab, &tci); CScriverWindow *pDlg = (CScriverWindow*)tci.lParam; - if (pDlg != NULL) { + if (pDlg != nullptr) { HWND hChild = pDlg->GetHwnd(); MCONTACT hContact = pDlg->m_hContact; POINT pt; GetCursorPos(&pt); HWND hParent = WindowFromPoint(pt); - while (GetParent(hParent) != NULL) + while (GetParent(hParent) != nullptr) hParent = GetParent(hParent); hParent = WindowList_Find(g_dat.hParentWindowList, (UINT_PTR)hParent); - if ((hParent != NULL && hParent != GetParent(hwnd)) || (hParent == NULL && pDlg->m_pParent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) { - if (hParent == NULL) { + if ((hParent != nullptr && hParent != GetParent(hwnd)) || (hParent == nullptr && pDlg->m_pParent->childrenCount > 1 && (GetKeyState(VK_CONTROL) & 0x8000))) { + if (hParent == nullptr) { hParent = GetParentWindow(hContact, FALSE); RECT rc; @@ -540,7 +540,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else { dat->destTab = -1; - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } } else if (dat->srcTab >= 0 && g_dat.flags2 & SMF2_TABCLOSEBUTTON) { @@ -558,7 +558,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (pt.x >= rect.left && pt.x < rect.left + (info.rcImage.right - info.rcImage.left) && pt.y >= rect.top && pt.y < rect.top + (info.rcImage.bottom - info.rcImage.top)) { HBITMAP hOldBitmap, hBmp; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HDC hdcMem = CreateCompatibleDC(hdc); pt.x -= rect.left; pt.y -= rect.top; @@ -573,7 +573,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SelectObject(hdcMem, hOldBitmap); DeleteDC(hdcMem); DeleteObject(hBmp); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); if (color1 != 0x000000 || color2 != 0xFFFFFF) { GetChildFromTab(hwnd, dat->srcTab)->Close(); dat->srcTab = -1; @@ -617,7 +617,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) HBITMAP hBitmap = CreateCompatibleBitmap(hDC, rect.right, rect.bottom); HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap); FillRect(hMemDC, &rect2, hBrush); - SetWindowOrgEx(hMemDC, rect.left, rect.top, NULL); + SetWindowOrgEx(hMemDC, rect.left, rect.top, nullptr); SendMessage(hwnd, WM_PRINTCLIENT, (WPARAM)hMemDC, PRF_CLIENT); SelectObject(hMemDC, hOldBitmap); ImageList_AddMasked(dat->hDragImageList, hBitmap, RGB(255, 0, 254)); @@ -643,7 +643,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (newDest != dat->destTab) { dat->destTab = newDest; ImageList_DragLeave(GetDesktopWindow()); - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); ImageList_DragEnter(GetDesktopWindow(), pt.x, pt.y); } else ImageList_DragMove(pt.x, pt.y); @@ -744,17 +744,17 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara dat->iSplitterX = db_get_dw(0, SRMMMOD, "splitterx", -1); dat->iSplitterY = db_get_dw(0, SRMMMOD, "splittery", -1); dat->flags2 = g_dat.flags2; - dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL); + dat->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, hwndDlg, nullptr, g_hInst, nullptr); dat->isChat = newData->isChat; SendMessage(dat->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0); //SetupStatusBar(dat); dat->hwndTabs = GetDlgItem(hwndDlg, IDC_TABS); - dat->hwndActive = NULL; + dat->hwndActive = nullptr; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); - if (g_dat.hTabIconList != NULL) + if (g_dat.hTabIconList != nullptr) TabCtrl_SetImageList(dat->hwndTabs, g_dat.hTabIconList); - dat->next = NULL; + dat->next = nullptr; if (!newData->isChat) { dat->prev = g_dat.lastParent; g_dat.lastParent = dat; @@ -763,7 +763,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara dat->prev = g_dat.lastChatParent; g_dat.lastChatParent = dat; } - if (dat->prev != NULL) + if (dat->prev != nullptr) dat->prev->next = dat; WindowList_Add(g_dat.hParentWindowList, hwndDlg, (UINT_PTR)hwndDlg); @@ -780,7 +780,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)&dat->windowWasCascaded); HMENU hMenu = GetSystemMenu(hwndDlg, FALSE); - InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(hMenu, 0, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); if (dat->bTopmost) { InsertMenu(hMenu, 0, MF_BYPOSITION | MF_ENABLED | MF_CHECKED | MF_STRING, IDM_TOPMOST, TranslateT("Always on top")); SetWindowPos(hwndDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -837,7 +837,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SetupStatusBar(dat); } MoveWindow(dat->hwndTabs, 0, 2, (rc.right - rc.left), (rc.bottom - rc.top) - (rcStatus.bottom - rcStatus.top) - 2, FALSE); - RedrawWindow(dat->hwndTabs, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE); + RedrawWindow(dat->hwndTabs, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE); GetMinimunWindowSize(dat, &size); if ((rcWindow.bottom - rcWindow.top) < size.cy || (rcWindow.right - rcWindow.left) < size.cx) { if ((rcWindow.bottom - rcWindow.top) < size.cy) @@ -849,16 +849,16 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara GetChildWindowRect(dat, &rcChild); dat->childRect = rcChild; MoveWindow(dat->hwndActive, rcChild.left, rcChild.top, rcChild.right - rcChild.left, rcChild.bottom - rcChild.top, TRUE); - RedrawWindow(GetDlgItem(dat->hwndActive, IDC_LOG), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(dat->hwndActive, IDC_LOG), nullptr, nullptr, RDW_INVALIDATE); if (dat->flags2 & SMF2_SHOWSTATUSBAR) { SendMessage(dat->hwndStatus, WM_SIZE, 0, 0); - RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + RedrawWindow(dat->hwndStatus, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); } } return FALSE; case WM_SETFOCUS: - if (dat->hwndActive != NULL) + if (dat->hwndActive != nullptr) SetFocus(dat->hwndActive); return TRUE; @@ -877,7 +877,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; if (dat && dat->hwndActive && dis->hwndItem == dat->hwndStatus) { CScriverWindow *pDlg = GetChildFromHWND(dat, dat->hwndActive); - if (pDlg != NULL) + if (pDlg != nullptr) DrawStatusIcons(pDlg->m_hContact, dis->hDC, dis->rcItem, 2); return TRUE; } @@ -928,11 +928,11 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara HMENU hSubMenu = GetSubMenu(hMenu, 3); TranslateMenu(hSubMenu); HMENU hUserMenu = (HMENU)SendMessage(pDlg->GetHwnd(), DM_GETCONTEXTMENU, 0, 0); - if (hUserMenu != NULL) { + if (hUserMenu != nullptr) { InsertMenu(hSubMenu, 0, MF_POPUP | MF_BYPOSITION, (UINT_PTR)hUserMenu, TranslateT("User menu")); InsertMenu(hSubMenu, 1, MF_SEPARATOR | MF_BYPOSITION, 0, 0); } - BOOL menuResult = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, x, y, 0, hwndDlg, NULL); + BOOL menuResult = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, x, y, 0, hwndDlg, nullptr); switch (menuResult) { case IDM_CLOSETAB: SendMessage(pDlg->GetHwnd(), WM_CLOSE, 0, 0); @@ -943,7 +943,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara default: Clist_MenuProcessCommand(LOWORD(menuResult), MPCF_CONTACTMENU, pDlg->m_hContact); } - if (hUserMenu != NULL) + if (hUserMenu != nullptr) DestroyMenu(hUserMenu); DestroyMenu(hMenu); } @@ -958,7 +958,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 2, (LPARAM)&rc); if (nm->pt.x >= rc.left) { CScriverWindow *pDlg = GetChildFromHWND(dat, dat->hwndActive); - if (pDlg != NULL) + if (pDlg != nullptr) CheckStatusIconClick(pDlg->m_hContact, dat->hwndStatus, nm->pt, rc, 2, (pNMHDR->code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0)); } return TRUE; @@ -995,7 +995,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SendMessage(dat->hwndStatus, SB_GETRECT, SendMessage(dat->hwndStatus, SB_GETPARTS, 0, 0) - 2, (LPARAM)&rc); if (pt.x >= rc.left) { CScriverWindow *pDlg = GetChildFromHWND(dat, dat->hwndActive); - if (pDlg != NULL) + if (pDlg != nullptr) CheckStatusIconClick(pDlg->m_hContact, dat->hwndStatus, pt, rc, 2, MBCF_RIGHTBUTTON); break; } @@ -1012,7 +1012,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SetLayeredWindowAttributes(hwndDlg, RGB(255, 255, 255), (BYTE)(255 - g_dat.inactiveAlpha), LWA_ALPHA); break; } - if (dat->hwndActive != NULL) { + if (dat->hwndActive != nullptr) { ActivateChild(dat, dat->hwndActive); g_dat.hFocusWnd = dat->hwndActive; PostMessage(dat->hwndActive, DM_SETFOCUS, 0, msg); @@ -1143,10 +1143,10 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara if (g_dat.lastChatParent == dat) g_dat.lastChatParent = dat->prev; - if (dat->prev != NULL) + if (dat->prev != nullptr) dat->prev->next = dat->next; - if (dat->next != NULL) + if (dat->next != nullptr) dat->next->prev = dat->prev; UnsubclassTabCtrl(dat->hwndTabs); @@ -1160,7 +1160,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara case CM_STARTFLASHING: if ((GetActiveWindow() != hwndDlg || GetForegroundWindow() != hwndDlg)) {// && !(g_dat.flags2 & SMF2_STAYMINIMIZED)) { dat->nFlash = 0; - SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(hwndDlg, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); } break; @@ -1250,7 +1250,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara { HWND hwnd = (HWND)lParam; TitleBarData *tbd = (TitleBarData *)wParam; - if (tbd != NULL && dat->hwndActive == hwnd) { + if (tbd != nullptr && dat->hwndActive == hwnd) { if (tbd->iFlags & TBDF_TEXT) { wchar_t oldtitle[256]; GetWindowText(hwndDlg, oldtitle, _countof(oldtitle)); @@ -1259,7 +1259,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara } if (tbd->iFlags & TBDF_ICON) { SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)tbd->hIcon); - if (tbd->hIconBig != NULL) + if (tbd->hIconBig != nullptr) SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)tbd->hIconBig); if (pTaskbarInterface) pTaskbarInterface->SetOverlayIcon(hwndDlg, tbd->hIconNot, L""); @@ -1272,12 +1272,12 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara { HWND hwnd = (HWND)lParam; StatusBarData *sbd = (StatusBarData *)wParam; - if (sbd != NULL) { + if (sbd != nullptr) { if ((sbd->iFlags & SBDF_TEXT) && dat->hwndActive == hwnd) SendMessage(dat->hwndStatus, SB_SETTEXT, sbd->iItem, (LPARAM)sbd->pszText); if ((sbd->iFlags & SBDF_ICON) && dat->hwndActive == hwnd) SendMessage(dat->hwndStatus, SB_SETICON, sbd->iItem, (LPARAM)sbd->hIcon); - RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(dat->hwndStatus, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); } } break; @@ -1285,15 +1285,15 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara case DM_STATUSICONCHANGE: SendMessage(dat->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0); SetupStatusBar(dat); - RedrawWindow(dat->hwndStatus, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(dat->hwndStatus, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); break; case CM_UPDATETABCONTROL: { TabControlData *tcd = (TabControlData*)wParam; int tabId = GetTabFromHWND(dat, (HWND)lParam); - if (tabId >= 0 && tcd != NULL) { - wchar_t *ptszTemp = NULL; + if (tabId >= 0 && tcd != nullptr) { + wchar_t *ptszTemp = nullptr; TCITEM tci; tci.mask = 0; @@ -1308,7 +1308,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara } if (tcd->iFlags & TCDF_ICON) { int iconIdx = -1; - if (tcd->hIcon != NULL) { + if (tcd->hIcon != nullptr) { TCITEM tci2; tci2.mask = TCIF_IMAGE; TabCtrl_GetItem(dat->hwndTabs, tabId, &tci2); @@ -1361,7 +1361,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara GetWindowRect(hwndDlg, &rc); SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSENDCHANGING); - RedrawWindow(hwndDlg, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); break; case DM_CASCADENEWWINDOW: @@ -1388,7 +1388,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam) return; TabCtrlData *tcdat = (TabCtrlData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - HANDLE hTheme = NULL; + HANDLE hTheme = nullptr; int tstate = 0; wchar_t szLabel[1024]; TCITEM tci; @@ -1422,7 +1422,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam) hTheme = OpenThemeData(hwnd, L"TAB"); if (IsThemeBackgroundPartiallyTransparent(hTheme, TABP_TABITEM, tstate)) DrawThemeParentBackground(hwnd, lpDIS->hDC, &rectTab); - DrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, NULL); + DrawThemeBackground(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, &rectTab, nullptr); } if (atTop) { dwFormat = DT_SINGLELINE | DT_TOP | DT_CENTER | DT_NOPREFIX | DT_NOCLIP; @@ -1502,14 +1502,14 @@ HWND GetParentWindow(MCONTACT hContact, BOOL bChat) newData.isChat = bChat; if (g_dat.flags2 & SMF2_USETABS) { if (!bChat || !(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) { - if (g_dat.lastParent != NULL) { + if (g_dat.lastParent != nullptr) { int tabsNum = (int)SendMessage(g_dat.lastParent->hwnd, CM_GETCHILDCOUNT, 0, 0); if (!(g_dat.flags2 & SMF2_LIMITTABS) || tabsNum < g_dat.limitTabsNum) return g_dat.lastParent->hwnd; } } else { - if (g_dat.lastChatParent != NULL) { + if (g_dat.lastChatParent != nullptr) { int tabsNum = (int)SendMessage(g_dat.lastChatParent->hwnd, CM_GETCHILDCOUNT, 0, 0); if (!(g_dat.flags2 & SMF2_LIMITCHATSTABS) || tabsNum < g_dat.limitChatsTabsNum) { return g_dat.lastChatParent->hwnd; @@ -1520,5 +1520,5 @@ HWND GetParentWindow(MCONTACT hContact, BOOL bChat) if (!(g_dat.flags2 & SMF2_SEPARATECHATSCONTAINERS)) newData.isChat = FALSE; - return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), NULL, DlgProcParentWindow, (LPARAM)&newData); + return CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGWIN), nullptr, DlgProcParentWindow, (LPARAM)&newData); } diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 9abbe55fd9..f15c4d957e 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -36,7 +36,7 @@ void logInfo(const char *fmt, ...) va_list vararg; int strsize; FILE *flog = fopen(filename, "at"); - if (flog != NULL) { + if (flog != nullptr) { GetLocalTime(&time); va_start(vararg, fmt); str = (char*)malloc(strsize = 2048); @@ -68,7 +68,7 @@ char* GetRichTextUtf(HWND hwnd) { int textBufferSize = GetRichTextLength(hwnd, CP_UTF8, TRUE); if (textBufferSize == 0) - return NULL; + return nullptr; textBufferSize++; char *textBuffer = (char*)mir_alloc(textBufferSize); @@ -106,7 +106,7 @@ static DWORD CALLBACK RichTextStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, static DWORD dwRead; char **ppText = (char**)dwCookie; - if (*ppText == NULL) { + if (*ppText == nullptr) { *ppText = (char*)mir_alloc(cb + 1); memcpy(*ppText, pbBuff, cb); (*ppText)[cb] = 0; @@ -130,9 +130,9 @@ static DWORD CALLBACK RichTextStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, char* GetRichTextRTF(HWND hwnd) { if (hwnd == 0) - return NULL; + return nullptr; - char *pszText = NULL; + char *pszText = nullptr; EDITSTREAM stream = { 0 }; stream.pfnCallback = RichTextStreamCallback; stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer @@ -166,7 +166,7 @@ wchar_t* GetRichTextWord(HWND hwnd, POINTL *ptl) { long iCharIndex, start, end, iRes; wchar_t *pszWord = GetRichEditSelection(hwnd); - if (pszWord == NULL) { + if (pszWord == nullptr) { iCharIndex = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)ptl); if (iCharIndex >= 0) { start = SendMessage(hwnd, EM_FINDWORDBREAK, WB_LEFT, iCharIndex); //-iChars; @@ -183,12 +183,12 @@ wchar_t* GetRichTextWord(HWND hwnd, POINTL *ptl) iRes = SendMessage(hwnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes <= 0) { mir_free(pszWord); - pszWord = NULL; + pszWord = nullptr; } } } } - if (pszWord != NULL) + if (pszWord != nullptr) rtrimText(pszWord); return pszWord; @@ -210,10 +210,10 @@ wchar_t *GetRichEditSelection(HWND hwnd) CHARRANGE sel; SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin == sel.cpMax) - return NULL; + return nullptr; MessageSendQueueItem msi; - msi.sendBuffer = NULL; + msi.sendBuffer = nullptr; msi.sendBufferSize = 0; EDITSTREAM stream; @@ -388,7 +388,7 @@ void SetSearchEngineIcons(HMENU hMenu, HIMAGELIST hImageList) void CSrmmWindow::GetContactUniqueId(char *buf, int maxlen) { ptrW id(Contact_GetInfo(CNF_UNIQUEID, m_hContact, m_szProto)); - if (id != NULL) + if (id != nullptr) strncpy_s(buf, maxlen, _T2A(id), _TRUNCATE); } @@ -397,11 +397,11 @@ HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle, RECT *rec TOOLINFO ti = { 0 }; HWND hwndTT; hwndTT = CreateWindowEx(WS_EX_TOPMOST, - TOOLTIPS_CLASS, NULL, + TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwndParent, NULL, g_hInst, NULL); + hwndParent, nullptr, g_hInst, nullptr); SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); ti.cbSize = sizeof(TOOLINFO); @@ -450,7 +450,7 @@ void SetButtonsPos(HWND hwndDlg, MCONTACT hContact, bool bShow) CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); - if (hwndButton == NULL) + if (hwndButton == nullptr) continue; if (cbd->m_dwButtonCID == IDC_ADD) @@ -464,10 +464,10 @@ void SetButtonsPos(HWND hwndDlg, MCONTACT hContact, bool bShow) int width = iGap + cbd->m_iButtonWidth; if (cbd->m_bRSided) { iRightX -= width; - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } else { - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); iLeftX += width; } } -- cgit v1.2.3