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/ClientChangeNotify/src/CString.cpp | 6 +++--- plugins/ClientChangeNotify/src/CString.h | 7 +++---- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 22 +++++++++++----------- plugins/ClientChangeNotify/src/Misc.h | 8 ++++---- plugins/ClientChangeNotify/src/OptDlg.cpp | 18 +++++++++--------- plugins/ClientChangeNotify/src/Options.cpp | 8 ++++---- plugins/ClientChangeNotify/src/Options.h | 4 ++-- plugins/ClientChangeNotify/src/pcre.cpp | 8 ++++---- 8 files changed, 40 insertions(+), 41 deletions(-) (limited to 'plugins/ClientChangeNotify') diff --git a/plugins/ClientChangeNotify/src/CString.cpp b/plugins/ClientChangeNotify/src/CString.cpp index 8cb1208896..21449ee8e6 100644 --- a/plugins/ClientChangeNotify/src/CString.cpp +++ b/plugins/ClientChangeNotify/src/CString.cpp @@ -268,7 +268,7 @@ TString& TString::operator = (const T *pStr) return *this; } -template class TString; +template class TString; template class TString; template class TString; @@ -278,13 +278,13 @@ CString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, return CString(p == NULL ? szDefaultValue : p); } -TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) +TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue) { ptrT p( db_get_tsa(hContact, szModule, szSetting)); return TCString(p == NULL ? szDefaultValue : p); } -TCString DBGetContactSettingAsString(MCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue) +TCString DBGetContactSettingAsString(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue) { // also converts numeric values to a string DBVARIANT dbv = {0}; int iRes = db_get_ws(hContact, szModule, szSetting, &dbv); diff --git a/plugins/ClientChangeNotify/src/CString.h b/plugins/ClientChangeNotify/src/CString.h index 9218a6459d..decedaaac7 100644 --- a/plugins/ClientChangeNotify/src/CString.h +++ b/plugins/ClientChangeNotify/src/CString.h @@ -20,7 +20,6 @@ #pragma once #include -#include #include #ifdef CHARARRAY_CONVERT #include "TMyArray.h" @@ -97,7 +96,7 @@ private: }; -typedef TString TCString; +typedef TString TCString; typedef TString CString; typedef TString WCString; @@ -164,9 +163,9 @@ __inline CHARARRAY WCHAR2UTF8(WCString Str) #undef db_get_s CString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const char *szDefaultValue); -TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); +TCString db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue); int db_get_s(MCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); -TCString DBGetContactSettingAsString(MCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue); // also converts numeric values to a string +TCString DBGetContactSettingAsString(MCONTACT hContact, const char *szModule, const char *szSetting, const wchar_t *szDefaultValue); // also converts numeric values to a string // various string helpers. their return values are valid only while the class is visible class UTF8Encode diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index dfd08a712c..86cc7fdee5 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -149,11 +149,11 @@ void ShowPopup(SHOWPOPUP_DATA *sd) { TCString PopupText; if (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT)) { - mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s (was %s)"), (const TCHAR*)sd->MirVer, (const TCHAR*)sd->OldMirVer); + mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s (was %s)"), (const wchar_t*)sd->MirVer, (const wchar_t*)sd->OldMirVer); PopupText.ReleaseBuffer(); } else { - mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s"), (const TCHAR*)sd->MirVer); + mir_sntprintf(PopupText.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("changed client to %s"), (const wchar_t*)sd->MirVer); PopupText.ReleaseBuffer(); } @@ -168,8 +168,8 @@ void ShowPopup(SHOWPOPUP_DATA *sd) ppd.lchIcon = Skin_LoadProtoIcon(szProto, db_get_w(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE)); pdata->hIcon = NULL; } - _tcsncpy(ppd.lptzContactName, (TCHAR*)pcli->pfnGetContactDisplayName(sd->hContact, 0), _countof(ppd.lptzContactName) - 1); - _tcsncpy(ppd.lptzText, PopupText, _countof(ppd.lptzText) - 1); + wcsncpy(ppd.lptzContactName, (wchar_t*)pcli->pfnGetContactDisplayName(sd->hContact, 0), _countof(ppd.lptzContactName) - 1); + wcsncpy(ppd.lptzText, PopupText, _countof(ppd.lptzText) - 1); ppd.colorBack = (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_DEFBGCOLOUR) ? 0 : sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_BGCOLOUR)); ppd.colorText = (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_DEFTEXTCOLOUR) ? 0 : sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_TEXTCOLOUR)); ppd.PluginWindowProc = PopupWndProc; @@ -244,7 +244,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) } } } - if (sd.MirVer == (const TCHAR*)sd.OldMirVer) { + if (sd.MirVer == (const wchar_t*)sd.OldMirVer) { _ASSERT(hContact); return 0; } @@ -257,7 +257,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (hContact) { TCString ClientName; if (PopupOptPage.GetValue(IDC_POPUPOPTDLG_SHOWPREVCLIENT) && sd.OldMirVer.GetLen()) { - mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const TCHAR*)sd.MirVer, (const TCHAR*)sd.OldMirVer); + mir_sntprintf(ClientName.GetBuffer(MAX_MSG_LEN), MAX_MSG_LEN, TranslateT("%s (was %s)"), (const wchar_t*)sd.MirVer, (const wchar_t*)sd.OldMirVer); ClientName.ReleaseBuffer(); } else ClientName = sd.MirVer; @@ -277,9 +277,9 @@ static int PrebuildMainMenu(WPARAM, LPARAM) // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded if (bPopupExists) { if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) - Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENT("Disable c&lient change notification"), IcoLib_GetIcon("popup_enabled")); + Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Disable c&lient change notification"), IcoLib_GetIcon("popup_enabled")); else - Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENT("Enable c&lient change notification"), IcoLib_GetIcon("popup_disabled")); + Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Enable c&lient change notification"), IcoLib_GetIcon("popup_disabled")); } return 0; } @@ -330,12 +330,12 @@ int MirandaLoaded(WPARAM, LPARAM) CMenuItem mi; SET_UID(mi, 0xfabb9181, 0xdb92, 0x43f4, 0x86, 0x40, 0xca, 0xb6, 0x4c, 0x93, 0x34, 0x27); - mi.root = Menu_CreateRoot(MO_MAIN, LPGENT("Popups"), 0); + mi.root = Menu_CreateRoot(MO_MAIN, LPGENW("Popups"), 0); mi.flags = CMIF_TCHAR; if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) - mi.name.t = LPGENT("Disable c&lient change notification"); + mi.name.w = LPGENW("Disable c&lient change notification"); else - mi.name.t = LPGENT("Enable c&lient change notification"); + mi.name.w = LPGENW("Enable c&lient change notification"); mi.pszService = MS_CCN_TOGGLEPOPUPS; g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h index d490677750..7d1b1eb238 100644 --- a/plugins/ClientChangeNotify/src/Misc.h +++ b/plugins/ClientChangeNotify/src/Misc.h @@ -20,7 +20,7 @@ #include "stdafx.h" extern BOOL bPopupExists; -__inline void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine = L"", bool IsErrorMsg = false, int Timeout = 0) +__inline void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine = L"", bool IsErrorMsg = false, int Timeout = 0) { if (bPopupExists) { @@ -43,7 +43,7 @@ __inline void ShowLog(TCString &LogFilePath) INT_PTR Result = (INT_PTR)ShellExecute(NULL, L"open", LogFilePath, NULL, NULL, SW_SHOW); if (Result <= 32) // Error { - TCHAR szError[64]; + wchar_t szError[64]; mir_sntprintf(szError, TranslateT("Error #%d"), Result); ShowMsg(szError, TranslateT("Can't open log file ") + LogFilePath, true); } @@ -52,10 +52,10 @@ __inline void ShowLog(TCString &LogFilePath) __inline void RecompileRegexps(TCString IgnoreSubstrings) { FreePcreCompileData(); - TCHAR *p = _tcstok(IgnoreSubstrings, L";"); + wchar_t *p = wcstok(IgnoreSubstrings, L";"); while (p) { CompileRegexp(p, p[0] != '/'); - p = _tcstok(NULL, L";"); + p = wcstok(NULL, L";"); } } diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 4aefc4c519..9ec69fe61c 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -58,17 +58,17 @@ void EnablePopupOptDlgControls() static struct { - TCHAR *Text; + wchar_t *Text; int Action; } PopupActions[] = { - LPGENT("Open message window"), PCA_OPENMESSAGEWND, - LPGENT("Close popup"), PCA_CLOSEPOPUP, - LPGENT("Open contact details window"), PCA_OPENDETAILS, - LPGENT("Open contact menu"), PCA_OPENMENU, - LPGENT("Open contact history"), PCA_OPENHISTORY, - LPGENT("Do nothing"), PCA_DONOTHING + LPGENW("Open message window"), PCA_OPENMESSAGEWND, + LPGENW("Close popup"), PCA_CLOSEPOPUP, + LPGENW("Open contact details window"), PCA_OPENDETAILS, + LPGENW("Open contact menu"), PCA_OPENMENU, + LPGENW("Open contact history"), PCA_OPENHISTORY, + LPGENW("Do nothing"), PCA_DONOTHING }; INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -163,11 +163,11 @@ int OptionsDlgInit(WPARAM wParam, LPARAM) if (bPopupExists) { OPTIONSDIALOGPAGE optDi = { sizeof(optDi) }; optDi.position = 920000000; - optDi.ptszTitle = LPGENT("ClientChangeNotify"); + optDi.pwszTitle = LPGENW("ClientChangeNotify"); optDi.pfnDlgProc = PopupOptDlg; optDi.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPOPTDLG); optDi.hInstance = g_hInstance; - optDi.ptszGroup = LPGENT("Popups"); + optDi.pwszGroup = LPGENW("Popups"); optDi.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; Options_AddPage(wParam, &optDi); } diff --git a/plugins/ClientChangeNotify/src/Options.cpp b/plugins/ClientChangeNotify/src/Options.cpp index aea2556676..62463ea611 100644 --- a/plugins/ClientChangeNotify/src/Options.cpp +++ b/plugins/ClientChangeNotify/src/Options.cpp @@ -286,7 +286,7 @@ int TreeReadEnum(const char *szSetting, LPARAM lParam) pItem.Title = db_get_s(NULL, pData->sModule, *pData->sDBSettingPrefix + szSetting, L""); pItem.User_Str1 = (pData->TreeCtrl->User_Str1_DBName == NULL) ? NULL : db_get_s(NULL, pData->sModule, - *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (TCHAR*)NULL); + *pData->sDBSettingPrefix + pData->TreeCtrl->sDBSetting + pData->TreeCtrl->User_Str1_DBName + (szSetting + Len), (wchar_t*)NULL); } } return 0; @@ -722,7 +722,7 @@ void COptItem_ListCtrl::MemToWnd(HWND hWnd) SendMessage(hListView, LB_RESETCONTENT, 0, 0); for (int i = 0; i < m_value.GetSize(); i++) - SendMessage(hListView, LB_INSERTSTRING, -1, (LPARAM)(TCHAR*)m_value[i].Text); + SendMessage(hListView, LB_INSERTSTRING, -1, (LPARAM)(wchar_t*)m_value[i].Text); SendMessage(hListView, WM_SETREDRAW, true, 0); COptItem::MemToWnd(hWnd); @@ -794,7 +794,7 @@ void COptItem_ListCtrl::ModifyItem(HWND hWnd, int ID, CListItem &Item) int TopIndex = SendMessage(hListView, LB_GETTOPINDEX, 0, 0); int Res = SendMessage(hListView, LB_DELETESTRING, ID, 0); _ASSERT(Res != LB_ERR); - Res = SendMessage(hListView, LB_INSERTSTRING, ID, (LPARAM)(TCHAR*)(Item.Text)); + Res = SendMessage(hListView, LB_INSERTSTRING, ID, (LPARAM)(wchar_t*)(Item.Text)); _ASSERT(Res != LB_ERR && Res != LB_ERRSPACE); SendMessage(hListView, LB_SETCURSEL, CurSel, 0); SendMessage(hListView, LB_SETTOPINDEX, TopIndex, 0); @@ -808,7 +808,7 @@ CListItem* COptItem_ListCtrl::InsertItem(HWND hWnd, int ID, CListItem &Item) // ID is position at which to insert the item; -1 = add to the end of the list { HWND hListView = GetDlgItem(hWnd, m_dlgItemID); - int Res = SendMessage(hListView, LB_INSERTSTRING, ID, (LPARAM)(TCHAR*)(Item.Text)); // LB_INSERTSTRING doesn't sort the lists even with LBS_SORT style + int Res = SendMessage(hListView, LB_INSERTSTRING, ID, (LPARAM)(wchar_t*)(Item.Text)); // LB_INSERTSTRING doesn't sort the lists even with LBS_SORT style _ASSERT(Res != LB_ERR && Res != LB_ERRSPACE); int i = m_value.AddElem(Item); m_bModified = true; diff --git a/plugins/ClientChangeNotify/src/Options.h b/plugins/ClientChangeNotify/src/Options.h index b22a0b902b..aac3e9d1c0 100644 --- a/plugins/ClientChangeNotify/src/Options.h +++ b/plugins/ClientChangeNotify/src/Options.h @@ -92,7 +92,7 @@ class COptItem_Edit : public COptItem { public: COptItem_Edit() {} - COptItem_Edit(int m_dlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool m_bReadOnly = false) + COptItem_Edit(int m_dlgItemID, char *szDBSetting, int nMaxLen, wchar_t *szDefValue, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, nMaxLen, lParam, m_bReadOnly), sDefValue(szDefValue) {} @@ -323,7 +323,7 @@ class COptItem_StrDBSetting : public COptItem { public: COptItem_StrDBSetting() {} - COptItem_StrDBSetting(int m_dlgItemID, char *szDBSetting, int nMaxLen, TCHAR *szDefValue, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, nMaxLen, lParam, m_bReadOnly), sDefValue(szDefValue) {} + COptItem_StrDBSetting(int m_dlgItemID, char *szDBSetting, int nMaxLen, wchar_t *szDefValue, int lParam = 0, bool m_bReadOnly = false) : COptItem(m_dlgItemID, szDBSetting, nMaxLen, lParam, m_bReadOnly), sDefValue(szDefValue) {} void DBToMem(const CString &sModule, CString *sDBSettingPrefix = NULL) { sValue = GetStrDBVal(sModule, sDBSettingPrefix); COptItem::DBToMem(sModule, sDBSettingPrefix); } void MemToDB(const CString &sModule, CString *sDBSettingPrefix = NULL) { SetStrDBVal(sModule, sValue, sDBSettingPrefix); COptItem::MemToDB(sModule, sDBSettingPrefix); } void WndToMem(HWND hWnd) { COptItem::WndToMem(hWnd); } diff --git a/plugins/ClientChangeNotify/src/pcre.cpp b/plugins/ClientChangeNotify/src/pcre.cpp index 259e9facdb..c7954f265f 100644 --- a/plugins/ClientChangeNotify/src/pcre.cpp +++ b/plugins/ClientChangeNotify/src/pcre.cpp @@ -71,8 +71,8 @@ TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) { TCString OrigRegexp = Regexp; Regexp = Regexp.Right(Regexp.GetLen() - 1); - TCHAR *pRegexpEnd = (TCHAR*)Regexp + Regexp.GetLen(); - TCHAR *p = _tcsrchr(Regexp.GetBuffer(), '/'); + wchar_t *pRegexpEnd = (wchar_t*)Regexp + Regexp.GetLen(); + wchar_t *p = wcsrchr(Regexp.GetBuffer(), '/'); if (!p) { Regexp = OrigRegexp; @@ -126,7 +126,7 @@ TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) PcreCompileData[NewID].pExtra = pcre16_study(PcreCompileData[NewID].pPcre, 0, &Err); } else { - // Result += LogMessage(TranslateT("Syntax error in regexp\n%s\nat offset %d: %s."), (TCHAR*)Regexp, ErrOffs, (TCHAR*)ANSI2TCHAR(Err)) + L"\n\n"; + // Result += LogMessage(TranslateT("Syntax error in regexp\n%s\nat offset %d: %s."), (wchar_t*)Regexp, ErrOffs, (wchar_t*)ANSI2TCHAR(Err)) + L"\n\n"; PcreCompileData[NewID].Pattern = Regexp; } } @@ -165,7 +165,7 @@ int PcreCheck(TCString Str, int StartingID) } } else { - if (_tcsstr(Str.ToLower(), PcreCompileData[I].Pattern.ToLower())) + if (wcsstr(Str.ToLower(), PcreCompileData[I].Pattern.ToLower())) { return PcreCompileData[I].ID; } -- cgit v1.2.3