summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/utils.h
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-11 23:06:29 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-11 23:06:29 +0000
commitc774fa6be8cf5e9ff30ecfdb15604e25d83769ad (patch)
tree362f6e195ceff70ae97cea6963c0787fb95e7ad3 /plugins/TabSRMM/src/utils.h
parent85f41ee15b0a861d016ce1749d0ee10b0a6c34f5 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@11833 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/utils.h')
-rw-r--r--plugins/TabSRMM/src/utils.h75
1 files changed, 33 insertions, 42 deletions
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 15cccca2c7..fd66f18cc5 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -113,13 +113,13 @@ public:
static void AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename);
- /**
- * safe strlen function - do not overflow the given buffer length
- * if the buffer does not contain a valid (zero-terminated) string, it
- * will return 0.
- *
- * careful: maxlen must be given in element counts!!
- */
+ //////////////////////////////////////////////////////////////////////////////////////
+ // safe strlen function - do not overflow the given buffer length
+ // if the buffer does not contain a valid (zero-terminated) string, it
+ // will return 0.
+ //
+ // careful: maxlen must be given in element counts!!
+
template<typename T> static size_t safe_strlen(const T* src, const size_t maxlen = 0)
{
size_t s = 0;
@@ -127,10 +127,7 @@ public:
while(s < maxlen && *(src++))
s++;
- if (s >= maxlen && *src != 0)
- return 0;
- else
- return(s);
+ return (s >= maxlen && *src != 0) ? 0 : s;
}
public:
@@ -138,14 +135,15 @@ public:
static int rtf_ctable_size;
};
-LRESULT _dlgReturn(HWND hWnd, LRESULT result);
-
-
+__forceinline LRESULT _dlgReturn(HWND hWnd, LRESULT result)
+{
+ SetWindowLongPtr(hWnd, DWLP_MSGRESULT, result);
+ return result;
+}
-/**
- * implement a warning dialog with a "do not show this again" check
- * box
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// implements a warning dialog with a "do not show this again" check
+// box
class CWarning {
@@ -168,39 +166,32 @@ public:
WARN_LAST = 11
};
- /*
- * the flags (low word is reserved for default windows flags like MB_OK etc.
- */
-
+ // the flags(low word is reserved for default windows flags like MB_OK etc.
enum {
- CWF_UNTRANSLATED = 0x00010000, // do not translate the msg (useful for some error messages)
- CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
+ CWF_UNTRANSLATED = 0x00010000, // do not translate the msg (useful for some error messages)
+ CWF_NOALLOWHIDE = 0x00020000 // critical message, hide the "do not show this again" check box
};
CWarning(const wchar_t* tszTitle, const wchar_t* tszText, const UINT uId, const DWORD dwFlags);
~CWarning();
public:
- /*
- * static function to construct and show the dialog, returns the
- * user's choice
- */
- static LRESULT show (const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = 0);
- static void destroyAll ();
- LRESULT ShowDialog () const;
+ // static function to construct and show the dialog, returns the user's choice
+ static LRESULT show(const int uId, DWORD dwFlags = 0, const wchar_t* tszTxt = 0);
+ static void destroyAll();
+ LRESULT ShowDialog() const;
private:
- ptrT m_szTitle, m_szText;
- UINT m_uId;
- HFONT m_hFontCaption;
- DWORD m_dwFlags;
- HWND m_hwnd;
- bool m_fIsModal;
-
- INT_PTR CALLBACK dlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- //void resize () const;
- static INT_PTR CALLBACK stubDlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static __int64 getMask (); // get bit mask for disabled message classes
+ ptrT m_szTitle, m_szText;
+ UINT m_uId;
+ HFONT m_hFontCaption;
+ DWORD m_dwFlags;
+ HWND m_hwnd;
+ bool m_fIsModal;
+
+ INT_PTR CALLBACK dlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static INT_PTR CALLBACK stubDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static __int64 getMask(); // get bit mask for disabled message classes
private:
static HANDLE hWindowList;