diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-13 19:45:47 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-13 19:45:47 +0000 |
commit | fd748a24ce28cbafa4c4417878751a8f0884d111 (patch) | |
tree | 853fd8ad0f471b968f50f2d299cb1f674feff161 /plugins/TabSRMM/src/utils.h | |
parent | a6adee75cb2203221213268847f08006107fe2c9 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@10442 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/utils.h')
-rw-r--r-- | plugins/TabSRMM/src/utils.h | 59 |
1 files changed, 5 insertions, 54 deletions
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index fec8ab9db2..e50d56af96 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -107,61 +107,12 @@ public: static HMODULE loadSystemLibrary(const wchar_t* szFilename);
- static INT_PTR CALLBACK PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
- static LPCTSTR extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich);
+ static INT_PTR CALLBACK PopupDlgProcError(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+ static LPCTSTR extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich);
- template<typename T> static size_t CopyToClipBoard(T* _t, const HWND hwndOwner)
- {
- if (!OpenClipboard(hwndOwner) || _t == 0)
- return 0;
-
- std::basic_string<T> *s = new std::basic_string<T>(_t);
- size_t _s = sizeof(T);
- size_t i = _s * (s->length() + 1);
-
- EmptyClipboard();
- HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, i);
-
- CopyMemory((void*)GlobalLock(hData), (void*)_t, i);
- GlobalUnlock(hData);
- SetClipboardData(_s == sizeof(char) ? CF_TEXT : CF_UNICODETEXT, hData);
- CloseClipboard();
- delete s;
- return(i);
- }
-
- template<typename T> static void AddToFileList(T ***pppFiles, int *totalCount, LPCTSTR szFilename)
- {
- size_t _s = sizeof(T);
-
- *pppFiles = (T**)mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(T*));
- (*pppFiles)[*totalCount] = NULL;
-
- if (_s == 1)
- (*pppFiles)[*totalCount-1] = reinterpret_cast<T *>(mir_t2a(szFilename));
- else
- (*pppFiles)[*totalCount-1] = reinterpret_cast<T *>(mir_tstrdup(szFilename));
-
- if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
- WIN32_FIND_DATA fd;
- HANDLE hFind;
- TCHAR szPath[MAX_PATH];
-
- lstrcpy(szPath, szFilename);
- lstrcat(szPath, _T("\\*"));
- if ((hFind = FindFirstFile(szPath, &fd)) != INVALID_HANDLE_VALUE) {
- do {
- if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
- continue;
- lstrcpy(szPath, szFilename);
- lstrcat(szPath, _T("\\"));
- lstrcat(szPath, fd.cFileName);
- AddToFileList(pppFiles, totalCount, szPath);
- } while (FindNextFile(hFind, &fd));
- FindClose(hFind);
- }
- }
- }
+ static size_t CopyToClipBoard(const wchar_t *str, const HWND hwndOwner);
+
+ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename);
/**
* safe strlen function - do not overflow the given buffer length
|