From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Folders/src/dlg_handlers.cpp | 16 ++++++++-------- plugins/Folders/src/folderItem.cpp | 10 +++++----- plugins/Folders/src/folderItem.h | 16 ++++++++-------- plugins/Folders/src/services.cpp | 16 ++++++++-------- plugins/Folders/src/services.h | 8 ++++---- plugins/Folders/src/utils.cpp | 14 +++++++------- plugins/Folders/src/utils.h | 6 +++--- 7 files changed, 43 insertions(+), 43 deletions(-) (limited to 'plugins/Folders/src') diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index d14722300f..82a1b38d04 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -13,19 +13,19 @@ static PFolderItem GetSelectedItem(HWND hWnd) return (PFolderItem)SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETITEMDATA, index, 0); } -static void GetEditText(HWND hWnd, TCHAR *buffer, int size) +static void GetEditText(HWND hWnd, wchar_t *buffer, int size) { GetWindowText(GetDlgItem(hWnd, IDC_FOLDER_EDIT), buffer, size); } -static void SetEditText(HWND hWnd, const TCHAR *buffer) +static void SetEditText(HWND hWnd, const wchar_t *buffer) { bInitializing = 1; SetDlgItemText(hWnd, IDC_FOLDER_EDIT, buffer); bInitializing = 0; } -static int ContainsSection(HWND hWnd, const TCHAR *section) +static int ContainsSection(HWND hWnd, const wchar_t *section) { int index = SendDlgItemMessage(hWnd, IDC_FOLDERS_SECTIONS_LIST, LB_FINDSTRINGEXACT, -1, (LPARAM)section); return (index != LB_ERR); @@ -37,7 +37,7 @@ static void LoadRegisteredFolderSections(HWND hWnd) for (int i = 0; i < lstRegisteredFolders.getCount(); i++) { CFolderItem &tmp = lstRegisteredFolders[i]; - TCHAR *translated = mir_a2t(tmp.GetSection()); + wchar_t *translated = mir_a2t(tmp.GetSection()); if (!ContainsSection(hWnd, TranslateTS(translated))) { int idx = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)TranslateTS(translated)); SendMessage(hwndList, LB_SETITEMDATA, idx, (LPARAM)tmp.GetSection()); @@ -71,7 +71,7 @@ static void LoadRegisteredFolderItems(HWND hWnd) static void RefreshPreview(HWND hWnd) { - TCHAR tmp[MAX_FOLDER_SIZE]; + wchar_t tmp[MAX_FOLDER_SIZE]; GetEditText(hWnd, tmp, MAX_FOLDER_SIZE); SetDlgItemText(hWnd, IDC_PREVIEW_EDIT, ExpandPath(tmp)); } @@ -90,7 +90,7 @@ static void SaveItem(HWND hWnd, PFolderItem item, int bEnableApply) if (!item) return; - TCHAR buffer[MAX_FOLDER_SIZE]; + wchar_t buffer[MAX_FOLDER_SIZE]; GetEditText(hWnd, buffer, _countof(buffer)); item->SetFormat(buffer); @@ -103,7 +103,7 @@ static int ChangesNotSaved(HWND hWnd, PFolderItem item) if (!item) return 0; - TCHAR buffer[MAX_FOLDER_SIZE]; + wchar_t buffer[MAX_FOLDER_SIZE]; GetEditText(hWnd, buffer, MAX_FOLDER_SIZE); return mir_tstrcmp(item->GetFormat(), buffer) != 0; } @@ -119,7 +119,7 @@ static void CheckForChanges(HWND hWnd, int bNeedConfirmation = 1) static INT_PTR CALLBACK DlgProcVariables(HWND hWnd, UINT msg, WPARAM wParam, LPARAM) { - TCHAR tszMessage[2048]; + wchar_t tszMessage[2048]; switch (msg) { case WM_INITDIALOG: diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index e1b46cb393..9cc475593e 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -CFolderItem::CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName) +CFolderItem::CFolderItem(const char *sectionName, const char *name, const wchar_t *format, const wchar_t *userName) { m_szSection = mir_strdup(sectionName); m_szName = mir_strdup(name); @@ -43,7 +43,7 @@ CFolderItem::~CFolderItem() mir_free(m_tszUserName); } -void CFolderItem::SetFormat(const TCHAR *newFormat) +void CFolderItem::SetFormat(const wchar_t *newFormat) { mir_free(m_tszOldFormat); m_tszOldFormat = m_tszFormat; @@ -55,12 +55,12 @@ int CFolderItem::IsEqual(const CFolderItem *other) return (IsEqual(other->GetSection(), other->GetUserName())); } -int CFolderItem::IsEqual(const char *section, const TCHAR *name) +int CFolderItem::IsEqual(const char *section, const wchar_t *name) { return !mir_tstrcmp(m_tszUserName, name) && !mir_strcmp(m_szSection, section); } -int CFolderItem::IsEqualTranslated(const char *trSection, const TCHAR *trName) +int CFolderItem::IsEqualTranslated(const char *trSection, const wchar_t *trName) { return !mir_tstrcmp(TranslateTS(m_tszUserName), trName) && !mir_strcmp(Translate(m_szSection), trSection); } @@ -111,7 +111,7 @@ int CFolderItem::FolderDeleteOldDirectory(int showFolder) return res; } -void CFolderItem::GetDataFromDatabase(const TCHAR *szNotFound) +void CFolderItem::GetDataFromDatabase(const wchar_t *szNotFound) { char szSettingName[256]; strcpy_s(szSettingName, _countof(szSettingName), m_szSection); diff --git a/plugins/Folders/src/folderItem.h b/plugins/Folders/src/folderItem.h index 03b88f86e5..ad02db6d12 100644 --- a/plugins/Folders/src/folderItem.h +++ b/plugins/Folders/src/folderItem.h @@ -32,30 +32,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CFolderItem { char *m_szSection, *m_szName; - TCHAR *m_tszFormat, *m_tszOldFormat, *m_tszUserName; + wchar_t *m_tszFormat, *m_tszOldFormat, *m_tszUserName; - void GetDataFromDatabase(const TCHAR *szNotFound); + void GetDataFromDatabase(const wchar_t *szNotFound); void WriteDataToDatabase(); int FolderCreateDirectory(int showFolder = 0); int FolderDeleteOldDirectory(int showFolder = 0); public: - CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName); + CFolderItem(const char *sectionName, const char *name, const wchar_t *format, const wchar_t *userName); virtual ~CFolderItem(); CMString Expand(); void Save(); int IsEqual(const CFolderItem *other); - int IsEqual(const char *section, const TCHAR *name); - int IsEqualTranslated(const char *trSection, const TCHAR *trName); + int IsEqual(const char *section, const wchar_t *name); + int IsEqualTranslated(const char *trSection, const wchar_t *trName); int operator ==(const CFolderItem *other); __inline const char* GetSection() const { return m_szSection; } __inline const char* GetName() const { return m_szName; } - __inline const TCHAR* GetUserName() const { return m_tszUserName; } - __inline const TCHAR* GetFormat() const { return m_tszFormat; } - void SetFormat(const TCHAR *newFormat); + __inline const wchar_t* GetUserName() const { return m_tszUserName; } + __inline const wchar_t* GetFormat() const { return m_tszFormat; } + void SetFormat(const wchar_t *newFormat); }; typedef CFolderItem *PFolderItem; diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 348db4468e..de7669c4e9 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -22,10 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define DEFAULT_SECTION "Unknown" -TCHAR szCurrentProfilePath[MAX_FOLDERS_PATH]; -TCHAR szCurrentProfile[MAX_FOLDERS_PATH]; -TCHAR szMirandaPath[MAX_FOLDERS_PATH]; -TCHAR szUserDataPath[MAX_FOLDERS_PATH]; +wchar_t szCurrentProfilePath[MAX_FOLDERS_PATH]; +wchar_t szCurrentProfile[MAX_FOLDERS_PATH]; +wchar_t szMirandaPath[MAX_FOLDERS_PATH]; +wchar_t szUserDataPath[MAX_FOLDERS_PATH]; INT_PTR RegisterPathService(WPARAM, LPARAM lParam) { @@ -69,7 +69,7 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) CMString buf(p->Expand()); if (data->flags & FF_UNICODE) - _tcsncpy_s(data->szPathT, data->nMaxPathSize, buf, _TRUNCATE); + wcsncpy_s(data->szPathT, data->nMaxPathSize, buf, _TRUNCATE); else strncpy_s(data->szPath, data->nMaxPathSize, _T2A(buf), _TRUNCATE); return 0; @@ -81,12 +81,12 @@ int InitServices() { CallService(MS_DB_GETPROFILEPATHT, _countof(szCurrentProfilePath), (LPARAM)szCurrentProfilePath); CallService(MS_DB_GETPROFILENAMET, _countof(szCurrentProfile), (LPARAM)szCurrentProfile); - TCHAR *pos = _tcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0; + wchar_t *pos = wcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0; GetModuleFileName(GetModuleHandleA("mir_app.mir"), szMirandaPath, _countof(szMirandaPath)); - pos = _tcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0; + pos = wcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0; - TCHAR *szTemp = Utils_ReplaceVarsT(L"%miranda_userdata%"); + wchar_t *szTemp = Utils_ReplaceVarsT(L"%miranda_userdata%"); mir_sntprintf(szUserDataPath, szTemp); mir_free(szTemp); diff --git a/plugins/Folders/src/services.h b/plugins/Folders/src/services.h index 6f1acaf1ca..c262748b13 100644 --- a/plugins/Folders/src/services.h +++ b/plugins/Folders/src/services.h @@ -23,10 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_FOLDERS_PATH 512 -extern TCHAR szCurrentProfilePath[MAX_FOLDERS_PATH]; -extern TCHAR szCurrentProfile[MAX_FOLDERS_PATH]; -extern TCHAR szMirandaPath[MAX_FOLDERS_PATH]; -extern TCHAR szUserDataPath[MAX_FOLDERS_PATH]; +extern wchar_t szCurrentProfilePath[MAX_FOLDERS_PATH]; +extern wchar_t szCurrentProfile[MAX_FOLDERS_PATH]; +extern wchar_t szMirandaPath[MAX_FOLDERS_PATH]; +extern wchar_t szUserDataPath[MAX_FOLDERS_PATH]; int InitServices(); void InitOptions(); diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 97ffef2eb6..2adc3b7035 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -20,12 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -CMString ExpandPath(const TCHAR *format) +CMString ExpandPath(const wchar_t *format) { CMString res; if (ServiceExists(MS_VARS_FORMATSTRING)) - res = VARST(ptrT(variables_parse((TCHAR*)format, NULL, NULL))); + res = VARST(ptrT(variables_parse((wchar_t*)format, NULL, NULL))); else res = VARST(format); @@ -47,20 +47,20 @@ CMString ExpandPath(const TCHAR *format) return res; } -void RemoveDirectories(const TCHAR *path) +void RemoveDirectories(const wchar_t *path) { - TCHAR *pos; - TCHAR *buffer = NEWWSTR_ALLOCA(path); + wchar_t *pos; + wchar_t *buffer = NEWWSTR_ALLOCA(path); if (!(GetFileAttributes(buffer) & FILE_ATTRIBUTE_REPARSE_POINT)) RemoveDirectory(buffer); - while (pos = _tcsrchr(buffer, '\\')) { + while (pos = wcsrchr(buffer, '\\')) { pos[0] = '\0'; if (!(GetFileAttributes(buffer) & FILE_ATTRIBUTE_REPARSE_POINT)) RemoveDirectory(buffer); } } -bool DirectoryExists(const TCHAR *path) +bool DirectoryExists(const wchar_t *path) { DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == INVALID_FILE_ATTRIBUTES || !(dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) diff --git a/plugins/Folders/src/utils.h b/plugins/Folders/src/utils.h index 3307335e14..4724635ce0 100644 --- a/plugins/Folders/src/utils.h +++ b/plugins/Folders/src/utils.h @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_FOLDERS_UTILS_H #define M_FOLDERS_UTILS_H -CMString ExpandPath(const TCHAR *format); +CMString ExpandPath(const wchar_t *format); -void RemoveDirectories(const TCHAR *szPath); -bool DirectoryExists(const TCHAR *szPath); +void RemoveDirectories(const wchar_t *szPath); +bool DirectoryExists(const wchar_t *szPath); #endif \ No newline at end of file -- cgit v1.2.3