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/BasicHistory/src/BasicHistory.cpp | 12 +- plugins/BasicHistory/src/BinaryExport.h | 2 +- plugins/BasicHistory/src/DatExport.cpp | 2 +- plugins/BasicHistory/src/DatExport.h | 2 +- plugins/BasicHistory/src/EventList.cpp | 28 ++-- plugins/BasicHistory/src/EventList.h | 20 +-- plugins/BasicHistory/src/ExportManager.cpp | 28 ++-- plugins/BasicHistory/src/ExportManager.h | 2 +- plugins/BasicHistory/src/HistoryWindow.cpp | 52 +++---- plugins/BasicHistory/src/IExport.h | 2 +- plugins/BasicHistory/src/IImport.h | 2 +- plugins/BasicHistory/src/Options.cpp | 196 +++++++++++++-------------- plugins/BasicHistory/src/Options.h | 2 +- plugins/BasicHistory/src/PlainHtmlExport.cpp | 6 +- plugins/BasicHistory/src/PlainHtmlExport.h | 2 +- plugins/BasicHistory/src/RichHtmlExport.cpp | 28 ++-- plugins/BasicHistory/src/RichHtmlExport.h | 2 +- plugins/BasicHistory/src/Scheduler.cpp | 60 ++++---- plugins/BasicHistory/src/Searcher.cpp | 20 +-- plugins/BasicHistory/src/Searcher.h | 6 +- plugins/BasicHistory/src/TxtExport.cpp | 2 +- plugins/BasicHistory/src/TxtExport.h | 2 +- 22 files changed, 239 insertions(+), 239 deletions(-) (limited to 'plugins/BasicHistory/src') diff --git a/plugins/BasicHistory/src/BasicHistory.cpp b/plugins/BasicHistory/src/BasicHistory.cpp index 512c21ee8c..91150ad439 100644 --- a/plugins/BasicHistory/src/BasicHistory.cpp +++ b/plugins/BasicHistory/src/BasicHistory.cpp @@ -146,7 +146,7 @@ void InitTaskMenuItems() mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED; mi.pszService = MS_HISTORY_EXECUTE_TASK; mi.root = hTaskMainMenu; - mi.name.t = (TCHAR*)taskIt->taskName.c_str(); + mi.name.w = (wchar_t*)taskIt->taskName.c_str(); HGENMENU menu = Menu_AddMainMenuItem(&mi); Menu_ConfigureItem(menu, MCI_OPT_EXECPARAM, pos++); taskMenus.push_back(menu); @@ -205,14 +205,14 @@ int ModulesLoaded(WPARAM, LPARAM) { InitMenuItems(); - TCHAR ftpExe[MAX_PATH]; + wchar_t ftpExe[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, ftpExe))) { - _tcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); + wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); DWORD atr = GetFileAttributes(ftpExe); if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY) { #ifdef _WIN64 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILESX86, NULL, SHGFP_TYPE_CURRENT, ftpExe))) { - _tcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); + wcscat_s(ftpExe, L"\\WinSCP\\WinSCP.exe"); atr = GetFileAttributes(ftpExe); if (!(atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY)) Options::instance->ftpExePathDef = ftpExe; @@ -222,8 +222,8 @@ int ModulesLoaded(WPARAM, LPARAM) else Options::instance->ftpExePathDef = ftpExe; } - TCHAR *log = L"%miranda_logpath%\\BasicHistory\\ftplog.txt"; - TCHAR *logAbsolute = Utils_ReplaceVarsT(log); + wchar_t *log = L"%miranda_logpath%\\BasicHistory\\ftplog.txt"; + wchar_t *logAbsolute = Utils_ReplaceVarsT(log); Options::instance->ftpLogPath = logAbsolute; mir_free(logAbsolute); Options::instance->Load(); diff --git a/plugins/BasicHistory/src/BinaryExport.h b/plugins/BasicHistory/src/BinaryExport.h index 94d92c5f1d..917e27787f 100644 --- a/plugins/BasicHistory/src/BinaryExport.h +++ b/plugins/BasicHistory/src/BinaryExport.h @@ -25,7 +25,7 @@ class BinaryExport : public IImport { public: - virtual const TCHAR* GetExt() + virtual const wchar_t* GetExt() { return L"bin"; } diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 336adcd3e7..92975b61ff 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -152,7 +152,7 @@ bool DatExport::GetEventList(std::vector& eventList) DBEVENTINFO info = {0}; info.cbSize = sizeof(DBEVENTINFO); info.szModule = GetContactProto(hContact); - TCHAR _str[MAXSELECTSTR + 8]; // for safety reason + wchar_t _str[MAXSELECTSTR + 8]; // for safety reason std::multimap sortedEvents; while(dataSize > 0) { messageHeader.cbSize = 0; diff --git a/plugins/BasicHistory/src/DatExport.h b/plugins/BasicHistory/src/DatExport.h index efe071c0ac..81fbdf61a0 100644 --- a/plugins/BasicHistory/src/DatExport.h +++ b/plugins/BasicHistory/src/DatExport.h @@ -25,7 +25,7 @@ class DatExport : public IImport { public: - virtual const TCHAR* GetExt() + virtual const wchar_t* GetExt() { return L"dat"; } diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index c2ced6267e..eab014339e 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -300,7 +300,7 @@ void HistoryEventList::RefreshEventList() } } -bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun) +bool HistoryEventList::SearchInContact(MCONTACT hContact, wchar_t *strFind, ComparatorInterface* compFun) { InitFilters(); @@ -327,7 +327,7 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, Compar EventIndex ei; EventData ed; - TCHAR str[MAXSELECTSTR + 8]; // for safety reason + wchar_t str[MAXSELECTSTR + 8]; // for safety reason for (std::list::iterator itL = tempList.begin(); itL != tempList.end(); ++itL) { ei.isExternal = itL->isExternal; ei.hEvent = itL->hEvent; @@ -343,27 +343,27 @@ bool HistoryEventList::SearchInContact(MCONTACT hContact, TCHAR *strFind, Compar void HistoryEventList::InitNames() { - TCHAR str[200]; + wchar_t str[200]; if (m_hContact) { - _tcscpy_s(m_contactName, pcli->pfnGetContactDisplayName(m_hContact, 0)); + wcscpy_s(m_contactName, pcli->pfnGetContactDisplayName(m_hContact, 0)); mir_sntprintf(str, TranslateT("History for %s"), m_contactName); } else { - _tcscpy_s(m_contactName, TranslateT("System")); + wcscpy_s(m_contactName, TranslateT("System")); mir_sntprintf(str, TranslateT("History")); } if (m_isWnd) SetWindowText(m_hWnd, str); - _tcscpy_s(m_myName, GetMyName().c_str()); + wcscpy_s(m_myName, GetMyName().c_str()); } void HistoryEventList::AddGroup(const EventIndex& ev) { EventData data; GetEventData(ev, data); - TCHAR eventText[256]; + wchar_t eventText[256]; int i; eventText[0] = 0; TimeZone_PrintTimeStamp(NULL, data.timestamp, L"d t", eventText, 64, 0); @@ -374,7 +374,7 @@ void HistoryEventList::AddGroup(const EventIndex& ev) else user = m_contactName; GetEventMessage(ev, eventText, 256); - for (i = 0; eventText[i] != 0 && eventText[i] != _T('\r') && eventText[i] != _T('\n'); ++i); + for (i = 0; eventText[i] != 0 && eventText[i] != '\r' && eventText[i] != '\n'; ++i); eventText[i] = 0; if (i > Options::instance->groupMessageLen) { eventText[Options::instance->groupMessageLen - 3] = '.'; @@ -446,15 +446,15 @@ std::wstring HistoryEventList::GetContactId() return ::GetContactId(m_hContact); } -static void GetMessageDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) +static void GetMessageDescription(DBEVENTINFO *dbei, wchar_t* buf, int cbBuf) { - TCHAR *msg = DbGetEventTextT(dbei, CP_ACP); - _tcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), _TRUNCATE); + wchar_t *msg = DbGetEventTextT(dbei, CP_ACP); + wcsncpy_s(buf, cbBuf, msg ? msg : TranslateT("Invalid Message"), _TRUNCATE); buf[cbBuf - 1] = 0; mir_free(msg); } -void HistoryEventList::GetObjectDescription(DBEVENTINFO *dbei, TCHAR* str, int cbStr) +void HistoryEventList::GetObjectDescription(DBEVENTINFO *dbei, wchar_t* str, int cbStr) { GetMessageDescription(dbei, str, cbStr); } @@ -599,7 +599,7 @@ void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, { mir_cslock lck(csEventList); - TCHAR buf[32]; + wchar_t buf[32]; mir_sntprintf(buf, L"%016llx", (unsigned long long int)hContact); ImportDiscData data; data.file = m_contactFileDir + buf; @@ -610,7 +610,7 @@ void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, void HistoryEventList::Init() { - TCHAR temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; temp[0] = 0; GetTempPath(MAX_PATH, temp); m_contactFileDir = temp; diff --git a/plugins/BasicHistory/src/EventList.h b/plugins/BasicHistory/src/EventList.h index 8f4f65089a..52c70e64c1 100644 --- a/plugins/BasicHistory/src/EventList.h +++ b/plugins/BasicHistory/src/EventList.h @@ -24,7 +24,7 @@ along with this program. If not, see . class ComparatorInterface { public: - virtual bool Compare(const bool isMe, const std::wstring& message, TCHAR *strFind) = 0; + virtual bool Compare(const bool isMe, const std::wstring& message, wchar_t *strFind) = 0; }; class HistoryEventList @@ -84,8 +84,8 @@ private: void ImportMessages(const std::vector& messages); protected: - TCHAR m_contactName[256]; - TCHAR m_myName[256]; + wchar_t m_contactName[256]; + wchar_t m_myName[256]; bool m_isWnd; bool m_isFlat; int m_deltaTime; @@ -117,7 +117,7 @@ public: int GetFilterNr(); std::wstring GetFilterName(); void RefreshEventList(); - bool SearchInContact(MCONTACT hContact, TCHAR *strFind, ComparatorInterface* compFun); + bool SearchInContact(MCONTACT hContact, wchar_t *strFind, ComparatorInterface* compFun); std::wstring GetContactName(); std::wstring GetMyName(); std::wstring GetProtocolName(); @@ -129,18 +129,18 @@ public: static int GetContactMessageNumber(MCONTACT hContact); static bool IsImportedHistory(MCONTACT hContact); static void DeleteImporter(MCONTACT hContact); - static void GetObjectDescription( DBEVENTINFO *dbei, TCHAR* str, int cbStr ); + static void GetObjectDescription( DBEVENTINFO *dbei, wchar_t* str, int cbStr ); bool GetEventData(const EventIndex& ev, EventData& data); void GetExtEventDBei(const EventIndex& ev); HICON GetEventCoreIcon(const EventIndex& ev); - void GetEventMessage(const EventIndex& ev, TCHAR* message) // must be allocated with MAXSELECTSTR len + void GetEventMessage(const EventIndex& ev, wchar_t* message) // must be allocated with MAXSELECTSTR len { if (!ev.isExternal) GetObjectDescription(&m_dbei, message, MAXSELECTSTR); else - _tcscpy_s(message, MAXSELECTSTR, m_importedMessages[ev.exIdx].message.c_str()); + wcscpy_s(message, MAXSELECTSTR, m_importedMessages[ev.exIdx].message.c_str()); } - void GetEventMessage(const EventIndex& ev, TCHAR* message, int strLen) + void GetEventMessage(const EventIndex& ev, wchar_t* message, int strLen) { if (!ev.isExternal) GetObjectDescription(&m_dbei, message, strLen); @@ -149,12 +149,12 @@ public: std::wstring& meg = m_importedMessages[ev.exIdx].message; if ((int)meg.size() >= strLen) { - memcpy_s(message, strLen * sizeof(TCHAR), meg.c_str(), (strLen - 1) * sizeof(TCHAR)); + memcpy_s(message, strLen * sizeof(wchar_t), meg.c_str(), (strLen - 1) * sizeof(wchar_t)); message[strLen - 1] = 0; } else { - _tcscpy_s(message, strLen, meg.c_str()); + wcscpy_s(message, strLen, meg.c_str()); } } } diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index d783fde17f..c2168d861c 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -33,23 +33,23 @@ ExportManager::ExportManager(HWND hwnd, MCONTACT hContact, int filter) : { } -std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open) +std::wstring GetFile(const wchar_t* ext, HWND hwnd, bool open) { - TCHAR filter[512]; + wchar_t filter[512]; std::locale loc; - TCHAR extUpper[32]; + wchar_t extUpper[32]; - _tcscpy_s(extUpper, ext); + wcscpy_s(extUpper, ext); extUpper[0] = std::toupper(ext[0], loc); mir_sntprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext); size_t len = mir_tstrlen(filter) + 1; mir_sntprintf(filter + len, _countof(filter) - len, L"*.%s", ext); len += mir_tstrlen(filter + len); filter[++len] = 0; - TCHAR stzFilePath[1024]; - _tcscpy_s(stzFilePath, TranslateT("History")); - _tcscat_s(stzFilePath, L"."); - _tcscat_s(stzFilePath, ext); + wchar_t stzFilePath[1024]; + wcscpy_s(stzFilePath, TranslateT("History")); + wcscat_s(stzFilePath, L"."); + wcscat_s(stzFilePath, ext); len = mir_tstrlen(stzFilePath) + 1; stzFilePath[len] = 0; OPENFILENAME ofn = {0}; @@ -75,7 +75,7 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open) return L""; } -std::wstring ReplaceExt(const std::wstring& file, const TCHAR* ext) +std::wstring ReplaceExt(const std::wstring& file, const wchar_t* ext) { size_t pos = file.find(L""); if (pos < file.length()) { @@ -178,7 +178,7 @@ bool ExportManager::Export(IExport::ExportType type) return true; } -const TCHAR* ExportManager::GetExt(IImport::ImportType type) +const wchar_t* ExportManager::GetExt(IImport::ImportType type) { IImport *imp = NULL; switch(type) { @@ -192,7 +192,7 @@ const TCHAR* ExportManager::GetExt(IImport::ImportType type) return L""; } - const TCHAR *ext = imp->GetExt(); + const wchar_t *ext = imp->GetExt(); delete imp; return ext; } @@ -294,7 +294,7 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst return; m_exp->WriteGroup(isMe, time, user, eventText); - TCHAR str[MAXSELECTSTR + 8]; // for safety reason + wchar_t str[MAXSELECTSTR + 8]; // for safety reason str[0] = 0; bool isFirst = true; bool lastMe = false; @@ -312,8 +312,8 @@ void ExportManager::AddGroup(bool isMe, const std::wstring &time, const std::wst if (GetEventData(hDbEvent, data)) { lastMe = data.isMe; - TCHAR* formatDate = Options::instance->messagesShowSec ? L"d s" : L"d t"; - TCHAR* longFormatDate = Options::instance->messagesShowSec ? L"d s" : L"d t"; + wchar_t* formatDate = Options::instance->messagesShowSec ? L"d s" : L"d t"; + wchar_t* longFormatDate = Options::instance->messagesShowSec ? L"d s" : L"d t"; if (!Options::instance->messagesShowDate) { if (isFirst) { isFirst = false; diff --git a/plugins/BasicHistory/src/ExportManager.h b/plugins/BasicHistory/src/ExportManager.h index 1cefb47463..73cd4ca1b7 100644 --- a/plugins/BasicHistory/src/ExportManager.h +++ b/plugins/BasicHistory/src/ExportManager.h @@ -55,6 +55,6 @@ public: void DeleteExportedEvents(); int Import(IImport::ImportType type, const std::vector &contacts); bool Import(IImport::ImportType type, std::vector &eventList, std::wstring *err = NULL, bool *differentContact = NULL, std::vector *contacts = NULL); - static const TCHAR* GetExt(IImport::ImportType type); + static const wchar_t* GetExt(IImport::ImportType type); }; diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index ecfe7e8e2b..499488c6e4 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -388,7 +388,7 @@ INT_PTR HistoryWindow::DeleteAllUserHistory(WPARAM hContact, LPARAM) } } - TCHAR *message = TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"); + wchar_t *message = TranslateT("This operation will PERMANENTLY REMOVE all history for this contact.\nAre you sure you want to do this?"); if (MessageBox(hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK) return FALSE; @@ -427,7 +427,7 @@ bool HistoryWindow::IsInList(HWND hWnd) void ClickLink(HWND hwnd, ENLINK *penLink) { - TCHAR buf[1024]; + wchar_t buf[1024]; if (penLink->msg != WM_LBUTTONUP) return; @@ -566,14 +566,14 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP if (HIWORD(wParam) == BN_CLICKED) { if (Button_GetCheck(GetDlgItem(hwndDlg, IDC_SHOWHIDE)) & BST_CHECKED) { SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)historyWindow->minusIco); - SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Hide Contacts"), BATF_TCHAR); historyWindow->isContactList = true; ShowWindow(GetDlgItem(hwndDlg, IDC_LIST_CONTACTS), SW_SHOW); ShowWindow(historyWindow->splitterYhWnd, SW_SHOW); } else { SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)historyWindow->plusIco); - SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR); + SendDlgItemMessage(hwndDlg, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Show Contacts"), BATF_TCHAR); historyWindow->isContactList = false; ShowWindow(GetDlgItem(hwndDlg, IDC_LIST_CONTACTS), SW_HIDE); ShowWindow(historyWindow->splitterYhWnd, SW_HIDE); @@ -728,7 +728,7 @@ INT_PTR CALLBACK HistoryWindow::DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wP TEXTRANGE tr; tr.chrg.cpMin = iStart; tr.chrg.cpMax = iEnd; - tr.lpstrText = new TCHAR[iEnd - iStart + 1]; + tr.lpstrText = new wchar_t[iEnd - iStart + 1]; SendMessage(historyWindow->editWindow, EM_GETTEXTRANGE, 0, (LPARAM)& tr); historyWindow->FormatQuote(quote, historyWindow->currentGroup[start], tr.lpstrText); delete[] tr.lpstrText; @@ -988,13 +988,13 @@ void HistoryWindow::Initialise() SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONSETASFLATBTN, TRUE, 0); if (m_hContact == NULL || Options::instance->showContacts) { SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)minusIco); - SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Hide Contacts"), BATF_TCHAR); + SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Hide Contacts"), BATF_TCHAR); Button_SetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE), BST_CHECKED); isContactList = true; } else { SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)plusIco); - SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show Contacts"), BATF_TCHAR); + SendDlgItemMessage(m_hWnd, IDC_SHOWHIDE, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Show Contacts"), BATF_TCHAR); Button_SetCheck(GetDlgItem(m_hWnd, IDC_SHOWHIDE), BST_UNCHECKED); ShowWindow(GetDlgItem(m_hWnd, IDC_LIST_CONTACTS), SW_HIDE); ShowWindow(splitterYhWnd, SW_HIDE); @@ -1226,21 +1226,21 @@ void HistoryWindow::FillHistoryThread(void* param) void HistoryWindow::AddGroup(bool, const std::wstring &time, const std::wstring &user, const std::wstring &eventText, int ico) { - TCHAR msg[256]; + wchar_t msg[256]; msg[0] = 0; if (Options::instance->groupShowTime) - _tcscpy_s(msg, time.c_str()); + wcscpy_s(msg, time.c_str()); if (Options::instance->groupShowName) { if (msg[0] != 0) - _tcscat_s(msg, L" "); - _tcscat_s(msg, user.c_str()); + wcscat_s(msg, L" "); + wcscat_s(msg, user.c_str()); } if (Options::instance->groupShowMessage) { if (msg[0] != 0) - _tcscat_s(msg, L" "); - _tcscat_s(msg, eventText.c_str()); + wcscat_s(msg, L" "); + wcscat_s(msg, eventText.c_str()); } LVITEM item = { 0 }; @@ -1295,8 +1295,8 @@ void HistoryWindow::SelectEventGroup(int sel) if (sel < 0 || sel >= (int)m_eventList.size()) return; - TCHAR _str[MAXSELECTSTR + 8]; // for safety reason - TCHAR *str = _str + sizeof(int) / sizeof(TCHAR); + wchar_t _str[MAXSELECTSTR + 8]; // for safety reason + wchar_t *str = _str + sizeof(int) / sizeof(wchar_t); BSTR pStr = str; unsigned int *strLen = (unsigned int*)_str; str[0] = 0; @@ -1339,9 +1339,9 @@ void HistoryWindow::SelectEventGroup(int sel) lastMe = data.isMe; backColor = Options::instance->GetColor(lastMe ? Options::OutBackground : Options::InBackground); if (Options::instance->messagesShowEvents) { - str[0] = _T('>'); + str[0] = '>'; str[1] = 0; - *strLen = 1 * sizeof(TCHAR); + *strLen = 1 * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); TextFont->SetBackColor(backColor); @@ -1360,7 +1360,7 @@ void HistoryWindow::SelectEventGroup(int sel) ImageDataObject::InsertIcon(RichEditOle, ico, backColor, 16, 16); } - TCHAR* formatDate = Options::instance->messagesShowSec ? (isUser ? L"d s " : L"d s\n") : (isUser ? L"d t " : L"d t\n"); + wchar_t* formatDate = Options::instance->messagesShowSec ? (isUser ? L"d s " : L"d s\n") : (isUser ? L"d t " : L"d t\n"); if (!Options::instance->messagesShowDate) { if (isFirst) { isFirst = false; @@ -1378,7 +1378,7 @@ void HistoryWindow::SelectEventGroup(int sel) } TimeZone_PrintTimeStamp(NULL, data.timestamp, formatDate, str, MAXSELECTSTR, 0); - *strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR); + *strLen = (unsigned int)mir_tstrlen(str) * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutTimestamp : Options::InTimestamp); @@ -1388,7 +1388,7 @@ void HistoryWindow::SelectEventGroup(int sel) if (isUser) { mir_sntprintf(str, MAXSELECTSTR, L"%s\n", (lastMe) ? m_myName : m_contactName); - *strLen = (unsigned int)mir_tstrlen(str) * sizeof(TCHAR); + *strLen = (unsigned int)mir_tstrlen(str) * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutName : Options::InName); @@ -1401,9 +1401,9 @@ void HistoryWindow::SelectEventGroup(int sel) size_t i = strStl.length(); if (i + 1 >= MAXSELECTSTR) continue; - str[i++] = _T('\n'); + str[i++] = '\n'; str[i] = 0; - *strLen = (unsigned int)i * sizeof(TCHAR); + *strLen = (unsigned int)i * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutMessages : Options::InMessages); @@ -1944,7 +1944,7 @@ void HistoryWindow::Delete(int what) if (toDelete == 0) return; - TCHAR message[256]; + wchar_t message[256]; mir_sntprintf(message, TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete); if (MessageBox(m_hWnd, message, TranslateT("Are You sure?"), MB_OKCANCEL | MB_ICONERROR) != IDOK) return; @@ -1960,7 +1960,7 @@ void HistoryWindow::Delete(int what) rebuild = (start == 0 && end == currentGroup.size()); if (areImpMessages) { - TCHAR *ptszMsg = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again."); + wchar_t *ptszMsg = TranslateT("Do you want to delete all imported messages for this contact?\nNote that next scheduler task import this messages again."); if (MessageBox(m_hWnd, ptszMsg, TranslateT("Are You sure?"), MB_YESNO | MB_ICONERROR) == IDYES) { HistoryEventList::DeleteImporter(m_hContact); rebuild = true; @@ -2030,7 +2030,7 @@ void HistoryWindow::FormatQuote(std::wstring "e, const MessageData &md, cons quote += m_myName; else quote += m_contactName; - TCHAR str[32]; + wchar_t str[32]; TimeZone_PrintTimeStamp(NULL, md.timestamp, L"d t", str, 32, 0); quote += L", "; quote += str; @@ -2046,7 +2046,7 @@ void HistoryWindow::FormatQuote(std::wstring "e, const MessageData &md, cons } f = nf + 1; - if (msg[nf] == _T('\r') && f < (int)msg.length() && msg[f] == _T('\n')) + if (msg[nf] == '\r' && f < (int)msg.length() && msg[f] == '\n') ++f; } else if (msg.length() - f > 0) { diff --git a/plugins/BasicHistory/src/IExport.h b/plugins/BasicHistory/src/IExport.h index d024a084e4..b9edc83d02 100644 --- a/plugins/BasicHistory/src/IExport.h +++ b/plugins/BasicHistory/src/IExport.h @@ -36,7 +36,7 @@ public: stream = str; } - virtual const TCHAR* GetExt() = 0; + virtual const wchar_t* GetExt() = 0; virtual void WriteHeader(const std::wstring &fileName, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string& baseProto1, const std::wstring& encoding) = 0; virtual void WriteFooter() = 0; virtual void WriteGroup(bool isMe, const std::wstring &time, const std::wstring &user, const std::wstring &eventText) = 0; diff --git a/plugins/BasicHistory/src/IImport.h b/plugins/BasicHistory/src/IImport.h index 84a65c15f2..6752bf9eef 100644 --- a/plugins/BasicHistory/src/IImport.h +++ b/plugins/BasicHistory/src/IImport.h @@ -42,7 +42,7 @@ public: stream = str; } - virtual const TCHAR* GetExt() = 0; + virtual const wchar_t* GetExt() = 0; virtual int IsContactInFile(const std::vector& contacts) = 0; virtual bool GetEventList(std::vector& eventList) = 0; diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index d464b4299c..262b46e47c 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -31,22 +31,22 @@ Options *Options::instance; struct EventNamesType { int id; - TCHAR* name; + wchar_t* name; } EventNames[] = { - EVENTTYPE_MESSAGE, LPGENT("Message"), - EVENTTYPE_FILE, LPGENT("File transfer"), - EVENTTYPE_URL, LPGENT("Link"), - EVENTTYPE_AUTHREQUEST, LPGENT("Authorization request"), - EVENTTYPE_ADDED, LPGENT("You were added"), - EVENTTYPE_CONTACTS, LPGENT("Contacts received"), - ICQEVENTTYPE_SMS, LPGENT("SMS message") + EVENTTYPE_MESSAGE, LPGENW("Message"), + EVENTTYPE_FILE, LPGENW("File transfer"), + EVENTTYPE_URL, LPGENW("Link"), + EVENTTYPE_AUTHREQUEST, LPGENW("Authorization request"), + EVENTTYPE_ADDED, LPGENW("You were added"), + EVENTTYPE_CONTACTS, LPGENW("Contacts received"), + ICQEVENTTYPE_SMS, LPGENW("SMS message") }; struct TCpTable { UINT cpId; - TCHAR *cpName; + wchar_t *cpName; } cpTable[] = { { CP_UTF8, L"UTF-8" }, @@ -123,34 +123,34 @@ int Options::InitOptions(WPARAM wParam, LPARAM) odp.position = 100000000; odp.hInstance = hInst; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.ptszTitle = LPGENT("History"); + odp.pwszTitle = LPGENW("History"); - odp.ptszTab = LPGENT("Group list"); + odp.pwszTab = LPGENW("Group list"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GROUPLIST); odp.pfnDlgProc = Options::DlgProcOptsGroupList; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Messages"); + odp.pwszTab = LPGENW("Messages"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MESSAGES); odp.pfnDlgProc = Options::DlgProcOptsMessages; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Searching"); + odp.pwszTab = LPGENW("Searching"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SEARCHING); odp.pfnDlgProc = Options::DlgProcOptsSearching; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Export"); + odp.pwszTab = LPGENW("Export"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXPORT); odp.pfnDlgProc = Options::DlgProcOptsExport; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Scheduler"); + odp.pwszTab = LPGENW("Scheduler"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SCHEDULER); odp.pfnDlgProc = Options::DlgProcOptsScheduler; Options_AddPage(wParam, &odp); - odp.ptszTab = LPGENT("Advanced"); + odp.pwszTab = LPGENW("Advanced"); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_MAIN); odp.pfnDlgProc = Options::DlgProcOptsMain; Options_AddPage(wParam, &odp); @@ -158,69 +158,69 @@ int Options::InitOptions(WPARAM wParam, LPARAM) } struct FontOptionsList { - TCHAR* szDescr; + wchar_t* szDescr; COLORREF defColour; - TCHAR* szDefFace; + wchar_t* szDefFace; BYTE defStyle; char defSize; - TCHAR* szBackgroundName; + wchar_t* szBackgroundName; DWORD flags; }; struct ColorOptionsList { - TCHAR* tszName; + wchar_t* tszName; COLORREF def; }; struct HotkeyOptionsList { const char *pszName; - const TCHAR *ptszDescription; - const TCHAR *ptszSection; + const wchar_t *ptszDescription; + const wchar_t *ptszSection; const char *pszService; WORD DefHotKey; LPARAM lParam; }; static FontOptionsList g_FontOptionsList[] = { - {LPGENT(">> Outgoing timestamp"), RGB(0, 0, 0), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENT("Outgoing background"), FIDF_ALLOWEFFECTS}, - {LPGENT("<< Incoming timestamp"), RGB(0, 0, 0), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENT("Incoming background"), FIDF_ALLOWEFFECTS}, - {LPGENT(">> Outgoing name"), RGB(100,100,100), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENT("Outgoing background"), FIDF_ALLOWEFFECTS}, - {LPGENT("<< Incoming name"), RGB(90,160,90), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENT("Incoming background"), FIDF_ALLOWEFFECTS}, - {LPGENT(">> Outgoing messages"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENT("Outgoing background"), FIDF_ALLOWEFFECTS}, - {LPGENT("<< Incoming messages"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENT("Incoming background"), FIDF_ALLOWEFFECTS}, - {LPGENT("Group list"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENT("Group list background"), FIDF_DISABLESTYLES}, - {LPGENT("Find window"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENT("Find window background"), FIDF_DISABLESTYLES}, + {LPGENW(">> Outgoing timestamp"), RGB(0, 0, 0), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENW("Outgoing background"), FIDF_ALLOWEFFECTS}, + {LPGENW("<< Incoming timestamp"), RGB(0, 0, 0), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENW("Incoming background"), FIDF_ALLOWEFFECTS}, + {LPGENW(">> Outgoing name"), RGB(100,100,100), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENW("Outgoing background"), FIDF_ALLOWEFFECTS}, + {LPGENW("<< Incoming name"), RGB(90,160,90), L"MS Shell Dlg 2", DBFONTF_BOLD, -11, LPGENW("Incoming background"), FIDF_ALLOWEFFECTS}, + {LPGENW(">> Outgoing messages"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENW("Outgoing background"), FIDF_ALLOWEFFECTS}, + {LPGENW("<< Incoming messages"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENW("Incoming background"), FIDF_ALLOWEFFECTS}, + {LPGENW("Group list"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENW("Group list background"), FIDF_DISABLESTYLES}, + {LPGENW("Find window"), RGB(0, 0, 0), L"MS Shell Dlg 2", 0, -11, LPGENW("Find window background"), FIDF_DISABLESTYLES}, }; static ColorOptionsList g_ColorOptionsList[] = { - LPGENT("Outgoing background"), RGB(245,245,255), - LPGENT("Incoming background"), RGB(245,255,245), - LPGENT("Group list background"), GetSysColor(COLOR_3DFACE), - LPGENT("Window background"), GetSysColor(COLOR_3DFACE), - LPGENT("Contact list background"), GetSysColor(COLOR_3DFACE), - LPGENT("Find window background"), GetSysColor(COLOR_WINDOW), + LPGENW("Outgoing background"), RGB(245,245,255), + LPGENW("Incoming background"), RGB(245,255,245), + LPGENW("Group list background"), GetSysColor(COLOR_3DFACE), + LPGENW("Window background"), GetSysColor(COLOR_3DFACE), + LPGENW("Contact list background"), GetSysColor(COLOR_3DFACE), + LPGENW("Find window background"), GetSysColor(COLOR_WINDOW), }; static HotkeyOptionsList g_HotkeyOptionsList[] = { - { "basichistory_hot_showall", LPGENT("Open global history"), LPGENT("History"), MS_HISTORY_SHOWCONTACTHISTORY, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'H') | HKF_MIRANDA_LOCAL, 0 }, - { "basichistory_hot_find", LPGENT("Find"), LPGENT("History"), 0, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND }, - { "basichistory_hot_findnext", LPGENT("Find Next"), LPGENT("History"), 0, VK_F3, HISTORY_HK_FINDNEXT }, - { "basichistory_hot_findprev", LPGENT("Find Previous"), LPGENT("History"), 0, VK_F2, HISTORY_HK_FINDPREV }, - { "basichistory_hot_matchcase", LPGENT("Switch Match Case"), LPGENT("History"), 0, 0, HISTORY_HK_MATCHCASE }, - { "basichistory_hot_matchwhole", LPGENT("Switch Match Whole Word"), LPGENT("History"), 0, 0, HISTORY_HK_MATCHWHOLE }, - { "basichistory_hot_showcontacts", LPGENT("Show/Hide Contacts"), LPGENT("History"), 0, 0, HISTORY_HK_SHOWCONTACTS }, - { "basichistory_hot_onlyin", LPGENT("Switch Only Incoming Messages"), LPGENT("History"), 0, 0, HISTORY_HK_ONLYIN }, - { "basichistory_hot_onlyout", LPGENT("Switch Only Outgoing Messages"), LPGENT("History"), 0, 0, HISTORY_HK_ONLYOUT }, - { "basichistory_hot_onlygroup", LPGENT("Switch Only Selected Group"), LPGENT("History"), 0, 0, HISTORY_HK_ONLYGROUP }, - { "basichistory_hot_allcontacts", LPGENT("Switch All Contacts"), LPGENT("History"), 0, 0, HISTORY_HK_ALLCONTACTS }, - { "basichistory_hot_delete", LPGENT("Delete"), LPGENT("History"), 0, VK_DELETE, HISTORY_HK_DELETE }, - { "basichistory_hot_exrhtml", LPGENT("Export To Rich Html"), LPGENT("History"), 0, 0, HISTORY_HK_EXRHTML }, - { "basichistory_hot_exphtml", LPGENT("Export To Plain Html"), LPGENT("History"), 0, 0, HISTORY_HK_EXPHTML }, - { "basichistory_hot_extxt", LPGENT("Export To Txt"), LPGENT("History"), 0, 0, HISTORY_HK_EXTXT }, - { "basichistory_hot_exbin", LPGENT("Export To Binary"), LPGENT("History"), 0, 0, HISTORY_HK_EXBIN }, - { "basichistory_hot_impbin", LPGENT("Import From Binary"), LPGENT("History"), 0, 0, HISTORY_HK_IMPBIN }, - { "basichistory_hot_exdat", LPGENT("Export To Dat (mContacts)"), LPGENT("History"), 0, 0, HISTORY_HK_EXDAT }, - { "basichistory_hot_impdat", LPGENT("Import From Dat (mContacts)"), LPGENT("History"), 0, 0, HISTORY_HK_IMPDAT }, + { "basichistory_hot_showall", LPGENW("Open global history"), LPGENW("History"), MS_HISTORY_SHOWCONTACTHISTORY, HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'H') | HKF_MIRANDA_LOCAL, 0 }, + { "basichistory_hot_find", LPGENW("Find"), LPGENW("History"), 0, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), HISTORY_HK_FIND }, + { "basichistory_hot_findnext", LPGENW("Find Next"), LPGENW("History"), 0, VK_F3, HISTORY_HK_FINDNEXT }, + { "basichistory_hot_findprev", LPGENW("Find Previous"), LPGENW("History"), 0, VK_F2, HISTORY_HK_FINDPREV }, + { "basichistory_hot_matchcase", LPGENW("Switch Match Case"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHCASE }, + { "basichistory_hot_matchwhole", LPGENW("Switch Match Whole Word"), LPGENW("History"), 0, 0, HISTORY_HK_MATCHWHOLE }, + { "basichistory_hot_showcontacts", LPGENW("Show/Hide Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_SHOWCONTACTS }, + { "basichistory_hot_onlyin", LPGENW("Switch Only Incoming Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYIN }, + { "basichistory_hot_onlyout", LPGENW("Switch Only Outgoing Messages"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYOUT }, + { "basichistory_hot_onlygroup", LPGENW("Switch Only Selected Group"), LPGENW("History"), 0, 0, HISTORY_HK_ONLYGROUP }, + { "basichistory_hot_allcontacts", LPGENW("Switch All Contacts"), LPGENW("History"), 0, 0, HISTORY_HK_ALLCONTACTS }, + { "basichistory_hot_delete", LPGENW("Delete"), LPGENW("History"), 0, VK_DELETE, HISTORY_HK_DELETE }, + { "basichistory_hot_exrhtml", LPGENW("Export To Rich Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXRHTML }, + { "basichistory_hot_exphtml", LPGENW("Export To Plain Html"), LPGENW("History"), 0, 0, HISTORY_HK_EXPHTML }, + { "basichistory_hot_extxt", LPGENW("Export To Txt"), LPGENW("History"), 0, 0, HISTORY_HK_EXTXT }, + { "basichistory_hot_exbin", LPGENW("Export To Binary"), LPGENW("History"), 0, 0, HISTORY_HK_EXBIN }, + { "basichistory_hot_impbin", LPGENW("Import From Binary"), LPGENW("History"), 0, 0, HISTORY_HK_IMPBIN }, + { "basichistory_hot_exdat", LPGENW("Export To Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_EXDAT }, + { "basichistory_hot_impdat", LPGENW("Import From Dat (mContacts)"), LPGENW("History"), 0, 0, HISTORY_HK_IMPDAT }, }; const int g_fontsSize = _countof(g_FontOptionsList); @@ -238,26 +238,26 @@ void Options::Load(void) cid.cbSize = sizeof(ColourIDT); hid.cbSize = sizeof(HOTKEYDESC); strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); - _tcsncpy_s(fid.backgroundGroup, L"History", _TRUNCATE); - _tcsncpy_s(fid.group, LPGENT("History"), _TRUNCATE); + wcsncpy_s(fid.backgroundGroup, L"History", _TRUNCATE); + wcsncpy_s(fid.group, LPGENW("History"), _TRUNCATE); for (int i = 0; i < g_fontsSize; ++i) { fid.order = i; - _tcsncpy_s(fid.deffontsettings.szFace, g_FontOptionsList[i].szDefFace, _TRUNCATE); + wcsncpy_s(fid.deffontsettings.szFace, g_FontOptionsList[i].szDefFace, _TRUNCATE); fid.deffontsettings.size = g_FontOptionsList[i].defSize; fid.deffontsettings.colour = g_FontOptionsList[i].defColour; fid.deffontsettings.style = g_FontOptionsList[i].defStyle; fid.deffontsettings.charset = DEFAULT_CHARSET; mir_snprintf(fid.prefix, _countof(fid.prefix), "Font%d", i); - _tcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE); - _tcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE); + wcsncpy_s(fid.name, g_FontOptionsList[i].szDescr, _TRUNCATE); + wcsncpy_s(fid.backgroundName, g_FontOptionsList[i].szBackgroundName, _TRUNCATE); fid.flags = FIDF_DEFAULTVALID | FIDF_CLASSGENERAL | g_FontOptionsList[i].flags; FontRegisterT(&fid); } strncpy_s(cid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); - _tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE); + wcsncpy_s(cid.group, LPGENW("History"), _TRUNCATE); for (int i = 0; i < g_colorsSize; ++i) { - _tcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, _TRUNCATE); + wcsncpy_s(cid.name, g_ColorOptionsList[i].tszName, _TRUNCATE); mir_snprintf(cid.setting, _countof(cid.setting), "Color%d", i); cid.order = i; cid.defcolour = g_ColorOptionsList[i].def; @@ -410,8 +410,8 @@ COLORREF Options::GetFont(Fonts fontId, PLOGFONT font) { FontIDT fid = {0}; fid.cbSize = sizeof(FontIDT); - _tcsncpy_s(fid.group, LPGENT("History"), _TRUNCATE); - _tcsncpy_s(fid.name, g_FontOptionsList[fontId].szDescr, _TRUNCATE); + wcsncpy_s(fid.group, LPGENW("History"), _TRUNCATE); + wcsncpy_s(fid.name, g_FontOptionsList[fontId].szDescr, _TRUNCATE); return (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)font); } @@ -419,8 +419,8 @@ COLORREF Options::GetColor(Colors colorId) { ColourIDT cid = {0}; cid.cbSize = sizeof(ColourIDT); - _tcsncpy_s(cid.group, LPGENT("History"), _TRUNCATE); - _tcsncpy_s(cid.name, g_ColorOptionsList[colorId].tszName, _TRUNCATE); + wcsncpy_s(cid.group, LPGENW("History"), _TRUNCATE); + wcsncpy_s(cid.name, g_ColorOptionsList[colorId].tszName, _TRUNCATE); return (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, NULL); } @@ -721,7 +721,7 @@ void SetEventCB(HWND hwndCB, int eventId) selCpIdx = i; if (selCpIdx == -1) { - TCHAR buf[24]; + wchar_t buf[24]; mir_sntprintf(buf, L"%d", eventId); ComboBox_SetText(hwndCB, buf); } @@ -732,10 +732,10 @@ int GetEventCB(HWND hwndCB, bool errorReport, int &eventId) { int selCpIdx = ComboBox_GetCurSel(hwndCB); if (selCpIdx < 0) { - TCHAR text[24]; + wchar_t text[24]; ComboBox_GetText(hwndCB, text, 24); - TCHAR * stopOn = NULL; - long cp = _tcstol(text, &stopOn, 10); + wchar_t * stopOn = NULL; + long cp = wcstol(text, &stopOn, 10); if (errorReport && (stopOn == text || *stopOn != '\0' || cp < 0)) { MessageBox(GetParent(hwndCB), TranslateT("Invalid event number"), TranslateT("Error"), MB_OK | MB_ICONERROR); SetFocus(hwndCB); @@ -776,7 +776,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel) selCpIdx = i; if (selCpIdx == -1) { - TCHAR buf[24]; + wchar_t buf[24]; mir_sntprintf(buf, L"%d", *it); ListBox_AddString(hwndLB, buf); } @@ -786,7 +786,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel) bool CheckFile(HWND hwndEdit) { - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; Edit_GetText(hwndEdit, buf, MAX_PATH); DWORD atr = GetFileAttributes(buf); if (atr == INVALID_FILE_ATTRIBUTES || atr & FILE_ATTRIBUTE_DIRECTORY) { @@ -798,27 +798,27 @@ bool CheckFile(HWND hwndEdit) return true; } -bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR* ext, const TCHAR* title, bool open) +bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const wchar_t* defName, const wchar_t* ext, const wchar_t* title, bool open) { - TCHAR filter[1024]; + wchar_t filter[1024]; std::locale loc; - TCHAR extUpper[32]; - _tcscpy_s(extUpper, ext); + wchar_t extUpper[32]; + wcscpy_s(extUpper, ext); extUpper[0] = std::toupper(ext[0], loc); mir_sntprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext); size_t len = mir_tstrlen(filter) + 1; mir_sntprintf(filter + len, _countof(filter) - len, L"*.%s", ext); len += mir_tstrlen(filter + len) + 1; - _tcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)")); + wcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)")); len += mir_tstrlen(filter + len) + 1; - _tcscpy_s(filter + len, 1024 - len, L"*.*"); + wcscpy_s(filter + len, 1024 - len, L"*.*"); len += mir_tstrlen(filter + len) + 1; filter[len] = 0; - TCHAR stzFilePath[1024]; + wchar_t stzFilePath[1024]; Edit_GetText(hwndEdit, stzFilePath, 1023); if (stzFilePath[0] == 0) { - _tcscpy_s(stzFilePath, defName); + wcscpy_s(stzFilePath, defName); len = mir_tstrlen(stzFilePath) + 1; stzFilePath[len] = 0; } @@ -911,7 +911,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, switch(LOWORD(wParam)) { case IDC_ADD_FILTER: { - TCHAR name[24]; + wchar_t name[24]; Edit_GetText(nameFilter, name, 24); if (name[0] == 0) { MessageBox(hwndDlg, TranslateT("Enter filter name"), TranslateT("Error"), MB_ICONERROR); @@ -1079,7 +1079,7 @@ INT_PTR CALLBACK Options::DlgProcOptsMain(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { HWND ftp = GetDlgItem(hwndDlg, IDC_WINSCP); - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; Edit_GetText(ftp, buf, MAX_PATH); if (buf[0] != 0 && !CheckFile(ftp)) { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -1282,7 +1282,7 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name } if (selCpIdx == -1) { - TCHAR buf[300]; + wchar_t buf[300]; mir_sntprintf(buf, L"%d;%s", codepage, name.c_str()); ComboBox_SetText(hwndCB, buf); } @@ -1295,18 +1295,18 @@ unsigned int GetCodepageCB(HWND hwndCB, bool errorReport, unsigned int, const st { int selCpIdx = ComboBox_GetCurSel(hwndCB); if (selCpIdx < 0) { - TCHAR text[128]; + wchar_t text[128]; ComboBox_GetText(hwndCB, text, 128); std::wstring str = text; name = L""; - size_t pos = str.find_first_of(_T(';')); + size_t pos = str.find_first_of(';'); if (pos < str.length()) { text[pos] = 0; name = str.substr(pos + 1); } - TCHAR * stopOn = NULL; - long cp = _tcstol(text, &stopOn, 10); + wchar_t * stopOn = NULL; + long cp = wcstol(text, &stopOn, 10); if ((pos >= str.length() || name.empty() || stopOn == text || *stopOn != '\0' || cp < 0 || cp > 0xffff)) { if (errorReport) { MessageBox(GetParent(hwndCB), TranslateT("You've entered invalid codepage. Select codepage from combo box or enter correct number."), TranslateT("Invalid codepage"), MB_OK | MB_ICONERROR); @@ -1399,7 +1399,7 @@ INT_PTR CALLBACK Options::DlgProcOptsExport(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE; } - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; Edit_GetText(GetDlgItem(hwndDlg, IDC_HTML2EXTCSSFILE), buf, MAX_PATH); instance->extCssHtml2 = buf; } @@ -1696,9 +1696,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, Edit_LimitText(deltaTime, 4); SetDlgItemInt(hwndDlg, IDC_TRIGER_DELTA_TIME, to->deltaTime, FALSE); - TCHAR timeFormat[10]; + wchar_t timeFormat[10]; if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SSHORTTIME, timeFormat, 10) == 0) { - TCHAR sep = _T(':'); + wchar_t sep = ':'; if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0) sep = timeFormat[0]; mir_sntprintf(timeFormat, L"HH%cmm", sep); @@ -1747,7 +1747,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, BOOL isOK = FALSE; toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE); if (!isOK) { - TCHAR tszBuf[256]; + wchar_t tszBuf[256]; mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; @@ -1778,7 +1778,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, toCp.dayOfMonth = GetDlgItemInt(hwndDlg, IDC_TRIGER_DAY, &isOK, FALSE); if (!isOK) { if (toCp.trigerType == TaskOptions::Monthly) { - TCHAR tszBuf[256]; + wchar_t tszBuf[256]; mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; @@ -1788,7 +1788,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, toCp.deltaTime = GetDlgItemInt(hwndDlg, IDC_TRIGER_DELTA_TIME, &isOK, FALSE); if (!isOK) { if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) { - TCHAR tszBuf[256]; + wchar_t tszBuf[256]; mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; @@ -1802,9 +1802,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, to->taskName = L""; if (!IsValidTask(toCp, top->tasks, &err, &errDescr)) { to->taskName = lastName; - TCHAR tszBuf[256]; + wchar_t tszBuf[256]; if (err.empty()) - _tcscpy_s(tszBuf, TranslateT("Some value is invalid")); + wcscpy_s(tszBuf, TranslateT("Some value is invalid")); else if (errDescr.empty()) mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str()); else @@ -1868,9 +1868,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow(GetDlgItem(hwndDlg, IDC_IMPORT_TYPE), showImport); std::wstring str; - TCHAR* compressText = TranslateT("Compress output files"); - TCHAR* uploadText = TranslateT("Upload to FTP (WinSCP requred)"); - TCHAR* typeText = TranslateT("Export to"); + wchar_t* compressText = TranslateT("Compress output files"); + wchar_t* uploadText = TranslateT("Upload to FTP (WinSCP requred)"); + wchar_t* typeText = TranslateT("Export to"); if (showFilter == SW_HIDE) { str = TranslateT("** Use to insert extension, to insert contact name"); compressText = TranslateT("Input files are compressed"); diff --git a/plugins/BasicHistory/src/Options.h b/plugins/BasicHistory/src/Options.h index e74c81ff33..097eec73f7 100644 --- a/plugins/BasicHistory/src/Options.h +++ b/plugins/BasicHistory/src/Options.h @@ -114,7 +114,7 @@ struct TaskOptions dayOfMonth = 1; deltaTime = 24; orderNr = 0; - TCHAR buf[MAX_PATH]; + wchar_t buf[MAX_PATH]; if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, buf))) { filePath = buf; diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index c98386a056..52bf4fadd7 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -73,7 +73,7 @@ void PlainHtmlExport::WriteFooter() void PlainHtmlExport::WriteGroup(bool, const std::wstring &time, const std::wstring&, const std::wstring&) { - TCHAR buf[256]; + wchar_t buf[256]; EXP_FILE << L"
\n"; mir_sntprintf(buf, TranslateT("Conversation started at %s"), time.c_str()); EXP_FILE << L"
" << buf << L"
\n"; @@ -82,8 +82,8 @@ void PlainHtmlExport::WriteGroup(bool, const std::wstring &time, const std::wstr void PlainHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, const std::wstring &shortDate, const std::wstring &user, const std::wstring &message, const DBEVENTINFO&) { - TCHAR *id = isMe ? L"out" : L"inc"; - TCHAR* ev = (isMe ? L"1" : L"0"); + wchar_t *id = isMe ? L"out" : L"inc"; + wchar_t* ev = (isMe ? L"1" : L"0"); bool isUrl = false; std::wstring mes = UrlHighlightHtml(MakeTextHtmled(message), isUrl); if (isUrl) diff --git a/plugins/BasicHistory/src/PlainHtmlExport.h b/plugins/BasicHistory/src/PlainHtmlExport.h index 122e82d808..985e75d410 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.h +++ b/plugins/BasicHistory/src/PlainHtmlExport.h @@ -22,7 +22,7 @@ class PlainHtmlExport : public IExport { public: - virtual const TCHAR* GetExt() + virtual const wchar_t* GetExt() { return L"html"; } diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 5b030b5721..45bc07ee5b 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -39,19 +39,19 @@ std::wstring MakeTextHtmled(const std::wstring& message, std::queue'): + case '>': ret += L">"; break; - case _T('\t'): + case '\t': ret += L" "; break; - case _T('\n'): + case '\n': ret += L"
"; break; } @@ -257,8 +257,8 @@ void IcoSave(const std::wstring &fileName, HICON hicon) bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true) { size_t len = mir_tstrlen(lpszDir); - TCHAR *pszFrom = new TCHAR[len+2]; - _tcscpy_s(pszFrom, len+2, lpszDir); + wchar_t *pszFrom = new wchar_t[len+2]; + wcscpy_s(pszFrom, len+2, lpszDir); pszFrom[len] = 0; pszFrom[len+1] = 0; @@ -365,8 +365,8 @@ void RichHtmlExport::WriteFooter() void RichHtmlExport::WriteGroup(bool isMe, const std::wstring &time, const std::wstring&, const std::wstring &eventText) { - TCHAR *id = isMe ? L"out" : L"inc"; - TCHAR* ev = (isMe ? L"1" : L"0"); + wchar_t *id = isMe ? L"out" : L"inc"; + wchar_t* ev = (isMe ? L"1" : L"0"); if (groupId > 0) EXP_FILE << L"
\n"; @@ -383,9 +383,9 @@ void RichHtmlExport::WriteGroup(bool isMe, const std::wstring &time, const std:: void RichHtmlExport::WriteMessage(bool isMe, const std::wstring &longDate, const std::wstring &shortDate, const std::wstring &user, const std::wstring &message, const DBEVENTINFO&) { - TCHAR *id = isMe ? L"out" : L"inc"; - TCHAR* ev = (isMe ? L"1" : L"0"); - TCHAR* ev1 = ev; + wchar_t *id = isMe ? L"out" : L"inc"; + wchar_t* ev = (isMe ? L"1" : L"0"); + wchar_t* ev1 = ev; bool isUrl = false; std::wstring mes = ReplaceSmileys(isMe, message, isUrl); if (isUrl) @@ -405,8 +405,8 @@ std::wstring RichHtmlExport::ReplaceSmileys(bool isMe, const std::wstring &msg, if (!Options::instance->exportHtml2UseSmileys || !g_SmileyAddAvail) return UrlHighlightHtml(MakeTextHtmled(msg), isUrl); - TCHAR* msgbuf = new TCHAR[msg.length() + 1]; - memcpy_s(msgbuf, (msg.length() + 1) * sizeof(TCHAR), msg.c_str(), (msg.length() + 1) * sizeof(TCHAR)); + wchar_t* msgbuf = new wchar_t[msg.length() + 1]; + memcpy_s(msgbuf, (msg.length() + 1) * sizeof(wchar_t), msg.c_str(), (msg.length() + 1) * sizeof(wchar_t)); SMADD_BATCHPARSE2 sp = {0}; SMADD_BATCHPARSERES *spr; sp.cbSize = sizeof(sp); diff --git a/plugins/BasicHistory/src/RichHtmlExport.h b/plugins/BasicHistory/src/RichHtmlExport.h index e1f31fc15c..6bdcd6e842 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.h +++ b/plugins/BasicHistory/src/RichHtmlExport.h @@ -29,7 +29,7 @@ private: std::unordered_set smileys; std::wstring ReplaceSmileys(bool isMe, const std::wstring &msg, bool &isUrl); public: - virtual const TCHAR* GetExt() + virtual const wchar_t* GetExt() { return L"html"; } diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 2185cb8212..01176f8b8e 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -44,13 +44,13 @@ void StartThread(bool init); void StopThread(); bool GetNextExportTime(bool init, time_t now); bool ExecuteCurrentTask(time_t now); -void GetZipFileTime(const TCHAR *file, uLong *dt); -std::wstring ReplaceExt(const std::wstring& file, const TCHAR* ext); +void GetZipFileTime(const wchar_t *file, uLong *dt); +std::wstring ReplaceExt(const std::wstring& file, const wchar_t* ext); bool ZipFiles(const std::wstring& dir, std::wstring zipFilePath, const std::string& password); bool UnzipFiles(const std::wstring& dir, std::wstring& zipFilePath, const std::string& password); bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std::wstring& ftpName); bool FtpGetFiles(const std::wstring& dir, const std::list& files, const std::wstring& ftpName); -void CreatePath(const TCHAR *szDir); +void CreatePath(const wchar_t *szDir); void DoError(const TaskOptions& to, const std::wstring error); static HANDLE hPopupClass; @@ -169,7 +169,7 @@ bool IsValidTask(TaskOptions& to, std::list* top, std::wstring* err *errDescr = TranslateT("To create session open WinSCP, click New Session, enter data and save with specific name. Remember if FTP server using password you should save it in WinSCP."); return false; } - if (to.useFtp && (to.filePath.find(_T('\\')) < to.filePath.length() || to.filePath.find(_T(':')) < to.filePath.length() || to.filePath[0] != L'/')) { + if (to.useFtp && (to.filePath.find('\\') < to.filePath.length() || to.filePath.find(':') < to.filePath.length() || to.filePath[0] != L'/')) { if (err != NULL) *err = TranslateT("Path to file"); if (errDescr != NULL) @@ -232,9 +232,9 @@ bool DoTask(TaskOptions& to) std::wstring err; std::wstring errDescr; if (!IsValidTask(to, NULL, &err, &errDescr)) { - TCHAR msg[256]; + wchar_t msg[256]; if (err.empty()) - _tcscpy_s(msg, TranslateT("Some value is invalid")); + wcscpy_s(msg, TranslateT("Some value is invalid")); else if (errDescr.empty()) mir_sntprintf(msg, TranslateT("Invalid '%s' value."), err.c_str()); else @@ -280,14 +280,14 @@ bool DoTask(TaskOptions& to) std::vector contacts; if (to.useFtp || to.compress) { std::map existingContacts; - TCHAR temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; temp[0] = 0; GetTempPath(MAX_PATH, temp); dir = temp; dir += GetName(filePath); dir = GetFileName(dir, L"", existingContacts, true); dir = ReplaceExt(dir, L""); - size_t pos = dir.find_last_of(_T('.')); + size_t pos = dir.find_last_of('.'); if (pos < dir.length()) dir = dir.substr(0, pos); @@ -295,7 +295,7 @@ bool DoTask(TaskOptions& to) CreateDirectory(dir.c_str(), NULL); } - const TCHAR* ext = ExportManager::GetExt(to.importType); + const wchar_t* ext = ExportManager::GetExt(to.importType); if (to.isSystem) { std::wstring n = GetFileName(filePath, mExp.GetContactName(), existingContacts1, true); n = ReplaceExt(n, ext); @@ -394,7 +394,7 @@ bool DoTask(TaskOptions& to) if (!errorStr.empty()) errorStr += L"\n"; - TCHAR msg[1024]; + wchar_t msg[1024]; mir_sntprintf(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str()); errorStr += msg; } @@ -402,7 +402,7 @@ bool DoTask(TaskOptions& to) if (!errorStr.empty()) errorStr += L"\n"; - TCHAR msg[1024]; + wchar_t msg[1024]; mir_sntprintf(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str()); errorStr += msg; @@ -434,14 +434,14 @@ bool DoTask(TaskOptions& to) } else { filePath = GetName(filePath); - TCHAR temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; temp[0] = 0; GetTempPath(MAX_PATH, temp); dir = temp; dir += filePath; dir = GetFileName(dir, L"", existingContacts, true); dir = ReplaceExt(dir, L""); - size_t pos = dir.find_last_of(_T('.')); + size_t pos = dir.find_last_of('.'); if (pos < dir.length()) dir = dir.substr(0, pos); @@ -458,7 +458,7 @@ bool DoTask(TaskOptions& to) if (!errorStr.empty()) errorStr += L"\n"; - TCHAR msg[1024]; + wchar_t msg[1024]; mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); errorStr += msg; @@ -480,7 +480,7 @@ bool DoTask(TaskOptions& to) if (!errorStr.empty()) errorStr += L"\n"; - TCHAR msg[1024]; + wchar_t msg[1024]; mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); errorStr += msg; break; @@ -507,7 +507,7 @@ bool DoTask(TaskOptions& to) } else { zipFilePath = GetName(zipFilePath); - TCHAR temp[MAX_PATH]; + wchar_t temp[MAX_PATH]; temp[0] = 0; GetTempPath(MAX_PATH, temp); zipDir = temp; @@ -567,7 +567,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, if (!baseName1.empty()) { std::wstring name = baseName1; int i = 0; - TCHAR buf[32]; + wchar_t buf[32]; std::map::iterator it = existingContacts.find(name); while(it != existingContacts.end()) { _itot_s(++i, buf, 10); @@ -583,7 +583,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, pos = str.find(L""); if (pos < str.length()) { - TCHAR time[256]; + wchar_t time[256]; SYSTEMTIME st; GetLocalTime(&st); mir_sntprintf(time, L"%d-%02d-%02d %02d%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute); @@ -793,7 +793,7 @@ bool GetNextExportTime(bool init, time_t now) static void CALLBACK DoTaskFinishInMainAPCFunc(ULONG_PTR dwParam) { - TCHAR *item = (TCHAR*) dwParam; + wchar_t *item = (wchar_t*) dwParam; MessageBox(NULL, item, TranslateT("Task finished"), MB_OK | MB_ICONINFORMATION); delete[] item; } @@ -841,7 +841,7 @@ bool ExecuteCurrentTask(time_t now) if (to.showMBAfterExecute) { size_t size = to.taskName.size() + 1024; - TCHAR *name = new TCHAR[size]; + wchar_t *name = new wchar_t[size]; if (error) mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str()); else @@ -854,7 +854,7 @@ bool ExecuteCurrentTask(time_t now) return GetNextExportTime(false, now); } -void GetZipFileTime(const TCHAR *file, uLong *dt) +void GetZipFileTime(const wchar_t *file, uLong *dt) { FILETIME ftLocal; WIN32_FIND_DATA ff32; @@ -868,7 +868,7 @@ void GetZipFileTime(const TCHAR *file, uLong *dt) /* calculate the CRC32 of a file, because to encrypt a file, we need known the CRC32 of the file before */ -bool GetFileCrc(const TCHAR *filenameinzip, unsigned char *buf, unsigned long, unsigned long *result_crc) +bool GetFileCrc(const wchar_t *filenameinzip, unsigned char *buf, unsigned long, unsigned long *result_crc) { unsigned long calculate_crc = 0; bool error = true; @@ -1128,7 +1128,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: CreateDirectory(GetDirectoryName(log).c_str(), NULL); DeleteFile(log.c_str()); - TCHAR cmdLine[MAX_PATH]; + wchar_t cmdLine[MAX_PATH]; mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); STARTUPINFO startupInfo = { 0 }; @@ -1219,7 +1219,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list& files, std::wstring &log = Options::instance->ftpLogPath; CreateDirectory(GetDirectoryName(log).c_str(), NULL); DeleteFile(log.c_str()); - TCHAR cmdLine[MAX_PATH]; + wchar_t cmdLine[MAX_PATH]; mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); STARTUPINFO startupInfo = { 0 }; PROCESS_INFORMATION processInfo; @@ -1243,18 +1243,18 @@ bool FtpGetFiles(const std::wstring& dir, const std::list& files, return true; } -void CreatePath(const TCHAR *szDir) +void CreatePath(const wchar_t *szDir) { if (!szDir) return; DWORD dwAttributes; - TCHAR *pszLastBackslash, szTestDir[MAX_PATH]; + wchar_t *pszLastBackslash, szTestDir[MAX_PATH]; mir_tstrncpy(szTestDir, szDir, _countof(szTestDir)); if ((dwAttributes = GetFileAttributes(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return; - pszLastBackslash = _tcsrchr(szTestDir, '\\'); + pszLastBackslash = wcsrchr(szTestDir, '\\'); if (pszLastBackslash == NULL) return; @@ -1282,7 +1282,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM) void DoError(const TaskOptions& to, const std::wstring _error) { - TCHAR msg[256]; + wchar_t msg[256]; mir_sntprintf(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str()); if (Options::instance->schedulerHistoryAlerts) { std::wstring error = msg; @@ -1312,8 +1312,8 @@ void DoError(const TaskOptions& to, const std::wstring _error) else if (ServiceExists(MS_POPUP_ADDPOPUPT)) { POPUPDATAT ppd = { 0 }; ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY); - _tcscpy_s(ppd.lptzContactName, msg); - _tcscpy_s(ppd.lptzText, _error.c_str()); + wcscpy_s(ppd.lptzContactName, msg); + wcscpy_s(ppd.lptzText, _error.c_str()); CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, 0); } } diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index bac7c8f37c..a3c8b4f093 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -61,12 +61,12 @@ void Searcher::ClearFind() } } -inline TCHAR mytoupper(TCHAR a, std::locale* loc) +inline wchar_t mytoupper(wchar_t a, std::locale* loc) { - return std::toupper(a, *loc); + return std::toupper(a, *loc); } -bool Searcher::CompareStr(std::wstring str, TCHAR *strFind) +bool Searcher::CompareStr(std::wstring str, wchar_t *strFind) { std::locale loc; if (!matchCase) @@ -89,7 +89,7 @@ bool Searcher::CompareStr(std::wstring str, TCHAR *strFind) void Searcher::Find() { FINDTEXTEX ft; - TCHAR str[128]; + wchar_t str[128]; int curSel = 0; bool isStart = false; bool finished = false; @@ -104,7 +104,7 @@ void Searcher::Find() GetWindowText(context->findWindow, str, _countof(str)); if (!str[0]) { - TCHAR buf[256]; + wchar_t buf[256]; mir_sntprintf(buf, TranslateT("\"%s\" not found"), str); MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION); return; @@ -297,20 +297,20 @@ void Searcher::Find() SendMessage(context->editWindow,EM_SETOPTIONS,ECOOP_AND,~ECO_NOHIDESEL); lastFindSelection = -1; if (isStart) { - TCHAR buf[256]; + wchar_t buf[256]; GetWindowText(context->findWindow, str, _countof(str)); mir_sntprintf(buf, TranslateT("\"%s\" not found"), str); MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION); } - else MessageBox(context->m_hWnd, TranslateTS(onlyGroup ? LPGENT("You have reached the end of the group.") : LPGENT("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION); + else MessageBox(context->m_hWnd, TranslateTS(onlyGroup ? LPGENW("You have reached the end of the group.") : LPGENW("You have reached the end of the history.")), TranslateT("Search"), MB_OK | MB_ICONINFORMATION); } -bool Searcher::IsInSel(int sel, TCHAR *strFind) +bool Searcher::IsInSel(int sel, wchar_t *strFind) { if (sel < 0 || sel >= (int)context->m_eventList.size()) return false; - TCHAR str[MAXSELECTSTR + 8]; // for safety reason + wchar_t str[MAXSELECTSTR + 8]; // for safety reason HistoryEventList::EventData data; for (std::deque::iterator it = context->m_eventList[sel].begin(); it != context->m_eventList[sel].end(); ++it) { HistoryEventList::EventIndex hDbEvent = *it; @@ -328,7 +328,7 @@ bool Searcher::IsInSel(int sel, TCHAR *strFind) return false; } -bool Searcher::Compare(const bool isMe, const std::wstring& message, TCHAR *strFind) +bool Searcher::Compare(const bool isMe, const std::wstring& message, wchar_t *strFind) { if (onlyIn && isMe || onlyOut && !isMe) return false; diff --git a/plugins/BasicHistory/src/Searcher.h b/plugins/BasicHistory/src/Searcher.h index a3229da1f5..1a76274221 100644 --- a/plugins/BasicHistory/src/Searcher.h +++ b/plugins/BasicHistory/src/Searcher.h @@ -31,11 +31,11 @@ private: bool isFindContactChanged; bool findBack, matchCase, matchWholeWords, onlyIn, onlyOut, onlyGroup, allUsers, searchForInLG, searchForInMes; - bool CompareStr(std::wstring str, TCHAR *strFind); - bool IsInSel(int sel, TCHAR *strFind); + bool CompareStr(std::wstring str, wchar_t *strFind); + bool IsInSel(int sel, wchar_t *strFind); public: Searcher(); - virtual bool Compare(const bool isMe, const std::wstring& message, TCHAR *strFind); + virtual bool Compare(const bool isMe, const std::wstring& message, wchar_t *strFind); void Find(); void ChangeFindDirection(bool isBack); void ClearFind(); diff --git a/plugins/BasicHistory/src/TxtExport.cpp b/plugins/BasicHistory/src/TxtExport.cpp index b2f9ddc5c9..89df71c8b3 100644 --- a/plugins/BasicHistory/src/TxtExport.cpp +++ b/plugins/BasicHistory/src/TxtExport.cpp @@ -26,7 +26,7 @@ TxtExport::~TxtExport() void TxtExport::WriteHeader(const std::wstring&, const std::wstring &filterName, const std::wstring &myName, const std::wstring &myId, const std::wstring &name1, const std::wstring &proto1, const std::wstring &id1, const std::string&, const std::wstring&) { - TCHAR* start = TranslateT("###"); + wchar_t* start = TranslateT("###"); EXP_FILE << start << "\n" << start << L" " << TranslateT("History Log") << L"\n"; EXP_FILE << start << L" " << myName; if (proto1.length() || myId.length()) diff --git a/plugins/BasicHistory/src/TxtExport.h b/plugins/BasicHistory/src/TxtExport.h index 3147d9024d..6c47a1d50e 100644 --- a/plugins/BasicHistory/src/TxtExport.h +++ b/plugins/BasicHistory/src/TxtExport.h @@ -23,7 +23,7 @@ class TxtExport : public IExport { public: - virtual const TCHAR* GetExt() + virtual const wchar_t* GetExt() { return L"txt"; } -- cgit v1.2.3