aboutsummaryrefslogtreecommitdiff
path: root/c/win.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-04 18:18:37 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-04 18:19:37 +0200
commit94119478207034b767c1d0a4fa5d8950f7b07b02 (patch)
treece9ffb57a4947855b09c54017f6b2abe3e8af6d3 /c/win.h
parent1c218db34a3bd4aba5c1c088561b91b02e691fde (diff)
downloadEpisodeBrowser-94119478207034b767c1d0a4fa5d8950f7b07b02.tar.gz
Use C++ casts, nullptr.
Diffstat (limited to 'c/win.h')
-rw-r--r--c/win.h12
1 files changed, 6 insertions, 6 deletions
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 <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,