diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-20 02:12:32 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-20 02:12:32 +0200 |
commit | df42108d1f4c1628fe62874e48e87282fab6bc65 (patch) | |
tree | 76589bd39abd7ec180a9928d49325dbee5d2562b /c/common.cpp | |
parent | 4da9280a307ced3fab399d655b9d11330fc33bc4 (diff) | |
download | EpisodeBrowser-df42108d1f4c1628fe62874e48e87282fab6bc65.tar.gz |
Fix bug in and rename throw_nil, warn_nil.
In warn_nil, the return value was undefined on exception -- I think.
While informative, the names throw_nil and warn_nil don't work very
well in conditionals:
if (warn_nil<f>(...)) g();
sounds like g should be called if f returns nil and a warning is
issued. But it is actually the other way around; g is called if f is
successful.
if (prefer<f>(...)) g();
sounds less like that.
Diffstat (limited to 'c/common.cpp')
-rw-r--r-- | c/common.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/c/common.cpp b/c/common.cpp index b85be49..7981801 100644 --- a/c/common.cpp +++ b/c/common.cpp @@ -87,8 +87,8 @@ static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPAR int EBMessageBox(const TCHAR* const tszText, const TCHAR* const tszCaption, const unsigned uType) { extern HWND g_hWnd; - HHOOK hHook = throw_nil<SetWindowsHookEx>(WH_CBT, CBTProc, (HINSTANCE)NULL, GetCurrentThreadId()); + HHOOK hHook = require<SetWindowsHookEx>(WH_CBT, CBTProc, (HINSTANCE)NULL, GetCurrentThreadId()); int r = MessageBox(g_hWnd, tszText, tszCaption, uType); - throw_nil<UnhookWindowsHookEx>(hHook); + require<UnhookWindowsHookEx>(hHook); return r; } |