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/Toaster/src/main.cpp | 10 +++++----- plugins/Toaster/src/services.cpp | 10 +++++----- plugins/Toaster/src/toast_notification.cpp | 12 ++++++------ plugins/Toaster/src/utils.cpp | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) (limited to 'plugins/Toaster/src') diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index d97bd34b37..fe4d45943e 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -29,8 +29,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { if (!IsWinVer8Plus()) { - MessageBox(NULL, TranslateT("This plugin requires Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR); - return NULL; + MessageBox(nullptr, TranslateT("This plugin requires Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR); + return nullptr; } return &pluginInfo; } @@ -54,7 +54,7 @@ extern "C" int __declspec(dllexport) Load(void) } else { - MessageBox(NULL, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR); + MessageBox(nullptr, TranslateT("Failed to create temporary directory"), _T(MODULE), MB_OK | MB_ICONERROR); } return 0; @@ -70,13 +70,13 @@ int OnPreShutdown(WPARAM, LPARAM) CleanupClasses(); SHFILEOPSTRUCT file_op = { - NULL, + nullptr, FO_DELETE, wszTempDir, L"", FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION, false, - 0, + nullptr, L"" }; SHFileOperation(&file_op); diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 95bfc49a8b..3d1dbd2040 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -99,7 +99,7 @@ static INT_PTR CreatePopup2(WPARAM wParam, LPARAM) title = mir_a2u(ppd->lpzTitle); } - ToastData *td = NULL; + ToastData *td = nullptr; if (ppd->hbmAvatar) td = new ToastData(ppd->lchContact, title, text, ppd->hbmAvatar); @@ -132,7 +132,7 @@ static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam) auto it = mp_Classes.find(ppc->pszClassName); if (it != mp_Classes.end()) { - ToastData *td = NULL; + ToastData *td = nullptr; if (it->second->iFlags & PCF_TCHAR) { @@ -187,7 +187,7 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) { bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0; if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0); - CallFunctionAsync(HideAllToasts, NULL); + CallFunctionAsync(HideAllToasts, nullptr); return enabled; } case PUQS_GETSTATUS: @@ -199,7 +199,7 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM) static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) { - HICON hIcon = NULL; + HICON hIcon = nullptr; switch (lParam) { case SM_WARNING: @@ -213,7 +213,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam) break; } - ToastData *td = new ToastData(NULL, NULL, (wchar_t*)wParam, hIcon); + ToastData *td = new ToastData(NULL, nullptr, (wchar_t*)wParam, hIcon); CallFunctionAsync(ShowToastNotification, td); return 0; diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index b815fd9e68..56eae765e6 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -39,23 +39,23 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml ComPtr xmlDocument; CHECKHR(Windows::Foundation::ActivateInstance(StringReferenceWrapper(RuntimeClass_Windows_Data_Xml_Dom_XmlDocument).Get(), &xmlDocument)); - HXML xmlToast = xmlCreateNode(L"toast", NULL, 0); + HXML xmlToast = xmlCreateNode(L"toast", nullptr, 0); - HXML xmlAudioNode = xmlAddChild(xmlToast, L"audio", NULL); + HXML xmlAudioNode = xmlAddChild(xmlToast, L"audio", nullptr); xmlAddAttr(xmlAudioNode, L"silent", L"true"); - HXML xmlVisualNode = xmlAddChild(xmlToast, L"visual", NULL); + HXML xmlVisualNode = xmlAddChild(xmlToast, L"visual", nullptr); - HXML xmlBindingNode = xmlAddChild(xmlVisualNode, L"binding", NULL); + HXML xmlBindingNode = xmlAddChild(xmlVisualNode, L"binding", nullptr); xmlAddAttr(xmlBindingNode, L"template", L"ToastImageAndText02"); if (_imagePath) { - HXML xmlImageNode = xmlAddChild(xmlBindingNode, L"image", NULL); + HXML xmlImageNode = xmlAddChild(xmlBindingNode, L"image", nullptr); xmlAddAttr(xmlImageNode, L"id", L"1"); xmlAddAttr(xmlImageNode, L"src", CMStringW(FORMAT, L"file:///%s", _imagePath)); } - HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != NULL ? _caption : L"Miranda NG"); + HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != nullptr ? _caption : L"Miranda NG"); xmlAddAttr(xmlTitleNode, L"id", L"1"); if (_text) { diff --git a/plugins/Toaster/src/utils.cpp b/plugins/Toaster/src/utils.cpp index a46ea09cb4..7726eec8c5 100644 --- a/plugins/Toaster/src/utils.cpp +++ b/plugins/Toaster/src/utils.cpp @@ -15,7 +15,7 @@ wchar_t* GetShortcutPath() HRESULT InstallShortcut(_In_z_ wchar_t *shortcutPath) { wchar_t exePath[MAX_PATH]; - GetModuleFileName(NULL, exePath, MAX_PATH); + GetModuleFileName(nullptr, exePath, MAX_PATH); ComPtr shellLink; CHECKHR(CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink))); -- cgit v1.2.3