diff --git a/Application/Application.cpp b/Application/Application.cpp index 7f8e969a..25d74208 100644 --- a/Application/Application.cpp +++ b/Application/Application.cpp @@ -73,9 +73,9 @@ FARPROC WINAPI DelayLoadFailureHook(unsigned int dliNotify, DelayLoadInfo* dli) #endif const WCHAR* format = L"%S (%i-bit) error %ld.\n\nDo you want to view help online?"; wsprintf(buffer, format, dli->szDll, arch, dli->dwLastError); - if (MessageBox(NULL, buffer, L"Rainmeter", MB_YESNO | MB_ICONERROR) == IDYES) + if (MessageBox(nullptr, buffer, L"Rainmeter", MB_YESNO | MB_ICONERROR) == IDYES) { - ShellExecute(NULL, L"open", L"http://rainmeter.net/dllerror", NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", L"http://rainmeter.net/dllerror", nullptr, nullptr, SW_SHOWNORMAL); } ExitProcess(0); @@ -117,12 +117,12 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) const DWORD size = MAX_PATH; WCHAR buffer[size]; DWORD type = 0; - if (RegQueryValueEx(hKey, NULL , NULL, &type, (LPBYTE)buffer, (LPDWORD)&size) == ERROR_SUCCESS && + if (RegQueryValueEx(hKey, nullptr , nullptr, &type, (LPBYTE)buffer, (LPDWORD)&size) == ERROR_SUCCESS && type == REG_SZ) { SetCurrentDirectory(buffer); lstrcat(buffer, L"\\Rainmeter.exe"); - ShellExecute(NULL, L"open", buffer, args, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", buffer, args, nullptr, SW_SHOWNORMAL); } RegCloseKey(hKey); } @@ -136,7 +136,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) #ifndef _DEBUG EXTERN_C int WINAPI Main() { - int result = wWinMain(NULL, NULL, NULL, 0); + int result = wWinMain(nullptr, nullptr, nullptr, 0); ExitProcess(result); return 0; // Never reached. } diff --git a/Common/ControlTemplate.cpp b/Common/ControlTemplate.cpp index b55c098c..4a258d68 100644 --- a/Common/ControlTemplate.cpp +++ b/Common/ControlTemplate.cpp @@ -27,7 +27,7 @@ void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, G { const Control& ct = cts[i]; - WCHAR* text = ct.textId ? getString(ct.textId) : NULL; + WCHAR* text = ct.textId ? getString(ct.textId) : nullptr; RECT r = { ct.x, ct.y, ct.w, ct.h }; MapDialogRect(parent, &r); @@ -40,8 +40,8 @@ void CreateControls(const Control* cts, UINT ctCount, HWND parent, HFONT font, G r.left, r.top, r.right, r.bottom, parent, (HMENU)ct.id, - NULL, - NULL); + nullptr, + nullptr); SendMessage(wnd, WM_SETFONT, (WPARAM)font, FALSE); } } diff --git a/Common/Dialog.cpp b/Common/Dialog.cpp index bd4827f3..469112e0 100644 --- a/Common/Dialog.cpp +++ b/Common/Dialog.cpp @@ -20,7 +20,7 @@ #include #include -HWND Dialog::c_ActiveDialogWindow = NULL; +HWND Dialog::c_ActiveDialogWindow = nullptr; // // BaseDialog @@ -88,11 +88,11 @@ void BaseDialog::Show(const WCHAR* title, short x, short y, short w, short h, DW if (modeless) { - CreateDialogIndirectParam(NULL, dt, parent, InitialDlgProc, (LPARAM)this); + CreateDialogIndirectParam(nullptr, dt, parent, InitialDlgProc, (LPARAM)this); } else { - DialogBoxIndirectParam(NULL, dt, parent, InitialDlgProc, (LPARAM)this); + DialogBoxIndirectParam(nullptr, dt, parent, InitialDlgProc, (LPARAM)this); } delete [] dt; @@ -154,7 +154,7 @@ void Dialog::ShowDialogWindow(const WCHAR* title, short x, short y, short w, sho INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam) { - c_ActiveDialogWindow = wParam ? m_Window : NULL; + c_ActiveDialogWindow = wParam ? m_Window : nullptr; return FALSE; } @@ -177,7 +177,7 @@ bool Dialog::HandleMessage(MSG& msg) */ void Dialog::SetMenuButton(HWND button) { - SetWindowSubclass(button, MenuButtonProc, NULL, NULL); + SetWindowSubclass(button, MenuButtonProc, 0, 0); } LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) diff --git a/Common/Gfx/Util/DWriteFontCollectionLoader.cpp b/Common/Gfx/Util/DWriteFontCollectionLoader.cpp index 97bcb735..cfb9020f 100644 --- a/Common/Gfx/Util/DWriteFontCollectionLoader.cpp +++ b/Common/Gfx/Util/DWriteFontCollectionLoader.cpp @@ -50,7 +50,7 @@ HRESULT STDMETHODCALLTYPE DWriteFontCollectionLoader::QueryInterface(IID const& return S_OK; } - *ppvObject = NULL; + *ppvObject = nullptr; return E_NOINTERFACE; } diff --git a/Common/Gfx/Util/DWriteFontFileEnumerator.cpp b/Common/Gfx/Util/DWriteFontFileEnumerator.cpp index ea8e0cb3..54e72186 100644 --- a/Common/Gfx/Util/DWriteFontFileEnumerator.cpp +++ b/Common/Gfx/Util/DWriteFontFileEnumerator.cpp @@ -55,7 +55,7 @@ HRESULT STDMETHODCALLTYPE DWriteFontFileEnumerator::QueryInterface(IID const& ri return S_OK; } - *ppvObject = NULL; + *ppvObject = nullptr; return E_NOINTERFACE; } diff --git a/Common/MenuTemplate.cpp b/Common/MenuTemplate.cpp index 6695dbff..e47fe522 100644 --- a/Common/MenuTemplate.cpp +++ b/Common/MenuTemplate.cpp @@ -35,7 +35,7 @@ HMENU MenuTemplate::CreateSubMenu(const MenuTemplate* items, UINT& itemIndex, UI UINT itemFlags = MF_STRING; UINT_PTR itemId = item.id; - const WCHAR* itemText = item.idText ? getString(item.idText) : NULL; + const WCHAR* itemText = item.idText ? getString(item.idText) : nullptr; if (item.type == MenuItem_ItemGrayed) { diff --git a/Common/StringUtil.cpp b/Common/StringUtil.cpp index 0c85fc0d..b0aec559 100644 --- a/Common/StringUtil.cpp +++ b/Common/StringUtil.cpp @@ -31,11 +31,11 @@ std::string Narrow(const WCHAR* str, int strLen, int cp) strLen = (int)wcslen(str); } - int bufLen = WideCharToMultiByte(cp, 0, str, strLen, NULL, 0, NULL, NULL); + int bufLen = WideCharToMultiByte(cp, 0, str, strLen, nullptr, 0, nullptr, nullptr); if (bufLen > 0) { narrowStr.resize(bufLen); - WideCharToMultiByte(cp, 0, str, strLen, &narrowStr[0], bufLen, NULL, NULL); + WideCharToMultiByte(cp, 0, str, strLen, &narrowStr[0], bufLen, nullptr, nullptr); } } return narrowStr; @@ -52,7 +52,7 @@ std::wstring Widen(const char* str, int strLen, int cp) strLen = strlen(str); } - int bufLen = MultiByteToWideChar(cp, 0, str, strLen, NULL, 0); + int bufLen = MultiByteToWideChar(cp, 0, str, strLen, nullptr, 0); if (bufLen > 0) { wideStr.resize(bufLen); diff --git a/Installer/Application.cpp b/Installer/Application.cpp index 6f458043..1cb40960 100644 --- a/Installer/Application.cpp +++ b/Installer/Application.cpp @@ -56,13 +56,13 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) if (!IsSupportedPlatform()) { - MessageBox(NULL, L"Windows XP SP2 or higher is required to install Rainmeter.", NULL, MB_OK | MB_ICONERROR); + MessageBox(nullptr, L"Windows XP SP2 or higher is required to install Rainmeter.", nullptr, MB_OK | MB_ICONERROR); return (int)InstallStatus::UnsupportedPlatform; } if (!IsSupportedCPU()) { - MessageBox(NULL, L"A Pentium III or later processor is required to install Rainmeter.", NULL, MB_OK | MB_ICONERROR); + MessageBox(nullptr, L"A Pentium III or later processor is required to install Rainmeter.", nullptr, MB_OK | MB_ICONERROR); return (int)InstallStatus::UnsupportedPlatform; } diff --git a/Installer/DialogInstall.cpp b/Installer/DialogInstall.cpp index bd51475c..8e1a52d9 100644 --- a/Installer/DialogInstall.cpp +++ b/Installer/DialogInstall.cpp @@ -37,7 +37,7 @@ CDialogInstall* CDialogInstall::Create() 0, 0, 350, 210, DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, WS_EX_APPWINDOW | WS_EX_CONTROLPARENT, - NULL, + nullptr, false); return dialog; diff --git a/Installer/Util.cpp b/Installer/Util.cpp index c22a6603..d8254526 100644 --- a/Installer/Util.cpp +++ b/Installer/Util.cpp @@ -53,7 +53,7 @@ bool IsProcessUserAdmin() BOOL runningAsAdmin = FALSE; // Allocate and initialize a SID of the administrators group. - PSID adminGroupSid = NULL; + PSID adminGroupSid = nullptr; SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; if (AllocateAndInitializeSid( &NtAuthority, @@ -64,13 +64,13 @@ bool IsProcessUserAdmin() &adminGroupSid)) { // Check if the primary access token of the process has the admin group SID. - if (!CheckTokenMembership(NULL, adminGroupSid, &runningAsAdmin)) + if (!CheckTokenMembership(nullptr, adminGroupSid, &runningAsAdmin)) { runningAsAdmin = TRUE; } FreeSid(adminGroupSid); - adminGroupSid = NULL; + adminGroupSid = nullptr; } return runningAsAdmin; @@ -130,7 +130,7 @@ bool CopyDirectory(const WCHAR* fromPath, const WCHAR* toPath) SHFILEOPSTRUCT fo = { - NULL, + nullptr, FO_COPY, from, to, @@ -148,7 +148,7 @@ bool CopyDirectory(const WCHAR* fromPath, const WCHAR* toPath) bool CreateShortcutFile(const WCHAR* filePath, const WCHAR* targetPath) { IShellLink* psl; - HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl); + HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl); if (SUCCEEDED(hr)) { IPersistFile* ppf; @@ -195,7 +195,7 @@ bool SetRegistryData(DWORD type, HKEY rootKey, const WCHAR* subKey, const WCHAR* { BOOL result = FALSE; HKEY regKey; - if (RegCreateKeyEx(rootKey, subKey, 0, 0, 0, KEY_SET_VALUE, NULL, ®Key, NULL) == ERROR_SUCCESS) + if (RegCreateKeyEx(rootKey, subKey, 0, 0, 0, KEY_SET_VALUE, nullptr, ®Key, nullptr) == ERROR_SUCCESS) { if (RegSetValueEx(regKey, value, 0, type, data, dataSize) == ERROR_SUCCESS) { @@ -226,13 +226,13 @@ bool SetRegistryString(HKEY rootKey, const WCHAR* subKey, const WCHAR* value, co bool DownloadFile(const WCHAR* url, const WCHAR* file) { bool result = false; - HINTERNET hNet = InternetOpen(L"Mozilla/5.0", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); + HINTERNET hNet = InternetOpen(L"Mozilla/5.0", INTERNET_OPEN_TYPE_PRECONFIG, nullptr, nullptr, 0); if (hNet) { - HANDLE hFile = CreateFile(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(file, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile) { - HINTERNET hUrl = InternetOpenUrl(hNet, url, NULL, 0, INTERNET_FLAG_RESYNCHRONIZE, 0); + HINTERNET hUrl = InternetOpenUrl(hNet, url, nullptr, 0, INTERNET_FLAG_RESYNCHRONIZE, 0); if (hUrl) { const DWORD bufferSize = 8192; @@ -250,7 +250,7 @@ bool DownloadFile(const WCHAR* url, const WCHAR* file) } DWORD writeSize; - if (!WriteFile(hFile, buffer, readSize, &writeSize, NULL) || + if (!WriteFile(hFile, buffer, readSize, &writeSize, nullptr) || readSize != writeSize) { break; diff --git a/Library/CommandHandler.cpp b/Library/CommandHandler.cpp index 2db5c4ef..7a270db0 100644 --- a/Library/CommandHandler.cpp +++ b/Library/CommandHandler.cpp @@ -257,7 +257,7 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo if (pos) { bang.assign(command, 0, pos - command); - args = ParseString(pos + 1, skin ? &skin->GetParser() : NULL); + args = ParseString(pos + 1, skin ? &skin->GetParser() : nullptr); } else { @@ -290,7 +290,7 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo if (count == 0 && start != std::wstring::npos) { - // Change ] to NULL + // Change ] to nullptr bangs[i] = L'\0'; // Skip whitespace @@ -348,13 +348,13 @@ void CommandHandler::ExecuteCommand(const WCHAR* command, MeterWindow* skin, boo skin->MakePathAbsolute(sound); } - PlaySound(sound.c_str(), NULL, flags); + PlaySound(sound.c_str(), nullptr, flags); } return; } else if (_wcsnicmp(L"STOP", &command[4], 4) == 0) // PLAYSTOP { - PlaySound(NULL, NULL, SND_PURGE); + PlaySound(nullptr, nullptr, SND_PURGE); return; } } @@ -460,7 +460,7 @@ void CommandHandler::RunFile(const WCHAR* file, const WCHAR* args) DWORD type = GetFileAttributes(si.lpFile); if (type & FILE_ATTRIBUTE_DIRECTORY && type != 0xFFFFFFFF) { - ShellExecute(si.hwnd, si.lpVerb, si.lpFile, NULL, NULL, si.nShow); + ShellExecute(si.hwnd, si.lpVerb, si.lpFile, nullptr, nullptr, si.nShow); } else { @@ -751,7 +751,7 @@ void CommandHandler::DoSkinMenuBang(std::vector& args, MeterWindow void CommandHandler::DoTrayMenuBang(std::vector& args, MeterWindow* skin) { POINT pos = System::GetCursorPosition(); - g_Rainmeter->ShowContextMenu(pos, NULL); + g_Rainmeter->ShowContextMenu(pos, nullptr); } void CommandHandler::DoResetStatsBang(std::vector& args, MeterWindow* meterWindow) @@ -865,7 +865,7 @@ void CommandHandler::DoWriteKeyValueBang(std::vector& args, MeterW { if (write != 0) { - WritePrivateProfileString(NULL, NULL, NULL, iniWrite); // FLUSH + WritePrivateProfileString(nullptr, nullptr, nullptr, iniWrite); // FLUSH // Copy the file back. if (!System::CopyFiles(strIniWrite, strIniFile)) @@ -924,13 +924,13 @@ void CommandHandler::DoLogBang(std::vector& args, MeterWindow* ski void CommandHandler::DoRefreshApp(std::vector& args, MeterWindow* meterWindow) { // Refresh needs to be delayed since it crashes if done during Update(). - PostMessage(g_Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, NULL, NULL); + PostMessage(g_Rainmeter->m_Window, WM_RAINMETER_DELAYED_REFRESH_ALL, 0, 0); } void CommandHandler::DoQuitBang(std::vector& args, MeterWindow* meterWindow) { // Quit needs to be delayed since it crashes if done during Update(). - PostMessage(g_Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), NULL); + PostMessage(g_Rainmeter->GetTrayWindow()->GetWindow(), WM_COMMAND, MAKEWPARAM(IDM_QUIT, 0), 0); } void CommandHandler::DoLsBoxHookBang(std::vector& args, MeterWindow* meterWindow) diff --git a/Library/CommandHandler.h b/Library/CommandHandler.h index 6b17ee84..72e467e7 100644 --- a/Library/CommandHandler.h +++ b/Library/CommandHandler.h @@ -115,9 +115,9 @@ public: void ExecuteBang(const WCHAR* name, std::vector& args, MeterWindow* skin); static void RunCommand(std::wstring command); - static void RunFile(const WCHAR* file, const WCHAR* args = NULL); + static void RunFile(const WCHAR* file, const WCHAR* args = nullptr); - static std::vector ParseString(const WCHAR* str, ConfigParser* parser = NULL); + static std::vector ParseString(const WCHAR* str, ConfigParser* parser = nullptr); static void DoActivateSkinBang(std::vector& args, MeterWindow* skin); static void DoDeactivateSkinBang(std::vector& args, MeterWindow* skin); diff --git a/Library/ConfigParser.cpp b/Library/ConfigParser.cpp index a9817b01..40c26b88 100644 --- a/Library/ConfigParser.cpp +++ b/Library/ConfigParser.cpp @@ -68,7 +68,7 @@ void ConfigParser::Initialize(const std::wstring& filename, MeterWindow* meterWi m_LastDefaultUsed = false; m_LastValueDefined = false; - m_CurrentSection = NULL; + m_CurrentSection = nullptr; m_SectionInsertPos = m_Sections.end(); // Set the built-in variables. Do this before the ini file is read so that the paths can be used with @include @@ -143,7 +143,7 @@ void ConfigParser::SetBuiltInVariable(const std::wstring& strVariable, const std } /* -** Gets a value for the variable. Returns NULL if not found. +** Gets a value for the variable. Returns nullptr if not found. ** */ const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable) @@ -171,7 +171,7 @@ const std::wstring* ConfigParser::GetVariable(const std::wstring& strVariable) return &(*iter).second; } - return NULL; + return nullptr; } /* @@ -341,7 +341,7 @@ bool ConfigParser::GetSectionVariable(std::wstring& strVariable, std::wstring& s } else { - decimalsSz = NULL; + decimalsSz = nullptr; } } @@ -805,7 +805,7 @@ Measure* ConfigParser::GetMeasure(const std::wstring& name) return (*iter).second; } - return NULL; + return nullptr; } std::vector ConfigParser::ReadFloats(LPCTSTR section, LPCTSTR key) @@ -855,7 +855,7 @@ int ConfigParser::ReadInt(LPCTSTR section, LPCTSTR key, int defValue) else if (*string) { errno = 0; - int intValue = wcstol(string, NULL, 10); + int intValue = wcstol(string, nullptr, 10); if (errno != ERANGE) { return intValue; @@ -887,7 +887,7 @@ uint32_t ConfigParser::ReadUInt(LPCTSTR section, LPCTSTR key, uint32_t defValue) else if (*string) { errno = 0; - uint32_t uintValue = wcstoul(string, NULL, 10); + uint32_t uintValue = wcstoul(string, nullptr, 10); if (errno != ERANGE) { return uintValue; @@ -919,7 +919,7 @@ uint64_t ConfigParser::ReadUInt64(LPCTSTR section, LPCTSTR key, uint64_t defValu else if (*string) { errno = 0; - uint64_t uint64Value = _wcstoui64(string, NULL, 10); + uint64_t uint64Value = _wcstoui64(string, nullptr, 10); if (errno != ERANGE) { return uint64Value; @@ -951,7 +951,7 @@ double ConfigParser::ReadFloat(LPCTSTR section, LPCTSTR key, double defValue) else if (*string) { errno = 0; - value = wcstod(string, NULL); + value = wcstod(string, nullptr); if (errno != ERANGE) { return value; @@ -970,7 +970,7 @@ bool ConfigParser::ParseFormula(const std::wstring& formula, double* resultValue { const WCHAR* string = formula.c_str(); const WCHAR* errMsg = MathParser::CheckedParse(string, resultValue); - if (errMsg != NULL) + if (errMsg != nullptr) { LogErrorF(L"Formula: %s: %s", errMsg, string); return false; @@ -1074,7 +1074,7 @@ double ConfigParser::ParseDouble(LPCTSTR string, double defValue) else if (*string) { errno = 0; - double value = wcstod(string, NULL); + double value = wcstod(string, nullptr); if (errno != ERANGE) { return value; @@ -1107,7 +1107,7 @@ int ConfigParser::ParseInt(LPCTSTR string, int defValue) else if (*string) { errno = 0; - int intValue = wcstol(string, NULL, 10); + int intValue = wcstol(string, nullptr, 10); if (errno != ERANGE) { return intValue; @@ -1140,7 +1140,7 @@ uint32_t ConfigParser::ParseUInt(LPCTSTR string, uint32_t defValue) else if (*string) { errno = 0; - uint32_t uintValue = wcstoul(string, NULL, 10); + uint32_t uintValue = wcstoul(string, nullptr, 10); if (errno != ERANGE) { return uintValue; @@ -1173,7 +1173,7 @@ uint64_t ConfigParser::ParseUInt64(LPCTSTR string, uint64_t defValue) else if (*string) { errno = 0; - uint64_t uint64Value = _wcstoui64(string, NULL, 10); + uint64_t uint64Value = _wcstoui64(string, nullptr, 10); if (errno != ERANGE) { return uint64Value; @@ -1200,17 +1200,17 @@ bool ParseInt4(LPCTSTR string, T& v1, T& v2, T& v3, T& v4) { v1 = ConfigParser::ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { v2 = ConfigParser::ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { v3 = ConfigParser::ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { v4 = ConfigParser::ParseInt(token, 0); @@ -1288,7 +1288,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, { if (depth > 100) // Is 100 enough to assume the include loop never ends? { - g_Rainmeter->ShowMessage(NULL, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR); + g_Rainmeter->ShowMessage(nullptr, GetString(ID_STR_INCLUDEINFINITELOOP), MB_OK | MB_ICONERROR); return; } @@ -1320,10 +1320,10 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, DWORD itemsSize = MAX_LINE_LENGTH; WCHAR* items = new WCHAR[itemsSize]; - WCHAR* pos = NULL; - WCHAR* epos = NULL; + WCHAR* pos = nullptr; + WCHAR* epos = nullptr; - if (skinSection == NULL) + if (skinSection == nullptr) { // Get all the sections do @@ -1395,7 +1395,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, const WCHAR* sectionName = (*it).c_str(); bool isVariables = (_wcsicmp(sectionName, L"Variables") == 0); - bool isMetadata = (skinSection == NULL && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0); + bool isMetadata = (skinSection == nullptr && !isVariables && _wcsicmp(sectionName, L"Metadata") == 0); bool resetInsertPos = true; // Read all "key=value" from the section @@ -1422,7 +1422,7 @@ void ConfigParser::ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection, { size_t len = wcslen(pos); WCHAR* sep = wmemchr(pos, L'=', len); - if (sep != NULL && sep != pos) + if (sep != nullptr && sep != pos) { size_t clen = sep - pos; // key's length diff --git a/Library/ConfigParser.h b/Library/ConfigParser.h index 5da1a244..d4ebe0a1 100644 --- a/Library/ConfigParser.h +++ b/Library/ConfigParser.h @@ -41,7 +41,7 @@ public: ConfigParser(); ~ConfigParser(); - void Initialize(const std::wstring& filename, MeterWindow* meterWindow = NULL, LPCTSTR skinSection = NULL, const std::wstring* resourcePath = NULL); + void Initialize(const std::wstring& filename, MeterWindow* meterWindow = nullptr, LPCTSTR skinSection = nullptr, const std::wstring* resourcePath = nullptr); void AddMeasure(Measure* pMeasure); Measure* GetMeasure(const std::wstring& name); @@ -64,7 +64,7 @@ public: bool GetLastKeyDefined() { return !m_LastDefaultUsed; } bool GetLastValueDefined() { return m_LastValueDefined; } - void ResetMonitorVariables(MeterWindow* meterWindow = NULL); + void ResetMonitorVariables(MeterWindow* meterWindow = nullptr); const std::wstring& ReadString(LPCTSTR section, LPCTSTR key, LPCTSTR defValue, bool bReplaceMeasures = true); bool IsKeyDefined(LPCTSTR section, LPCTSTR key); @@ -102,7 +102,7 @@ private: void ReadVariables(); - void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = NULL, int depth = 0); + void ReadIniFile(const std::wstring& iniFile, LPCTSTR skinSection = nullptr, int depth = 0); void SetAutoSelectedMonitorVariables(MeterWindow* meterWindow); diff --git a/Library/Dialog.cpp b/Library/Dialog.cpp index 9e45711e..269ace12 100644 --- a/Library/Dialog.cpp +++ b/Library/Dialog.cpp @@ -19,8 +19,8 @@ #include "StdAfx.h" #include "Dialog.h" -HWND Dialog::c_ActiveDialogWindow = NULL; -HWND Dialog::c_ActiveTabWindow = NULL; +HWND Dialog::c_ActiveDialogWindow = nullptr; +HWND Dialog::c_ActiveTabWindow = nullptr; /* ** Constructor. @@ -59,7 +59,7 @@ INT_PTR Dialog::OnActivate(WPARAM wParam, LPARAM lParam) } else { - c_ActiveDialogWindow = c_ActiveTabWindow = NULL; + c_ActiveDialogWindow = c_ActiveTabWindow = nullptr; } return FALSE; @@ -86,7 +86,7 @@ BOOL CALLBACK Dialog::SetFontProc(HWND hWnd, LPARAM lParam) */ void Dialog::SetMenuButton(HWND button) { - SetWindowSubclass(button, MenuButtonProc, NULL, NULL); + SetWindowSubclass(button, MenuButtonProc, 0, 0); } LRESULT CALLBACK Dialog::MenuButtonProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index ef34c7d9..29b0987c 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -29,7 +29,7 @@ extern Rainmeter* g_Rainmeter; WINDOWPLACEMENT DialogAbout::c_WindowPlacement = {0}; -DialogAbout* DialogAbout::c_Dialog = NULL; +DialogAbout* DialogAbout::c_Dialog = nullptr; /* ** Constructor. @@ -192,11 +192,11 @@ INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) RECT r; HWND item = GetControl(Id_Tab); - SetWindowPos(item, NULL, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, w - 18, h - 47, SWP_NOMOVE | SWP_NOZORDER); item = GetControl(Id_CloseButton); GetClientRect(item, &r); - SetWindowPos(item, NULL, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, w - r.right - 9, h - r.bottom - 8, 0, 0, SWP_NOSIZE | SWP_NOZORDER); w -= 48; h -= 100; @@ -217,7 +217,7 @@ INT_PTR DialogAbout::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) } delete c_Dialog; - c_Dialog = NULL; + c_Dialog = nullptr; } return TRUE; } @@ -265,9 +265,9 @@ INT_PTR DialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam) if (Platform::IsAtLeastWinVista()) { item = m_TabLog.GetControl(TabLog::Id_ItemsListView); - SetWindowTheme(item, L"explorer", NULL); + SetWindowTheme(item, L"explorer", nullptr); item = m_TabSkins.GetControl(TabSkins::Id_ItemsListView); - SetWindowTheme(item, L"explorer", NULL); + SetWindowTheme(item, L"explorer", nullptr); } if (c_WindowPlacement.length == 0) @@ -435,25 +435,25 @@ void DialogAbout::TabLog::Initialize() */ void DialogAbout::TabLog::Resize(int w, int h) { - SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); RECT r; HWND item = GetControl(Id_ErrorCheckBox); GetClientRect(item, &r); - SetWindowPos(item, NULL, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_WarningCheckBox); - SetWindowPos(item, NULL, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_NoticeCheckBox); - SetWindowPos(item, NULL, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right * 2, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_DebugCheckBox); - SetWindowPos(item, NULL, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + SetWindowPos(item, nullptr, r.right * 3, h - r.bottom, 0, 0, SWP_NOSIZE | SWP_NOZORDER); item = GetControl(Id_ItemsListView); - SetWindowPos(item, NULL, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, w, h - r.bottom - 7, SWP_NOMOVE | SWP_NOZORDER); // Adjust third colum LVCOLUMN lvc; @@ -674,14 +674,14 @@ void DialogAbout::TabSkins::Initialize() */ void DialogAbout::TabSkins::Resize(int w, int h) { - SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); HWND item = GetControl(Id_SkinsListBox); int wList = (w < 650) ? (w - 373) : 277; - SetWindowPos(item, NULL, 0, 0, wList, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, wList, h, SWP_NOMOVE | SWP_NOZORDER); item = GetControl(Id_ItemsListView); - SetWindowPos(item, NULL, (w < 650) ? (w - 365) : 285, 0, w - wList - 10, h, SWP_NOZORDER); + SetWindowPos(item, nullptr, (w < 650) ? (w - 365) : 285, 0, w - wList - 10, h, SWP_NOZORDER); // Adjust third column LVCOLUMN lvc; @@ -730,7 +730,7 @@ void DialogAbout::TabSkins::UpdateSkinList() { if (windows.empty()) { - m_SkinWindow = NULL; + m_SkinWindow = nullptr; item = GetControl(Id_ItemsListView); ListView_DeleteAllItems(item); } @@ -754,7 +754,7 @@ void DialogAbout::TabSkins::UpdateMeasureList(MeterWindow* meterWindow) { // Find selected skin HWND item = GetControl(Id_SkinsListBox); - int selected = (int)SendMessage(item, LB_GETCURSEL, NULL, NULL); + int selected = (int)SendMessage(item, LB_GETCURSEL, 0, 0); const std::map& windows = g_Rainmeter->GetAllMeterWindows(); std::map::const_iterator iter = windows.begin(); @@ -894,7 +894,7 @@ INT_PTR DialogAbout::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam) case Id_SkinsListBox: if (HIWORD(wParam) == LBN_SELCHANGE) { - UpdateMeasureList(NULL); + UpdateMeasureList(nullptr); } break; @@ -1105,10 +1105,10 @@ void DialogAbout::TabPlugins::Initialize() */ void DialogAbout::TabPlugins::Resize(int w, int h) { - SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); HWND item = GetControl(Id_ItemsListView); - SetWindowPos(item, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); // Adjust third colum LVCOLUMN lvc; @@ -1201,7 +1201,7 @@ void DialogAbout::TabVersion::Initialize() */ void DialogAbout::TabVersion::Resize(int w, int h) { - SetWindowPos(m_Window, NULL, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(m_Window, nullptr, 0, 0, w, h, SWP_NOMOVE | SWP_NOZORDER); } INT_PTR DialogAbout::TabVersion::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 5f5050d7..f08453c0 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -32,7 +32,7 @@ extern Rainmeter* g_Rainmeter; WINDOWPLACEMENT DialogManage::c_WindowPlacement = {0}; -DialogManage* DialogManage::c_Dialog = NULL; +DialogManage* DialogManage::c_Dialog = nullptr; /* ** Constructor. @@ -173,7 +173,7 @@ INT_PTR DialogManage::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) } delete c_Dialog; - c_Dialog = NULL; + c_Dialog = nullptr; } return TRUE; } @@ -237,7 +237,7 @@ INT_PTR DialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam) { // Use arrows instead of plus/minus in the tree for Vista+ item = m_TabSkins.GetControl(TabSkins::Id_SkinsTreeView); - SetWindowTheme(item, L"explorer", NULL); + SetWindowTheme(item, L"explorer", nullptr); } if (c_WindowPlacement.length == 0) @@ -290,7 +290,7 @@ INT_PTR DialogManage::OnCommand(WPARAM wParam, LPARAM lParam) } url += L"Tab"; - ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); + ShellExecute(m_Window, L"open", url.c_str(), nullptr, nullptr, SW_SHOWNORMAL); } break; @@ -491,12 +491,12 @@ void DialogManage::TabSkins::Initialize() // Apply icons and populate tree item = GetControl(Id_SkinsTreeView); TreeView_SetImageList(item, hImageList, TVSIL_NORMAL); - Update(NULL, false); + Update(nullptr, false); // Get rid of the EDITTEXT control border item = GetControl(Id_DescriptionLabel); SetWindowLongPtr(item, GWL_EXSTYLE, GetWindowLongPtr(item, GWL_EXSTYLE) &~ WS_EX_CLIENTEDGE); - SetWindowPos(item, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER); + SetWindowPos(item, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER); item = GetControl(Id_TransparencyDropDownList); ComboBox_AddString(item, L"0%"); @@ -547,7 +547,7 @@ void DialogManage::TabSkins::Update(MeterWindow* meterWindow, bool deleted) if (deleted) { DisableControls(); - m_SkinWindow = NULL; + m_SkinWindow = nullptr; } else { @@ -778,10 +778,10 @@ void DialogManage::TabSkins::ReadSkin() const WCHAR* fileSz = file.c_str(); item = GetControl(Id_AuthorLabel); - if (GetPrivateProfileString(L"Metadata", L"Author", NULL, buffer, MAX_LINE_LENGTH, fileSz) == 0) + if (GetPrivateProfileString(L"Metadata", L"Author", nullptr, buffer, MAX_LINE_LENGTH, fileSz) == 0) { // For backwards compatibility. - GetPrivateProfileString(L"Rainmeter", L"Author", NULL, buffer, MAX_LINE_LENGTH, fileSz); + GetPrivateProfileString(L"Rainmeter", L"Author", nullptr, buffer, MAX_LINE_LENGTH, fileSz); } SetWindowText(item, buffer); @@ -792,26 +792,26 @@ void DialogManage::TabSkins::ReadSkin() // Set metadata item = GetControl(Id_VersionLabel); - GetPrivateProfileString(L"Metadata", L"Version", NULL, buffer, MAX_LINE_LENGTH, fileSz); + GetPrivateProfileString(L"Metadata", L"Version", nullptr, buffer, MAX_LINE_LENGTH, fileSz); SetWindowText(item, buffer); item = GetControl(Id_LicenseLabel); - GetPrivateProfileString(L"Metadata", L"License", NULL, buffer, MAX_LINE_LENGTH, fileSz); + GetPrivateProfileString(L"Metadata", L"License", nullptr, buffer, MAX_LINE_LENGTH, fileSz); SetWindowText(item, buffer); item = GetControl(Id_DescriptionLabel); std::wstring text; - if (GetPrivateProfileString(L"Metadata", L"Information", NULL, buffer, MAX_LINE_LENGTH, fileSz) > 0) + if (GetPrivateProfileString(L"Metadata", L"Information", nullptr, buffer, MAX_LINE_LENGTH, fileSz) > 0) { text = buffer; } else { // For backwards compatibility - GetPrivateProfileString(L"Metadata", L"Description", NULL, buffer, MAX_LINE_LENGTH, fileSz); + GetPrivateProfileString(L"Metadata", L"Description", nullptr, buffer, MAX_LINE_LENGTH, fileSz); text = buffer; - if (GetPrivateProfileString(L"Metadata", L"Instructions", NULL, buffer, MAX_LINE_LENGTH, fileSz) > 0) + if (GetPrivateProfileString(L"Metadata", L"Instructions", nullptr, buffer, MAX_LINE_LENGTH, fileSz) > 0) { text += L"\r\n\r\n"; text += buffer; @@ -867,7 +867,7 @@ std::wstring DialogManage::TabSkins::GetTreeSelectionPath(HWND tree) TreeView_GetItem(tree, &tvi); std::wstring path = buffer; - while ((tvi.hItem = TreeView_GetParent(tree, tvi.hItem)) != NULL) + while ((tvi.hItem = TreeView_GetParent(tree, tvi.hItem)) != nullptr) { TreeView_GetItem(tree, &tvi); path.insert(0, 1, L'\\'); @@ -940,7 +940,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n if (pos) { const int folderLen = (int)(pos - name); - tvi.cchTextMax = folderLen + 1; // Length of folder name plus 1 for NULL + tvi.cchTextMax = folderLen + 1; // Length of folder name plus 1 for nullptr // Find and expand the folder do @@ -948,7 +948,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n TreeView_GetItem(tree, &tvi); if (wcsncmp(buffer, name, folderLen) == 0) { - if ((item = TreeView_GetChild(tree, tvi.hItem)) != NULL) + if ((item = TreeView_GetChild(tree, tvi.hItem)) != nullptr) { TreeView_Expand(tree, tvi.hItem, TVE_EXPAND); ++pos; // Skip the slash @@ -958,7 +958,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n break; } } - while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != NULL); + while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != nullptr); } else { @@ -974,7 +974,7 @@ void DialogManage::TabSkins::SelectTreeItem(HWND tree, HTREEITEM item, LPCWSTR n break; } } - while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != NULL); + while ((tvi.hItem = TreeView_GetNextSibling(tree, tvi.hItem)) != nullptr); } } @@ -1030,7 +1030,7 @@ INT_PTR DialogManage::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam) --r.bottom, 0, m_Window, - NULL + nullptr ); } @@ -1198,7 +1198,7 @@ INT_PTR DialogManage::TabSkins::OnCommand(WPARAM wParam, LPARAM lParam) --r.bottom, 0, m_Window, - NULL + nullptr ); DestroyMenu(menu); @@ -1361,7 +1361,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam) if (TreeView_GetItem(nm->hwndFrom, &tvi)) { - HMENU menu = NULL; + HMENU menu = nullptr; MENUITEMINFO mii = {0}; mii.cbSize = sizeof(MENUITEMINFO); mii.fMask = MIIM_STRING; @@ -1416,7 +1416,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam) pt.y, 0, m_Window, - NULL + nullptr ); DestroyMenu(menu); @@ -1428,7 +1428,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam) case TVN_SELCHANGED: if (nm->idFrom == Id_SkinsTreeView) { - m_SkinWindow = NULL; + m_SkinWindow = nullptr; m_SkinFileName.clear(); m_SkinFolderPath.clear(); @@ -1453,7 +1453,7 @@ INT_PTR DialogManage::TabSkins::OnNotify(WPARAM wParam, LPARAM lParam) // Loop through parents to get skin folder m_SkinFolderPath.clear(); - while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != NULL) + while ((tvi.hItem = TreeView_GetParent(nm->hwndFrom, tvi.hItem)) != nullptr) { TreeView_GetItem(nm->hwndFrom, &tvi); m_SkinFolderPath.insert(0, 1, L'\\'); @@ -1645,7 +1645,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam) else { // Make sure path exists - CreateDirectory(path.c_str(), NULL); + CreateDirectory(path.c_str(), nullptr); } path += L"\\Rainmeter.ini"; @@ -1673,7 +1673,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam) { if (parser.GetValue(*iter, L"Active", L"") == L"0") { - WritePrivateProfileString((*iter).c_str(), NULL, NULL, path.c_str()); + WritePrivateProfileString((*iter).c_str(), nullptr, nullptr, path.c_str()); } } } @@ -1694,7 +1694,7 @@ INT_PTR DialogManage::TabLayouts::OnCommand(WPARAM wParam, LPARAM lParam) else { // Create empty layout - HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (file == INVALID_HANDLE_VALUE) { std::wstring text = GetFormattedString(ID_STR_THEMESAVEFAIL, path.c_str()); @@ -1950,7 +1950,7 @@ INT_PTR DialogManage::TabSettings::OnCommand(WPARAM wParam, LPARAM lParam) resource += buffer; resource += L".dll"; FreeLibrary(g_Rainmeter->m_ResourceInstance); - g_Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); + g_Rainmeter->m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); g_Rainmeter->m_ResourceLCID = lcid; if (DialogAbout::GetDialog()) diff --git a/Library/Export.cpp b/Library/Export.cpp index eaa248db..6c6bb178 100644 --- a/Library/Export.cpp +++ b/Library/Export.cpp @@ -23,7 +23,7 @@ #include "Measure.h" #include "MeasurePlugin.h" -#define NULLCHECK(str) { if ((str) == NULL) { (str) = L""; } } +#define NULLCHECK(str) { if ((str) == nullptr) { (str) = L""; } } extern Rainmeter* g_Rainmeter; @@ -94,7 +94,7 @@ void* __stdcall RmGet(void* rm, int type) } } - return NULL; + return nullptr; } void __stdcall RmExecute(void* skin, LPCWSTR command) @@ -139,7 +139,7 @@ LPCWSTR ReadConfigString(LPCWSTR section, LPCWSTR option, LPCWSTR defValue) // Deprecated! LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data) { - if (command == NULL || *command == L'\0') + if (command == nullptr || *command == L'\0') { return L"noop"; } diff --git a/Library/Litestep.cpp b/Library/Litestep.cpp index 35e37b64..7a6808b7 100644 --- a/Library/Litestep.cpp +++ b/Library/Litestep.cpp @@ -39,8 +39,8 @@ WCHAR* GetString(UINT id) std::wstring GetFormattedString(UINT id, ...) { - LPWSTR pBuffer = NULL; - va_list args = NULL; + LPWSTR pBuffer = nullptr; + va_list args = nullptr; va_start(args, id); DWORD len = FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, @@ -62,7 +62,7 @@ HICON GetIcon(UINT id, bool large) { typedef HRESULT (WINAPI * FPLOADICONMETRIC)(HINSTANCE hinst, PCWSTR pszName, int lims, HICON* phico); - HINSTANCE hExe = GetModuleHandle(NULL); + HINSTANCE hExe = GetModuleHandle(nullptr); HINSTANCE hComctl = GetModuleHandle(L"Comctl32"); if (hComctl) { diff --git a/Library/Logger.cpp b/Library/Logger.cpp index 3fa51e13..3e266e24 100644 --- a/Library/Logger.cpp +++ b/Library/Logger.cpp @@ -57,7 +57,7 @@ void Logger::StartLogFile() if (_waccess(filePath, 0) == -1) { // Create empty log file. - HANDLE file = CreateFile(filePath, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(filePath, GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); if (file != INVALID_HANDLE_VALUE) { CloseHandle(file); @@ -65,7 +65,7 @@ void Logger::StartLogFile() else { const std::wstring text = GetFormattedString(ID_STR_LOGFILECREATEFAIL, filePath); - g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_OK | MB_ICONERROR); + g_Rainmeter->ShowMessage(nullptr, text.c_str(), MB_OK | MB_ICONERROR); SetLogToFile(false); return; } @@ -85,7 +85,7 @@ void Logger::DeleteLogFile() if (_waccess(filePath, 0) != -1) { const std::wstring text = GetFormattedString(ID_STR_LOGFILEDELETE, filePath); - const int res = g_Rainmeter->ShowMessage(NULL, text.c_str(), MB_YESNO | MB_ICONQUESTION); + const int res = g_Rainmeter->ShowMessage(nullptr, text.c_str(), MB_YESNO | MB_ICONQUESTION); if (res == IDYES) { SetLogToFile(false); diff --git a/Library/MathParser.cpp b/Library/MathParser.cpp index 6e5923db..5ed4bf39 100644 --- a/Library/MathParser.cpp +++ b/Library/MathParser.cpp @@ -124,8 +124,8 @@ static Function g_Functions[] = { L"rad", &rad, 3 }, { L"sgn", &sgn, 3 }, { L"neg", &neg, 3 }, - { L"e", NULL, 1 }, - { L"pi", NULL, 2 } + { L"e", nullptr, 1 }, + { L"pi", nullptr, 2 } }; static const int FUNC_MAX_LEN = 5; @@ -234,7 +234,7 @@ const WCHAR* MathParser::Check(const WCHAR* formula) ++formula; } - return (brackets != 0) ? eBrackets : NULL; + return (brackets != 0) ? eBrackets : nullptr; } const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result) @@ -242,7 +242,7 @@ const WCHAR* MathParser::CheckedParse(const WCHAR* formula, double* result) const WCHAR* error = Check(formula); if (!error) { - error = Parse(formula, NULL, result); + error = Parse(formula, nullptr, result); } return error; } @@ -254,7 +254,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* if (!*formula) { *result = 0.0; - return NULL; + return nullptr; } Parser parser; @@ -277,7 +277,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* return eSyntax; case Token::Final: - if ((error = CalcToObr(parser)) != NULL) + if ((error = CalcToObr(parser)) != nullptr) { return error; } @@ -289,7 +289,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* { // Done! *result = parser.numStack[0]; - return NULL; + return nullptr; } break; @@ -309,13 +309,13 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* case Operator::ClosingBracket: { - if ((error = CalcToObr(parser)) != NULL) return error; + if ((error = CalcToObr(parser)) != nullptr) return error; } break; case Operator::Comma: { - if ((error = CalcToObr(parser)) != NULL) return error; + if ((error = CalcToObr(parser)) != nullptr) return error; if (parser.opStack[parser.opTop].type == Operator::MultiArgFunction) { @@ -361,7 +361,7 @@ const WCHAR* MathParser::Parse(const WCHAR* formula, MeasureCalc* calc, double* while (g_OpPriorities[(int)op.type] <= g_OpPriorities[(int)parser.opStack[parser.opTop].type]) { - if ((error = Calc(parser)) != NULL) return error; + if ((error = Calc(parser)) != nullptr) return error; } parser.opStack[++parser.opTop] = op; } @@ -427,7 +427,7 @@ static const WCHAR* Calc(Parser& parser) // Multi-argument function if (op.type == Operator::Conditional) { - return NULL; + return nullptr; } else if (op.type == Operator::MultiArgFunction) { @@ -438,7 +438,7 @@ static const WCHAR* Calc(Parser& parser) if (error) return error; parser.numStack[++parser.valTop] = res; - return NULL; + return nullptr; } else if (parser.valTop < 0) { @@ -583,7 +583,7 @@ static const WCHAR* Calc(Parser& parser) } parser.numStack[++parser.valTop] = res; - return NULL; + return nullptr; } static const WCHAR* CalcToObr(Parser& parser) @@ -594,7 +594,7 @@ static const WCHAR* CalcToObr(Parser& parser) if (error) return error; } --parser.opTop; - return NULL; + return nullptr; } Token GetNextToken(Lexer& lexer) @@ -902,5 +902,5 @@ static const WCHAR* round(int paramcnt, double* args, double* result) for (int i = 0; i < sharpness; i++) x /= coef; *result = x; - return NULL; + return nullptr; } diff --git a/Library/Measure.cpp b/Library/Measure.cpp index e9f51b4f..f73af7ea 100644 --- a/Library/Measure.cpp +++ b/Library/Measure.cpp @@ -255,9 +255,9 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer) flags, // default options &error, // for error message &erroffset, // for error offset - NULL); // use default character tables + nullptr); // use default character tables - if (re == NULL) + if (re == nullptr) { MakePlainSubstitute(str, i); LogNoticeF(L"Substitute: %S", error); @@ -268,7 +268,7 @@ const WCHAR* Measure::CheckSubstitute(const WCHAR* buffer) { rc = pcre_exec( re, // the compiled pattern - NULL, // no extra data - we didn't study the pattern + nullptr, // no extra data - we didn't study the pattern utf8str.c_str(), // the subject string utf8str.length(), // the length of the subject offset, // start at offset 0 in the subject @@ -624,7 +624,7 @@ double Measure::GetValueRange() */ const WCHAR* Measure::GetStringValue() { - return NULL; + return nullptr; } /* @@ -849,7 +849,7 @@ Measure* Measure::Create(const WCHAR* measure, MeterWindow* meterWindow, const W LogErrorF(L"Measure=%s is not valid in [%s]", measure, name); - return NULL; + return nullptr; } /* diff --git a/Library/MeasureCPU.cpp b/Library/MeasureCPU.cpp index 14ab3c7f..99f6a407 100644 --- a/Library/MeasureCPU.cpp +++ b/Library/MeasureCPU.cpp @@ -38,7 +38,7 @@ typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION { #define Li2Double(x) ((double)((x).QuadPart)) #define Ft2Double(x) ((double)((x).dwHighDateTime) * 4.294967296E9 + (double)((x).dwLowDateTime)) -FPNTQSI MeasureCPU::c_NtQuerySystemInformation = NULL; +FPNTQSI MeasureCPU::c_NtQuerySystemInformation = nullptr; int MeasureCPU::c_NumOfProcessors = 0; ULONG MeasureCPU::c_BufferSize = 0; @@ -124,7 +124,7 @@ void MeasureCPU::UpdateValue() { LONG status; ULONG bufSize = c_BufferSize; - BYTE* buf = (bufSize > 0) ? new BYTE[bufSize] : NULL; + BYTE* buf = (bufSize > 0) ? new BYTE[bufSize] : nullptr; int loop = 0; diff --git a/Library/MeasureCalc.cpp b/Library/MeasureCalc.cpp index b8414a70..cce4a6e6 100644 --- a/Library/MeasureCalc.cpp +++ b/Library/MeasureCalc.cpp @@ -57,7 +57,7 @@ MeasureCalc::~MeasureCalc() void MeasureCalc::UpdateValue() { const WCHAR* errMsg = MathParser::Parse(m_Formula.c_str(), this, &m_Value); - if (errMsg != NULL) + if (errMsg != nullptr) { if (!m_ParseError) { @@ -103,7 +103,7 @@ void MeasureCalc::ReadOptions(ConfigParser& parser, const WCHAR* section) } const WCHAR* errMsg = MathParser::Check(m_Formula.c_str()); - if (errMsg != NULL) + if (errMsg != nullptr) { LogErrorF(L"Calc: %s in [%s]", errMsg, m_Name.c_str()); m_Formula.clear(); diff --git a/Library/MeasureDiskSpace.cpp b/Library/MeasureDiskSpace.cpp index 8629d3a9..f6c48c12 100644 --- a/Library/MeasureDiskSpace.cpp +++ b/Library/MeasureDiskSpace.cpp @@ -113,11 +113,11 @@ void MeasureDiskSpace::UpdateValue() { if (!m_DiskQuota) { - sizeResult = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes); + sizeResult = GetDiskFreeSpaceEx(drive, nullptr, (PULARGE_INTEGER)&i64TotalBytes, (PULARGE_INTEGER)&i64FreeBytes); } else { - sizeResult = GetDiskFreeSpaceEx(drive, (PULARGE_INTEGER)&i64FreeBytes, (PULARGE_INTEGER)&i64TotalBytes, NULL); + sizeResult = GetDiskFreeSpaceEx(drive, (PULARGE_INTEGER)&i64FreeBytes, (PULARGE_INTEGER)&i64TotalBytes, nullptr); } } @@ -147,7 +147,7 @@ void MeasureDiskSpace::UpdateValue() if (type != DRIVE_NO_ROOT_DIR && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore removable drives { - labelResult = GetVolumeInformation(drive, volumeName, MAX_PATH + 1, NULL, NULL, NULL, NULL, 0); + labelResult = GetVolumeInformation(drive, volumeName, MAX_PATH + 1, nullptr, nullptr, nullptr, nullptr, 0); } m_StringValue = (labelResult) ? volumeName : L""; @@ -166,7 +166,7 @@ void MeasureDiskSpace::UpdateValue() */ const WCHAR* MeasureDiskSpace::GetStringValue() { - return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : NULL; + return (m_Type || m_Label) ? CheckSubstitute(m_StringValue.c_str()) : nullptr; } /* @@ -213,7 +213,7 @@ void MeasureDiskSpace::ReadOptions(ConfigParser& parser, const WCHAR* section) type != DRIVE_CDROM && (!m_IgnoreRemovable || type != DRIVE_REMOVABLE)) // Ignore CD-ROMS and removable drives { - result = GetDiskFreeSpaceEx(drive, NULL, (PULARGE_INTEGER)&i64TotalBytes, NULL); + result = GetDiskFreeSpaceEx(drive, nullptr, (PULARGE_INTEGER)&i64TotalBytes, nullptr); } } diff --git a/Library/MeasureNet.cpp b/Library/MeasureNet.cpp index 64966081..f74a2d49 100644 --- a/Library/MeasureNet.cpp +++ b/Library/MeasureNet.cpp @@ -21,13 +21,13 @@ #include "Rainmeter.h" #include "System.h" -BYTE* MeasureNet::c_Table = NULL; +BYTE* MeasureNet::c_Table = nullptr; UINT MeasureNet::c_NumOfTables = 0; std::vector MeasureNet::c_StatValues; std::vector MeasureNet::c_OldStatValues; -FPGETIFTABLE2 MeasureNet::c_GetIfTable2 = NULL; -FPFREEMIBTABLE MeasureNet::c_FreeMibTable = NULL; +FPGETIFTABLE2 MeasureNet::c_GetIfTable2 = nullptr; +FPFREEMIBTABLE MeasureNet::c_FreeMibTable = nullptr; extern Rainmeter* g_Rainmeter; @@ -65,7 +65,7 @@ void MeasureNet::UpdateIFTable() if (c_Table) { c_FreeMibTable(c_Table); - c_Table = NULL; + c_Table = nullptr; } if (c_GetIfTable2((MIB_IF_TABLE2**)&c_Table) == NO_ERROR) @@ -121,13 +121,13 @@ void MeasureNet::UpdateIFTable() else { // Something's wrong. Unable to get the table. - c_Table = NULL; + c_Table = nullptr; c_NumOfTables = 0; } } else { - if (c_Table == NULL) + if (c_Table == nullptr) { // Gotta reserve few bytes for the tables DWORD value = 0; @@ -214,7 +214,7 @@ void MeasureNet::UpdateIFTable() { // Something's wrong. Unable to get the table. delete [] c_Table; - c_Table = NULL; + c_Table = nullptr; c_NumOfTables = 0; } } @@ -416,7 +416,7 @@ ULONG64 MeasureNet::GetNetStatsValue(NET net) */ void MeasureNet::UpdateValue() { - if (c_Table == NULL) return; + if (c_Table == nullptr) return; if (m_Cumulative) { @@ -460,7 +460,7 @@ void MeasureNet::ReadOptions(ConfigParser& parser, const WCHAR* section) Measure::ReadOptions(parser, section); double value; - const WCHAR* netName = NULL; + const WCHAR* netName = nullptr; if (m_Net == NET_IN) { @@ -588,7 +588,7 @@ void MeasureNet::ReadStats(const std::wstring& iniFile, std::wstring& statsDate) WCHAR buffer[48]; ConfigParser parser; - parser.Initialize(iniFile, NULL, L"Statistics"); + parser.Initialize(iniFile, nullptr, L"Statistics"); const std::wstring& date = parser.ReadString(L"Statistics", L"Since", L"", false); if (!date.empty()) @@ -702,8 +702,8 @@ void MeasureNet::InitializeStatic() if (!c_GetIfTable2 || !c_FreeMibTable) { - c_GetIfTable2 = NULL; - c_FreeMibTable = NULL; + c_GetIfTable2 = nullptr; + c_FreeMibTable = nullptr; } } @@ -726,13 +726,13 @@ void MeasureNet::FinalizeStatic() c_FreeMibTable(c_Table); } - c_GetIfTable2 = NULL; - c_FreeMibTable = NULL; + c_GetIfTable2 = nullptr; + c_FreeMibTable = nullptr; } else { delete [] c_Table; } - c_Table = NULL; + c_Table = nullptr; c_NumOfTables = 0; } diff --git a/Library/MeasurePlugin.cpp b/Library/MeasurePlugin.cpp index 50d1c963..462862f3 100644 --- a/Library/MeasurePlugin.cpp +++ b/Library/MeasurePlugin.cpp @@ -230,7 +230,7 @@ const WCHAR* MeasurePlugin::GetStringValue() if (ret) return CheckSubstitute(ret); } - return NULL; + return nullptr; } /* diff --git a/Library/MeasurePlugin.h b/Library/MeasurePlugin.h index 6b5c5460..33040f50 100644 --- a/Library/MeasurePlugin.h +++ b/Library/MeasurePlugin.h @@ -52,7 +52,7 @@ protected: virtual void UpdateValue(); private: - bool IsNewApi() { return m_ReloadFunc != NULL; } + bool IsNewApi() { return m_ReloadFunc != nullptr; } HMODULE m_Plugin; diff --git a/Library/MeasureRegistry.cpp b/Library/MeasureRegistry.cpp index 65bd6e92..66a14543 100644 --- a/Library/MeasureRegistry.cpp +++ b/Library/MeasureRegistry.cpp @@ -47,7 +47,7 @@ MeasureRegistry::~MeasureRegistry() */ void MeasureRegistry::UpdateValue() { - if (m_RegKey != NULL) + if (m_RegKey != nullptr) { DWORD size = 4096; WCHAR* data = new WCHAR[size]; @@ -56,7 +56,7 @@ void MeasureRegistry::UpdateValue() if (RegQueryValueEx( m_RegKey, m_RegValueName.c_str(), - NULL, + nullptr, (LPDWORD)&type, (LPBYTE)data, (LPDWORD)&size) == ERROR_SUCCESS) @@ -71,7 +71,7 @@ void MeasureRegistry::UpdateValue() case REG_SZ: case REG_EXPAND_SZ: case REG_MULTI_SZ: - m_Value = wcstod(data, NULL); + m_Value = wcstod(data, nullptr); m_StringValue = data; break; @@ -159,6 +159,6 @@ void MeasureRegistry::ReadOptions(ConfigParser& parser, const WCHAR* section) */ const WCHAR* MeasureRegistry::GetStringValue() { - return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : NULL; + return !m_StringValue.empty() ? CheckSubstitute(m_StringValue.c_str()) : nullptr; } diff --git a/Library/MeasureScript.cpp b/Library/MeasureScript.cpp index e5ee0742..57108fa1 100644 --- a/Library/MeasureScript.cpp +++ b/Library/MeasureScript.cpp @@ -78,7 +78,7 @@ void MeasureScript::UpdateValue() */ const WCHAR* MeasureScript::GetStringValue() { - return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : NULL; + return (m_ValueType == LUA_TSTRING) ? CheckSubstitute(m_StringValue.c_str()) : nullptr; } /* diff --git a/Library/MeasureTime.cpp b/Library/MeasureTime.cpp index 4931b59c..53dee1d2 100644 --- a/Library/MeasureTime.cpp +++ b/Library/MeasureTime.cpp @@ -126,11 +126,11 @@ void MeasureTime::UpdateValue() const WCHAR* format = m_Format.c_str(); if (_wcsicmp(L"locale-time", format) == 0) { - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH); } else if (_wcsicmp(L"locale-date", format) == 0) { - GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); + GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH); } else { @@ -148,7 +148,7 @@ void MeasureTime::UpdateValue() TimeToString(tmpSz, MAX_LINE_LENGTH, format, &today); } - m_Value = wcstod(tmpSz, NULL); + m_Value = wcstod(tmpSz, nullptr); delete [] tmpSz; } @@ -193,11 +193,11 @@ const WCHAR* MeasureTime::GetStringValue() const WCHAR* format = m_Format.c_str(); if (_wcsicmp(L"locale-time", format) == 0) { - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH); } else if (_wcsicmp(L"locale-date", format) == 0) { - GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, NULL, tmpSz, MAX_LINE_LENGTH); + GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysToday, nullptr, tmpSz, MAX_LINE_LENGTH); } else { diff --git a/Library/Meter.cpp b/Library/Meter.cpp index b244087b..d1c402b8 100644 --- a/Library/Meter.cpp +++ b/Library/Meter.cpp @@ -74,7 +74,7 @@ Meter::~Meter() { delete m_Transformation; - if (m_ToolTipHandle != NULL) + if (m_ToolTipHandle != nullptr) { DestroyWindow(m_ToolTipHandle); } @@ -190,11 +190,11 @@ void Meter::Show() // Change the option as well to avoid reset in ReadOptions(). m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"0"); - if (m_ToolTipHandle != NULL) + if (m_ToolTipHandle != nullptr) { if (!m_ToolTipHidden) { - SendMessage(m_ToolTipHandle, TTM_ACTIVATE, TRUE, NULL); + SendMessage(m_ToolTipHandle, TTM_ACTIVATE, TRUE, 0); } } } @@ -210,9 +210,9 @@ void Meter::Hide() // Change the option as well to avoid reset in ReadOptions(). m_MeterWindow->GetParser().SetValue(m_Name, L"Hidden", L"1"); - if (m_ToolTipHandle != NULL) + if (m_ToolTipHandle != nullptr) { - SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, NULL); + SendMessage(m_ToolTipHandle, TTM_ACTIVATE, FALSE, 0); } } @@ -349,7 +349,7 @@ void Meter::ReadOptions(ConfigParser& parser, const WCHAR* section) else if (!matrix.empty()) { delete m_Transformation; - m_Transformation = NULL; + m_Transformation = nullptr; LogErrorF(L"Meter: Incorrect number of values in TransformationMatrix=%s", parser.ReadString(section, L"TransformationMatrix", L"").c_str()); } @@ -411,7 +411,7 @@ Meter* Meter::Create(const WCHAR* meter, MeterWindow* meterWindow, const WCHAR* LogErrorF(L"Meter=%s is not valid in [%s]", meter, name); - return NULL; + return nullptr; } /* @@ -538,16 +538,16 @@ void Meter::CreateToolTip(MeterWindow* meterWindow) HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, - NULL, + nullptr, style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hMeterWindow, - NULL, + nullptr, hInstance, - NULL); + nullptr); if (hwndTT) { @@ -555,7 +555,7 @@ void Meter::CreateToolTip(MeterWindow* meterWindow) TOOLINFO ti = {sizeof(TOOLINFO), TTF_SUBCLASS, hMeterWindow, 0, GetMeterRect(), hInstance}; - SendMessage(hwndTT, TTM_ADDTOOL, NULL, (LPARAM) (LPTOOLINFO) &ti); + SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)&ti); m_ToolTipHandle = hwndTT; UpdateToolTip(); @@ -572,19 +572,19 @@ void Meter::UpdateToolTip() TOOLINFO ti = {sizeof(TOOLINFO)}; ti.hwnd = m_MeterWindow->GetWindow(); - SendMessage(hwndTT, TTM_GETTOOLINFO, NULL, (LPARAM)&ti); + SendMessage(hwndTT, TTM_GETTOOLINFO, 0, (LPARAM)&ti); std::wstring text = m_ToolTipText; ReplaceMeasures(text); ti.lpszText = (LPTSTR)text.c_str(); ti.rect = GetMeterRect(); - SendMessage(hwndTT, TTM_SETTOOLINFO, NULL, (LPARAM)&ti); - SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, NULL, m_ToolTipWidth); + SendMessage(hwndTT, TTM_SETTOOLINFO, 0, (LPARAM)&ti); + SendMessage(hwndTT, TTM_SETMAXTIPWIDTH, 0, m_ToolTipWidth); if (!m_ToolTipTitle.empty()) { - HICON hIcon = NULL; + HICON hIcon = nullptr; bool destroy = false; if (!m_ToolTipIcon.empty()) @@ -604,22 +604,22 @@ void Meter::UpdateToolTip() } else if (_wcsicmp(tipIcon, L"QUESTION") == 0) { - hIcon = LoadIcon(NULL, IDI_QUESTION); + hIcon = LoadIcon(nullptr, IDI_QUESTION); } else if (_wcsicmp(tipIcon, L"SHIELD") == 0) { - hIcon = LoadIcon(NULL, IDI_SHIELD); + hIcon = LoadIcon(nullptr, IDI_SHIELD); } else { - hIcon = (HICON)LoadImage(NULL, tipIcon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); + hIcon = (HICON)LoadImage(nullptr, tipIcon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE); destroy = true; } } text = m_ToolTipTitle; ReplaceMeasures(text); - SendMessage(hwndTT, TTM_SETTITLE, (WPARAM) hIcon, (LPARAM)text.c_str()); + SendMessage(hwndTT, TTM_SETTITLE, (WPARAM)hIcon, (LPARAM)text.c_str()); if (destroy) { @@ -629,11 +629,11 @@ void Meter::UpdateToolTip() if (m_ToolTipHidden) { - SendMessage(hwndTT, TTM_ACTIVATE, FALSE, NULL); + SendMessage(hwndTT, TTM_ACTIVATE, FALSE, 0); } else { - SendMessage(hwndTT, TTM_ACTIVATE, !IsHidden(), NULL); + SendMessage(hwndTT, TTM_ACTIVATE, !IsHidden(), 0); } } diff --git a/Library/Meter.h b/Library/Meter.h index 71c52c46..7369fb12 100644 --- a/Library/Meter.h +++ b/Library/Meter.h @@ -60,7 +60,7 @@ public: bool HasMouseAction() { return m_HasMouseAction; } const std::wstring& GetToolTipText() { return m_ToolTipText; } - bool HasToolTip() { return m_ToolTipHandle != NULL; } + bool HasToolTip() { return m_ToolTipHandle != nullptr; } void CreateToolTip(MeterWindow* meterWindow); void UpdateToolTip(); diff --git a/Library/MeterBitmap.cpp b/Library/MeterBitmap.cpp index 7d912223..a612cb26 100644 --- a/Library/MeterBitmap.cpp +++ b/Library/MeterBitmap.cpp @@ -33,7 +33,7 @@ extern Rainmeter* g_Rainmeter; ** */ MeterBitmap::MeterBitmap(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name), - m_Image(L"BitmapImage", NULL, true), + m_Image(L"BitmapImage", nullptr, true), m_NeedsReload(false), m_ZeroFrame(false), m_FrameCount(1), diff --git a/Library/MeterButton.cpp b/Library/MeterButton.cpp index aee29303..c34c0d0e 100644 --- a/Library/MeterButton.cpp +++ b/Library/MeterButton.cpp @@ -39,7 +39,7 @@ enum BUTTON_STATE ** */ MeterButton::MeterButton(MeterWindow* meterWindow, const WCHAR* name) : Meter(meterWindow, name), - m_Image(L"ButtonImage", NULL, true), + m_Image(L"ButtonImage", nullptr, true), m_NeedsReload(false), m_Bitmaps(), m_State(BUTTON_STATE_NORMAL), @@ -71,7 +71,7 @@ void MeterButton::Initialize() for (int i = 0; i < BUTTON_FRAMES; ++i) { delete m_Bitmaps[i]; - m_Bitmaps[i] = NULL; + m_Bitmaps[i] = nullptr; } // Load the bitmaps if defined @@ -186,7 +186,7 @@ bool MeterButton::Draw(Gfx::Canvas& canvas) { if (!Meter::Draw(canvas)) return false; - if (m_Bitmaps[m_State] == NULL) return false; // Unable to continue + if (m_Bitmaps[m_State] == nullptr) return false; // Unable to continue Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext(); diff --git a/Library/MeterHistogram.cpp b/Library/MeterHistogram.cpp index 08841904..8a822fe8 100644 --- a/Library/MeterHistogram.cpp +++ b/Library/MeterHistogram.cpp @@ -80,10 +80,10 @@ void MeterHistogram::DisposeBuffer() // Delete buffers delete [] m_PrimaryValues; - m_PrimaryValues = NULL; + m_PrimaryValues = nullptr; delete [] m_SecondaryValues; - m_SecondaryValues = NULL; + m_SecondaryValues = nullptr; } /* @@ -115,7 +115,7 @@ void MeterHistogram::Initialize() { Meter::Initialize(); - Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; + Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr; // A sanity check if (secondaryMeasure && !m_PrimaryImageName.empty() && (m_OverlapImageName.empty() || m_SecondaryImageName.empty())) @@ -329,10 +329,10 @@ bool MeterHistogram::Update() { int maxSize = m_GraphHorizontalOrientation ? m_H : m_W; - if (maxSize > 0) // m_PrimaryValues is not NULL + if (maxSize > 0) // m_PrimaryValues is not nullptr { Measure* measure = m_Measures[0]; - Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; + Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr; // Gather values m_PrimaryValues[m_MeterPos] = measure->GetValue(); @@ -419,7 +419,7 @@ bool MeterHistogram::Draw(Gfx::Canvas& canvas) Gdiplus::Graphics& graphics = canvas.BeginGdiplusContext(); - Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : NULL; + Measure* secondaryMeasure = (m_Measures.size() >= 2) ? m_Measures[1] : nullptr; GraphicsPath primaryPath; GraphicsPath secondaryPath; diff --git a/Library/MeterString.cpp b/Library/MeterString.cpp index 6914cd86..eb701d45 100644 --- a/Library/MeterString.cpp +++ b/Library/MeterString.cpp @@ -91,7 +91,7 @@ MeterString::MeterString(MeterWindow* meterWindow, const WCHAR* name) : Meter(me MeterString::~MeterString() { delete m_TextFormat; - m_TextFormat = NULL; + m_TextFormat = nullptr; } /* @@ -243,7 +243,7 @@ void MeterString::ReadOptions(ConfigParser& parser, const WCHAR* section) m_Scale = parser.ParseDouble(scale.c_str(), 1); const WCHAR* hAlign = parser.ReadString(section, L"StringAlign", L"LEFT").c_str(); - const WCHAR* vAlign = NULL; + const WCHAR* vAlign = nullptr; if (_wcsnicmp(hAlign, L"LEFT", 4) == 0) { m_TextFormat->SetHorizontalAlignment(Gfx::HorizontalAlignment::Left); @@ -418,7 +418,7 @@ bool MeterString::Draw(Gfx::Canvas& canvas) { if (!Meter::Draw(canvas)) return false; - return DrawString(canvas, NULL); + return DrawString(canvas, nullptr); } /* diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 4a0ad721..3c72f175 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -63,11 +63,11 @@ enum INTERVAL int MeterWindow::c_InstanceCount = 0; -HINSTANCE MeterWindow::c_DwmInstance = NULL; -FPDWMENABLEBLURBEHINDWINDOW MeterWindow::c_DwmEnableBlurBehindWindow = NULL; -FPDWMGETCOLORIZATIONCOLOR MeterWindow::c_DwmGetColorizationColor = NULL; -FPDWMSETWINDOWATTRIBUTE MeterWindow::c_DwmSetWindowAttribute = NULL; -FPDWMISCOMPOSITIONENABLED MeterWindow::c_DwmIsCompositionEnabled = NULL; +HINSTANCE MeterWindow::c_DwmInstance = nullptr; +FPDWMENABLEBLURBEHINDWINDOW MeterWindow::c_DwmEnableBlurBehindWindow = nullptr; +FPDWMGETCOLORIZATIONCOLOR MeterWindow::c_DwmGetColorizationColor = nullptr; +FPDWMSETWINDOWATTRIBUTE MeterWindow::c_DwmSetWindowAttribute = nullptr; +FPDWMISCOMPOSITIONENABLED MeterWindow::c_DwmIsCompositionEnabled = nullptr; extern Rainmeter* g_Rainmeter; @@ -164,7 +164,7 @@ MeterWindow::MeterWindow(const std::wstring& folderPath, const std::wstring& fil wc.style = CS_NOCLOSE | CS_DBLCLKS; wc.lpfnWndProc = InitialWndProc; wc.hInstance = g_Rainmeter->GetInstance(); - wc.hCursor = NULL; // The cursor should be controlled by using SetCursor() when needed. + wc.hCursor = nullptr; // The cursor should be controlled by using SetCursor() when needed. wc.lpszClassName = METERWINDOW_CLASS_NAME; RegisterClassEx(&wc); } @@ -194,17 +194,17 @@ MeterWindow::~MeterWindow() if (c_DwmInstance) { FreeLibrary(c_DwmInstance); - c_DwmInstance = NULL; + c_DwmInstance = nullptr; - c_DwmEnableBlurBehindWindow = NULL; - c_DwmGetColorizationColor = NULL; - c_DwmSetWindowAttribute = NULL; - c_DwmIsCompositionEnabled = NULL; + c_DwmEnableBlurBehindWindow = nullptr; + c_DwmGetColorizationColor = nullptr; + c_DwmSetWindowAttribute = nullptr; + c_DwmIsCompositionEnabled = nullptr; } } delete m_Canvas; - m_Canvas = NULL; + m_Canvas = nullptr; } /* @@ -244,7 +244,7 @@ void MeterWindow::Dispose(bool refresh) m_Measures.clear(); delete m_Background; - m_Background = NULL; + m_Background = nullptr; m_BackgroundSize.cx = m_BackgroundSize.cy = 0; m_BackgroundName.clear(); @@ -252,13 +252,13 @@ void MeterWindow::Dispose(bool refresh) if (m_BlurRegion) { DeleteObject(m_BlurRegion); - m_BlurRegion = NULL; + m_BlurRegion = nullptr; } if (m_FontCollection) { delete m_FontCollection; - m_FontCollection = NULL; + m_FontCollection = nullptr; } if (!refresh) @@ -266,7 +266,7 @@ void MeterWindow::Dispose(bool refresh) if (m_Window) { DestroyWindow(m_Window); - m_Window = NULL; + m_Window = nullptr; } } } @@ -280,14 +280,14 @@ void MeterWindow::Initialize() m_Window = CreateWindowEx( WS_EX_TOOLWINDOW, METERWINDOW_CLASS_NAME, - NULL, + nullptr, WS_POPUP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, g_Rainmeter->GetInstance(), this); @@ -390,7 +390,7 @@ void MeterWindow::Deactivate() g_Rainmeter->AddUnmanagedMeterWindow(this); HideFade(); - SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, NULL); + SetTimer(m_Window, TIMER_DEACTIVATE, m_FadeDuration + 50, nullptr); } /* @@ -448,7 +448,7 @@ void MeterWindow::Refresh(bool init, bool all) MapCoordsToScreen(m_ScreenX, m_ScreenY, m_WindowW, m_WindowH); } - SetWindowPos(m_Window, NULL, m_ScreenX, m_ScreenY, m_WindowW, m_WindowH, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); + SetWindowPos(m_Window, nullptr, m_ScreenX, m_ScreenY, m_WindowW, m_WindowH, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING); ScreenToWindow(); @@ -464,12 +464,12 @@ void MeterWindow::Refresh(bool init, bool all) // Start the timers if (m_WindowUpdate >= 0) { - SetTimer(m_Window, TIMER_METER, m_WindowUpdate, NULL); + SetTimer(m_Window, TIMER_METER, m_WindowUpdate, nullptr); } - SetTimer(m_Window, TIMER_MOUSE, INTERVAL_MOUSE, NULL); + SetTimer(m_Window, TIMER_MOUSE, INTERVAL_MOUSE, nullptr); - g_Rainmeter->SetCurrentParser(NULL); + g_Rainmeter->SetCurrentParser(nullptr); m_State = STATE_RUNNING; @@ -591,7 +591,7 @@ void MeterWindow::MapCoordsToScreen(int& x, int& y, int w, int h) */ void MeterWindow::MoveWindow(int x, int y) { - SetWindowPos(m_Window, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(m_Window, nullptr, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); SavePositionIfAppropriate(); } @@ -710,7 +710,7 @@ void MeterWindow::DoBang(Bang bang, const std::vector& args) { case Bang::Refresh: // Refresh needs to be delayed since it crashes if done during Update() - PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)NULL, (LPARAM)NULL); + PostMessage(m_Window, WM_METERWINDOW_DELAYED_REFRESH, (WPARAM)nullptr, (LPARAM)nullptr); break; case Bang::Redraw: @@ -722,7 +722,7 @@ void MeterWindow::DoBang(Bang bang, const std::vector& args) Update(false); if (m_WindowUpdate >= 0) { - SetTimer(m_Window, TIMER_METER, m_WindowUpdate, NULL); + SetTimer(m_Window, TIMER_METER, m_WindowUpdate, nullptr); } break; @@ -1032,25 +1032,25 @@ void MeterWindow::ResizeBlur(const std::wstring& arg, int mode) while (token[0] == L' ') ++token; type = m_Parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { while (token[0] == L' ') ++token; x = m_Parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { while (token[0] == L' ') ++token; y = m_Parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { while (token[0] == L' ') ++token; w = m_Parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { while (token[0] == L' ') ++token; @@ -1072,7 +1072,7 @@ void MeterWindow::ResizeBlur(const std::wstring& arg, int mode) break; case 2: - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { while (token[0] == L' ') ++token; @@ -1677,7 +1677,7 @@ void MeterWindow::ScreenToWindow() RECT rect = {m_ScreenX, m_ScreenY, m_ScreenX + m_WindowW, m_ScreenY + m_WindowH}; HMONITOR hMonitor = MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST); - if (hMonitor != NULL) + if (hMonitor != nullptr) { int screenIndex = 1; for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter, ++screenIndex) @@ -1793,7 +1793,7 @@ void MeterWindow::ReadOptions() const WCHAR* section = m_FolderPath.c_str(); ConfigParser parser; - parser.Initialize(g_Rainmeter->GetIniFile(), NULL, section); + parser.Initialize(g_Rainmeter->GetIniFile(), nullptr, section); INT writeFlags = 0; auto addWriteFlag = [&](INT flag) @@ -1980,7 +1980,7 @@ bool MeterWindow::ReadSkin() std::wstring resourcePath = GetResourcesPath(); bool hasResourcesFolder = (_waccess(resourcePath.c_str(), 0) == 0); - m_Parser.Initialize(iniFile, this, NULL, &resourcePath); + m_Parser.Initialize(iniFile, this, nullptr, &resourcePath); // Read options from Rainmeter.ini. ReadOptions(); @@ -2090,7 +2090,7 @@ bool MeterWindow::ReadSkin() (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, &fd, FindExSearchNameMatch, - NULL, + nullptr, 0); if (find != INVALID_HANDLE_VALUE) @@ -2155,7 +2155,7 @@ bool MeterWindow::ReadSkin() // to avoid errors caused by referencing nonexistent [sections] in the options. m_HasNetMeasures = false; m_HasButtons = false; - Meter* prevMeter = NULL; + Meter* prevMeter = nullptr; for (auto iter = m_Parser.GetSections().cbegin(); iter != m_Parser.GetSections().cend(); ++iter) { const WCHAR* section = (*iter).c_str(); @@ -2285,7 +2285,7 @@ bool MeterWindow::ResizeWindow(bool reset) // Reset size (this is calculated below) delete m_Background; - m_Background = NULL; + m_Background = nullptr; if ((m_BackgroundMode == BGMODE_IMAGE || m_BackgroundMode == BGMODE_SCALED_IMAGE || m_BackgroundMode == BGMODE_TILED_IMAGE) && !m_BackgroundName.empty()) { @@ -2555,7 +2555,7 @@ void MeterWindow::PostUpdate(bool bActiveTransition) // Start/stop the transition timer if necessary if (bActiveTransition && !m_ActiveTransition) { - SetTimer(m_Window, TIMER_TRANSITION, m_TransitionUpdate, NULL); + SetTimer(m_Window, TIMER_TRANSITION, m_TransitionUpdate, nullptr); m_ActiveTransition = true; } else if (m_ActiveTransition && !bActiveTransition) @@ -2729,12 +2729,12 @@ void MeterWindow::UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled if (!canvasBeginDrawCalled) m_Canvas->BeginDraw(); HDC dcMemory = m_Canvas->GetDC(); - if (!UpdateLayeredWindow(m_Window, NULL, NULL, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA)) + if (!UpdateLayeredWindow(m_Window, nullptr, nullptr, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA)) { // Retry after resetting WS_EX_LAYERED flag. RemoveWindowExStyle(WS_EX_LAYERED); AddWindowExStyle(WS_EX_LAYERED); - UpdateLayeredWindow(m_Window, NULL, NULL, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA); + UpdateLayeredWindow(m_Window, nullptr, nullptr, &szWindow, dcMemory, &ptSrc, 0, &blendPixelFunction, ULW_ALPHA); } m_Canvas->ReleaseDC(dcMemory); @@ -2750,7 +2750,7 @@ void MeterWindow::UpdateWindow(int alpha, bool reset, bool canvasBeginDrawCalled void MeterWindow::UpdateWindowTransparency(int alpha) { BLENDFUNCTION blendPixelFunction = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; - UpdateLayeredWindow(m_Window, NULL, NULL, NULL, NULL, NULL, 0, &blendPixelFunction, ULW_ALPHA); + UpdateLayeredWindow(m_Window, nullptr, nullptr, nullptr, nullptr, nullptr, 0, &blendPixelFunction, ULW_ALPHA); m_TransparencyValue = alpha; } @@ -2918,7 +2918,7 @@ void MeterWindow::FadeWindow(int from, int to) } } - SetTimer(m_Window, TIMER_FADE, INTERVAL_FADE, NULL); + SetTimer(m_Window, TIMER_FADE, INTERVAL_FADE, nullptr); } } @@ -2951,7 +2951,7 @@ void MeterWindow::ShowWindowIfAppropriate() POINT pos = System::GetCursorPosition(); POINT posScr = pos; - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); bool inside = HitTest(pos.x, pos.y); if (inside) @@ -3024,14 +3024,14 @@ HWND MeterWindow::GetWindowFromPoint(POINT pos) return hwndPos; } - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); if (HitTest(pos.x, pos.y)) { if (hwndPos) { HWND hWnd = GetAncestor(hwndPos, GA_ROOT); - while (hWnd = FindWindowEx(NULL, hWnd, METERWINDOW_CLASS_NAME, NULL)) + while (hWnd = FindWindowEx(nullptr, hWnd, METERWINDOW_CLASS_NAME, nullptr)) { if (hWnd == m_Window) { @@ -3061,7 +3061,7 @@ bool MeterWindow::HitTest(int x, int y) void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute) { bool redraw = false; - HCURSOR cursor = NULL; + HCURSOR cursor = nullptr; std::vector::const_reverse_iterator j = m_Meters.rbegin(); for ( ; j != m_Meters.rend(); ++j) @@ -3069,7 +3069,7 @@ void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute) // Hidden meters are ignored if ((*j)->IsHidden()) continue; - MeterButton* button = NULL; + MeterButton* button = nullptr; if (m_HasButtons && (*j)->GetTypeID() == TypeID()) { button = (MeterButton*)(*j); @@ -3109,7 +3109,7 @@ void MeterWindow::HandleButtons(POINT pos, BUTTONPROC proc, bool execute) if (!cursor) { - cursor = LoadCursor(NULL, IDC_ARROW); + cursor = LoadCursor(nullptr, IDC_ARROW); } SetCursor(cursor); @@ -3131,7 +3131,7 @@ LRESULT MeterWindow::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT MeterWindow::OnEnterMenuLoop(UINT uMsg, WPARAM wParam, LPARAM lParam) { // Set cursor to default - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); return 0; } @@ -3189,7 +3189,7 @@ LRESULT MeterWindow::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCMOUSEMOVE) { // Map to local window - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } ++m_MouseMoveCounter; @@ -3245,7 +3245,7 @@ LRESULT MeterWindow::OnMouseScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam) pos.x = GET_X_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam); - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); // Handle buttons HandleButtons(pos, BUTTONPROC_MOVE); @@ -3266,7 +3266,7 @@ LRESULT MeterWindow::OnMouseHScrollMove(UINT uMsg, WPARAM wParam, LPARAM lParam) pos.x = GET_X_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam); - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); // Handle buttons HandleButtons(pos, BUTTONPROC_MOVE); @@ -3606,7 +3606,7 @@ LRESULT MeterWindow::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam) SavePositionIfAppropriate(); POINT pos = System::GetCursorPosition(); - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); // Handle buttons HandleButtons(pos, BUTTONPROC_UP, false); // redraw only @@ -3638,7 +3638,7 @@ LRESULT MeterWindow::OnEnterSizeMove(UINT uMsg, WPARAM wParam, LPARAM lParam) m_Dragged = true; // Don't post the WM_NCLBUTTONUP message! // Set cursor to default - SetCursor(LoadCursor(NULL, IDC_ARROW)); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); } return 0; @@ -3664,7 +3664,7 @@ LRESULT MeterWindow::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam) POINT pos; pos.x = GET_X_LPARAM(lParam); pos.y = GET_Y_LPARAM(lParam); - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); int x1 = m_DragMargins.left; if (x1 < 0) x1 += m_WindowW; @@ -3726,7 +3726,7 @@ LRESULT MeterWindow::OnWindowPosChanging(UINT uMsg, WPARAM wParam, LPARAM lParam const std::vector& monitors = System::GetMultiMonitorInfo().monitors; const RECT windowRect = {wp->x, wp->y, wp->x + (m_WindowW ? m_WindowW : 1), wp->y + (m_WindowH ? m_WindowH : 1)}; - const RECT* workArea = NULL; + const RECT* workArea = nullptr; size_t maxSize = 0; for (auto iter = monitors.cbegin(); iter != monitors.cend(); ++iter) @@ -3902,7 +3902,7 @@ LRESULT MeterWindow::OnLeftButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCLBUTTONDOWN) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -3934,7 +3934,7 @@ LRESULT MeterWindow::OnLeftButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCLBUTTONUP) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -3958,7 +3958,7 @@ LRESULT MeterWindow::OnLeftButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lP if (uMsg == WM_NCLBUTTONDBLCLK) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -3985,7 +3985,7 @@ LRESULT MeterWindow::OnRightButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCRBUTTONDOWN) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4032,7 +4032,7 @@ LRESULT MeterWindow::OnRightButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM l if (uMsg == WM_NCRBUTTONDBLCLK) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4059,7 +4059,7 @@ LRESULT MeterWindow::OnMiddleButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCMBUTTONDOWN) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4083,7 +4083,7 @@ LRESULT MeterWindow::OnMiddleButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCMBUTTONUP) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4107,7 +4107,7 @@ LRESULT MeterWindow::OnMiddleButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM if (uMsg == WM_NCMBUTTONDBLCLK) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4134,7 +4134,7 @@ LRESULT MeterWindow::OnXButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCXBUTTONDOWN) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4165,7 +4165,7 @@ LRESULT MeterWindow::OnXButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam) if (uMsg == WM_NCXBUTTONUP) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4196,7 +4196,7 @@ LRESULT MeterWindow::OnXButtonDoubleClick(UINT uMsg, WPARAM wParam, LPARAM lPara if (uMsg == WM_NCXBUTTONDBLCLK) { // Transform the point to client rect - MapWindowPoints(NULL, m_Window, &pos, 1); + MapWindowPoints(nullptr, m_Window, &pos, 1); } // Handle buttons @@ -4360,7 +4360,7 @@ bool MeterWindow::DoMoveAction(int x, int y, MOUSEACTION action) } // Handle button - MeterButton* button = NULL; + MeterButton* button = nullptr; if (m_HasButtons && (*j)->GetTypeID() == TypeID()) { button = (MeterButton*)(*j); @@ -4645,7 +4645,7 @@ LRESULT MeterWindow::OnDelayedMove(UINT uMsg, WPARAM wParam, LPARAM lParam) // Move the window temporarily ResizeWindow(false); - SetWindowPos(m_Window, NULL, m_ScreenX, m_ScreenY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); + SetWindowPos(m_Window, nullptr, m_ScreenX, m_ScreenY, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); return 0; } @@ -4771,5 +4771,5 @@ Meter* MeterWindow::GetMeter(const std::wstring& meterName) return (*j); } } - return NULL; + return nullptr; } diff --git a/Library/Mouse.cpp b/Library/Mouse.cpp index cadbf522..9efa2501 100644 --- a/Library/Mouse.cpp +++ b/Library/Mouse.cpp @@ -174,7 +174,7 @@ HCURSOR Mouse::GetCursor() const break; } - return LoadCursor(NULL, name); + return LoadCursor(nullptr, name); } std::wstring Mouse::GetActionCommand(MOUSEACTION action) const @@ -189,7 +189,7 @@ void Mouse::DestroyCustomCursor() if (m_CustomCursor) { DestroyCursor(m_CustomCursor); - m_CustomCursor = NULL; + m_CustomCursor = nullptr; } } diff --git a/Library/Mouse.h b/Library/Mouse.h index 455ddd34..adc9ade6 100644 --- a/Library/Mouse.h +++ b/Library/Mouse.h @@ -63,7 +63,7 @@ enum MOUSECURSOR class Mouse { public: - Mouse(MeterWindow* meterWindow, Meter* meter = NULL); + Mouse(MeterWindow* meterWindow, Meter* meter = nullptr); ~Mouse(); void ReadOptions(ConfigParser& parser, const WCHAR* section); diff --git a/Library/Rainmeter.cpp b/Library/Rainmeter.cpp index 5b68b9c4..7f0ab7e5 100644 --- a/Library/Rainmeter.cpp +++ b/Library/Rainmeter.cpp @@ -55,7 +55,7 @@ int RainmeterMain(LPWSTR cmdLine) // Avoid loading a dll from current directory SetDllDirectory(L""); - const WCHAR* layout = NULL; + const WCHAR* layout = nullptr; if (cmdLine[0] == L'!' || cmdLine[0] == L'[') { @@ -67,7 +67,7 @@ int RainmeterMain(LPWSTR cmdLine) cds.dwData = 1; cds.cbData = (DWORD)((wcslen(cmdLine) + 1) * sizeof(WCHAR)); cds.lpData = (PVOID)cmdLine; - SendMessage(wnd, WM_COPYDATA, NULL, (LPARAM)&cds); + SendMessage(wnd, WM_COPYDATA, 0, (LPARAM)&cds); return 0; } @@ -92,7 +92,7 @@ int RainmeterMain(LPWSTR cmdLine) } } - const WCHAR* iniFile = (*cmdLine && !layout) ? cmdLine : NULL; + const WCHAR* iniFile = (*cmdLine && !layout) ? cmdLine : nullptr; g_Rainmeter = new Rainmeter; int ret = g_Rainmeter->Initialize(iniFile, layout); @@ -102,7 +102,7 @@ int RainmeterMain(LPWSTR cmdLine) } delete g_Rainmeter; - g_Rainmeter = NULL; + g_Rainmeter = nullptr; return ret; } @@ -132,13 +132,13 @@ Rainmeter::Rainmeter() : m_GDIplusToken(), m_GlobalOptions() { - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); InitCommonControls(); // Initialize GDI+. GdiplusStartupInput gdiplusStartupInput; - GdiplusStartup(&m_GDIplusToken, &gdiplusStartupInput, NULL); + GdiplusStartup(&m_GDIplusToken, &gdiplusStartupInput, nullptr); } /* @@ -253,10 +253,10 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, m_Instance, - NULL); + nullptr); if (!m_Window) return 1; @@ -317,7 +317,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Rainmeter", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS) { DWORD type = 0; - if (RegQueryValueEx(hKey, L"Language", NULL, &type, (LPBYTE)buffer, (LPDWORD)&size) != ERROR_SUCCESS || + if (RegQueryValueEx(hKey, L"Language", nullptr, &type, (LPBYTE)buffer, (LPDWORD)&size) != ERROR_SUCCESS || type != REG_SZ) { buffer[0] = L'\0'; @@ -328,22 +328,22 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) if (buffer[0] != L'\0') { // Try selected language - m_ResourceLCID = wcstoul(buffer, NULL, 10); + m_ResourceLCID = wcstoul(buffer, nullptr, 10); resource += buffer; resource += L".dll"; - m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); + m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); } if (!m_ResourceInstance) { // Try English resource = m_Path; resource += L"Languages\\1033.dll"; - m_ResourceInstance = LoadLibraryEx(resource.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); + m_ResourceInstance = LoadLibraryEx(resource.c_str(), nullptr, DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE); m_ResourceLCID = 1033; if (!m_ResourceInstance) { - MessageBox(NULL, L"Unable to load language library", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); + MessageBox(nullptr, L"Unable to load language library", APPNAME, MB_OK | MB_TOPMOST | MB_ICONERROR); return 1; } } @@ -363,12 +363,12 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) } } else if (bDefaultIniLocation && - SUCCEEDED(SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, buffer))) + SUCCEEDED(SHGetFolderPath(nullptr, CSIDL_MYDOCUMENTS, nullptr, SHGFP_TYPE_CURRENT, buffer))) { // Use My Documents/Rainmeter/Skins m_SkinPath = buffer; m_SkinPath += L"\\Rainmeter\\"; - CreateDirectory(m_SkinPath.c_str(), NULL); + CreateDirectory(m_SkinPath.c_str(), nullptr); m_SkinPath += L"Skins\\"; WritePrivateProfileString(L"Rainmeter", L"SkinPath", m_SkinPath.c_str(), iniFile); @@ -382,7 +382,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) CreateComponentFolders(bDefaultIniLocation); delete [] buffer; - buffer = NULL; + buffer = nullptr; LogNoticeF(L"Path: %s", m_Path.c_str()); LogNoticeF(L"IniFile: %s", iniFile); @@ -429,7 +429,7 @@ int Rainmeter::Initialize(LPCWSTR iniPath, LPCWSTR layout) if (m_SkinFolders.empty()) { std::wstring error = GetFormattedString(ID_STR_NOAVAILABLESKINS, m_SkinPath.c_str()); - ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR); + ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR); } ResetStats(); @@ -510,11 +510,11 @@ bool Rainmeter::IsAlreadyRunning() } *pos = L'\0'; - m_Mutex = CreateMutex(NULL, FALSE, mutexName); + m_Mutex = CreateMutex(nullptr, FALSE, mutexName); if (GetLastError() == ERROR_ALREADY_EXISTS) { alreadyRunning = true; - m_Mutex = NULL; + m_Mutex = nullptr; } } @@ -530,7 +530,7 @@ int Rainmeter::MessagePump() BOOL ret; // Run the standard window message loop - while ((ret = GetMessage(&msg, NULL, 0, 0)) != 0) + while ((ret = GetMessage(&msg, nullptr, 0, 0)) != 0) { if (ret == -1) { @@ -587,7 +587,7 @@ LRESULT CALLBACK Rainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA { // Execute bang WCHAR* bang = (WCHAR*)lParam; - g_Rainmeter->ExecuteCommand(bang, NULL); + g_Rainmeter->ExecuteCommand(bang, nullptr); free(bang); // _wcsdup() } break; @@ -608,12 +608,12 @@ LRESULT CALLBACK Rainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA void Rainmeter::SetNetworkStatisticsTimer() { - static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL); + static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, nullptr); } void Rainmeter::CreateOptionsFile() { - CreateDirectory(m_SettingsPath.c_str(), NULL); + CreateDirectory(m_SettingsPath.c_str(), nullptr); std::wstring defaultIni = GetDefaultLayoutPath(); defaultIni += L"illustro default\\Rainmeter.ini"; @@ -634,7 +634,7 @@ void Rainmeter::CreateDataFile() else { // Create empty file - HANDLE file = CreateFile(dataFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(dataFile, GENERIC_WRITE, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); if (file != INVALID_HANDLE_VALUE) { CloseHandle(file); @@ -646,7 +646,7 @@ void Rainmeter::CreateComponentFolders(bool defaultIniLocation) { std::wstring path; - if (CreateDirectory(m_SkinPath.c_str(), NULL)) + if (CreateDirectory(m_SkinPath.c_str(), nullptr)) { // Folder just created, so copy default skins there std::wstring from = GetDefaultSkinPath(); @@ -860,7 +860,7 @@ void Rainmeter::ActivateSkin(int folderIndex, int fileIndex) if (_waccess(skinIniPath.c_str(), 0) == -1) { std::wstring message = GetFormattedString(ID_STR_UNABLETOACTIVATESKIN, folderPath.c_str(), fileSz); - ShowMessage(NULL, message.c_str(), MB_OK | MB_ICONEXCLAMATION); + ShowMessage(nullptr, message.c_str(), MB_OK | MB_ICONEXCLAMATION); return; } @@ -1047,7 +1047,7 @@ MeterWindow* Rainmeter::GetMeterWindow(const std::wstring& folderPath) } } - return NULL; + return nullptr; } MeterWindow* Rainmeter::GetMeterWindowByINI(const std::wstring& ini_searching) @@ -1069,7 +1069,7 @@ MeterWindow* Rainmeter::GetMeterWindowByINI(const std::wstring& ini_searching) } } - return NULL; + return nullptr; } std::pair Rainmeter::GetMeterWindowIndex(const std::wstring& folderPath, const std::wstring& file) @@ -1122,7 +1122,7 @@ MeterWindow* Rainmeter::GetMeterWindow(HWND hwnd) } } - return NULL; + return nullptr; } void Rainmeter::GetMeterWindowsByLoadOrder(std::multimap& windows, const std::wstring& group) @@ -1268,7 +1268,7 @@ int Rainmeter::ScanForSkinsRecursive(const std::wstring& path, std::wstring base (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, &fileData, FindExSearchNameMatch, - NULL, + nullptr, 0); bool foundFiles = false; @@ -1375,7 +1375,7 @@ void Rainmeter::ScanForLayouts() (Platform::IsAtLeastWin7()) ? FindExInfoBasic : FindExInfoStandard, &fileData, FindExSearchNameMatch, - NULL, + nullptr, 0); if (hSearch != INVALID_HANDLE_VALUE) @@ -1416,7 +1416,7 @@ void Rainmeter::ExecuteCommand(const WCHAR* command, MeterWindow* meterWindow, b void Rainmeter::DelayedExecuteCommand(const WCHAR* command) { WCHAR* bang = _wcsdup(command); - PostMessage(m_Window, WM_RAINMETER_DELAYED_EXECUTE, (WPARAM)NULL, (LPARAM)bang); + PostMessage(m_Window, WM_RAINMETER_DELAYED_EXECUTE, (WPARAM)nullptr, (LPARAM)bang); } /* @@ -1431,7 +1431,7 @@ void Rainmeter::ReadGeneralSettings(const std::wstring& iniFile) m_DesktopWorkAreas.clear(); ConfigParser parser; - parser.Initialize(iniFile, NULL, NULL); + parser.Initialize(iniFile, nullptr, nullptr); m_UseD2D = 0!=parser.ReadInt(L"Rainmeter", L"UseD2D", 0); @@ -1591,7 +1591,7 @@ void Rainmeter::RefreshAll() DeactivateSkin(mw, index); - ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); + ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONEXCLAMATION); continue; } } @@ -1602,7 +1602,7 @@ void Rainmeter::RefreshAll() DeactivateSkin(mw, -2); // -2 = Force deactivate - ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONEXCLAMATION); + ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONEXCLAMATION); continue; } @@ -1611,7 +1611,7 @@ void Rainmeter::RefreshAll() } DialogAbout::UpdateSkins(); - DialogManage::UpdateSkins(NULL); + DialogManage::UpdateSkins(nullptr); } bool Rainmeter::LoadLayout(const std::wstring& name) @@ -1632,7 +1632,7 @@ bool Rainmeter::LoadLayout(const std::wstring& name) std::wstring backup = GetLayoutPath(); backup += L"@Backup"; - CreateDirectory(backup.c_str(), NULL); + CreateDirectory(backup.c_str(), nullptr); backup += L"\\Rainmeter.ini"; bool backupLayout = (_wcsicmp(name.c_str(), L"@Backup") == 0); @@ -1797,7 +1797,7 @@ void Rainmeter::UpdateDesktopWorkArea(bool reset) if (changed && System::GetWindow()) { // Update System::MultiMonitorInfo for for work area variables - SendMessageTimeout(System::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, NULL); + SendMessageTimeout(System::GetWindow(), WM_SETTINGCHANGE, SPI_SETWORKAREA, 0, SMTO_ABORTIFHUNG, 1000, nullptr); } } @@ -1817,7 +1817,7 @@ void Rainmeter::ReadStats() if (GetPrivateProfileSection(L"Statistics", tmpSz, SHRT_MAX, iniFile) > 0) { - WritePrivateProfileString(L"Statistics", NULL, NULL, iniFile); + WritePrivateProfileString(L"Statistics", nullptr, nullptr, iniFile); } else { @@ -1850,7 +1850,7 @@ void Rainmeter::WriteStats(bool bForce) const WCHAR* statsFile = m_StatsFile.c_str(); MeasureNet::WriteStats(statsFile, m_StatsDate); - WritePrivateProfileString(NULL, NULL, NULL, statsFile); + WritePrivateProfileString(nullptr, nullptr, nullptr, statsFile); } } @@ -1983,11 +1983,11 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow) menu = CreateSkinMenu(meterWindow, 0, allSkinsMenu); InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_POPUP, (UINT_PTR)rainmeterMenu, L"Rainmeter"); - InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_SEPARATOR, 0, NULL); + InsertMenu(menu, IDM_CLOSESKIN, MF_BYCOMMAND | MF_SEPARATOR, 0, nullptr); } else { - InsertMenu(menu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(menu, 12, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); // Create a menu for all active skins int index = 0; @@ -2005,12 +2005,12 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow) { InsertMenu(menu, 0, MF_BYPOSITION, IDM_NEW_VERSION, GetString(ID_STR_UPDATEAVAILABLE)); HiliteMenuItem(GetTrayWindow()->GetWindow(), menu, 0, MF_BYPOSITION | MF_HILITE); - InsertMenu(menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); } } HWND hWnd = WindowFromPoint(pos); - if (hWnd != NULL) + if (hWnd != nullptr) { MeterWindow* mw = GetMeterWindow(hWnd); if (mw) @@ -2025,7 +2025,7 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow) HWND hWndForeground = GetForegroundWindow(); if (hWndForeground != hWnd) { - DWORD foregroundThreadID = GetWindowThreadProcessId(hWndForeground, NULL); + DWORD foregroundThreadID = GetWindowThreadProcessId(hWndForeground, nullptr); DWORD currentThreadID = GetCurrentThreadId(); AttachThreadInput(currentThreadID, foregroundThreadID, TRUE); SetForegroundWindow(hWnd); @@ -2040,7 +2040,7 @@ void Rainmeter::ShowContextMenu(POINT pos, MeterWindow* meterWindow) pos.y, 0, hWnd, - NULL); + nullptr); if (meterWindow) { @@ -2097,7 +2097,7 @@ int Rainmeter::CreateAllSkinsMenuRecursive(HMENU skinMenu, int index) if (hasSubfolder && fileIndex != 0) { - InsertMenu(subMenu, fileIndex, MF_SEPARATOR | MF_BYPOSITION, 0, NULL); + InsertMenu(subMenu, fileIndex, MF_SEPARATOR | MF_BYPOSITION, 0, nullptr); } } @@ -2380,8 +2380,8 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu) if (position != 0) { - InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, NULL, L"Custom skin actions"); - InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_STRING | MF_GRAYED, 0, L"Custom skin actions"); + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); } } else @@ -2393,7 +2393,7 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu) { if (isTitleSeparator(cTitles[i])) { - AppendMenu(customMenu, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + AppendMenu(customMenu, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); } else { @@ -2401,7 +2401,7 @@ HMENU Rainmeter::CreateSkinMenu(MeterWindow* meterWindow, int index, HMENU menu) } } - InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); + InsertMenu(skinMenu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, nullptr); } } } @@ -2542,7 +2542,7 @@ void Rainmeter::TestSettingsFile(bool bDefaultIniLocation) error += GetFormattedString(ID_STR_SETTINGSREADONLY, iniFile); } - ShowMessage(NULL, error.c_str(), MB_OK | MB_ICONERROR); + ShowMessage(nullptr, error.c_str(), MB_OK | MB_ICONERROR); } } @@ -2570,7 +2570,7 @@ void Rainmeter::ExpandEnvironmentVariables(std::wstring& strPath) pos = strPath.find(L"%APPDATA%", pos); if (pos != std::wstring::npos) { - HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buffer); + HRESULT hr = SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, buffer); if (SUCCEEDED(hr)) { size_t len = wcslen(buffer); diff --git a/Library/RainmeterQuery.h b/Library/RainmeterQuery.h index eef5d989..ae48650b 100644 --- a/Library/RainmeterQuery.h +++ b/Library/RainmeterQuery.h @@ -77,7 +77,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) #include #define RAINMETER_QUERY_CLASS_NAME TEXT("RainmeterTrayClass") -#define RAINMETER_QUERY_WINDOW_NAME NULL +#define RAINMETER_QUERY_WINDOW_NAME nullptr #define WM_QUERY_RAINMETER WM_APP + 1000 #define WM_QUERY_RAINMETER_RETURN WM_APP + 1001 @@ -109,7 +109,7 @@ of the COPYDATASTRUCT. /* This Retuns the Window Handle of the active skin requested by config name in cds.lpData, -or NULL if the config is not loaded. Currently, the config name is Case-Sensitive. +or nullptr if the config is not loaded. Currently, the config name is Case-Sensitive. To requst the data, send a message to Rainmeter in a way similar to this example. COPYDATASTRUCT cds; diff --git a/Library/RawString.h b/Library/RawString.h index 4f0cf644..e63ce1e7 100644 --- a/Library/RawString.h +++ b/Library/RawString.h @@ -76,14 +76,14 @@ public: if (m_String) { free(m_String); - m_String = NULL; + m_String = nullptr; } } private: WCHAR* str_alloc(const WCHAR* str) { - return str ? _wcsdup(str) : NULL; + return str ? _wcsdup(str) : nullptr; } WCHAR* m_String; diff --git a/Library/System.cpp b/Library/System.cpp index b6c843f3..837cc1c6 100644 --- a/Library/System.cpp +++ b/Library/System.cpp @@ -44,10 +44,10 @@ enum INTERVAL MultiMonitorInfo System::c_Monitors = { 0 }; -HWND System::c_Window = NULL; -HWND System::c_HelperWindow = NULL; +HWND System::c_Window = nullptr; +HWND System::c_HelperWindow = nullptr; -HWINEVENTHOOK System::c_WinEventHook = NULL; +HWINEVENTHOOK System::c_WinEventHook = nullptr; bool System::c_ShowDesktop = false; @@ -78,10 +78,10 @@ void System::Initialize(HINSTANCE instance) CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, instance, - NULL); + nullptr); c_HelperWindow = CreateWindowEx( WS_EX_TOOLWINDOW, @@ -92,10 +92,10 @@ void System::Initialize(HINSTANCE instance) CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, instance, - NULL); + nullptr); SetWindowPos(c_Window, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); SetWindowPos(c_HelperWindow, HWND_BOTTOM, 0, 0, 0, 0, ZPOS_FLAGS); @@ -110,13 +110,13 @@ void System::Initialize(HINSTANCE instance) c_WinEventHook = SetWinEventHook( EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_FOREGROUND, - NULL, + nullptr, MyWinEventProc, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); - SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); + SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, nullptr); } /* @@ -131,19 +131,19 @@ void System::Finalize() if (c_WinEventHook) { UnhookWinEvent(c_WinEventHook); - c_WinEventHook = NULL; + c_WinEventHook = nullptr; } if (c_HelperWindow) { DestroyWindow(c_HelperWindow); - c_HelperWindow = NULL; + c_HelperWindow = nullptr; } if (c_Window) { DestroyWindow(c_Window); - c_Window = NULL; + c_Window = nullptr; } } @@ -171,13 +171,13 @@ BOOL CALLBACK MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonit info.rcWork.left, info.rcWork.top, info.rcWork.right, info.rcWork.bottom, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); } - if (m == NULL) return TRUE; + if (m == nullptr) return TRUE; if (m->useEnumDisplayDevices) { for (auto iter = m->monitors.begin(); iter != m->monitors.end(); ++iter) { - if ((*iter).handle == NULL && _wcsicmp(info.szDevice, (*iter).deviceName.c_str()) == 0) + if ((*iter).handle == nullptr && _wcsicmp(info.szDevice, (*iter).deviceName.c_str()) == 0) { (*iter).handle = hMonitor; (*iter).screen = *lprcMonitor; @@ -261,7 +261,7 @@ void System::SetMultiMonitorInfo() DISPLAY_DEVICE dd = {sizeof(DISPLAY_DEVICE)}; - if (EnumDisplayDevices(NULL, 0, &dd, 0)) + if (EnumDisplayDevices(nullptr, 0, &dd, 0)) { DWORD dwDevice = 0; @@ -320,7 +320,7 @@ void System::SetMultiMonitorInfo() { MonitorInfo monitor = {0}; - monitor.handle = NULL; + monitor.handle = nullptr; monitor.deviceName = deviceName; // E.g. "\\.\DISPLAY1" // Get the monitor name (E.g. "Generic Non-PnP Monitor") @@ -364,7 +364,7 @@ void System::SetMultiMonitorInfo() } } - if (monitor.handle != NULL) + if (monitor.handle != nullptr) { MONITORINFO info = {sizeof(MONITORINFO)}; GetMonitorInfo(monitor.handle, &info); @@ -410,7 +410,7 @@ void System::SetMultiMonitorInfo() } ++dwDevice; } - while (EnumDisplayDevices(NULL, dwDevice, &dd, 0)); + while (EnumDisplayDevices(nullptr, dwDevice, &dd, 0)); } if (monitors.empty()) // Failed to enumerate the non-mirroring monitors @@ -428,7 +428,7 @@ void System::SetMultiMonitorInfo() if (c_Monitors.useEnumDisplayMonitors) { - EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)(&c_Monitors)); + EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)(&c_Monitors)); if (monitors.empty()) // Failed to enumerate the monitors { @@ -460,7 +460,7 @@ void System::SetMultiMonitorInfo() { if (logging) { - EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)NULL); // Only logging + EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)nullptr); // Only logging } } @@ -522,7 +522,7 @@ void System::UpdateWorkareaInfo() int i = 1; for (auto iter = monitors.begin(); iter != monitors.end(); ++iter, ++i) { - if ((*iter).active && (*iter).handle != NULL) + if ((*iter).active && (*iter).handle != nullptr) { MONITORINFO info = {sizeof(MONITORINFO)}; GetMonitorInfo((*iter).handle, &info); @@ -546,7 +546,7 @@ void System::UpdateWorkareaInfo() */ HWND System::GetDefaultShellWindow() { - static HWND c_ShellW = NULL; // cache + static HWND c_ShellW = nullptr; // cache HWND ShellW = GetShellWindow(); if (ShellW) @@ -562,7 +562,7 @@ HWND System::GetDefaultShellWindow() if (!(GetClassName(ShellW, className, classLen) > 0 && wcscmp(className, L"Progman") == 0)) { - ShellW = NULL; + ShellW = nullptr; } } } @@ -573,14 +573,14 @@ HWND System::GetDefaultShellWindow() /* ** Finds the WorkerW window. -** If the WorkerW window is not active, returns NULL. +** If the WorkerW window is not active, returns nullptr. ** */ HWND System::GetWorkerW() { - static HWND c_DefView = NULL; // cache + static HWND c_DefView = nullptr; // cache HWND ShellW = GetDefaultShellWindow(); - if (!ShellW) return NULL; // Default Shell (Explorer) not running + if (!ShellW) return nullptr; // Default Shell (Explorer) not running if (c_DefView && IsWindow(c_DefView)) { @@ -589,7 +589,7 @@ HWND System::GetWorkerW() { if (parent == ShellW) { - return NULL; + return nullptr; } else { @@ -604,14 +604,14 @@ HWND System::GetWorkerW() } } - HWND WorkerW = NULL, DefView = FindWindowEx(ShellW, NULL, L"SHELLDLL_DefView", L""); - if (DefView == NULL) + HWND WorkerW = nullptr, DefView = FindWindowEx(ShellW, nullptr, L"SHELLDLL_DefView", L""); + if (DefView == nullptr) { - while (WorkerW = FindWindowEx(NULL, WorkerW, L"WorkerW", L"")) + while (WorkerW = FindWindowEx(nullptr, WorkerW, L"WorkerW", L"")) { if (IsWindowVisible(WorkerW) && BelongToSameProcess(ShellW, WorkerW) && - (DefView = FindWindowEx(WorkerW, NULL, L"SHELLDLL_DefView", L""))) + (DefView = FindWindowEx(WorkerW, nullptr, L"SHELLDLL_DefView", L""))) { break; } @@ -756,7 +756,7 @@ void System::ChangeZPosInOrder() LogDebug(L"2: ----- AFTER -----"); // Log all windows in Z-order - EnumWindows(MyEnumWindowsProc, (LPARAM)NULL); + EnumWindows(MyEnumWindowsProc, (LPARAM)nullptr); } } @@ -836,11 +836,11 @@ void System::PrepareHelperWindow(HWND WorkerW) */ bool System::CheckDesktopState(HWND WorkerW) { - HWND hwnd = NULL; + HWND hwnd = nullptr; if (WorkerW && IsWindowVisible(WorkerW)) { - hwnd = FindWindowEx(NULL, WorkerW, L"RainmeterSystem", L"System"); + hwnd = FindWindowEx(nullptr, WorkerW, L"RainmeterSystem", L"System"); } bool stateChanged = (hwnd && !c_ShowDesktop) || (!hwnd && c_ShowDesktop); @@ -861,11 +861,11 @@ bool System::CheckDesktopState(HWND WorkerW) if (c_ShowDesktop) { - SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_RESTOREWINDOWS, NULL); + SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_RESTOREWINDOWS, nullptr); } else { - SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, NULL); + SetTimer(c_Window, TIMER_SHOWDESKTOP, INTERVAL_SHOWDESKTOP, nullptr); } } @@ -890,7 +890,7 @@ void CALLBACK System::MyWinEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, H { const int max = 5; int loop = 0; - while (loop < max && FindWindowEx(hwnd, NULL, L"SHELLDLL_DefView", L"") == NULL) + while (loop < max && FindWindowEx(hwnd, nullptr, L"SHELLDLL_DefView", L"") == nullptr) { Sleep(2); // Wait for 2-16 ms before retrying ++loop; @@ -983,7 +983,7 @@ LRESULT CALLBACK System::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (wParam == PBT_APMRESUMESUSPEND) { // Deliver PBT_APMRESUMESUSPEND event to all meter windows - SetTimer(hWnd, TIMER_RESUME, INTERVAL_RESUME, NULL); + SetTimer(hWnd, TIMER_RESUME, INTERVAL_RESUME, nullptr); } return TRUE; @@ -1035,7 +1035,7 @@ POINT System::GetCursorPosition() */ bool System::IsFileWritable(LPCWSTR file) { - HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + HANDLE hFile = CreateFile(file, GENERIC_WRITE, FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr); if (hFile == INVALID_HANDLE_VALUE) { return false; @@ -1111,7 +1111,7 @@ void System::InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection) */ void System::SetClipboardText(const std::wstring& text) { - if (OpenClipboard(NULL)) + if (OpenClipboard(nullptr)) { // Include terminating null char size_t len = text.length() + 1; @@ -1161,7 +1161,7 @@ void System::SetWallpaper(const std::wstring& wallpaper, const std::wstring& sty HKEY hKey; if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Control Panel\\Desktop", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) { - const WCHAR* wallStyle = NULL; + const WCHAR* wallStyle = nullptr; const WCHAR* wallTile = L"0"; const WCHAR* option = style.c_str(); @@ -1229,7 +1229,7 @@ bool System::CopyFiles(std::wstring from, std::wstring to, bool bMove) SHFILEOPSTRUCT fo = { - NULL, + nullptr, bMove ? FO_MOVE : FO_COPY, from.c_str(), to.c_str(), @@ -1272,10 +1272,10 @@ bool System::RemoveFolder(std::wstring folder) SHFILEOPSTRUCT fo = { - NULL, + nullptr, FO_DELETE, folder.c_str(), - NULL, + nullptr, FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO }; @@ -1304,7 +1304,7 @@ void System::UpdateIniFileMappingList() ULONGLONG ftLastWriteTime; bool changed = false; - ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, (LPFILETIME)&ftLastWriteTime); + ret = RegQueryInfoKey(hKey, nullptr, nullptr, nullptr, &numSubKeys, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (LPFILETIME)&ftLastWriteTime); if (ret == ERROR_SUCCESS) { //LogDebugF(L"IniFileMapping: numSubKeys=%u, ftLastWriteTime=%llu", numSubKeys, ftLastWriteTime); @@ -1336,7 +1336,7 @@ void System::UpdateIniFileMappingList() WCHAR* buffer = new WCHAR[MAX_PATH]; DWORD index = 0, cch = MAX_PATH; - while ((ret = RegEnumKeyEx(hKey, index++, buffer, &cch, NULL, NULL, NULL, NULL)) != ERROR_NO_MORE_ITEMS) + while ((ret = RegEnumKeyEx(hKey, index++, buffer, &cch, nullptr, nullptr, nullptr, nullptr)) != ERROR_NO_MORE_ITEMS) { if (ret == ERROR_SUCCESS) { diff --git a/Library/System.h b/Library/System.h index fdc1234a..d1f3f4d3 100644 --- a/Library/System.h +++ b/Library/System.h @@ -69,7 +69,7 @@ public: static bool IsFileWritable(LPCWSTR file); - static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = NULL); + static HMODULE RmLoadLibrary(LPCWSTR lpLibFileName, DWORD* dwError = nullptr); static void ResetWorkingDirectory(); static void InitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection); diff --git a/Library/TintedImage.cpp b/Library/TintedImage.cpp index 94c2ec04..fe3d2d45 100644 --- a/Library/TintedImage.cpp +++ b/Library/TintedImage.cpp @@ -57,7 +57,7 @@ public: { return (*iter).second->GetCache(); } - return NULL; + return nullptr; } static void AddCache(const std::wstring& key, Bitmap* bitmap, HGLOBAL hBuffer) @@ -111,7 +111,7 @@ private: ImageCache() {} ImageCache(const ImageCache& cache) {} - void Dispose() { delete m_Bitmap; m_Bitmap = NULL; if (m_hBuffer) { ::GlobalFree(m_hBuffer); m_hBuffer = NULL; } } + void Dispose() { delete m_Bitmap; m_Bitmap = nullptr; if (m_hBuffer) { ::GlobalFree(m_hBuffer); m_hBuffer = nullptr; } } Bitmap* m_Bitmap; HGLOBAL m_hBuffer; @@ -187,9 +187,9 @@ TintedImage::~TintedImage() void TintedImage::DisposeImage() { delete m_BitmapTint; - m_BitmapTint = NULL; + m_BitmapTint = nullptr; - m_Bitmap = NULL; + m_Bitmap = nullptr; if (!m_CacheKey.empty()) { @@ -211,10 +211,10 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, if (pBuffer) { DWORD readBytes; - ReadFile(fileHandle, pBuffer, fileSize, &readBytes, NULL); + ReadFile(fileHandle, pBuffer, fileSize, &readBytes, nullptr); ::GlobalUnlock(hBuffer); - IStream* pStream = NULL; + IStream* pStream = nullptr; if (::CreateStreamOnHGlobal(hBuffer, FALSE, &pStream) == S_OK) { Bitmap* bitmap = Bitmap::FromStream(pStream); @@ -288,7 +288,7 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, bitmap = clone; ::GlobalFree(hBuffer); - hBuffer = NULL; + hBuffer = nullptr; //////////////////////////////////////////// } *phBuffer = hBuffer; @@ -302,8 +302,8 @@ Bitmap* TintedImage::LoadImageFromFileHandle(HANDLE fileHandle, DWORD fileSize, ::GlobalFree(hBuffer); } - *phBuffer = NULL; - return NULL; + *phBuffer = nullptr; + return nullptr; } /* @@ -326,12 +326,12 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) // Read the bitmap to memory so that it's not locked by GDI+ DWORD fileSize; - HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if (fileHandle != INVALID_HANDLE_VALUE && (fileSize = GetFileSize(fileHandle, NULL)) != INVALID_FILE_SIZE) + HANDLE fileHandle = CreateFile(filename.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, nullptr); + if (fileHandle != INVALID_HANDLE_VALUE && (fileSize = GetFileSize(fileHandle, nullptr)) != INVALID_FILE_SIZE) { // Compare the filename/timestamp/filesize to check if the file has been changed (don't load if it's not) ULONGLONG fileTime; - GetFileTime(fileHandle, NULL, NULL, (LPFILETIME)&fileTime); + GetFileTime(fileHandle, nullptr, nullptr, (LPFILETIME)&fileTime); std::wstring key = ImageCachePool::CreateKey(filename, fileTime, fileSize, m_UseExifOrientation ? L"EXIF" : L"NONE"); if (bLoadAlways || wcscmp(key.c_str(), m_CacheKey.c_str()) != 0) @@ -339,7 +339,7 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) DisposeImage(); Bitmap* bitmap = ImageCachePool::GetCache(key); - HGLOBAL hBuffer = NULL; + HGLOBAL hBuffer = nullptr; m_Bitmap = (bitmap) ? bitmap : @@ -386,7 +386,7 @@ void TintedImage::LoadImage(const std::wstring& imageName, bool bLoadAlways) if (m_NeedsCrop || m_NeedsTinting || m_NeedsTransform) { delete m_BitmapTint; - m_BitmapTint = NULL; + m_BitmapTint = nullptr; if (m_Bitmap->GetWidth() > 0 && m_Bitmap->GetHeight() > 0) { @@ -643,22 +643,22 @@ void TintedImage::ReadOptions(ConfigParser& parser, const WCHAR* section) { m_Crop.X = parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { m_Crop.Y = parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { m_Crop.Width = parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { m_Crop.Height = parser.ParseInt(token, 0); - token = wcstok(NULL, L","); + token = wcstok(nullptr, L","); if (token) { m_CropMode = (CROPMODE)parser.ParseInt(token, 0); diff --git a/Library/TintedImage.h b/Library/TintedImage.h index 459a0ac2..14325b8d 100644 --- a/Library/TintedImage.h +++ b/Library/TintedImage.h @@ -71,8 +71,8 @@ public: void ReadOptions(ConfigParser& parser, const WCHAR* section); - bool IsLoaded() { return (m_Bitmap != NULL); } - bool IsTinted() { return (m_BitmapTint != NULL); } + bool IsLoaded() { return (m_Bitmap != nullptr); } + bool IsTinted() { return (m_BitmapTint != nullptr); } bool IsOptionsChanged() { return m_NeedsCrop || m_NeedsTinting || m_NeedsTransform; } void ClearOptionFlags() { m_NeedsCrop = m_NeedsTinting = m_NeedsTransform = false; } diff --git a/Library/TrayWindow.cpp b/Library/TrayWindow.cpp index 5da4a0d7..73bde54f 100644 --- a/Library/TrayWindow.cpp +++ b/Library/TrayWindow.cpp @@ -98,14 +98,14 @@ void TrayWindow::Initialize() m_Window = CreateWindowEx( WS_EX_TOOLWINDOW, L"RainmeterTrayClass", - NULL, + nullptr, WS_POPUP | WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, wc.hInstance, this); @@ -145,14 +145,14 @@ void TrayWindow::TryAddTrayIcon() if (m_Icon) { DestroyIcon(m_Icon); - m_Icon = NULL; + m_Icon = nullptr; } m_Icon = CreateTrayIcon(0); if (!AddTrayIcon()) { - SetTimer(m_Window, TIMER_ADDTRAYICON, INTERVAL_ADDTRAYICON, NULL); + SetTimer(m_Window, TIMER_ADDTRAYICON, INTERVAL_ADDTRAYICON, nullptr); } } @@ -176,7 +176,7 @@ void TrayWindow::RemoveTrayIcon() if (m_Icon) { DestroyIcon(m_Icon); - m_Icon = NULL; + m_Icon = nullptr; } } @@ -185,7 +185,7 @@ void TrayWindow::ModifyTrayIcon(double value) if (m_Icon) { DestroyIcon(m_Icon); - m_Icon = NULL; + m_Icon = nullptr; } m_Icon = CreateTrayIcon(value); @@ -201,7 +201,7 @@ void TrayWindow::ModifyTrayIcon(double value) HICON TrayWindow::CreateTrayIcon(double value) { - if (m_Measure != NULL) + if (m_Measure != nullptr) { if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM) { @@ -230,7 +230,7 @@ HICON TrayWindow::CreateTrayIcon(double value) SolidBrush brush2(m_Color2); graphics.FillPolygon(&brush2, points, TRAYICON_SIZE + 2); - HICON icon = NULL; + HICON icon = nullptr; trayBitmap.GetHICON(&icon); return icon; } @@ -285,7 +285,7 @@ HICON TrayWindow::CreateTrayIcon(double value) Rect r(0, 0, TRAYICON_SIZE, TRAYICON_SIZE); graphics.DrawImage(m_Bitmap, r, newX, newY, TRAYICON_SIZE, TRAYICON_SIZE, UnitPixel); - HICON icon = NULL; + HICON icon = nullptr; trayBitmap.GetHICON(&icon); return icon; } @@ -340,7 +340,7 @@ void TrayWindow::SetTrayIcon(bool enabled) // Save to Rainmeter.ini. const std::wstring& iniFile = g_Rainmeter->GetIniFile(); - WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? NULL : L"0", iniFile.c_str()); + WritePrivateProfileString(L"Rainmeter", L"TrayIcon", enabled ? nullptr : L"0", iniFile.c_str()); } void TrayWindow::ReadOptions(ConfigParser& parser) @@ -350,10 +350,10 @@ void TrayWindow::ReadOptions(ConfigParser& parser) KillTimer(m_Window, TIMER_TRAYMEASURE); delete m_Measure; - m_Measure = NULL; + m_Measure = nullptr; delete m_Bitmap; - m_Bitmap = NULL; + m_Bitmap = nullptr; std::vector::const_iterator iter = m_Icons.begin(); for ( ; iter != m_Icons.end(); ++iter) @@ -375,7 +375,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser) ConfigParser* oldParser = g_Rainmeter->GetCurrentParser(); g_Rainmeter->SetCurrentParser(&parser); - m_Measure = Measure::Create(measureName.c_str(), NULL, L"TrayMeasure"); + m_Measure = Measure::Create(measureName.c_str(), nullptr, L"TrayMeasure"); if (m_Measure) { m_Measure->ReadOptions(parser); @@ -409,7 +409,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser) if (_wcsicmp(imagePath + (imageName.size() - 4), L".ico") == 0) { int count = 1; - HICON hIcon = NULL; + HICON hIcon = nullptr; // Load the icons do @@ -417,11 +417,11 @@ void TrayWindow::ReadOptions(ConfigParser& parser) WCHAR buffer[MAX_PATH]; _snwprintf_s(buffer, _TRUNCATE, imagePath, count++); - hIcon = (HICON)LoadImage(NULL, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE); + hIcon = (HICON)LoadImage(nullptr, buffer, IMAGE_ICON, TRAYICON_SIZE, TRAYICON_SIZE, LR_LOADFROMFILE); if (hIcon) m_Icons.push_back(hIcon); if (wcscmp(imagePath, buffer) == 0) break; } - while(hIcon != NULL); + while(hIcon != nullptr); } if (m_Icons.empty()) @@ -433,7 +433,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser) if (Ok != status) { delete m_Bitmap; - m_Bitmap = NULL; + m_Bitmap = nullptr; LogWarningF(L"Bitmap image not found: %s", imagePath); } } @@ -448,7 +448,7 @@ void TrayWindow::ReadOptions(ConfigParser& parser) if (m_Measure) { - SetTimer(m_Window, TIMER_TRAYMEASURE, INTERVAL_TRAYMEASURE, NULL); // Update the tray once per sec + SetTimer(m_Window, TIMER_TRAYMEASURE, INTERVAL_TRAYMEASURE, nullptr); // Update the tray once per sec } } else @@ -483,7 +483,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM break; case IDM_REFRESH: - PostMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)NULL, (LPARAM)NULL); + PostMessage(g_Rainmeter->GetWindow(), WM_RAINMETER_DELAYED_REFRESH_ALL, (WPARAM)nullptr, (LPARAM)nullptr); break; case IDM_SHOWLOGFILE: @@ -559,7 +559,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM if (index < 0) { MeterWindow* meterWindow = (*iter).second; - SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, NULL); + SendMessage(meterWindow->GetWindow(), WM_COMMAND, mID, 0); break; } } @@ -602,7 +602,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM if (*bang && !IsCtrlKeyDown()) // Ctrl is pressed, so only run default action { - g_Rainmeter->ExecuteCommand(bang, NULL); + g_Rainmeter->ExecuteCommand(bang, nullptr); tray->m_TrayContextMenuEnabled = (uMouseMsg != WM_RBUTTONDOWN); break; } @@ -618,7 +618,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM if (tray->m_TrayContextMenuEnabled) { POINT pos = System::GetCursorPosition(); - g_Rainmeter->ShowContextMenu(pos, NULL); + g_Rainmeter->ShowContextMenu(pos, nullptr); } break; @@ -702,7 +702,7 @@ LRESULT CALLBACK TrayWindow::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM { LPCWSTR folderPath = (LPCWSTR)cds->lpData; MeterWindow* mw = g_Rainmeter->GetMeterWindow(folderPath); - return (mw) ? (LRESULT)mw->GetWindow() : NULL; + return (mw) ? (LRESULT)mw->GetWindow() : 0; } } return 1; diff --git a/Library/UpdateCheck.cpp b/Library/UpdateCheck.cpp index 67a702cb..afdece2c 100644 --- a/Library/UpdateCheck.cpp +++ b/Library/UpdateCheck.cpp @@ -29,16 +29,17 @@ void CheckVersion(void* dummy) HINTERNET hRootHandle = InternetOpen( L"Rainmeter", INTERNET_OPEN_TYPE_PRECONFIG, - NULL, - NULL, + nullptr, + nullptr, 0); - if (hRootHandle == NULL) + if (hRootHandle == nullptr) { return; } - HINTERNET hUrlDump = InternetOpenUrl(hRootHandle, L"http://rainmeter.github.io/rainmeter/release", NULL, NULL, INTERNET_FLAG_RESYNCHRONIZE, 0); + HINTERNET hUrlDump = InternetOpenUrl( + hRootHandle, L"http://rainmeter.github.io/rainmeter/release", nullptr, 0, INTERNET_FLAG_RESYNCHRONIZE, 0); if (hUrlDump) { DWORD dwSize; @@ -94,5 +95,5 @@ void CheckVersion(void* dummy) void CheckUpdate() { - _beginthread(CheckVersion, 0, NULL); + _beginthread(CheckVersion, 0, nullptr); } diff --git a/Library/lua/LuaManager.cpp b/Library/lua/LuaManager.cpp index 9d2f70c2..43e40cd3 100644 --- a/Library/lua/LuaManager.cpp +++ b/Library/lua/LuaManager.cpp @@ -26,7 +26,7 @@ lua_State* LuaManager::c_State = 0; void LuaManager::Initialize() { - if (c_State == NULL) + if (c_State == nullptr) { // Initialize Lua c_State = luaL_newstate(); @@ -50,10 +50,10 @@ void LuaManager::Finalize() --c_RefCount; } - if (c_RefCount == 0 && c_State != NULL) + if (c_RefCount == 0 && c_State != nullptr) { lua_close(c_State); - c_State = NULL; + c_State = nullptr; } } diff --git a/Library/lua/LuaScript.cpp b/Library/lua/LuaScript.cpp index db032a96..6fc043fb 100644 --- a/Library/lua/LuaScript.cpp +++ b/Library/lua/LuaScript.cpp @@ -60,7 +60,7 @@ bool LuaScript::Initialize(const std::wstring& scriptFile) fread(fileData, fileSize, 1, file); fclose(file); - file = NULL; + file = nullptr; int load = luaL_loadbuffer(L, fileData, fileSize, ""); delete [] fileData; @@ -209,7 +209,7 @@ int LuaScript::RunFunctionWithReturn(const char* funcName, double& numValue, std size_t strLen = 0; const char* str = lua_tolstring(L, -1, &strLen); strValue = StringUtil::Widen(str, (int)strLen); - numValue = strtod(str, NULL); + numValue = strtod(str, nullptr); } lua_pop(L, 2); diff --git a/Library/lua/glue/LuaGlobal.cpp b/Library/lua/glue/LuaGlobal.cpp index fa95b375..414e4e9e 100644 --- a/Library/lua/glue/LuaGlobal.cpp +++ b/Library/lua/glue/LuaGlobal.cpp @@ -37,7 +37,7 @@ static int Print(lua_State* L) // Get result const char* s = lua_tostring(L, -1); - if (s == NULL) + if (s == nullptr) { return luaL_error(L, LUA_QL("tostring") " must return a string to " LUA_QL("print")); } @@ -73,7 +73,7 @@ void LuaManager::RegisterGlobal(lua_State* L) const luaL_Reg toluaFuncs[] = { { "cast", tolua_cast }, - { NULL, NULL } + { nullptr, nullptr } }; luaL_register(L, "tolua", toluaFuncs); diff --git a/Library/lua/glue/LuaMeasure.cpp b/Library/lua/glue/LuaMeasure.cpp index 3e16a923..4dec3d39 100644 --- a/Library/lua/glue/LuaMeasure.cpp +++ b/Library/lua/glue/LuaMeasure.cpp @@ -147,7 +147,7 @@ void LuaManager::RegisterMeasure(lua_State* L) { "GetMinValue", GetMinValue }, { "GetMaxValue", GetMaxValue }, { "GetStringValue", GetStringValue }, - { NULL, NULL } + { nullptr, nullptr } }; luaL_register(L, "Measure", functions); diff --git a/Library/lua/glue/LuaMeter.cpp b/Library/lua/glue/LuaMeter.cpp index 3b083d86..9d2f0227 100644 --- a/Library/lua/glue/LuaMeter.cpp +++ b/Library/lua/glue/LuaMeter.cpp @@ -164,7 +164,7 @@ void LuaManager::RegisterMeter(lua_State* L) { "Hide", Hide }, { "Show", Show }, { "SetText", SetText }, - { NULL, NULL } + { nullptr, nullptr } }; luaL_register(L, "Meter", functions); diff --git a/Library/lua/glue/LuaMeterWindow.cpp b/Library/lua/glue/LuaMeterWindow.cpp index 7c5e6d5b..498fcc08 100644 --- a/Library/lua/glue/LuaMeterWindow.cpp +++ b/Library/lua/glue/LuaMeterWindow.cpp @@ -228,7 +228,7 @@ void LuaManager::RegisterMeterWindow(lua_State* L) { "GetX", GetX }, { "GetY", GetY }, { "MakePathAbsolute", MakePathAbsolute }, - { NULL, NULL } + { nullptr, nullptr } }; luaL_register(L, "MeterWindow", functions); diff --git a/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp b/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp index c8b93672..fc63f94f 100644 --- a/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp +++ b/Plugins/PluginAdvancedCPU/AdvancedCPU.cpp @@ -61,10 +61,10 @@ void UpdateProcesses(); void SplitName(WCHAR* names, std::vector& splittedNames) { WCHAR* token = wcstok(names, L";"); - while (token != NULL) + while (token != nullptr) { splittedNames.push_back(token); - token = wcstok(NULL, L";"); + token = wcstok(nullptr, L";"); } } @@ -216,7 +216,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) return measure->topProcessName.c_str(); } - return NULL; + return nullptr; } PLUGIN_EXPORT void Finalize(void* data) @@ -248,7 +248,7 @@ void UpdateProcesses() if (pPerfObj) { for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance(); - pObjInst != NULL; + pObjInst != nullptr; pObjInst = pPerfObj->GetNextObjectInstance()) { if (pObjInst->GetObjectInstanceName(name, 256)) @@ -260,9 +260,9 @@ void UpdateProcesses() } CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(L"% Processor Time"); - if (pPerfCntr != NULL) + if (pPerfCntr != nullptr) { - pPerfCntr->GetData(data, 256, NULL); + pPerfCntr->GetData(data, 256, nullptr); if (pPerfCntr->GetSize() == 8) { diff --git a/Plugins/PluginCoreTemp/CoreTempProxy.cpp b/Plugins/PluginCoreTemp/CoreTempProxy.cpp index e2b8ac9f..f6f32077 100644 --- a/Plugins/PluginCoreTemp/CoreTempProxy.cpp +++ b/Plugins/PluginCoreTemp/CoreTempProxy.cpp @@ -91,7 +91,7 @@ LPCWSTR CoreTempProxy::GetErrorMessage() } else { - ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, lastError, 0, this->m_ErrorMessage, 99, NULL); + ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, nullptr, lastError, 0, this->m_ErrorMessage, 99, nullptr); } return this->m_ErrorMessage; diff --git a/Plugins/PluginCoreTemp/PluginCoreTemp.cpp b/Plugins/PluginCoreTemp/PluginCoreTemp.cpp index 75fccdaa..4c4fb22b 100644 --- a/Plugins/PluginCoreTemp/PluginCoreTemp.cpp +++ b/Plugins/PluginCoreTemp/PluginCoreTemp.cpp @@ -130,7 +130,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) break; default: - return NULL; + return nullptr; } return buffer; diff --git a/Plugins/PluginCoreTemp/SharedMem.cpp b/Plugins/PluginCoreTemp/SharedMem.cpp index 24efcfe3..0a598b3f 100644 --- a/Plugins/PluginCoreTemp/SharedMem.cpp +++ b/Plugins/PluginCoreTemp/SharedMem.cpp @@ -16,8 +16,8 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData) HANDLE hdlMemory; HANDLE hdlMutex; - hdlMutex = CreateMutex(NULL,FALSE,CORE_TEMP_MUTEX_OBJECT); - if (hdlMutex == NULL) + hdlMutex = CreateMutex(nullptr,FALSE,CORE_TEMP_MUTEX_OBJECT); + if (hdlMutex == nullptr) { return false; } @@ -29,7 +29,7 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData) TRUE, CORE_TEMP_MAPPING_OBJECT); // "CoreTempMappingObject" - if (hdlMemory == NULL) + if (hdlMemory == nullptr) { ReleaseMutex(hdlMutex); CloseHandle(hdlMutex); @@ -37,10 +37,10 @@ bool CSharedMemClient::ReadSharedMem(PCORE_TEMP_SHARED_DATA i_SharedData) } pSharedData = (PCORE_TEMP_SHARED_DATA)MapViewOfFile(hdlMemory, FILE_MAP_READ, 0, 0, 0); - if (pSharedData == NULL) + if (pSharedData == nullptr) { CloseHandle(hdlMemory); - hdlMemory = NULL; + hdlMemory = nullptr; ReleaseMutex(hdlMutex); CloseHandle(hdlMutex); return false; diff --git a/Plugins/PluginFolderInfo/FolderInfo.cpp b/Plugins/PluginFolderInfo/FolderInfo.cpp index 196f35c7..8f076006 100644 --- a/Plugins/PluginFolderInfo/FolderInfo.cpp +++ b/Plugins/PluginFolderInfo/FolderInfo.cpp @@ -68,7 +68,7 @@ void CFolderInfo::FreePcre() if (m_RegExpFilter) { pcre_free(m_RegExpFilter); - m_RegExpFilter = NULL; + m_RegExpFilter = nullptr; } } @@ -131,8 +131,8 @@ void CFolderInfo::CalculateSize() } else if (!isFolder && m_RegExpFilter) { - int utf8BufLen = WideCharToMultiByte(CP_UTF8, 0, findData.cFileName, wcslen(findData.cFileName) + 1, utf8Buf, MAX_PATH * 3, NULL, NULL); - if (0 != pcre_exec(m_RegExpFilter, NULL, utf8Buf, utf8BufLen, 0, 0, NULL, 0)) + int utf8BufLen = WideCharToMultiByte(CP_UTF8, 0, findData.cFileName, wcslen(findData.cFileName) + 1, utf8Buf, MAX_PATH * 3, nullptr, nullptr); + if (0 != pcre_exec(m_RegExpFilter, nullptr, utf8Buf, utf8BufLen, 0, 0, nullptr, 0)) { continue; } @@ -178,14 +178,14 @@ void CFolderInfo::SetRegExpFilter(LPCWSTR filter) if (*filter) { int filterLen = wcslen(filter) + 1; - int bufLen = WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, NULL, 0, NULL, NULL); + int bufLen = WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, nullptr, 0, nullptr, nullptr); char* buf = new char[bufLen]; - WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, buf, bufLen, NULL, NULL); + WideCharToMultiByte(CP_UTF8, 0, filter, filterLen, buf, bufLen, nullptr, nullptr); const char* error; int erroffset; - m_RegExpFilter = pcre_compile(buf, PCRE_UTF8, &error, &erroffset, NULL); + m_RegExpFilter = pcre_compile(buf, PCRE_UTF8, &error, &erroffset, nullptr); delete [] buf; } diff --git a/Plugins/PluginNowPlaying/Internet.cpp b/Plugins/PluginNowPlaying/Internet.cpp index 47d57a43..994c49c2 100644 --- a/Plugins/PluginNowPlaying/Internet.cpp +++ b/Plugins/PluginNowPlaying/Internet.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "Internet.h" -HINTERNET Internet::c_NetHandle = NULL; +HINTERNET Internet::c_NetHandle = nullptr; /* ** Initialize internet handle and crtical section. @@ -29,8 +29,8 @@ void Internet::Initialize() { c_NetHandle = InternetOpen(L"Rainmeter NowPlaying.dll", INTERNET_OPEN_TYPE_PRECONFIG, - NULL, - NULL, + nullptr, + nullptr, 0); if (!c_NetHandle) @@ -57,7 +57,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage) // From WebParser.cpp std::wstring result; DWORD flags = INTERNET_FLAG_RESYNCHRONIZE; - HINTERNET hUrlDump = InternetOpenUrl(c_NetHandle, url.c_str(), NULL, NULL, flags, 0); + HINTERNET hUrlDump = InternetOpenUrl(c_NetHandle, url.c_str(), nullptr, 0, flags, 0); if (!hUrlDump) { @@ -68,7 +68,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage) const int CHUNK_SIZE = 8192; BYTE* lpData = new BYTE[CHUNK_SIZE]; BYTE* lpOutPut; - BYTE* lpHolding = NULL; + BYTE* lpHolding = nullptr; int nCounter = 1; int nBufferSize; DWORD dwDataSize = 0; @@ -98,7 +98,7 @@ std::wstring Internet::DownloadUrl(const std::wstring& url, int codepage) lpOutPut = new BYTE[nBufferSize + 2]; // Make sure the buffer is not the initial buffer. - if (lpHolding != NULL) + if (lpHolding != nullptr) { // Copy the data in the holding buffer. memcpy(lpOutPut, lpHolding, dwDataSize); @@ -223,10 +223,10 @@ void Internet::DecodeReferences(std::wstring& str) } std::wstring num(str, pos, end - pos); - WCHAR* pch = NULL; + WCHAR* pch = nullptr; errno = 0; long ch = wcstol(num.c_str(), &pch, base); - if (pch == NULL || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character + if (pch == nullptr || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character { start = pos; continue; @@ -253,7 +253,7 @@ std::wstring Internet::ConvertToWide(LPCSTR str, int codepage) if (str && *str) { int strLen = (int)strlen(str); - int bufLen = MultiByteToWideChar(codepage, 0, str, strLen, NULL, 0); + int bufLen = MultiByteToWideChar(codepage, 0, str, strLen, nullptr, 0); if (bufLen > 0) { szWide.resize(bufLen); diff --git a/Plugins/PluginNowPlaying/NowPlaying.cpp b/Plugins/PluginNowPlaying/NowPlaying.cpp index 5ffbf557..7c5269e6 100644 --- a/Plugins/PluginNowPlaying/NowPlaying.cpp +++ b/Plugins/PluginNowPlaying/NowPlaying.cpp @@ -29,7 +29,7 @@ static std::vector g_ParentMeasures; bool g_Initialized = false; -HINSTANCE g_Instance = NULL; +HINSTANCE g_Instance = nullptr; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { @@ -116,7 +116,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) { // ParentMeasure is created when PlayerName is an actual player (and not a reference) ParentMeasure* parent = measure->parent; - Player* oldPlayer = NULL; + Player* oldPlayer = nullptr; if (parent) { if (parent->data != data) @@ -147,13 +147,13 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) } else if (_wcsicmp(L"foobar2000", str) == 0) { - HWND fooWindow = FindWindow(L"foo_rainmeter_class", NULL); + HWND fooWindow = FindWindow(L"foo_rainmeter_class", nullptr); if (fooWindow) { const WCHAR* error = L"Your foobar2000 plugin is out of date.\n\nDo you want to update the plugin now?"; - if (MessageBox(NULL, error, L"Rainmeter", MB_YESNO | MB_ICONINFORMATION | MB_TOPMOST) == IDYES) + if (MessageBox(nullptr, error, L"Rainmeter", MB_YESNO | MB_ICONINFORMATION | MB_TOPMOST) == IDYES) { - ShellExecute(NULL, L"open", L"http://github.com/poiru/foo-cad#readme", NULL, NULL, SW_SHOWNORMAL); + ShellExecute(nullptr, L"open", L"http://github.com/poiru/foo-cad#readme", nullptr, nullptr, SW_SHOWNORMAL); } } @@ -365,7 +365,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) { Measure* measure = (Measure*)data; ParentMeasure* parent = measure->parent; - if (!parent) return NULL; + if (!parent) return nullptr; const Player* player = parent->player; static WCHAR buffer[32]; @@ -435,7 +435,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) return buffer; } - return NULL; + return nullptr; } PLUGIN_EXPORT void Finalize(void* data) diff --git a/Plugins/PluginNowPlaying/Player.cpp b/Plugins/PluginNowPlaying/Player.cpp index 5afffa75..bfcddbda 100644 --- a/Plugins/PluginNowPlaying/Player.cpp +++ b/Plugins/PluginNowPlaying/Player.cpp @@ -141,7 +141,7 @@ void Player::FindLyrics() m_Lyrics.clear(); unsigned int id; - HANDLE thread = (HANDLE)_beginthreadex(NULL, 0, LyricsThreadProc, this, 0, &id); + HANDLE thread = (HANDLE)_beginthreadex(nullptr, 0, LyricsThreadProc, this, 0, &id); if (thread) { m_InternetThread = thread; @@ -185,7 +185,7 @@ unsigned __stdcall Player::LyricsThreadProc(void* pParam) } CloseHandle(player->m_InternetThread); - player->m_InternetThread = NULL; + player->m_InternetThread = nullptr; return 0; } diff --git a/Plugins/PluginNowPlaying/PlayerAIMP.cpp b/Plugins/PluginNowPlaying/PlayerAIMP.cpp index 3be170e1..869e2627 100644 --- a/Plugins/PluginNowPlaying/PlayerAIMP.cpp +++ b/Plugins/PluginNowPlaying/PlayerAIMP.cpp @@ -21,7 +21,7 @@ #include "AIMP/aimp2_sdk.h" #include "Winamp/wa_ipc.h" -Player* PlayerAIMP::c_Player = NULL; +Player* PlayerAIMP::c_Player = nullptr; /* ** Constructor. @@ -44,7 +44,7 @@ PlayerAIMP::PlayerAIMP() : Player(), */ PlayerAIMP::~PlayerAIMP() { - c_Player = NULL; + c_Player = nullptr; if (m_FileMap) UnmapViewOfFile(m_FileMap); if (m_FileMapHandle) CloseHandle(m_FileMapHandle); } @@ -79,7 +79,7 @@ bool PlayerAIMP::CheckWindow() if (m_Window) { - m_WinampWindow = FindWindow(L"Winamp v1.x", NULL); + m_WinampWindow = FindWindow(L"Winamp v1.x", nullptr); m_FileMapHandle = OpenFileMapping(FILE_MAP_READ, FALSE, L"AIMP2_RemoteInfo"); if (m_FileMapHandle) @@ -315,14 +315,14 @@ void PlayerAIMP::OpenPlayer(std::wstring& path) if (RegQueryValueEx(hKey, L"DisplayIcon", - NULL, + nullptr, (LPDWORD)&type, (LPBYTE)data, (LPDWORD)&size) == ERROR_SUCCESS) { if (type == REG_SZ) { - ShellExecute(NULL, L"open", data, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", data, nullptr, nullptr, SW_SHOW); path = data; } } @@ -338,7 +338,7 @@ void PlayerAIMP::OpenPlayer(std::wstring& path) if (RegQueryValueEx(hKey, L"DisplayIcon", - NULL, + nullptr, (LPDWORD)&type, (LPBYTE)data, (LPDWORD)&size) == ERROR_SUCCESS) @@ -348,7 +348,7 @@ void PlayerAIMP::OpenPlayer(std::wstring& path) path = data; path.resize(path.find_last_of(L'\\') + 1); path += L"AIMP3.exe"; - ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } } } @@ -358,6 +358,6 @@ void PlayerAIMP::OpenPlayer(std::wstring& path) } else { - ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } } diff --git a/Plugins/PluginNowPlaying/PlayerCAD.cpp b/Plugins/PluginNowPlaying/PlayerCAD.cpp index 7b366f7c..af0279fa 100644 --- a/Plugins/PluginNowPlaying/PlayerCAD.cpp +++ b/Plugins/PluginNowPlaying/PlayerCAD.cpp @@ -20,7 +20,7 @@ #include "PlayerCAD.h" #include "CAD/cad_sdk.h" -Player* PlayerCAD::c_Player = NULL; +Player* PlayerCAD::c_Player = nullptr; extern HINSTANCE g_Instance; // This player emulates the CD Art Display IPC interface, which is supported by @@ -45,7 +45,7 @@ PlayerCAD::PlayerCAD() : Player(), */ PlayerCAD::~PlayerCAD() { - c_Player = NULL; + c_Player = nullptr; Uninitialize(); } @@ -85,8 +85,8 @@ void PlayerCAD::Initialize() CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, g_Instance, this); @@ -98,8 +98,8 @@ void PlayerCAD::Initialize() FPCHANGEWINDOWMESSAGEFILTEREX ChangeWindowMessageFilterEx = (FPCHANGEWINDOWMESSAGEFILTEREX)GetProcAddress(hUser32, "ChangeWindowMessageFilterEx"); if (ChangeWindowMessageFilterEx) { - ChangeWindowMessageFilterEx(m_Window, WM_USER, MSGFLT_ALLOW, NULL); - ChangeWindowMessageFilterEx(m_Window, WM_COPYDATA, MSGFLT_ALLOW, NULL); + ChangeWindowMessageFilterEx(m_Window, WM_USER, MSGFLT_ALLOW, nullptr); + ChangeWindowMessageFilterEx(m_Window, WM_COPYDATA, MSGFLT_ALLOW, nullptr); } else { @@ -119,17 +119,17 @@ void PlayerCAD::Initialize() LPCTSTR file = RmGetSettingsFile(); // Read saved settings - GetPrivateProfileString(L"NowPlaying.dll", L"ClassName", NULL, buffer, MAX_PATH, file); + GetPrivateProfileString(L"NowPlaying.dll", L"ClassName", nullptr, buffer, MAX_PATH, file); std::wstring className = buffer; - GetPrivateProfileString(L"NowPlaying.dll", L"WindowName", NULL, buffer, MAX_PATH, file); + GetPrivateProfileString(L"NowPlaying.dll", L"WindowName", nullptr, buffer, MAX_PATH, file); std::wstring windowName = buffer; - GetPrivateProfileString(L"NowPlaying.dll", L"PlayerPath", NULL, buffer, MAX_PATH, file); + GetPrivateProfileString(L"NowPlaying.dll", L"PlayerPath", nullptr, buffer, MAX_PATH, file); m_PlayerPath = buffer; - LPCTSTR classSz = className.empty() ? NULL : className.c_str(); - LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); + LPCTSTR classSz = className.empty() ? nullptr : className.c_str(); + LPCTSTR windowSz = windowName.empty() ? nullptr : windowName.c_str(); if (classSz || windowSz) { @@ -138,12 +138,12 @@ void PlayerCAD::Initialize() else { classSz = L"CD Art Display IPC Class"; - m_PlayerWindow = FindWindow(classSz, NULL); + m_PlayerWindow = FindWindow(classSz, nullptr); if (m_PlayerWindow) { WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); - windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : NULL; + windowSz = (GetWindowText(m_PlayerWindow, buffer, MAX_PATH) > 0) ? buffer : nullptr; WritePrivateProfileString(L"NowPlaying.dll", L"WindowName", windowSz, file); DWORD pID; @@ -151,7 +151,7 @@ void PlayerCAD::Initialize() HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pID); if (hProcess) { - if (GetModuleFileNameEx(hProcess, NULL, buffer, MAX_PATH) > 0) + if (GetModuleFileNameEx(hProcess, nullptr, buffer, MAX_PATH) > 0) { WritePrivateProfileString(L"NowPlaying.dll", L"PlayerPath", buffer, file); } @@ -279,7 +279,7 @@ LRESULT CALLBACK PlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l WCHAR* data = (WCHAR*)cds->lpData; WCHAR* pos; UINT index = 1; - while ((pos = wcschr(data, '\t')) != NULL) + while ((pos = wcschr(data, '\t')) != nullptr) { switch (index) { @@ -368,8 +368,8 @@ LRESULT CALLBACK PlayerCAD::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l player->m_PlayerPath.assign(data, 0, len); data.erase(0, ++len); - LPCTSTR classSz = className.empty() ? NULL : className.c_str(); - LPCTSTR windowSz = windowName.empty() ? NULL : windowName.c_str(); + LPCTSTR classSz = className.empty() ? nullptr : className.c_str(); + LPCTSTR windowSz = windowName.empty() ? nullptr : windowName.c_str(); LPCTSTR file = RmGetSettingsFile(); WritePrivateProfileString(L"NowPlaying.dll", L"ClassName", classSz, file); @@ -537,15 +537,15 @@ void PlayerCAD::OpenPlayer(std::wstring& path) { if (!m_Initialized) { - HINSTANCE ret = NULL; + HINSTANCE ret = nullptr; if (!path.empty()) { - ret = ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ret = ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } else if (!m_PlayerPath.empty()) { - ret = ShellExecute(NULL, L"open", m_PlayerPath.c_str(), NULL, NULL, SW_SHOW); + ret = ShellExecute(nullptr, L"open", m_PlayerPath.c_str(), nullptr, nullptr, SW_SHOW); } m_Open = (ret > (HINSTANCE)32); diff --git a/Plugins/PluginNowPlaying/PlayerITunes.cpp b/Plugins/PluginNowPlaying/PlayerITunes.cpp index 7c5a27dd..c2e332c9 100644 --- a/Plugins/PluginNowPlaying/PlayerITunes.cpp +++ b/Plugins/PluginNowPlaying/PlayerITunes.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "PlayerITunes.h" -Player* PlayerITunes::c_Player = NULL; +Player* PlayerITunes::c_Player = nullptr; extern HINSTANCE g_Instance; /* @@ -101,7 +101,7 @@ HRESULT STDMETHODCALLTYPE PlayerITunes::CEventHandler::Invoke(DISPID dispidMembe case ITEventAboutToPromptUserToQuit: PostMessage(m_Player->m_CallbackWindow, WM_USER, ITEventAboutToPromptUserToQuit, 0); - SetTimer(m_Player->m_CallbackWindow, TIMER_CHECKACTIVE, 500, NULL); + SetTimer(m_Player->m_CallbackWindow, TIMER_CHECKACTIVE, 500, nullptr); break; } @@ -135,7 +135,7 @@ PlayerITunes::PlayerITunes() : Player(), CW_USEDEFAULT, CW_USEDEFAULT, HWND_MESSAGE, - NULL, + nullptr, g_Instance, this); } @@ -146,7 +146,7 @@ PlayerITunes::PlayerITunes() : Player(), */ PlayerITunes::~PlayerITunes() { - c_Player = NULL; + c_Player = nullptr; DestroyWindow(m_CallbackWindow); UnregisterClass(L"NowPlayingITunesClass", g_Instance); @@ -176,7 +176,7 @@ void PlayerITunes::Initialize() { while (true) { - HRESULT hr = CoCreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID*)&m_iTunes); + HRESULT hr = CoCreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER, IID_IiTunes, (PVOID*)&m_iTunes); if (hr == CO_E_SERVER_EXEC_FAILURE) { @@ -187,7 +187,7 @@ void PlayerITunes::Initialize() else if (hr != S_OK) { // Failed to get hold of iTunes instance via COM - m_iTunes = NULL; + m_iTunes = nullptr; } break; @@ -621,7 +621,7 @@ void PlayerITunes::ClosePlayer() { m_iTunes->Quit(); Uninitialize(); - SetTimer(m_CallbackWindow, TIMER_CHECKACTIVE, 500, NULL); + SetTimer(m_CallbackWindow, TIMER_CHECKACTIVE, 500, nullptr); } /* @@ -630,5 +630,5 @@ void PlayerITunes::ClosePlayer() */ void PlayerITunes::OpenPlayer(std::wstring& path) { - ShellExecute(NULL, L"open", path.empty() ? L"iTunes.exe" : path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.empty() ? L"iTunes.exe" : path.c_str(), nullptr, nullptr, SW_SHOW); } diff --git a/Plugins/PluginNowPlaying/PlayerSpotify.cpp b/Plugins/PluginNowPlaying/PlayerSpotify.cpp index c42d1846..6fbebb4f 100644 --- a/Plugins/PluginNowPlaying/PlayerSpotify.cpp +++ b/Plugins/PluginNowPlaying/PlayerSpotify.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "PlayerSpotify.h" -Player* PlayerSpotify::c_Player = NULL; +Player* PlayerSpotify::c_Player = nullptr; /* ** Constructor. @@ -37,7 +37,7 @@ PlayerSpotify::PlayerSpotify() : Player(), */ PlayerSpotify::~PlayerSpotify() { - c_Player = NULL; + c_Player = nullptr; } /* @@ -67,7 +67,7 @@ bool PlayerSpotify::CheckWindow() { m_LastCheckTime = time; - m_Window = FindWindow(L"SpotifyMainWindow", NULL); + m_Window = FindWindow(L"SpotifyMainWindow", nullptr); if (m_Window) { m_Initialized = true; @@ -202,8 +202,8 @@ void PlayerSpotify::OpenPlayer(std::wstring& path) DWORD type = 0; if (RegQueryValueEx(hKey, - NULL, - NULL, + nullptr, + nullptr, (LPDWORD)&type, (LPBYTE)data, (LPDWORD)&size) == ERROR_SUCCESS) @@ -213,7 +213,7 @@ void PlayerSpotify::OpenPlayer(std::wstring& path) path = data; path.erase(0, 1); // Get rid of the leading quote path.resize(path.length() - 3); // And the ",0 at the end - ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } } @@ -222,7 +222,7 @@ void PlayerSpotify::OpenPlayer(std::wstring& path) } else { - ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } } else diff --git a/Plugins/PluginNowPlaying/PlayerWLM.cpp b/Plugins/PluginNowPlaying/PlayerWLM.cpp index e13ec1ac..071f64ae 100644 --- a/Plugins/PluginNowPlaying/PlayerWLM.cpp +++ b/Plugins/PluginNowPlaying/PlayerWLM.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "PlayerWLM.h" -Player* PlayerWLM::c_Player = NULL; +Player* PlayerWLM::c_Player = nullptr; extern HINSTANCE g_Instance; // This player emulates the MSN/WLM Messenger 'Listening to' interface, which is @@ -47,8 +47,8 @@ PlayerWLM::PlayerWLM() : Player(), CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, + nullptr, + nullptr, g_Instance, this); @@ -61,7 +61,7 @@ PlayerWLM::PlayerWLM() : Player(), */ PlayerWLM::~PlayerWLM() { - c_Player = NULL; + c_Player = nullptr; DestroyWindow(m_Window); UnregisterClass(L"MsnMsgrUIManager", g_Instance); } diff --git a/Plugins/PluginNowPlaying/PlayerWMP.cpp b/Plugins/PluginNowPlaying/PlayerWMP.cpp index df977013..3ccad5b3 100644 --- a/Plugins/PluginNowPlaying/PlayerWMP.cpp +++ b/Plugins/PluginNowPlaying/PlayerWMP.cpp @@ -19,7 +19,7 @@ #include "StdAfx.h" #include "PlayerWMP.h" -Player* PlayerWMP::c_Player = NULL; +Player* PlayerWMP::c_Player = nullptr; extern HINSTANCE g_Instance; namespace { @@ -114,7 +114,7 @@ HRESULT STDMETHODCALLTYPE PlayerWMP::CRemoteHost::QueryInterface(IID const& riid } else { - *object = NULL; + *object = nullptr; return E_NOINTERFACE; } @@ -143,11 +143,11 @@ HRESULT PlayerWMP::CRemoteHost::GetScriptableObject(BSTR* pbstrName, IDispatch** { if (pbstrName) { - *pbstrName = NULL; + *pbstrName = nullptr; } if (ppDispatch) { - *ppDispatch = NULL; + *ppDispatch = nullptr; } return E_NOTIMPL; } @@ -220,7 +220,7 @@ PlayerWMP::PlayerWMP() : Player(), PlayerWMP::~PlayerWMP() { - c_Player = NULL; + c_Player = nullptr; Uninitialize(); } @@ -265,13 +265,13 @@ void PlayerWMP::Initialize() L"NowPlayingWMP", L"", WS_DISABLED, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, g_Instance, NULL); + nullptr, nullptr, g_Instance, nullptr); HWND window = CreateWindow( L"AtlAxWin", L"", WS_DISABLED | WS_CHILD, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - m_Window, NULL, g_Instance, NULL); + m_Window, nullptr, g_Instance, nullptr); Microsoft::WRL::ComPtr axHost; Microsoft::WRL::ComPtr hostObject; @@ -513,7 +513,7 @@ void PlayerWMP::UpdateData() { m_LastCheckTime = time; - if (FindWindow(L"WMPlayerApp", NULL)) + if (FindWindow(L"WMPlayerApp", nullptr)) { Initialize(); } @@ -639,7 +639,7 @@ void PlayerWMP::SetVolume(int volume) */ void PlayerWMP::ClosePlayer() { - HWND wnd = FindWindow(L"WMPlayerApp", NULL); + HWND wnd = FindWindow(L"WMPlayerApp", nullptr); if (wnd) { @@ -653,5 +653,5 @@ void PlayerWMP::ClosePlayer() */ void PlayerWMP::OpenPlayer(std::wstring& path) { - ShellExecute(NULL, L"open", path.empty() ? L"wmplayer.exe" : path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.empty() ? L"wmplayer.exe" : path.c_str(), nullptr, nullptr, SW_SHOW); } diff --git a/Plugins/PluginNowPlaying/PlayerWinamp.cpp b/Plugins/PluginNowPlaying/PlayerWinamp.cpp index dda9134b..591fff20 100644 --- a/Plugins/PluginNowPlaying/PlayerWinamp.cpp +++ b/Plugins/PluginNowPlaying/PlayerWinamp.cpp @@ -22,7 +22,7 @@ #include "Winamp/wa_ipc.h" #include "Winamp/wa_cmd.h" -Player* PlayerWinamp::c_Player = NULL; +Player* PlayerWinamp::c_Player = nullptr; // This player retrieves data through the Winamp IPC interface. @@ -47,7 +47,7 @@ PlayerWinamp::PlayerWinamp(WINAMPTYPE type) : Player(), */ PlayerWinamp::~PlayerWinamp() { - c_Player = NULL; + c_Player = nullptr; if (m_WinampHandle) CloseHandle(m_WinampHandle); } @@ -78,7 +78,7 @@ bool PlayerWinamp::CheckWindow() { m_LastCheckTime = time; - m_Window = FindWindow(L"Winamp v1.x", NULL); + m_Window = FindWindow(L"Winamp v1.x", nullptr); if (m_Window) { DWORD pID; @@ -136,7 +136,7 @@ void PlayerWinamp::UpdateData() if (m_UseUnicodeAPI) { - if (!ReadProcessMemory(m_WinampHandle, m_WinampAddress, &wBuffer, sizeof(wBuffer), NULL)) + if (!ReadProcessMemory(m_WinampHandle, m_WinampAddress, &wBuffer, sizeof(wBuffer), nullptr)) { // Failed to read memory return; @@ -148,7 +148,7 @@ void PlayerWinamp::UpdateData() int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS); LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTFILE); - if (!ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), NULL)) + if (!ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), nullptr)) { // Failed to read memory return; @@ -281,13 +281,13 @@ void PlayerWinamp::UpdateData() if (m_UseUnicodeAPI) { LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE); - ReadProcessMemory(m_WinampHandle, address, &wBuffer, sizeof(wBuffer), NULL); + ReadProcessMemory(m_WinampHandle, address, &wBuffer, sizeof(wBuffer), nullptr); } else { int pos = SendMessage(m_Window, WM_WA_IPC, 0, IPC_GETLISTPOS); LPCVOID address = (LPCVOID)SendMessage(m_Window, WM_WA_IPC, pos, IPC_GETPLAYLISTTITLE); - ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), NULL); + ReadProcessMemory(m_WinampHandle, address, &cBuffer, sizeof(cBuffer), nullptr); mbstowcs(wBuffer, cBuffer, MAX_PATH); } @@ -458,7 +458,7 @@ void PlayerWinamp::OpenPlayer(std::wstring& path) { if (m_WinampType == WA_WINAMP) { - ShellExecute(NULL, L"open", path.empty() ? L"winamp.exe" : path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.empty() ? L"winamp.exe" : path.c_str(), nullptr, nullptr, SW_SHOW); } else // if (m_WinampType == WA_MEDIAMONKEY) { @@ -477,15 +477,15 @@ void PlayerWinamp::OpenPlayer(std::wstring& path) DWORD type = 0; if (RegQueryValueEx(hKey, - NULL, - NULL, + nullptr, + nullptr, (LPDWORD)&type, (LPBYTE)data, (LPDWORD)&size) == ERROR_SUCCESS) { if (type == REG_SZ) { - ShellExecute(NULL, L"open", data, NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", data, nullptr, nullptr, SW_SHOW); path = data; } } @@ -495,7 +495,7 @@ void PlayerWinamp::OpenPlayer(std::wstring& path) } else { - ShellExecute(NULL, L"open", path.c_str(), NULL, NULL, SW_SHOW); + ShellExecute(nullptr, L"open", path.c_str(), nullptr, nullptr, SW_SHOW); } } } diff --git a/Plugins/PluginPerfMon/ObjList.cpp b/Plugins/PluginPerfMon/ObjList.cpp index 77c95fdc..06caceee 100644 --- a/Plugins/PluginPerfMon/ObjList.cpp +++ b/Plugins/PluginPerfMon/ObjList.cpp @@ -42,7 +42,7 @@ CPerfObjectList::GetFirstPerfObject( void ) CPerfObject * CPerfObjectList::GetNextPerfObject( void ) { - // Are we at the last object in the list? Return NULL if so. + // Are we at the last object in the list? Return nullptr if so. if ( ++m_currentObjectListIndex >= m_pPerfSnapshot->GetNumObjectTypes() ) return 0; diff --git a/Plugins/PluginPerfMon/PerfData.cpp b/Plugins/PluginPerfMon/PerfData.cpp index 4aff9a96..e547c050 100644 --- a/Plugins/PluginPerfMon/PerfData.cpp +++ b/Plugins/PluginPerfMon/PerfData.cpp @@ -149,7 +149,7 @@ ULONGLONG GetPerfData(LPCWSTR objectName, LPCWSTR instanceName, LPCWSTR counterN if (pPerfObj) { for (CPerfObjectInstance* pObjInst = pPerfObj->GetFirstObjectInstance(); - pObjInst != NULL; + pObjInst != nullptr; pObjInst = pPerfObj->GetNextObjectInstance()) { if (*instanceName) @@ -170,9 +170,9 @@ ULONGLONG GetPerfData(LPCWSTR objectName, LPCWSTR instanceName, LPCWSTR counterN } CPerfCounter* pPerfCntr = pObjInst->GetCounterByName(counterName); - if (pPerfCntr != NULL) + if (pPerfCntr != nullptr) { - pPerfCntr->GetData(data, 256, NULL); + pPerfCntr->GetData(data, 256, nullptr); if (pPerfCntr->GetSize() == 1) { diff --git a/Plugins/PluginPerfMon/PerfSnap.cpp b/Plugins/PluginPerfMon/PerfSnap.cpp index 769038ab..7bd2e7fc 100644 --- a/Plugins/PluginPerfMon/PerfSnap.cpp +++ b/Plugins/PluginPerfMon/PerfSnap.cpp @@ -17,7 +17,7 @@ #include "perfsnap.h" #include "makeptr.h" -PBYTE CPerfSnapshot::c_pBuffer = NULL; +PBYTE CPerfSnapshot::c_pBuffer = nullptr; DWORD CPerfSnapshot::c_cbBufferSize = 0; CPerfSnapshot::CPerfSnapshot( diff --git a/Plugins/PluginPerfMon/Titledb.cpp b/Plugins/PluginPerfMon/Titledb.cpp index 9fe530b6..49ab5f81 100644 --- a/Plugins/PluginPerfMon/Titledb.cpp +++ b/Plugins/PluginPerfMon/Titledb.cpp @@ -96,7 +96,7 @@ CPerfTitleDatabase::CPerfTitleDatabase( // The raw data entries are an ASCII string index (e.g., "242"), followed // by the corresponding string. Fill in the appropriate slot in the // m_TitleStrings array with the pointer to the string name. The end - // of the list is indicated by a double NULL. + // of the list is indicated by a double nullptr. PTSTR pszWorkStr = (PTSTR)m_pszRawStrings; unsigned cbCurrStr; diff --git a/Plugins/PluginPing/Ping.cpp b/Plugins/PluginPing/Ping.cpp index d481d4ef..fd6a6f8b 100644 --- a/Plugins/PluginPing/Ping.cpp +++ b/Plugins/PluginPing/Ping.cpp @@ -43,7 +43,7 @@ struct MeasureData threadActive(false), value(), finishAction(), - skin(NULL) + skin(nullptr) { } }; @@ -83,11 +83,11 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) if (*value) { int strLen = (int)wcslen(value) + 1; - int bufLen = WideCharToMultiByte(CP_ACP, 0, value, strLen, NULL, 0, NULL, NULL); + int bufLen = WideCharToMultiByte(CP_ACP, 0, value, strLen, nullptr, 0, nullptr, nullptr); if (bufLen > 0) { char* buffer = new char[bufLen]; - WideCharToMultiByte(CP_ACP, 0, value, strLen, buffer, bufLen, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, value, strLen, buffer, bufLen, nullptr, nullptr); measure->destAddr = inet_addr(buffer); if (measure->destAddr == INADDR_NONE) @@ -136,7 +136,7 @@ DWORD WINAPI NetworkThreadProc(void* pParam) HANDLE hIcmpFile = IcmpCreateFile(); if (hIcmpFile != INVALID_HANDLE_VALUE) { - IcmpSendEcho(hIcmpFile, measure->destAddr, NULL, 0, NULL, buffer, bufferSize, measure->timeout); + IcmpSendEcho(hIcmpFile, measure->destAddr, nullptr, 0, nullptr, buffer, bufferSize, measure->timeout); IcmpCloseHandle(hIcmpFile); ICMP_ECHO_REPLY* reply = (ICMP_ECHO_REPLY*)buffer; @@ -148,7 +148,7 @@ DWORD WINAPI NetworkThreadProc(void* pParam) } } - HMODULE module = NULL; + HMODULE module = nullptr; EnterCriticalSection(&g_CriticalSection); if (measure->threadActive) @@ -188,7 +188,7 @@ PLUGIN_EXPORT double Update(void* data) { // Launch a new thread to fetch the web data DWORD id; - HANDLE thread = CreateThread(NULL, 0, NetworkThreadProc, measure, 0, &id); + HANDLE thread = CreateThread(nullptr, 0, NetworkThreadProc, measure, 0, &id); if (thread) { CloseHandle(thread); diff --git a/Plugins/PluginPower/PowerPlugin.cpp b/Plugins/PluginPower/PowerPlugin.cpp index e1e3376f..e1a80e7f 100644 --- a/Plugins/PluginPower/PowerPlugin.cpp +++ b/Plugins/PluginPower/PowerPlugin.cpp @@ -173,7 +173,7 @@ PLUGIN_EXPORT double Update(void* data) { PROCESSOR_POWER_INFORMATION* ppi = new PROCESSOR_POWER_INFORMATION[g_NumOfProcessors]; memset(ppi, 0, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); - CallNtPowerInformation(ProcessorInformation, NULL, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); + CallNtPowerInformation(ProcessorInformation, nullptr, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) * g_NumOfProcessors); double value = (measure->type == POWER_MHZ) ? ppi[0].CurrentMhz : ppi[0].CurrentMhz * 1000000.0; delete [] ppi; return value; @@ -223,7 +223,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) } } - return NULL; + return nullptr; } PLUGIN_EXPORT void Finalize(void* data) diff --git a/Plugins/PluginQuote/Quote.cpp b/Plugins/PluginQuote/Quote.cpp index 0710343b..e8b4a6ad 100644 --- a/Plugins/PluginQuote/Quote.cpp +++ b/Plugins/PluginQuote/Quote.cpp @@ -127,7 +127,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) measure->separator = RmReadString(rm, L"Separator", L"\n"); } - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); } PLUGIN_EXPORT double Update(void* data) @@ -163,8 +163,8 @@ PLUGIN_EXPORT double Update(void* data) WCHAR* wBuffer = (WCHAR*)buffer; // Read until we find the first separator - WCHAR* sepPos1 = NULL; - WCHAR* sepPos2 = NULL; + WCHAR* sepPos1 = nullptr; + WCHAR* sepPos2 = nullptr; do { size_t len = fread(buffer, sizeof(BYTE), BUFFER_SIZE, file); @@ -172,7 +172,7 @@ PLUGIN_EXPORT double Update(void* data) buffer[len + 1] = 0; sepPos1 = wcsstr(wBuffer, measure->separator.c_str()); - if (sepPos1 == NULL) + if (sepPos1 == nullptr) { // The separator wasn't found if (feof(file)) @@ -191,13 +191,13 @@ PLUGIN_EXPORT double Update(void* data) sepPos1 += measure->separator.size(); } } - while (sepPos1 == NULL); + while (sepPos1 == nullptr); // Find the second separator do { sepPos2 = wcsstr(sepPos1, measure->separator.c_str()); - if (sepPos2 == NULL) + if (sepPos2 == nullptr) { // The separator wasn't found if (feof(file)) @@ -228,7 +228,7 @@ PLUGIN_EXPORT double Update(void* data) measure->value += sepPos1; } } - while (sepPos2 == NULL); + while (sepPos2 == nullptr); } else { @@ -239,15 +239,15 @@ PLUGIN_EXPORT double Update(void* data) const char* separatorSz = separator.c_str(); // Read until we find the first separator - char* sepPos1 = NULL; - char* sepPos2 = NULL; + char* sepPos1 = nullptr; + char* sepPos2 = nullptr; do { size_t len = fread(buffer, sizeof(char), BUFFER_SIZE, file); aBuffer[len] = 0; sepPos1 = strstr(aBuffer, separatorSz); - if (sepPos1 == NULL) + if (sepPos1 == nullptr) { // The separator wasn't found if (feof(file)) @@ -265,13 +265,13 @@ PLUGIN_EXPORT double Update(void* data) sepPos1 += separator.size(); } } - while (sepPos1 == NULL); + while (sepPos1 == nullptr); // Find the second separator do { sepPos2 = strstr(sepPos1, separatorSz); - if (sepPos2 == NULL) + if (sepPos2 == nullptr) { // The separator wasn't found if (feof(file)) @@ -301,7 +301,7 @@ PLUGIN_EXPORT double Update(void* data) measure->value += StringUtil::Widen(sepPos1); } } - while (sepPos2 == NULL); + while (sepPos2 == nullptr); } } diff --git a/Plugins/PluginRecycleManager/RecycleManager.cpp b/Plugins/PluginRecycleManager/RecycleManager.cpp index 5155e531..184f602a 100644 --- a/Plugins/PluginRecycleManager/RecycleManager.cpp +++ b/Plugins/PluginRecycleManager/RecycleManager.cpp @@ -119,7 +119,7 @@ PLUGIN_EXPORT double Update(void* data) g_UpdateCount = g_InstanceCount * -2; DWORD id; - HANDLE thread = CreateThread(NULL, 0, QueryRecycleBinThreadProc, NULL, 0, &id); + HANDLE thread = CreateThread(nullptr, 0, QueryRecycleBinThreadProc, nullptr, 0, &id); if (thread) { CloseHandle(thread); @@ -167,15 +167,15 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args) if (_wcsicmp(args, L"EmptyBin") == 0) { - SHEmptyRecycleBin(NULL, NULL, 0); + SHEmptyRecycleBin(nullptr, nullptr, 0); } else if (_wcsicmp(args, L"EmptyBinSilent") == 0) { - SHEmptyRecycleBin(NULL, NULL, SHERB_NOCONFIRMATION | SHERB_NOPROGRESSUI | SHERB_NOSOUND); + SHEmptyRecycleBin(nullptr, nullptr, SHERB_NOCONFIRMATION | SHERB_NOPROGRESSUI | SHERB_NOSOUND); } else if (_wcsicmp(args, L"OpenBin") == 0) { - ShellExecute(NULL, L"open", L"explorer.exe", L"/N,::{645FF040-5081-101B-9F08-00AA002F954E}", NULL, SW_SHOW); + ShellExecute(nullptr, L"open", L"explorer.exe", L"/N,::{645FF040-5081-101B-9F08-00AA002F954E}", nullptr, SW_SHOW); } } @@ -185,12 +185,12 @@ DWORD WINAPI QueryRecycleBinThreadProc(void* pParam) SHQUERYRBINFO rbi = {0}; rbi.cbSize = sizeof(SHQUERYRBINFO); - SHQueryRecycleBin(NULL, &rbi); + SHQueryRecycleBin(nullptr, &rbi); g_BinCount = (double)rbi.i64NumItems; g_BinSize = (double)rbi.i64Size; EnterCriticalSection(&g_CriticalSection); - HMODULE module = NULL; + HMODULE module = nullptr; if (g_FreeInstanceInThread) { DWORD flags = GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; @@ -227,7 +227,7 @@ bool HasRecycleBinChanged() if (ls == ERROR_SUCCESS) { DWORD volumeCount = 0; - RegQueryInfoKey(volumeKey, NULL, NULL, NULL, &volumeCount, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + RegQueryInfoKey(volumeKey, nullptr, nullptr, nullptr, &volumeCount, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); if (volumeCount != s_LastVolumeCount) { s_LastVolumeCount = volumeCount; @@ -238,14 +238,14 @@ bool HasRecycleBinChanged() DWORD bufferSize = _countof(buffer); DWORD index = 0; - while ((ls = RegEnumKeyEx(volumeKey, index, buffer, &bufferSize, NULL, NULL, NULL, NULL)) == ERROR_SUCCESS) + while ((ls = RegEnumKeyEx(volumeKey, index, buffer, &bufferSize, nullptr, nullptr, nullptr, nullptr)) == ERROR_SUCCESS) { HKEY volumeSubKey; ls = RegOpenKeyEx(volumeKey, buffer, 0, KEY_QUERY_VALUE, &volumeSubKey); if (ls == ERROR_SUCCESS) { ULONGLONG lastWriteTime; - ls = RegQueryInfoKey(volumeSubKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&lastWriteTime); + ls = RegQueryInfoKey(volumeSubKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (FILETIME*)&lastWriteTime); if (ls == ERROR_SUCCESS) { if (lastWriteTime > s_LastWriteTime) @@ -274,7 +274,7 @@ bool HasRecycleBinChanged() if (ls == ERROR_SUCCESS) { ULONGLONG lastWriteTime; - ls = RegQueryInfoKey(iconKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, (FILETIME*)&lastWriteTime); + ls = RegQueryInfoKey(iconKey, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, (FILETIME*)&lastWriteTime); if (ls == ERROR_SUCCESS) { if (lastWriteTime > s_LastWriteTime) diff --git a/Plugins/PluginResMon/ResMon.cpp b/Plugins/PluginResMon/ResMon.cpp index 4915cb19..23bb4def 100644 --- a/Plugins/PluginResMon/ResMon.cpp +++ b/Plugins/PluginResMon/ResMon.cpp @@ -103,7 +103,7 @@ PLUGIN_EXPORT double Update(void* data) if (measure->type == WINDOW_COUNT) { g_WindowCount = 0; - EnumChildWindows(NULL, EnumWindowProc, 0); + EnumChildWindows(nullptr, EnumWindowProc, 0); return g_WindowCount; } @@ -133,7 +133,7 @@ PLUGIN_EXPORT double Update(void* data) for (UINT i = 0, isize = bytesNeeded / sizeof(DWORD); i < isize; ++i) { HANDLE hProcess = OpenProcess(flags, true, aProcesses[i]); - if (hProcess != NULL) + if (hProcess != nullptr) { if (name) { diff --git a/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp b/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp index 0df7536e..54dc66f6 100644 --- a/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp +++ b/Plugins/PluginSpeedFan/SpeedFanPlugin.cpp @@ -140,7 +140,7 @@ PLUGIN_EXPORT void Finalize(void* data) void ReadSharedData(SensorType type, ScaleType scale, UINT number, double* value) { HANDLE hData = OpenFileMapping(FILE_MAP_READ, FALSE, L"SFSharedMemory_ALM"); - if (hData == NULL) return; + if (hData == nullptr) return; SpeedFanData* ptr = (SpeedFanData*)MapViewOfFile(hData, FILE_MAP_READ, 0, 0, 0); if (ptr == 0) diff --git a/Plugins/PluginSysInfo/SysInfo.cpp b/Plugins/PluginSysInfo/SysInfo.cpp index 87f19a1f..dd189d9a 100644 --- a/Plugins/PluginSysInfo/SysInfo.cpp +++ b/Plugins/PluginSysInfo/SysInfo.cpp @@ -86,11 +86,11 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm) { if (GetSystemMetrics(SM_CMONITORS) > 32) { - LSLog(LOG_ERROR, NULL, L"SysInfo.dll: Max amount of monitors supported is 32."); + LSLog(LOG_ERROR, nullptr, L"SysInfo.dll: Max amount of monitors supported is 32."); } m_Monitors.count = 0; - EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, (LPARAM)(&m_Monitors)); + EnumDisplayMonitors(nullptr, nullptr, MyInfoEnumProc, (LPARAM)(&m_Monitors)); g_Initialized = true; } } @@ -361,7 +361,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) break; } - return NULL; + return nullptr; } PLUGIN_EXPORT double Update(void* data) diff --git a/Plugins/PluginVirtualDesktops/DexpotMeasure.cpp b/Plugins/PluginVirtualDesktops/DexpotMeasure.cpp index 2ebb8427..bb11ba76 100644 --- a/Plugins/PluginVirtualDesktops/DexpotMeasure.cpp +++ b/Plugins/PluginVirtualDesktops/DexpotMeasure.cpp @@ -25,13 +25,13 @@ #include "../../Library/Export.h" int DexpotMeasure::InstanceCount = 0; -HWND DexpotMeasure::hWndDexpot = NULL; -HWND DexpotMeasure::hWndMessageWindow = NULL; +HWND DexpotMeasure::hWndDexpot = nullptr; +HWND DexpotMeasure::hWndMessageWindow = nullptr; std::set DexpotMeasure::DexpotMeasures; TCHAR DexpotMeasure::StringBuffer[STRINGBUFFER_SIZE]; UINT DexpotMeasure::WM_DEXPOTSTARTED = RegisterWindowMessage(_T("DexpotStarted")); BOOL DexpotMeasure::PluginRegistered = FALSE; -HWND DexpotMeasure::hWndRainmeterControl = NULL; +HWND DexpotMeasure::hWndRainmeterControl = nullptr; int DexpotMeasure::CurrentDesktop = 0; std::vector DexpotDesktopNameMeasure::DesktopNames; @@ -54,7 +54,7 @@ DexpotMeasure* DexpotMeasure::CreateMeasure(HMODULE instance, UINT id, LPCTSTR i else if (TypeString == _T("DesktopWallpaper")) return new DexpotDesktopWallpaperMeasure(instance, id); else if (TypeString == _T("Command")) return new DexpotCommandMeasure(instance, id); - return NULL; + return nullptr; } UINT DexpotMeasure::Initialize(LPCTSTR iniFile, LPCTSTR section) @@ -115,7 +115,7 @@ BOOL DexpotMeasure::FindDexpotWindow() { if (IsWindow(hWndDexpot)) return TRUE; hWndDexpot = FindWindow(DEXPOTCLASS, DEXPOTTITLE); - return hWndDexpot != NULL; + return hWndDexpot != nullptr; } HWND DexpotMeasure::CreateMessageWindow() @@ -128,9 +128,9 @@ HWND DexpotMeasure::CreateMessageWindow() wc.lpfnWndProc = WindowProc; RegisterClass(&wc); - HWND hWnd = CreateWindowEx(0, _T("DexpotPluginWindowClass"), _T("Dexpot Rainmeter Plugin"), 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); + HWND hWnd = CreateWindowEx(0, _T("DexpotPluginWindowClass"), _T("Dexpot Rainmeter Plugin"), 0, 0, 0, 0, 0, nullptr, nullptr, hInstance, nullptr); SetWindowLong(hWnd, GWL_STYLE, 0); - SetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); + SetWindowPos(hWnd, nullptr, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); MoveWindow(hWnd, 0, 0, 0, 0, FALSE); return hWnd; @@ -385,7 +385,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot() { int Desktop = DesktopNumber == 0 ? CurrentDesktop : DesktopNumber; int nBytes = 0; - BYTE *pBytes = NULL; + BYTE *pBytes = nullptr; HANDLE fm; HANDLE mutex; @@ -429,7 +429,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot() bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = nBytes; - ScreenDC = GetDC(NULL); + ScreenDC = GetDC(nullptr); MemDC = CreateCompatibleDC(ScreenDC); MemDC2 = CreateCompatibleDC(ScreenDC); OriginalBitmap = CreateCompatibleBitmap(ScreenDC, DesktopWidth, DesktopHeight); @@ -441,7 +441,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot() bmi.bmiHeader.biHeight = ScaledHeight; bmi.bmiHeader.biSizeImage = nBytes; - ScaledBitmap = CreateDIBSection(MemDC, &bmi, 0, (void**) &ScaledBytes, NULL, 0); + ScaledBitmap = CreateDIBSection(MemDC, &bmi, 0, (void**) &ScaledBytes, nullptr, 0); OldBitmap = SelectObject(MemDC, (HGDIOBJ) ScaledBitmap); SetStretchBltMode(MemDC, HALFTONE); StretchBlt(MemDC, 0, 0, ScaledWidth, ScaledHeight, MemDC2, 0, 0, DesktopWidth, DesktopHeight, SRCCOPY); @@ -467,7 +467,7 @@ void DexpotScreenshotMeasure::UpdateScreenshot() DeleteObject(OriginalBitmap); DeleteDC(MemDC); DeleteDC(MemDC2); - ReleaseDC(NULL, ScreenDC); + ReleaseDC(nullptr, ScreenDC); } UnmapViewOfFile(pBytes); diff --git a/Plugins/PluginVirtualDesktops/VirtuaWinMeasure.cpp b/Plugins/PluginVirtualDesktops/VirtuaWinMeasure.cpp index 0b9f99fc..41d328a8 100644 --- a/Plugins/PluginVirtualDesktops/VirtuaWinMeasure.cpp +++ b/Plugins/PluginVirtualDesktops/VirtuaWinMeasure.cpp @@ -23,7 +23,7 @@ #include "VirtuaWinMessages.h" #include "../../Library/Export.h" -HWND VirtuaWinMeasure::vwHandle = NULL; +HWND VirtuaWinMeasure::vwHandle = nullptr; std::map VirtuaWinMeasure::StringToType; VirtuaWinMeasure::VirtuaWinMeasure(HMODULE instance, UINT id) : VDMeasure(instance, id) @@ -144,5 +144,5 @@ BOOL VirtuaWinMeasure::FindVirtuaWinWindow() { if (IsWindow(vwHandle)) return TRUE; vwHandle = FindWindow(_T("VirtuaWinMainClass"), _T("VirtuaWinMainClass")); - return vwHandle != NULL; + return vwHandle != nullptr; } diff --git a/Plugins/PluginVirtualDesktops/VirtualDesktops.cpp b/Plugins/PluginVirtualDesktops/VirtualDesktops.cpp index e61f3e5a..387e4548 100644 --- a/Plugins/PluginVirtualDesktops/VirtualDesktops.cpp +++ b/Plugins/PluginVirtualDesktops/VirtualDesktops.cpp @@ -90,7 +90,7 @@ HMODULE VDMeasure::hInstance; UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) { - VDMeasure *Measure = NULL; + VDMeasure *Measure = nullptr; LPCTSTR VDManager = ReadConfigString(section, _T("VDManager"), _T("")); if (_tcsicmp(VDManager, _T("Dexpot")) == 0) diff --git a/Plugins/PluginWebParser/WebParser.cpp b/Plugins/PluginWebParser/WebParser.cpp index 29c0e91f..0a11fd81 100644 --- a/Plugins/PluginWebParser/WebParser.cpp +++ b/Plugins/PluginWebParser/WebParser.cpp @@ -30,12 +30,12 @@ #include "../../Common/StringUtil.h" #include "../API/RainmeterAPI.h" -void ShowError(int lineNumber, WCHAR* errorMsg = NULL); +void ShowError(int lineNumber, WCHAR* errorMsg = nullptr); class ProxyCachePool { public: - ProxyCachePool(LPCWSTR globalProxyName = NULL) : + ProxyCachePool(LPCWSTR globalProxyName = nullptr) : m_GlobalProxyName((globalProxyName && *globalProxyName) ? globalProxyName : L"/auto") { m_GlobalProxyCache = new ProxyCache(CreateProxy(m_GlobalProxyName.c_str()), true); @@ -57,7 +57,7 @@ public: HINTERNET GetCache(const std::wstring& proxyName) { - ProxyCache* cache = NULL; + ProxyCache* cache = nullptr; if (proxyName.empty()) { @@ -125,12 +125,12 @@ private: if (_wcsicmp(proxyName, L"/auto") == 0) { proxyType = INTERNET_OPEN_TYPE_PRECONFIG; - proxyServer = NULL; + proxyServer = nullptr; } else if (_wcsicmp(proxyName, L"/none") == 0) { proxyType = INTERNET_OPEN_TYPE_DIRECT; - proxyServer = NULL; + proxyServer = nullptr; } else { @@ -141,7 +141,7 @@ private: HINTERNET handle = InternetOpen(L"Rainmeter WebParser plugin", proxyType, proxyServer, - NULL, + nullptr, 0); if (handle) @@ -179,7 +179,7 @@ private: ProxyCache() {} ProxyCache(const ProxyCache& cache) {} - void Dispose() { if (m_Handle) { InternetCloseHandle(m_Handle); m_Handle = NULL; } } + void Dispose() { if (m_Handle) { InternetCloseHandle(m_Handle); m_Handle = nullptr; } } HINTERNET m_Handle; bool m_IsGlobal; @@ -248,7 +248,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam); void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize); CRITICAL_SECTION g_CriticalSection; -ProxyCachePool* g_ProxyCachePool = NULL; +ProxyCachePool* g_ProxyCachePool = nullptr; UINT g_InstanceCount = 0; static std::vector g_Measures; @@ -327,10 +327,10 @@ void DecodeReferences(std::wstring& str, int opt) } std::wstring num(str, pos, end - pos); - WCHAR* pch = NULL; + WCHAR* pch = nullptr; errno = 0; long ch = wcstol(num.c_str(), &pch, base); - if (pch == NULL || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character + if (pch == nullptr || *pch != L'\0' || errno == ERANGE || ch <= 0 || ch >= 0xFFFE) // invalid character { start = pos; continue; @@ -656,7 +656,7 @@ void SetupGlobalProxySetting() WCHAR buffer[MAX_PATH] = {0}; LPCWSTR file = RmGetSettingsFile(); - GetPrivateProfileString(L"WebParser.dll", L"ProxyServer", NULL, buffer, MAX_PATH, file); + GetPrivateProfileString(L"WebParser.dll", L"ProxyServer", nullptr, buffer, MAX_PATH, file); g_ProxyCachePool = new ProxyCachePool(buffer); } } @@ -664,7 +664,7 @@ void SetupGlobalProxySetting() void ClearGlobalProxySetting() { delete g_ProxyCachePool; - g_ProxyCachePool = NULL; + g_ProxyCachePool = nullptr; } void SetupProxySetting(ProxySetting& setting, void* rm) @@ -683,7 +683,7 @@ void ClearProxySetting(ProxySetting& setting) g_ProxyCachePool->RemoveCache(setting.server); } - setting.handle = NULL; + setting.handle = nullptr; setting.server.clear(); } @@ -767,7 +767,7 @@ PLUGIN_EXPORT double Update(void* data) { // Launch a new thread to fetch the web data unsigned int id; - HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, measure, 0, &id); + HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, measure, 0, &id); if (threadHandle) { measure->dlThreadHandle = threadHandle; @@ -797,7 +797,7 @@ PLUGIN_EXPORT double Update(void* data) if (!measure->resultString.empty()) { - value = wcstod(measure->resultString.c_str(), NULL); + value = wcstod(measure->resultString.c_str(), nullptr); } LeaveCriticalSection(&g_CriticalSection); @@ -811,7 +811,7 @@ PLUGIN_EXPORT double Update(void* data) { // Launch a new thread to fetch the web data unsigned int id; - HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkThreadProc, measure, 0, &id); + HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkThreadProc, measure, 0, &id); if (threadHandle) { measure->threadHandle = threadHandle; @@ -901,9 +901,9 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize) flags, // default options &error, // for error message &erroffset, // for error offset - NULL); // use default character tables + nullptr); // use default character tables - if (re != NULL) + if (re != nullptr) { // Compilation succeeded: match the subject in the second argument std::string utf8Data; @@ -925,7 +925,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize) rc = pcre_exec( re, // the compiled pattern - NULL, // no extra data - we didn't study the pattern + nullptr, // no extra data - we didn't study the pattern parseData, // the subject string dwSize, // the length of the subject 0, // start at offset 0 in the subject @@ -1041,7 +1041,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize) { // Start the download thread unsigned int id; - HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, (*i), 0, &id); + HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, (*i), 0, &id); if (threadHandle) { (*i)->dlThreadHandle = threadHandle; @@ -1139,7 +1139,7 @@ void ParseData(MeasureData* measure, LPCSTR parseData, DWORD dwSize) { // Start the download thread unsigned int id; - HANDLE threadHandle = (HANDLE)_beginthreadex(NULL, 0, NetworkDownloadThreadProc, measure, 0, &id); + HANDLE threadHandle = (HANDLE)_beginthreadex(nullptr, 0, NetworkDownloadThreadProc, measure, 0, &id); if (threadHandle) { measure->dlThreadHandle = threadHandle; @@ -1229,7 +1229,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam) } PathCanonicalize(buffer, measure->downloadFolder.c_str()); - CreateDirectory(buffer, NULL); // Make sure that the folder exists + CreateDirectory(buffer, nullptr); // Make sure that the folder exists wcscat(buffer, path.c_str()); @@ -1245,7 +1245,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam) GetTempPath(MAX_PATH, buffer); wcscat(buffer, L"Rainmeter-Cache\\"); // "%TEMP%\Rainmeter-Cache\" } - CreateDirectory(buffer, NULL); // Make sure that the folder exists + CreateDirectory(buffer, nullptr); // Make sure that the folder exists directory = buffer; if (fullpath.empty()) @@ -1358,7 +1358,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam) } // Create empty file - HANDLE hFile = CreateFile(fullpath.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(fullpath.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); LeaveCriticalSection(&g_CriticalSection); @@ -1384,7 +1384,7 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam) if (ret == ERROR_SUCCESS) { DWORD size = sizeof(mode); - ret = RegQueryValueEx(hKey, L"SyncMode5", NULL, NULL, (LPBYTE)&mode, &size); + ret = RegQueryValueEx(hKey, L"SyncMode5", nullptr, nullptr, (LPBYTE)&mode, &size); RegCloseKey(hKey); } @@ -1412,10 +1412,10 @@ unsigned __stdcall NetworkDownloadThreadProc(void* pParam) log += fullpath; RmLog(LOG_DEBUG, log.c_str()); - HRESULT resultCoInitialize = CoInitialize(NULL); // requires before calling URLDownloadToFile function + HRESULT resultCoInitialize = CoInitialize(nullptr); // requires before calling URLDownloadToFile function // Download the file - HRESULT result = URLDownloadToFile(NULL, url.c_str(), fullpath.c_str(), NULL, NULL); + HRESULT result = URLDownloadToFile(nullptr, url.c_str(), fullpath.c_str(), 0, nullptr); if (result == S_OK) { EnterCriticalSection(&g_CriticalSection); @@ -1546,7 +1546,7 @@ PLUGIN_EXPORT void Finalize(void* data) EnterCriticalSection(&g_CriticalSection); TerminateThread(measure->threadHandle, 0); - measure->threadHandle = NULL; + measure->threadHandle = nullptr; LeaveCriticalSection(&g_CriticalSection); } @@ -1557,7 +1557,7 @@ PLUGIN_EXPORT void Finalize(void* data) EnterCriticalSection(&g_CriticalSection); TerminateThread(measure->dlThreadHandle, 0); - measure->dlThreadHandle = NULL; + measure->dlThreadHandle = nullptr; LeaveCriticalSection(&g_CriticalSection); } @@ -1605,19 +1605,19 @@ BYTE* DownloadUrl(HINTERNET handle, std::wstring& url, DWORD* dataSize, bool for flags = INTERNET_FLAG_RELOAD; } - HINTERNET hUrlDump = InternetOpenUrl(handle, url.c_str(), NULL, NULL, flags, 0); + HINTERNET hUrlDump = InternetOpenUrl(handle, url.c_str(), nullptr, 0, flags, 0); if (!hUrlDump) { if (_wcsnicmp(url.c_str(), L"file://", 7) == 0) // file scheme { const std::string urlACP = StringUtil::Narrow(url); - hUrlDump = InternetOpenUrlA(handle, urlACP.c_str(), NULL, NULL, flags, 0); + hUrlDump = InternetOpenUrlA(handle, urlACP.c_str(), nullptr, 0, flags, 0); } if (!hUrlDump) { ShowError(__LINE__); - return NULL; + return nullptr; } } @@ -1674,7 +1674,7 @@ void ShowError(int lineNumber, WCHAR* errorMsg) err += buffer; err += L") "; - if (errorMsg == NULL) + if (errorMsg == nullptr) { if (dwErr == ERROR_INTERNET_EXTENDED_ERROR) { @@ -1697,7 +1697,7 @@ void ShowError(int lineNumber, WCHAR* errorMsg) } else { - LPVOID lpMsgBuf = NULL; + LPVOID lpMsgBuf = nullptr; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -1710,10 +1710,10 @@ void ShowError(int lineNumber, WCHAR* errorMsg) MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); - if (lpMsgBuf == NULL) + if (lpMsgBuf == nullptr) { err += L"Unknown error"; } diff --git a/Plugins/PluginWifiStatus/WifiStatus.cpp b/Plugins/PluginWifiStatus/WifiStatus.cpp index 8a0081be..3398fb3d 100644 --- a/Plugins/PluginWifiStatus/WifiStatus.cpp +++ b/Plugins/PluginWifiStatus/WifiStatus.cpp @@ -48,9 +48,9 @@ UINT g_Instances = 0; // Globals that store system's wifi interface/adapter structs // These are initialized in Initialize(), used during each update -HANDLE g_hClient = NULL; -PWLAN_INTERFACE_INFO g_pInterface = NULL; -PWLAN_INTERFACE_INFO_LIST g_pIntfList = NULL; +HANDLE g_hClient = nullptr; +PWLAN_INTERFACE_INFO g_pInterface = nullptr; +PWLAN_INTERFACE_INFO_LIST g_pIntfList = nullptr; // Function that translates DOT11 ENUMs to output strings LPCWSTR GetDot11Str(int, int); @@ -61,7 +61,7 @@ std::wstring ConvertToWide(LPCSTR str, int strLen) if (str && *str) { - int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0); + int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, nullptr, 0); if (bufLen > 0) { szWide.resize(bufLen); @@ -73,18 +73,18 @@ std::wstring ConvertToWide(LPCSTR str, int strLen) void FinalizeHandle() { - g_pInterface = NULL; + g_pInterface = nullptr; - if (g_pIntfList != NULL) + if (g_pIntfList != nullptr) { WlanFreeMemory(g_pIntfList); - g_pIntfList = NULL; + g_pIntfList = nullptr; } - if (g_hClient != NULL) + if (g_hClient != nullptr) { - WlanCloseHandle(g_hClient, NULL); - g_hClient = NULL; + WlanCloseHandle(g_hClient, nullptr); + g_hClient = nullptr; } } @@ -100,10 +100,10 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm) WCHAR buffer[256]; // Create WINLAN API Handle - if (g_hClient == NULL) + if (g_hClient == nullptr) { DWORD dwNegotiatedVersion = 0; - DWORD dwErr = WlanOpenHandle(WLAN_API_VERSION, NULL, &dwNegotiatedVersion, &g_hClient); + DWORD dwErr = WlanOpenHandle(WLAN_API_VERSION, nullptr, &dwNegotiatedVersion, &g_hClient); if (ERROR_SUCCESS != dwErr) { FinalizeHandle(); @@ -114,9 +114,9 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm) } // Query list of WLAN interfaces - if (g_pIntfList == NULL) + if (g_pIntfList == nullptr) { - DWORD dwErr = WlanEnumInterfaces(g_hClient, NULL, &g_pIntfList); + DWORD dwErr = WlanEnumInterfaces(g_hClient, nullptr, &g_pIntfList); if (ERROR_SUCCESS != dwErr) { FinalizeHandle(); @@ -136,7 +136,7 @@ PLUGIN_EXPORT void Initialize(void** data, void* rm) PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) { - if (g_hClient == NULL) return; + if (g_hClient == nullptr) return; MeasureData* measure = (MeasureData*)data; WCHAR buffer[128]; @@ -234,7 +234,7 @@ PLUGIN_EXPORT void Reload(void* data, void* rm, double* maxValue) PLUGIN_EXPORT double Update(void* data) { - if (g_pInterface == NULL) return 0; + if (g_pInterface == nullptr) return 0; MeasureData* measure = (MeasureData*)data; double value = 0; @@ -243,8 +243,8 @@ PLUGIN_EXPORT double Update(void* data) { if (measure->type == LIST) { - PWLAN_AVAILABLE_NETWORK_LIST pwnl = NULL; - DWORD dwErr = WlanGetAvailableNetworkList(g_hClient, &g_pInterface->InterfaceGuid, NULL, NULL, &pwnl); + PWLAN_AVAILABLE_NETWORK_LIST pwnl = nullptr; + DWORD dwErr = WlanGetAvailableNetworkList(g_hClient, &g_pInterface->InterfaceGuid, 0, nullptr, &pwnl); if (ERROR_SUCCESS != dwErr) { @@ -267,7 +267,7 @@ PLUGIN_EXPORT double Update(void* data) std::wstring ssid = ConvertToWide((LPCSTR)pwnl->Network[i].dot11Ssid.ucSSID, (int)pwnl->Network[i].dot11Ssid.uSSIDLength); // Prevent duplicates that result from profiles, check using SSID - if (!ssid.empty() && ssid[0] && wcsstr(measure->statusString.c_str(), ssid.c_str()) == NULL) + if (!ssid.empty() && ssid[0] && wcsstr(measure->statusString.c_str(), ssid.c_str()) == nullptr) { ++printed; measure->statusString += ssid; @@ -299,8 +299,8 @@ PLUGIN_EXPORT double Update(void* data) else { ULONG outsize = 0; - PWLAN_CONNECTION_ATTRIBUTES wlan_cattr = NULL; - DWORD dwErr = WlanQueryInterface(g_hClient, &g_pInterface->InterfaceGuid, wlan_intf_opcode_current_connection, NULL, &outsize, (PVOID*)&wlan_cattr, NULL); + PWLAN_CONNECTION_ATTRIBUTES wlan_cattr = nullptr; + DWORD dwErr = WlanQueryInterface(g_hClient, &g_pInterface->InterfaceGuid, wlan_intf_opcode_current_connection, nullptr, &outsize, (PVOID*)&wlan_cattr, nullptr); if (ERROR_SUCCESS != dwErr) { @@ -357,7 +357,7 @@ PLUGIN_EXPORT double Update(void* data) PLUGIN_EXPORT LPCWSTR GetString(void* data) { - if (g_pInterface == NULL) return NULL; + if (g_pInterface == nullptr) return nullptr; MeasureData* measure = (MeasureData*)data; @@ -371,7 +371,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) return measure->statusString.c_str(); default: - return NULL; + return nullptr; } } diff --git a/Plugins/PluginWin7Audio/Win7AudioPlugin.cpp b/Plugins/PluginWin7Audio/Win7AudioPlugin.cpp index 21471182..5e3a6ef6 100644 --- a/Plugins/PluginWin7Audio/Win7AudioPlugin.cpp +++ b/Plugins/PluginWin7Audio/Win7AudioPlugin.cpp @@ -27,7 +27,7 @@ #include "../../Library/DisableThreadLibraryCalls.h" // contains DllMain entry point #define SAFE_RELEASE(punk) \ - if ((punk) != NULL) { (punk)->Release(); (punk) = NULL; } + if ((punk) != nullptr) { (punk)->Release(); (punk) = nullptr; } static BOOL com_initialized = FALSE; static BOOL instance_created = FALSE; @@ -110,7 +110,7 @@ HRESULT RegisterDevice(PCWSTR devID) InitCom(); IPolicyConfig *pPolicyConfig; - hr = CoCreateInstance(IID_CPolicyConfigClient, NULL, + hr = CoCreateInstance(IID_CPolicyConfigClient, nullptr, CLSCTX_ALL, IID_IPolicyConfig, (LPVOID *)&pPolicyConfig); if (hr == S_OK) diff --git a/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp b/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp index 336693c3..3d131859 100644 --- a/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp +++ b/Plugins/PluginWindowMessage/WindowMessagePlugin.cpp @@ -62,8 +62,8 @@ PLUGIN_EXPORT double Update(void* data) MeasureData* measure = (MeasureData*)data; HWND hwnd = FindWindow( - measure->windowClass.empty() ? NULL : measure->windowClass.c_str(), - measure->windowName.empty() ? NULL : measure->windowName.c_str()); + measure->windowClass.empty() ? nullptr : measure->windowClass.c_str(), + measure->windowName.empty() ? nullptr : measure->windowName.c_str()); if (hwnd) { @@ -96,7 +96,7 @@ PLUGIN_EXPORT LPCWSTR GetString(void* data) return measure->value.c_str(); } - return NULL; + return nullptr; } PLUGIN_EXPORT void Finalize(void* data) @@ -123,8 +123,8 @@ PLUGIN_EXPORT void ExecuteBang(void* data, LPCWSTR args) { HWND hwnd = FindWindow( - measure->windowClass.empty() ? NULL : measure->windowClass.c_str(), - measure->windowName.empty() ? NULL : measure->windowName.c_str()); + measure->windowClass.empty() ? nullptr : measure->windowClass.c_str(), + measure->windowName.empty() ? nullptr : measure->windowName.c_str()); if (hwnd) { diff --git a/Plugins/PluginiTunes/iTunesPlugin.cpp b/Plugins/PluginiTunes/iTunesPlugin.cpp index 45752f41..2b6e8fd6 100644 --- a/Plugins/PluginiTunes/iTunesPlugin.cpp +++ b/Plugins/PluginiTunes/iTunesPlugin.cpp @@ -294,7 +294,7 @@ static bool updateCurrentTrack() if (0 == lastClock || currentClock - lastClock > CLOCKS_PER_SEC) { wsprintf(CurrentTrackArtworkPath, L"%s%s", BaseDir, DefaultTrackArtworkPath); - if (CurrentTrack != NULL) + if (CurrentTrack != nullptr) CurrentTrack.Release(); if (FAILED(iTunes->get_CurrentTrack(&CurrentTrack)) || !CurrentTrack) return false; @@ -316,7 +316,7 @@ static bool updateCurrentTrack() _bstr_t path; wsprintf(CurrentTrackArtworkPath, L"%s\\iTunesArtwork", BaseDir); - CreateDirectory(CurrentTrackArtworkPath, NULL); + CreateDirectory(CurrentTrackArtworkPath, nullptr); switch (artworkFormat) { @@ -338,7 +338,7 @@ static bool updateCurrentTrack() } } } - return (NULL != CurrentTrack); + return (nullptr != CurrentTrack); } static bool iTunesAboutToPromptUserToQuit = false; @@ -353,7 +353,7 @@ public: CiTunesEventHandler() { m_dwRefCount=0; - ITypeLib* pITypeLib = NULL ; + ITypeLib* pITypeLib = nullptr ; HRESULT hr = ::LoadRegTypeLib(LIBID_iTunesLib, 1, 5, 0x00, &pITypeLib) ; // Get type information for the interface of the object. hr = pITypeLib->GetTypeInfoOfGuid(DIID__IiTunesEvents, &m_pITypeInfo) ; @@ -441,7 +441,7 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) { if (!CoInitialized) { - ::CoInitialize(NULL); + ::CoInitialize(nullptr); wcsncpy(BaseDir, iniFile, MAX_PATH); BaseDir[MAX_PATH - 1] = 0; wchar_t* lastBackslash = wcsrchr(BaseDir, L'\\'); @@ -452,14 +452,14 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id) if (CoInitialized && !InstanceCreated && (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes"))) { - if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) + if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER))) { InstanceCreated = true; initEventHandler(); } else { - LSLog(LOG_ERROR, NULL, L"iTunesPlugin.dll: Unable to create instance"); + LSLog(LOG_ERROR, nullptr, L"iTunesPlugin.dll: Unable to create instance"); } } @@ -492,14 +492,14 @@ UINT Update(UINT id) // Check if the iTunes window has appeared if (FindWindow(L"iTunesApp", L"iTunes") || FindWindow(L"iTunes", L"iTunes")) { - if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) + if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER))) { InstanceCreated = true; initEventHandler(); } else { - LSLog(LOG_ERROR, NULL, L"iTunesPlugin.dll: Unable to create instance"); + LSLog(LOG_ERROR, nullptr, L"iTunesPlugin.dll: Unable to create instance"); return 0; } } @@ -773,14 +773,14 @@ void ExecuteBang(LPCTSTR args, UINT id) } else { - LSLog(LOG_NOTICE, NULL, L"iTunesPlugin.dll: Invalid Command"); + LSLog(LOG_NOTICE, nullptr, L"iTunesPlugin.dll: Invalid Command"); return; } } if (!InstanceCreated) { - if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER))) + if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, nullptr, CLSCTX_LOCAL_SERVER))) { IITBrowserWindowPtr browserWindow; if (SUCCEEDED(iTunes->get_BrowserWindow(&browserWindow))) diff --git a/SkinInstaller/Application.cpp b/SkinInstaller/Application.cpp index df8edbe4..ca463e5b 100644 --- a/SkinInstaller/Application.cpp +++ b/SkinInstaller/Application.cpp @@ -41,7 +41,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi // Avoid loading a dll from current directory SetDllDirectory(L""); - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); InitCommonControls(); if (lpCmdLine[0] == L'"') @@ -88,7 +88,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi } else { - HRESULT hr = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, buffer); + HRESULT hr = SHGetFolderPath(nullptr, CSIDL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, buffer); wcscat(buffer, L"\\Rainmeter\\"); g_Data.settingsPath = buffer; wcscat(buffer, L"Rainmeter.ini"); @@ -106,14 +106,14 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi else { std::wstring error = L"SkinPath not found.\nMake sure that Rainmeter has been run at least once."; - MessageBox(NULL, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); + MessageBox(nullptr, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); return 1; } } else { std::wstring error = L"Rainmeter.ini not found.\nMake sure that Rainmeter has been run at least once."; - MessageBox(NULL, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); + MessageBox(nullptr, error.c_str(), L"Rainmeter Skin Installer", MB_ERROR); return 1; } } @@ -231,10 +231,10 @@ bool CloseRainmeterIfActive() bool IsRunning(const WCHAR* name, HANDLE* hMutex) { // Create mutex - HANDLE hMutexTmp = CreateMutex(NULL, FALSE, name); + HANDLE hMutexTmp = CreateMutex(nullptr, FALSE, name); if (GetLastError() == ERROR_ALREADY_EXISTS) { - *hMutex = NULL; + *hMutex = nullptr; return true; } else @@ -254,7 +254,7 @@ bool CopyFiles(const std::wstring& strFrom, const std::wstring& strTo, bool bMov SHFILEOPSTRUCT fo = { - NULL, + nullptr, bMove ? FO_MOVE : FO_COPY, tmpFrom.c_str(), tmpTo.c_str(), @@ -301,11 +301,11 @@ std::string ConvertToAscii(LPCTSTR str) if (str && *str) { int strLen = (int)wcslen(str); - int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, NULL, 0, NULL, NULL); + int bufLen = WideCharToMultiByte(CP_ACP, 0, str, strLen, nullptr, 0, nullptr, nullptr); if (bufLen > 0) { szAscii.resize(bufLen); - WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, str, strLen, &szAscii[0], bufLen, nullptr, nullptr); } } return szAscii; @@ -318,7 +318,7 @@ std::wstring ConvertToWide(LPCSTR str) if (str && *str) { int strLen = (int)strlen(str); - int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, NULL, 0); + int bufLen = MultiByteToWideChar(CP_ACP, 0, str, strLen, nullptr, 0); if (bufLen > 0) { szWide.resize(bufLen); diff --git a/SkinInstaller/DialogInstall.cpp b/SkinInstaller/DialogInstall.cpp index 1c4fa2c2..803fae03 100644 --- a/SkinInstaller/DialogInstall.cpp +++ b/SkinInstaller/DialogInstall.cpp @@ -28,7 +28,7 @@ extern GlobalData g_Data; -DialogInstall* DialogInstall::c_Dialog = NULL; +DialogInstall* DialogInstall::c_Dialog = nullptr; inline bool IsWin32Build() { @@ -107,7 +107,7 @@ void DialogInstall::Create(HINSTANCE hInstance, LPWSTR lpCmdLine) } else { - DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_INSTALL_DIALOG), NULL, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); + DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_INSTALL_DIALOG), nullptr, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); ReleaseMutex(hMutex); } } @@ -143,7 +143,7 @@ INT_PTR CALLBACK DialogInstall::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_DESTROY: delete c_Dialog; - c_Dialog = NULL; + c_Dialog = nullptr; return FALSE; } } @@ -153,7 +153,7 @@ INT_PTR CALLBACK DialogInstall::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam) { - HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); + HICON hIcon = (HICON)LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); if (GetOSPlatform() >= OSPLATFORM_VISTA) @@ -184,7 +184,7 @@ INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam) { HWND control = controlIds[i] ? GetDlgItem(m_Window, controlIds[i]) : m_TabInstall.GetWindow(); GetWindowRect(control, &r); - MapWindowPoints(NULL, m_Window, (POINT*)&r, sizeof(RECT) / sizeof(POINT)); + MapWindowPoints(nullptr, m_Window, (POINT*)&r, sizeof(RECT) / sizeof(POINT)); MoveWindow(control, r.left, r.top - yDiff, r.right - r.left, r.bottom - r.top, TRUE); } @@ -204,7 +204,7 @@ INT_PTR DialogInstall::OnInitDialog(WPARAM wParam, LPARAM lParam) m_ErrorMessage += L"\n\nThe Skin Packager tool must be used to create valid .rmskin packages."; } - MessageBox(NULL, m_ErrorMessage.c_str(), L"Rainmeter Skin Installer", MB_ERROR); + MessageBox(nullptr, m_ErrorMessage.c_str(), L"Rainmeter Skin Installer", MB_ERROR); EndDialog(m_Window, 0); } @@ -220,7 +220,7 @@ INT_PTR DialogInstall::OnCommand(WPARAM wParam, LPARAM lParam) { RECT r; GetWindowRect((HWND)lParam, &r); - HMENU menu = LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_INSTALL_MENU)); + HMENU menu = LoadMenu(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_INSTALL_MENU)); HMENU subMenu = GetSubMenu(menu, 0); if (m_PackageSkins.empty() || m_MergeSkins || m_BackupPackage) @@ -251,7 +251,7 @@ INT_PTR DialogInstall::OnCommand(WPARAM wParam, LPARAM lParam) --r.bottom, 0, m_Window, - NULL); + nullptr); DestroyMenu(menu); } @@ -324,7 +324,7 @@ bool DialogInstall::ExtractCurrentFile(const std::wstring& fileName) return false; } - HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(fileName.c_str(), GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { return false; @@ -336,7 +336,7 @@ bool DialogInstall::ExtractCurrentFile(const std::wstring& fileName) BYTE buffer[16384]; DWORD written; read = unzReadCurrentFile(m_PackageUnzFile, buffer, 16384); - if (read < 0 || !WriteFile(hFile, (LPCVOID)buffer, read, &written, NULL) || read != written) + if (read < 0 || !WriteFile(hFile, (LPCVOID)buffer, read, &written, nullptr) || read != written) { read = UNZ_ERRNO; break; @@ -407,7 +407,7 @@ bool DialogInstall::ReadPackage() { char cBuffer[MAX_PATH]; unz_file_info ufi; - if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK) + if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, nullptr, 0, nullptr, 0) == UNZ_OK) { MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH); while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\'; @@ -495,7 +495,7 @@ bool DialogInstall::ReadPackage() return false; } - m_HeaderBitmap = (HBITMAP)LoadImage(NULL, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + m_HeaderBitmap = (HBITMAP)LoadImage(nullptr, tempFileSz, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); DeleteFile(tempFileSz); } @@ -673,10 +673,10 @@ bool DialogInstall::InstallPackage() SHFILEOPSTRUCT fo = { - NULL, + nullptr, FO_DELETE, - NULL, - NULL, + nullptr, + nullptr, FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO }; @@ -690,7 +690,7 @@ bool DialogInstall::InstallPackage() else { std::wstring to = g_Data.skinsPath + L"@Backup\\"; - CreateDirectory(to.c_str(), NULL); + CreateDirectory(to.c_str(), nullptr); // Delete current backup to += *iter; @@ -715,7 +715,7 @@ bool DialogInstall::InstallPackage() { char cBuffer[MAX_PATH]; unz_file_info ufi; - if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, NULL, 0, NULL, 0) == UNZ_OK) + if (unzGetCurrentFileInfo(m_PackageUnzFile, &ufi, cBuffer, MAX_PATH, nullptr, 0, nullptr, 0) == UNZ_OK) { MultiByteToWideChar(CP_ACP, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH); while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\'; @@ -884,7 +884,7 @@ void DialogInstall::BeginInstall() { ListView_GetItem(item, &lvi); - std::set* component = NULL; + std::set* component = nullptr; switch (lvi.iGroupId) { case 0: component = &m_PackageSkins; break; @@ -902,7 +902,7 @@ void DialogInstall::BeginInstall() } EnableWindow(item, FALSE); - m_InstallThread = (HANDLE)_beginthreadex(NULL, 0, InstallThread, this, 0, NULL); + m_InstallThread = (HANDLE)_beginthreadex(nullptr, 0, InstallThread, this, 0, nullptr); if (!m_InstallThread) { MessageBox(m_Window, L"Unable to start install.", L"Rainmeter Skin Installer", MB_ERROR); @@ -972,7 +972,7 @@ void DialogInstall::KeepVariables() { if (keyname[j] == L'=') { - if (GetPrivateProfileString(L"Variables", currKey.c_str(), NULL, buffer, 4, toPath.c_str()) > 0) + if (GetPrivateProfileString(L"Variables", currKey.c_str(), nullptr, buffer, 4, toPath.c_str()) > 0) { while (keyname[++j] != L'\0') currValue += keyname[j]; WritePrivateProfileString(L"Variables", currKey.c_str(), currValue.c_str(), toPath.c_str()); @@ -1203,7 +1203,7 @@ bool DialogInstall::CreateDirectoryRecursive(const std::wstring& path) // Temporarily terminate string directory[pos] = L'\0'; - failed = CreateDirectory(directorySz, NULL) == 0 && GetLastError() == ERROR_PATH_NOT_FOUND; + failed = CreateDirectory(directorySz, nullptr) == 0 && GetLastError() == ERROR_PATH_NOT_FOUND; // Restore slash directory[pos] = L'\\'; @@ -1288,7 +1288,7 @@ std::wstring DialogInstall::GetWindowsVersionString() ** Constructor. ** */ -DialogInstall::TabInstall::TabInstall(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_INSTALL_TAB, DlgProc) +DialogInstall::TabInstall::TabInstall(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_INSTALL_TAB, DlgProc) { } @@ -1301,7 +1301,7 @@ void DialogInstall::TabInstall::Initialize() if (GetOSPlatform() >= OSPLATFORM_VISTA) { extendedFlags |= LVS_EX_DOUBLEBUFFER; - SetWindowTheme(item, L"explorer", NULL); + SetWindowTheme(item, L"explorer", nullptr); } ListView_EnableGroupView(item, TRUE); diff --git a/SkinInstaller/DialogPackage.cpp b/SkinInstaller/DialogPackage.cpp index 9ed42709..4cbf7465 100644 --- a/SkinInstaller/DialogPackage.cpp +++ b/SkinInstaller/DialogPackage.cpp @@ -28,7 +28,7 @@ extern GlobalData g_Data; extern OsNameVersion g_OsNameVersions[]; -DialogPackage* DialogPackage::c_Dialog = NULL; +DialogPackage* DialogPackage::c_Dialog = nullptr; DialogPackage::DialogPackage(HWND wnd) : Dialog(wnd), m_TabInfo(wnd), @@ -55,7 +55,7 @@ void DialogPackage::Create(HINSTANCE hInstance, LPWSTR lpCmdLine) } else { - DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_PACKAGE_DIALOG), NULL, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); + DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_PACKAGE_DIALOG), nullptr, (DLGPROC)DlgProc, (LPARAM)lpCmdLine); ReleaseMutex(hMutex); } } @@ -108,7 +108,7 @@ INT_PTR CALLBACK DialogPackage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_DESTROY: delete c_Dialog; - c_Dialog = NULL; + c_Dialog = nullptr; return FALSE; } } @@ -118,7 +118,7 @@ INT_PTR CALLBACK DialogPackage::DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA INT_PTR DialogPackage::OnInitDialog(WPARAM wParam, LPARAM lParam) { - HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); + HICON hIcon = (HICON)LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDI_SKININSTALLER), IMAGE_ICON, 16, 16, LR_SHARED); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); if (GetOSPlatform() >= OSPLATFORM_VISTA) @@ -180,7 +180,7 @@ INT_PTR DialogPackage::OnCommand(WPARAM wParam, LPARAM lParam) ShowWindow(item, SW_SHOWNORMAL); SendMessage(item, PBM_SETMARQUEE, (WPARAM)TRUE, 0); - m_PackagerThread = (HANDLE)_beginthreadex(NULL, 0, PackagerThreadProc, this, 0, NULL); + m_PackagerThread = (HANDLE)_beginthreadex(nullptr, 0, PackagerThreadProc, this, 0, nullptr); if (!m_PackagerThread) { MessageBox(m_Window, L"Unknown error.", L"Rainmeter Skin Packager", MB_ERROR); @@ -268,7 +268,7 @@ bool DialogPackage::CreatePackage() auto cleanup = [&]()->bool { - zipClose(m_ZipFile, NULL); + zipClose(m_ZipFile, nullptr); return false; }; @@ -332,8 +332,8 @@ bool DialogPackage::CreatePackage() // Add footer FILE* file; - if (zipClose(m_ZipFile, NULL) == ZIP_OK && - (file = _wfopen(m_TargetFile.c_str(), L"r+b")) != NULL) + if (zipClose(m_ZipFile, nullptr) == ZIP_OK && + (file = _wfopen(m_TargetFile.c_str(), L"r+b")) != nullptr) { fseek(file, 0, SEEK_END); DialogInstall::PackageFooter footer = { _ftelli64(file), 0, "RMSKIN" }; @@ -388,7 +388,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath } } - int open = zipOpenNewFileInZip(m_ZipFile, zipPathAscii.c_str(), NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); + int open = zipOpenNewFileInZip(m_ZipFile, zipPathAscii.c_str(), nullptr, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION); if (open != ZIP_OK) { return false; @@ -398,7 +398,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath if (filePath) { - HANDLE file = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE file = CreateFile(filePath, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (file == INVALID_HANDLE_VALUE) { result = false; @@ -410,7 +410,7 @@ bool DialogPackage::AddFileToPackage(const WCHAR* filePath, const WCHAR* zipPath const DWORD bufferSize = 16 * 1024; BYTE buffer[bufferSize]; DWORD readSize; - if (!ReadFile(file, buffer, bufferSize, &readSize, NULL)) + if (!ReadFile(file, buffer, bufferSize, &readSize, nullptr)) { result = false; } @@ -448,7 +448,7 @@ bool DialogPackage::AddFolderToPackage(const std::wstring& path, std::wstring ba FindExInfoStandard, &fd, FindExSearchNameMatch, - NULL, + nullptr, 0); if (hFind == INVALID_HANDLE_VALUE) @@ -505,7 +505,7 @@ bool DialogPackage::AddFolderToPackage(const std::wstring& path, std::wstring ba // Add directory entry if folder is empty. std::wstring zipPath = zipPrefix; zipPath.append(currentPath, path.length(), currentPath.length() - path.length()); - AddFileToPackage(NULL, zipPath.c_str()); + AddFileToPackage(nullptr, zipPath.c_str()); } std::list::const_iterator iter = folders.begin(); @@ -529,14 +529,14 @@ void DialogPackage::ShowHelp() url += L"_beta"; } - ShellExecute(m_Window, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); + ShellExecute(m_Window, L"open", url.c_str(), nullptr, nullptr, SW_SHOWNORMAL); } std::wstring DialogPackage::SelectFolder(HWND parent, const std::wstring& existingPath) { LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTFOLDER_DIALOG); std::wstring folder = existingPath; - if (DialogBoxParam(GetModuleHandle(NULL), dialog, parent, SelectFolderDlgProc, (LPARAM)&folder) != 1) + if (DialogBoxParam(GetModuleHandle(nullptr), dialog, parent, SelectFolderDlgProc, (LPARAM)&folder) != 1) { folder.clear(); } @@ -557,7 +557,7 @@ INT_PTR CALLBACK DialogPackage::SelectFolderDlgProc(HWND hWnd, UINT uMsg, WPARAM *existingPath += L'*'; WIN32_FIND_DATA fd; - HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoStandard, &fd, FindExSearchNameMatch, NULL, 0); + HANDLE hFind = FindFirstFileEx(existingPath->c_str(), FindExInfoStandard, &fd, FindExSearchNameMatch, nullptr, 0); existingPath->pop_back(); if (hFind != INVALID_HANDLE_VALUE) @@ -695,7 +695,7 @@ std::pair DialogPackage::SelectPlugin(HWND parent) { LPCWSTR dialog = MAKEINTRESOURCE(IDD_PACKAGESELECTPLUGIN_DIALOG); std::pair plugins; - if (DialogBoxParam(GetModuleHandle(NULL), dialog, parent, SelectPluginDlgProc, (LPARAM)&plugins) != 1) + if (DialogBoxParam(GetModuleHandle(nullptr), dialog, parent, SelectPluginDlgProc, (LPARAM)&plugins) != 1) { plugins.first.clear(); plugins.second.clear(); @@ -743,7 +743,7 @@ INT_PTR CALLBACK DialogPackage::SelectPluginDlgProc(HWND hWnd, UINT uMsg, WPARAM bool x32 = LOWORD(wParam) == IDC_PACKAGESELECTPLUGIN_32BITBROWSE_BUTTON; - LOADED_IMAGE* loadedImage = ImageLoad(ConvertToAscii(buffer).c_str(), NULL); + LOADED_IMAGE* loadedImage = ImageLoad(ConvertToAscii(buffer).c_str(), nullptr); if (loadedImage) { WORD machine = loadedImage->FileHeader->FileHeader.Machine; @@ -800,7 +800,7 @@ INT_PTR CALLBACK DialogPackage::SelectPluginDlgProc(HWND hWnd, UINT uMsg, WPARAM // // ----------------------------------------------------------------------------------------------- -DialogPackage::TabInfo::TabInfo(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEINFO_TAB, DlgProc) +DialogPackage::TabInfo::TabInfo(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEINFO_TAB, DlgProc) { } @@ -824,7 +824,7 @@ void DialogPackage::TabInfo::Initialize() if (GetOSPlatform() >= OSPLATFORM_VISTA) { extendedFlags |= LVS_EX_DOUBLEBUFFER; - SetWindowTheme(item, L"explorer", NULL); + SetWindowTheme(item, L"explorer", nullptr); } ListView_EnableGroupView(item, TRUE); @@ -1052,7 +1052,7 @@ INT_PTR DialogPackage::TabInfo::OnNotify(WPARAM wParam, LPARAM lParam) // // ----------------------------------------------------------------------------------------------- -DialogPackage::TabOptions::TabOptions(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEOPTIONS_TAB, DlgProc) +DialogPackage::TabOptions::TabOptions(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEOPTIONS_TAB, DlgProc) { } @@ -1061,7 +1061,7 @@ void DialogPackage::TabOptions::Initialize() m_Initialized = true; WCHAR buffer[MAX_PATH]; - SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, buffer); + SHGetFolderPath(nullptr, CSIDL_DESKTOPDIRECTORY, nullptr, SHGFP_TYPE_CURRENT, buffer); c_Dialog->m_TargetFile = buffer; c_Dialog->m_TargetFile += L'\\'; @@ -1292,7 +1292,7 @@ INT_PTR DialogPackage::TabOptions::OnCommand(WPARAM wParam, LPARAM lParam) // // ----------------------------------------------------------------------------------------------- -DialogPackage::TabAdvanced::TabAdvanced(HWND wnd) : Tab(GetModuleHandle(NULL), wnd, IDD_PACKAGEADVANCED_TAB, DlgProc) +DialogPackage::TabAdvanced::TabAdvanced(HWND wnd) : Tab(GetModuleHandle(nullptr), wnd, IDD_PACKAGEADVANCED_TAB, DlgProc) { }