From 94119478207034b767c1d0a4fa5d8950f7b07b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 4 Aug 2022 18:18:37 +0200 Subject: Use C++ casts, nullptr. --- c/win.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'c/win.h') diff --git a/c/win.h b/c/win.h index baafbf0..d36cbdf 100644 --- a/c/win.h +++ b/c/win.h @@ -19,8 +19,8 @@ struct Win32Error : public std::exception const wchar_t* What() const noexcept; DWORD code; private: - char* m_szMsg = NULL; - wchar_t* m_wszMsg = NULL; + char* m_szMsg = nullptr; + wchar_t* m_wszMsg = nullptr; }; /* Wrapper for loading and freeing dynamically linked libraries. */ @@ -49,7 +49,7 @@ T* Library::GetProcAddress(const char* const szProc) noexcept template auto Metric = GetSystemMetrics(I); -/* Check result of Windows API call, throwing error on NULL. */ +/* Check result of Windows API call, throwing error on null. */ template inline T Require(const T x) { @@ -57,13 +57,13 @@ inline T Require(const T x) return x; } -/* Check result of Windows API call, showing a warning on NULL. */ +/* Check result of Windows API call, showing a warning on null. */ template inline T Prefer(const T x) { if (!x) { EBMessageBox(Win32Error().What(), L"System Error", MB_ICONWARNING); - return (T)NULL; + return (T)0; } return x; } @@ -79,7 +79,7 @@ inline int Dpi(const int i) inline BOOL GetRelativeRect(const HWND hWnd, RECT* const rr) { if (!GetClientRect(hWnd, rr)) return 0; - return MapWindowPoints(hWnd, GetParent(hWnd), (POINT*)rr, 2); + return MapWindowPoints(hWnd, GetParent(hWnd), reinterpret_cast(rr), 2); } inline BOOL SetWindowRect(const HWND hWnd, -- cgit v1.2.3