diff options
Diffstat (limited to 'c/win.h')
-rw-r--r-- | c/win.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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 <int I> 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 <typename T> 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 <typename T> 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<POINT*>(rr), 2); } inline BOOL SetWindowRect(const HWND hWnd, |