From a7c24ca48995cf2bf436156302f96b91bf135409 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Mon, 13 Nov 2017 15:03:31 +0100 Subject: Code modernize ... * replace 0/NULL with nullptr [using clang-tidy] --- plugins/YAPP/src/message_pump.cpp | 12 ++++---- plugins/YAPP/src/options.cpp | 6 ++-- plugins/YAPP/src/popwin.cpp | 54 +++++++++++++++++------------------ plugins/YAPP/src/services.cpp | 30 +++++++++---------- plugins/YAPP/src/yapp.cpp | 8 +++--- plugins/YAPP/src/yapp_history.cpp | 6 ++-- plugins/YAPP/src/yapp_history_dlg.cpp | 20 ++++++------- 7 files changed, 68 insertions(+), 68 deletions(-) (limited to 'plugins/YAPP') diff --git a/plugins/YAPP/src/message_pump.cpp b/plugins/YAPP/src/message_pump.cpp index ea3e0b3197..606401da6b 100644 --- a/plugins/YAPP/src/message_pump.cpp +++ b/plugins/YAPP/src/message_pump.cpp @@ -14,9 +14,9 @@ unsigned __stdcall MessagePumpThread(void* param) if (param) SetEvent((HANDLE)param); - MSG hwndMsg = { 0 }; - while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !bShutdown) { - if (hwndMsg.hwnd != NULL && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */ + MSG hwndMsg = {}; + while (GetMessage(&hwndMsg, nullptr, 0, 0) > 0 && !bShutdown) { + if (hwndMsg.hwnd != nullptr && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */ continue; switch(hwndMsg.message) { case MUM_CREATEPOPUP: @@ -30,7 +30,7 @@ unsigned __stdcall MessagePumpThread(void* param) PopupData *pd = (PopupData*)hwndMsg.lParam; if (enabled && num_popups < MAX_POPUPS) { - HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)hwndMsg.lParam); + HWND hwnd = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, L"Popup", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, hInst, (LPVOID)hwndMsg.lParam); num_popups++; if (hwndMsg.wParam) // set notifyer handle SendMessage(hwnd, PUM_SETNOTIFYH, hwndMsg.wParam, 0); @@ -93,12 +93,12 @@ void InitMessagePump() popup_win_class.lpfnWndProc = PopupWindowProc; popup_win_class.hInstance = hInst; popup_win_class.lpszClassName = POP_WIN_CLASS; - popup_win_class.hCursor = LoadCursor(NULL, IDC_ARROW); + popup_win_class.hCursor = LoadCursor(nullptr, IDC_ARROW); RegisterClass(&popup_win_class); InitServices(); - hMPEvent = CreateEvent(0, TRUE, 0, 0); + hMPEvent = CreateEvent(nullptr, TRUE, 0, nullptr); CloseHandle(mir_forkthreadex(MessagePumpThread, hMPEvent, &message_pump_thread_id)); WaitForSingleObject(hMPEvent, INFINITE); CloseHandle(hMPEvent); diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp index 47720f25a9..423299490d 100644 --- a/plugins/YAPP/src/options.cpp +++ b/plugins/YAPP/src/options.cpp @@ -2,7 +2,7 @@ Options options; -HICON hPopupIcon = 0; +HICON hPopupIcon = nullptr; void LoadModuleDependentOptions() { if (ServiceExists(MS_AV_DRAWAVATAR)) @@ -427,7 +427,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_BTN_PREVIEW: if (arNewClasses[i]->flags & PCF_UNICODE) { POPUPCLASS pc = *arNewClasses[i]; - pc.PluginWindowProc = 0; + pc.PluginWindowProc = nullptr; POPUPDATACLASS d = {sizeof(d), pc.pszName}; d.pwszTitle = L"Preview"; d.pwszText = L"The quick brown fox jumps over the lazy dog."; @@ -435,7 +435,7 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam } else { POPUPCLASS pc = *arNewClasses[i]; - pc.PluginWindowProc = 0; + pc.PluginWindowProc = nullptr; POPUPDATACLASS d = {sizeof(d), pc.pszName}; d.pszTitle = "Preview"; d.pszText = "The quick brown fox jumps over the lazy dog."; diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index 60f273e1f0..bdaff9f4d1 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -24,7 +24,7 @@ struct HWNDStackNode { struct HWNDStackNode *next; }; -HWNDStackNode *hwnd_stack_top = 0; +HWNDStackNode *hwnd_stack_top = nullptr; int stack_size = 0; void RepositionWindows() { @@ -127,7 +127,7 @@ void AddWindowToStack(HWND hwnd) { break; } - SetWindowPos(hwnd, 0, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwnd, nullptr, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); stack_size++; @@ -136,7 +136,7 @@ void AddWindowToStack(HWND hwnd) { void RemoveWindowFromStack(HWND hwnd) { - HWNDStackNode *current = hwnd_stack_top, *prev = 0; + HWNDStackNode *current = hwnd_stack_top, *prev = nullptr; while(current) { if (current->hwnd == hwnd) { if (prev) @@ -171,7 +171,7 @@ void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) void DeinitWindowStack() { HWNDStackNode *current = hwnd_stack_top; - hwnd_stack_top = NULL; + hwnd_stack_top = nullptr; while(current) { HWNDStackNode *pNext = current->next; DestroyWindow(current->hwnd); @@ -197,7 +197,7 @@ struct PopupWindowData LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PopupWindowData *pwd = (PopupWindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); - PopupData *pd = 0; + PopupData *pd = nullptr; if (pwd) pd = pwd->pd; switch(uMsg) { @@ -207,7 +207,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd = (PopupWindowData *)mir_alloc(sizeof(PopupWindowData)); pd = (PopupData *)cs->lpCreateParams; pwd->pd = pd; - pwd->hNotify = 0; + pwd->hNotify = nullptr; trimW(pwd->pd->pwzTitle); trimW(pwd->pd->pwzText); @@ -237,17 +237,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SYSTEMTIME st; GetLocalTime(&st); - GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, 0, pwd->tbuff, 128); + GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, nullptr, pwd->tbuff, 128); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)pwd); // make a really long timeout - say 7 days? ;) if (pd->timeout == -1 || (pd->timeout == 0 && options.default_timeout == -1)) - SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, nullptr); else if (pd->timeout == 0) - SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, options.default_timeout * 1000, nullptr); else - SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, nullptr); AddWindowToStack(hwnd); // this updates our size } @@ -301,7 +301,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (wParam == ID_CLOSETIMER) { KillTimer(hwnd, ID_CLOSETIMER); if (pwd->mouse_in || (options.global_hover && global_mouse_in)) - SetTimer(hwnd, ID_CLOSETIMER, 800, 0); // reset timer if mouse in window - allow another 800 ms + SetTimer(hwnd, ID_CLOSETIMER, 800, nullptr); // reset timer if mouse in window - allow another 800 ms else { PostMessage(hwnd, UM_DESTROYPOPUP, 0, 0); } @@ -321,7 +321,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (adj_y == 0) adj_y = (pwd->new_y - r.top); int x = r.left + adj_x, y = r.top + adj_y; - SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(hwnd, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); if (!IsWindowVisible(hwnd)) { ShowWindow(hwnd, SW_SHOWNOACTIVATE); @@ -436,7 +436,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa iconx = r.left + options.padding; textxmin += 16 + options.padding; } - DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(ps.hdc, iconx, options.padding + (pwd->tb_height - 16) / 2, pd->hIcon, 16, 16, 0, nullptr, DI_NORMAL); } // title time @@ -518,12 +518,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SendMessage(hwnd, UM_FREEPLUGINDATA, 0, 0); if (pd) { - pd->SetIcon(NULL); + pd->SetIcon(nullptr); mir_free(pd->pwzTitle); mir_free(pd->pwzText); mir_free(pd); } - mir_free(pwd); pwd = 0; pd = 0; + mir_free(pwd); pwd = nullptr; pd = nullptr; SetWindowLongPtr(hwnd, GWLP_USERDATA, 0); break; @@ -548,10 +548,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa KillTimer(hwnd, ID_MOVETIMER); pwd->new_x = (int)wParam; pwd->new_y = (int)lParam; - SetTimer(hwnd, ID_MOVETIMER, 10, 0); + SetTimer(hwnd, ID_MOVETIMER, 10, nullptr); } else { - SetWindowPos(hwnd, 0, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(hwnd, nullptr, (int)wParam, (int)lParam, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); if (!IsWindowVisible(hwnd)) { ShowWindow(hwnd, SW_SHOWNOACTIVATE); UpdateWindow(hwnd); @@ -561,7 +561,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PUM_SETTEXT: replaceStrW(pd->ptzText, (wchar_t*)lParam); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); RepositionWindows(); return TRUE; @@ -649,9 +649,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa RECT r; GetWindowRect(hwnd, &r); if (r.right - r.left != options.win_width || r.bottom - r.top != *pHeight) { - SetWindowPos(hwnd, 0, 0, 0, options.win_width, *pHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + SetWindowPos(hwnd, nullptr, 0, 0, options.win_width, *pHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); SendMessage(hwnd, PUM_UPDATERGN, 0, 0); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); } } return TRUE; @@ -676,13 +676,13 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // make a really long timeout - say 7 days? ;) if (pd->timeout == -1) - SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, 7 * 24 * 60 * 60 * 1000, nullptr); else if (pd->timeout == 0) - SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, 7 * 1000, nullptr); else - SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, 0); + SetTimer(hwnd, ID_CLOSETIMER, pd->timeout * 1000, nullptr); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); RepositionWindows(); } return TRUE; @@ -699,15 +699,15 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pd->hContact = (MCONTACT)MNotifyGetDWord(pwd->hNotify, NFOPT_CONTACT, 0); pd->hIcon = (HICON)MNotifyGetDWord(pwd->hNotify, NFOPT_ICON, 0); - const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, 0); + const wchar_t *swzName = MNotifyGetWString(pwd->hNotify, NFOPT_TITLEW, nullptr); mir_free(pd->pwzTitle); pd->pwzTitle = mir_wstrdup(swzName); - const wchar_t *swzText = MNotifyGetWString(pwd->hNotify, NFOPT_TEXTW, 0); + const wchar_t *swzText = MNotifyGetWString(pwd->hNotify, NFOPT_TEXTW, nullptr); mir_free(pd->pwzText); pd->pwzText = mir_wstrdup(swzText); - InvalidateRect(hwnd, 0, TRUE); + InvalidateRect(hwnd, nullptr, TRUE); RepositionWindows(); } return TRUE; diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index da7c2d89b8..71f68a7b05 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -6,7 +6,7 @@ static HANDLE hEventNotify; void StripBBCodesInPlace(wchar_t *text) { - if (text == 0 || db_get_b(0, MODULE, "StripBBCodes", 1) == 0) + if (text == nullptr || db_get_b(0, MODULE, "StripBBCodes", 1) == 0) return; int read = 0, write = 0; @@ -69,7 +69,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM) pd_out->opaque = pd_in->PluginData; pd_out->timeout = pd_in->iSeconds; - lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr)); if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); mir_free(pd_out->pwzText); @@ -110,7 +110,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM) pd_out->opaque = pd_in->PluginData; pd_out->timeout = pd_in->iSeconds; - lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr)); if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); mir_free(pd_out->pwzText); @@ -149,7 +149,7 @@ void ShowPopup(PopupData &pd_in) StripBBCodesInPlace(pd_out->pwzTitle); StripBBCodesInPlace(pd_out->pwzText); - lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0)); + lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(nullptr)); if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { mir_free(pd_out->pwzTitle); @@ -166,7 +166,7 @@ static INT_PTR GetContact(WPARAM wParam, LPARAM) if (GetCurrentThreadId() == message_pump_thread_id) SendMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, 0); else { - HANDLE hEvent = CreateEvent(0, 0, 0, 0); + HANDLE hEvent = CreateEvent(nullptr, 0, 0, nullptr); PostMessage(hwndPop, PUM_GETCONTACT, (WPARAM)&hContact, (LPARAM)hEvent); MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0); CloseHandle(hEvent); @@ -178,11 +178,11 @@ static INT_PTR GetContact(WPARAM wParam, LPARAM) static INT_PTR GetOpaque(WPARAM wParam, LPARAM) { HWND hwndPop = (HWND)wParam; - void *data = 0; + void *data = nullptr; if (GetCurrentThreadId() == message_pump_thread_id) SendMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, 0); else { - HANDLE hEvent = CreateEvent(0, 0, 0, 0); + HANDLE hEvent = CreateEvent(nullptr, 0, 0, nullptr); PostMessage(hwndPop, PUM_GETOPAQUE, (WPARAM)&data, (LPARAM)hEvent); MsgWaitForMultipleObjectsEx(1, &hEvent, INFINITE, 0, 0); CloseHandle(hEvent); @@ -196,11 +196,11 @@ void UpdateMenu() bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1; if (isEnabled) { Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON)); - Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_ON)); + Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIcon(ICO_POPUP_ON)); } else { Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), IcoLib_GetIcon(ICO_POPUP_OFF)); - Menu_ModifyItem(hMenuRoot, NULL, IcoLib_GetIcon(ICO_POPUP_OFF)); + Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIcon(ICO_POPUP_OFF)); } if (hTTButton) @@ -275,7 +275,7 @@ static INT_PTR PopupChangeW(WPARAM wParam, LPARAM lParam) pd_out.opaque = pd_in->PluginData; pd_out.timeout = pd_in->iSeconds; - lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(0)); + lstPopupHistory.Add(pd_out.pwzTitle, pd_out.pwzText, time(nullptr)); SendMessage(hwndPop, PUM_CHANGE, 0, (LPARAM)&pd_out); } @@ -290,7 +290,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAT pd = {0}; mir_wstrcpy(pd.lptzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification"); - pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); + pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); wcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0; CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0); } @@ -305,7 +305,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAW pd = {0}; mir_wstrcpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification"); - pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); + pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); wcsncpy(pd.lpwzText, (wchar_t *)wParam, MAX_SECONDLINE); CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, 0); } @@ -317,7 +317,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) INT_PTR Popup_ShowHistory(WPARAM, LPARAM) { if (!hHistoryWindow) - hHistoryWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LST_HISTORY), NULL, DlgProcHistLst); + hHistoryWindow = CreateDialog(hInst, MAKEINTRESOURCE(IDD_LST_HISTORY), nullptr, DlgProcHistLst); ShowWindow(hHistoryWindow, SW_SHOW); return 0; @@ -359,7 +359,7 @@ static void FreePopupClass(POPUPCLASS *pc) static INT_PTR UnregisterPopupClass(WPARAM, LPARAM lParam) { POPUPCLASS *pc = (POPUPCLASS*)lParam; - if (pc == NULL) + if (pc == nullptr) return 1; for (int i=0; i < arClasses.getCount(); i++) @@ -377,7 +377,7 @@ static INT_PTR CreateClassPopup(WPARAM wParam, LPARAM lParam) POPUPDATACLASS *pdc = (POPUPDATACLASS *)lParam; if (pdc->cbSize < sizeof(POPUPDATACLASS)) return 1; - POPUPCLASS *pc = 0; + POPUPCLASS *pc = nullptr; if (wParam) pc = (POPUPCLASS *)wParam; else { diff --git a/plugins/YAPP/src/yapp.cpp b/plugins/YAPP/src/yapp.cpp index b045e2d873..482f774ec6 100644 --- a/plugins/YAPP/src/yapp.cpp +++ b/plugins/YAPP/src/yapp.cpp @@ -3,10 +3,10 @@ #include "stdafx.h" -HMODULE hInst = 0; +HMODULE hInst = nullptr; bool bShutdown = false; -MNOTIFYLINK *notifyLink = 0; +MNOTIFYLINK *notifyLink = nullptr; // used to work around a bug in neweventnotify and others with the address passed in the GetPluginData function bool ignore_gpd_passed_addy = false; @@ -15,7 +15,7 @@ FontIDW font_id_firstline = {0}, font_id_secondline = {0}, font_id_time = {0}; ColourIDW colour_id_bg = {0}, colour_id_border = {0}, colour_id_sidebar = {0}, colour_id_titleunderline = {0}; COLORREF colBg = GetSysColor(COLOR_3DSHADOW); -HFONT hFontFirstLine = 0, hFontSecondLine = 0, hFontTime = 0; +HFONT hFontFirstLine = nullptr, hFontSecondLine = nullptr, hFontTime = nullptr; COLORREF colFirstLine = RGB(255, 0, 0), colSecondLine = 0, colTime = RGB(0, 0, 255), colBorder = RGB(0, 0, 0), colSidebar = RGB(128, 128, 128), colTitleUnderline = GetSysColor(COLOR_3DSHADOW); @@ -75,7 +75,7 @@ int ReloadFont(WPARAM, LPARAM) int TTBLoaded(WPARAM, LPARAM) { - TTBButton ttb = { 0 }; + TTBButton ttb = {}; ttb.pszService = "Popup/EnableDisableMenuCommand"; ttb.lParamUp = 1; ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON; diff --git a/plugins/YAPP/src/yapp_history.cpp b/plugins/YAPP/src/yapp_history.cpp index 8e02c3c2ca..fb881cf1c1 100644 --- a/plugins/YAPP/src/yapp_history.cpp +++ b/plugins/YAPP/src/yapp_history.cpp @@ -38,8 +38,8 @@ void PopupHistoryList::DeleteData(int index) mir_free(item->titleT); mir_free(item->messageT); item->timestamp = 0; //invalidate item - item->title = NULL; - item->message = NULL; + item->title = nullptr; + item->message = nullptr; item->flags = 0; } @@ -77,7 +77,7 @@ PopupHistoryData *PopupHistoryList::Get(int index) { if ((index < 0) || (index >= count)) //a bit of sanity check { - return NULL; + return nullptr; } return &historyData[index]; diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index cd8d2f7720..025d987620 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -13,7 +13,7 @@ #define ANCHOR_BOTTOM 0x000008 #define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM -HWND hHistoryWindow = 0; //the history window +HWND hHistoryWindow = nullptr; //the history window PopupHistoryList lstPopupHistory; //defined in main.cpp const wchar_t *szHistoryColumns[] = {L"Title", L"Message", L"Timestamp"}; //need to make sure that the string and size vectors have the same number of elements @@ -103,7 +103,7 @@ void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) void AddAnchorWindowToDeferList(HDWP &hdWnds, HWND window, RECT *rParent, WINDOWPOS *wndPos, int anchors) { - if (NULL == window) /* Wine fix. */ + if (nullptr == window) /* Wine fix. */ return; RECT rChild = AnchorCalcPos(window, rParent, wndPos, anchors); hdWnds = DeferWindowPos(hdWnds, window, HWND_NOTOPMOST, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, SWP_NOZORDER); @@ -339,7 +339,7 @@ IEVIEWEVENTDATA *CreateAndFillEventData(PopupHistoryData *popupItem) eventData->pszTextW = popupItem->messageT; eventData->time = (DWORD) popupItem->timestamp; - eventData->next = NULL; + eventData->next = nullptr; } return eventData; @@ -357,9 +357,9 @@ void AddEventsCustomControl(HWND hWnd, int renderer, wchar_t *filter, SIG_MATCHE ieEvent.iType = IEE_LOG_MEM_EVENTS; ieEvent.hContact = NULL; - IEVIEWEVENTDATA *eventData = NULL; - IEVIEWEVENTDATA *cED = NULL; - IEVIEWEVENTDATA *prevED = NULL; + IEVIEWEVENTDATA *eventData = nullptr; + IEVIEWEVENTDATA *cED = nullptr; + IEVIEWEVENTDATA *prevED = nullptr; int i; int count = 0; @@ -447,7 +447,7 @@ void RefreshPopupHistory(HWND hWnd, int renderer) if (renderer == RENDER_DEFAULT) { HWND hHistoryList = GetDlgItem(hWnd, IDC_LST_HISTORY); - SortParams params = {0}; + SortParams params = {}; params.hList = hHistoryList; params.column = lastColumn; @@ -525,7 +525,7 @@ static LRESULT CALLBACK PopupsListSubclassProc(HWND hWnd, UINT msg, WPARAM wPara AppendMenu(hMenu, MF_STRING, POPUPMENU_TITLE, TranslateT("Copy title to clipboard")); AppendMenu(hMenu, MF_STRING, POPUPMENU_MESSAGE, TranslateT("Copy message to clipboard")); AppendMenu(hMenu, MF_STRING, POPUPMENU_TIMESTAMP, TranslateT("Copy timestamp to clipboard")); - selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL); + selection = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, nullptr); DestroyMenu(hMenu); if (selection) { @@ -601,7 +601,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara case WM_DESTROY: UnloadRenderer(hWnd, lstPopupHistory.GetRenderer()); - hHistoryWindow = NULL; + hHistoryWindow = nullptr; break; case WM_CLOSE: @@ -657,7 +657,7 @@ INT_PTR CALLBACK DlgProcHistLst(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara { LPNMLISTVIEW lv = (LPNMLISTVIEW) lParam; int column = lv->iSubItem; - SortParams params = {0}; + SortParams params = {}; params.hList = GetDlgItem(hWnd, IDC_LST_HISTORY); params.column = column; -- cgit v1.2.3