aboutsummaryrefslogtreecommitdiff
path: root/c/common.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-31 19:56:53 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-31 19:58:54 +0200
commitd9e1caa37e53c7dbc42b1fc652efc23a40c47c42 (patch)
treed2a1608a3c88fef98af9a356a116af3551ea5680 /c/common.h
parentd9bafcecfd60f38f98bca8a1705f6007b39e18a2 (diff)
downloadEpisodeBrowser-d9e1caa37e53c7dbc42b1fc652efc23a40c47c42.tar.gz
Limit use of Hungarian notation.
I don't hate Hungarian notation. It has some very nice qualities. But it also adds a lot of typing. That said, not using it feels a bit... unsafe. I might go back on this decision. We'll see.
Diffstat (limited to 'c/common.h')
-rw-r--r--c/common.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/c/common.h b/c/common.h
index e63095b..39fa9b8 100644
--- a/c/common.h
+++ b/c/common.h
@@ -14,30 +14,30 @@
struct wstring_owner
{
wstring_owner();
- wstring_owner(wchar_t* wsz);
- wstring_owner& operator=(wchar_t* wsz);
- wstring_owner(wstring_owner& wso) = delete;
- wstring_owner& operator=(wstring_owner& wso) = delete;
- wstring_owner(wstring_owner&& wso) noexcept;
- wstring_owner& operator=(wstring_owner&& wso) noexcept;
+ wstring_owner(wchar_t* s);
+ wstring_owner& operator=(wchar_t* s);
+ wstring_owner(wstring_owner& other) = delete;
+ wstring_owner& operator=(wstring_owner& other) = delete;
+ wstring_owner(wstring_owner&& other) noexcept;
+ wstring_owner& operator=(wstring_owner&& other) noexcept;
wchar_t *release();
operator bool() const;
~wstring_owner();
wchar_t* p = nullptr;
};
-wstring_owner WsoFromSz(const char* sz, int iCp = CP_UTF8);
+wstring_owner WsoFromSz(const char* buf, int cp = CP_UTF8);
int EBMessageBox(const wchar_t* wszText, const wchar_t* wszCaption, unsigned uType);
-wstring_owner WsoCopy(const wchar_t* wsz);
+wstring_owner WsoCopy(const wchar_t* s);
struct Win32Error : public std::exception
{
Win32Error();
- Win32Error(DWORD dwErr);
+ Win32Error(DWORD code);
~Win32Error();
const char* what() const noexcept;
const wchar_t* WhatW() const noexcept;
- DWORD dwErr;
+ DWORD code;
private:
char* m_szMsg = NULL;
wchar_t* m_wszMsg = NULL;
@@ -45,7 +45,7 @@ private:
struct Library
{
- Library(const wchar_t* wszLibrary);
+ Library(const wchar_t* lib);
~Library();
template <class T> T* GetProcAddress(const char* szProc);
private:
@@ -59,9 +59,9 @@ T* Library::GetProcAddress(const char* const szProc)
}
template<size_t N, typename... T>
-inline int wszf(wchar_t (&wsz)[N], const wchar_t* const wszFmt, T... xs)
+inline int wszf(wchar_t (&buf)[N], const wchar_t* const fmt, T... xs)
{
- return _snwprintf_s(wsz, N, _TRUNCATE, wszFmt, xs...);
+ return _snwprintf_s(buf, N, _TRUNCATE, fmt, xs...);
}
/* Create and return an object of type C. If construction fails,
@@ -103,8 +103,8 @@ inline T prefer(const T x)
/* Return integer scaled for current DPI. */
inline int Dpi(const int i)
{
- extern int g_iDPI;
- return MulDiv(i, g_iDPI, 96);
+ extern int g_dpi;
+ return MulDiv(i, g_dpi, 96);
}
inline int Cmp(const int a, const int b)
@@ -115,10 +115,10 @@ inline int Cmp(const int a, const int b)
}
/* Get window rectangle relative to parent. */
-inline BOOL GetRelativeRect(const HWND hWnd, RECT* const pRr)
+inline BOOL GetRelativeRect(const HWND hWnd, RECT* const rr)
{
- if (!GetClientRect(hWnd, pRr)) return 0;
- return MapWindowPoints(hWnd, GetParent(hWnd), (POINT*)pRr, 2);
+ if (!GetClientRect(hWnd, rr)) return 0;
+ return MapWindowPoints(hWnd, GetParent(hWnd), (POINT*)rr, 2);
}
inline BOOL SetWindowRect(const HWND hWnd,