From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/BasicHistory/src/EventList.cpp | 12 +++++----- plugins/BasicHistory/src/ExportManager.cpp | 10 ++++---- plugins/BasicHistory/src/HistoryWindow.cpp | 8 +++---- plugins/BasicHistory/src/Options.cpp | 34 ++++++++++++++-------------- plugins/BasicHistory/src/PlainHtmlExport.cpp | 2 +- plugins/BasicHistory/src/RichHtmlExport.cpp | 2 +- plugins/BasicHistory/src/Scheduler.cpp | 26 ++++++++++----------- plugins/BasicHistory/src/Searcher.cpp | 8 +++---- 8 files changed, 51 insertions(+), 51 deletions(-) (limited to 'plugins/BasicHistory') diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index eab014339e..bea541c11a 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -346,11 +346,11 @@ void HistoryEventList::InitNames() wchar_t str[200]; if (m_hContact) { wcscpy_s(m_contactName, pcli->pfnGetContactDisplayName(m_hContact, 0)); - mir_sntprintf(str, TranslateT("History for %s"), m_contactName); + mir_snwprintf(str, TranslateT("History for %s"), m_contactName); } else { wcscpy_s(m_contactName, TranslateT("System")); - mir_sntprintf(str, TranslateT("History")); + mir_snwprintf(str, TranslateT("History")); } if (m_isWnd) @@ -398,7 +398,7 @@ std::wstring HistoryEventList::GetContactName() std::wstring HistoryEventList::GetMyName() { - ptrT name(Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(m_hContact))); + ptrW name(Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(m_hContact))); return (name == NULL) ? TranslateT("Me") : name; } @@ -431,13 +431,13 @@ std::string HistoryEventList::GetBaseProtocol() std::wstring HistoryEventList::GetMyId() { - ptrT id(Contact_GetInfo(CNF_DISPLAYUID, NULL, GetContactProto(m_hContact))); + ptrW id(Contact_GetInfo(CNF_DISPLAYUID, NULL, GetContactProto(m_hContact))); return (id == NULL) ? L"" : id; } inline std::wstring GetContactId(MCONTACT hContact) { - ptrT id(Contact_GetInfo(CNF_DISPLAYUID, hContact)); + ptrW id(Contact_GetInfo(CNF_DISPLAYUID, hContact)); return (id == NULL) ? L"" : id; } @@ -600,7 +600,7 @@ void HistoryEventList::AddImporter(MCONTACT hContact, IImport::ImportType type, mir_cslock lck(csEventList); wchar_t buf[32]; - mir_sntprintf(buf, L"%016llx", (unsigned long long int)hContact); + mir_snwprintf(buf, L"%016llx", (unsigned long long int)hContact); ImportDiscData data; data.file = m_contactFileDir + buf; data.type = type; diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index c2168d861c..c7ac9b099c 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -41,16 +41,16 @@ std::wstring GetFile(const wchar_t* ext, HWND hwnd, bool open) 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); + mir_snwprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext); + size_t len = mir_wstrlen(filter) + 1; + mir_snwprintf(filter + len, _countof(filter) - len, L"*.%s", ext); + len += mir_wstrlen(filter + len); filter[++len] = 0; wchar_t stzFilePath[1024]; wcscpy_s(stzFilePath, TranslateT("History")); wcscat_s(stzFilePath, L"."); wcscat_s(stzFilePath, ext); - len = mir_tstrlen(stzFilePath) + 1; + len = mir_wstrlen(stzFilePath) + 1; stzFilePath[len] = 0; OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 499488c6e4..be1dac8781 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -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(wchar_t); + *strLen = (unsigned int)mir_wstrlen(str) * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutTimestamp : Options::InTimestamp); @@ -1387,8 +1387,8 @@ void HistoryWindow::SelectEventGroup(int sel) TextFont->Release(); if (isUser) { - mir_sntprintf(str, MAXSELECTSTR, L"%s\n", (lastMe) ? m_myName : m_contactName); - *strLen = (unsigned int)mir_tstrlen(str) * sizeof(wchar_t); + mir_snwprintf(str, MAXSELECTSTR, L"%s\n", (lastMe) ? m_myName : m_contactName); + *strLen = (unsigned int)mir_wstrlen(str) * sizeof(wchar_t); TextSelection->SetStart(MAXLONG); TextSelection->GetFont(&TextFont); SetFontFromOptions(TextFont, caps, lastMe ? Options::OutName : Options::InName); @@ -1945,7 +1945,7 @@ void HistoryWindow::Delete(int what) return; wchar_t message[256]; - mir_sntprintf(message, TranslateT("Number of history items to delete: %d.\nAre you sure you want to do this?"), toDelete); + mir_snwprintf(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; diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 262b46e47c..4e243c3682 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -722,7 +722,7 @@ void SetEventCB(HWND hwndCB, int eventId) if (selCpIdx == -1) { wchar_t buf[24]; - mir_sntprintf(buf, L"%d", eventId); + mir_snwprintf(buf, L"%d", eventId); ComboBox_SetText(hwndCB, buf); } else ComboBox_SetCurSel(hwndCB, selCpIdx); @@ -777,7 +777,7 @@ void ReloadEventLB(HWND hwndLB, const FilterOptions &sel) if (selCpIdx == -1) { wchar_t buf[24]; - mir_sntprintf(buf, L"%d", *it); + mir_snwprintf(buf, L"%d", *it); ListBox_AddString(hwndLB, buf); } else ListBox_AddString(hwndLB, TranslateTS(EventNames[selCpIdx].name)); @@ -805,25 +805,25 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const wchar_t* defName, const wcha 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; + mir_snwprintf(filter, TranslateT("%s Files (*.%s)"), extUpper, ext); + size_t len = mir_wstrlen(filter) + 1; + mir_snwprintf(filter + len, _countof(filter) - len, L"*.%s", ext); + len += mir_wstrlen(filter + len) + 1; wcscpy_s(filter + len, 1024 - len, TranslateT("All Files (*.*)")); - len += mir_tstrlen(filter + len) + 1; + len += mir_wstrlen(filter + len) + 1; wcscpy_s(filter + len, 1024 - len, L"*.*"); - len += mir_tstrlen(filter + len) + 1; + len += mir_wstrlen(filter + len) + 1; filter[len] = 0; wchar_t stzFilePath[1024]; Edit_GetText(hwndEdit, stzFilePath, 1023); if (stzFilePath[0] == 0) { wcscpy_s(stzFilePath, defName); - len = mir_tstrlen(stzFilePath) + 1; + len = mir_wstrlen(stzFilePath) + 1; stzFilePath[len] = 0; } else { - len = mir_tstrlen(stzFilePath) + 1; + len = mir_wstrlen(stzFilePath) + 1; stzFilePath[len] = 0; } @@ -1283,7 +1283,7 @@ void InitCodepageCB(HWND hwndCB, unsigned int codepage, const std::wstring& name if (selCpIdx == -1) { wchar_t buf[300]; - mir_sntprintf(buf, L"%d;%s", codepage, name.c_str()); + mir_snwprintf(buf, L"%d;%s", codepage, name.c_str()); ComboBox_SetText(hwndCB, buf); } else ComboBox_SetCurSel(hwndCB, selCpIdx); @@ -1701,7 +1701,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, wchar_t sep = ':'; if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, timeFormat, 10) > 0) sep = timeFormat[0]; - mir_sntprintf(timeFormat, L"HH%cmm", sep); + mir_snwprintf(timeFormat, L"HH%cmm", sep); } SYSTEMTIME st; @@ -1748,7 +1748,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, toCp.eventDeltaTime = GetDlgItemInt(hwndDlg, IDC_EVENT_TIME, &isOK, TRUE); if (!isOK) { wchar_t tszBuf[256]; - mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than")); + mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Events older than")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; } @@ -1779,7 +1779,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (!isOK) { if (toCp.trigerType == TaskOptions::Monthly) { wchar_t tszBuf[256]; - mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day")); + mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Day")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; } @@ -1789,7 +1789,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (!isOK) { if (toCp.trigerType == TaskOptions::DeltaMin || toCp.trigerType == TaskOptions::DeltaHour) { wchar_t tszBuf[256]; - mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time")); + mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), TranslateT("Delta time")); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; } @@ -1806,9 +1806,9 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, if (err.empty()) wcscpy_s(tszBuf, TranslateT("Some value is invalid")); else if (errDescr.empty()) - mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str()); + mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value."), err.c_str()); else - mir_sntprintf(tszBuf, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str()); + mir_snwprintf(tszBuf, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str()); MessageBox(hwndDlg, tszBuf, TranslateT("Error"), MB_ICONERROR); break; } diff --git a/plugins/BasicHistory/src/PlainHtmlExport.cpp b/plugins/BasicHistory/src/PlainHtmlExport.cpp index 52bf4fadd7..1f00085b7a 100644 --- a/plugins/BasicHistory/src/PlainHtmlExport.cpp +++ b/plugins/BasicHistory/src/PlainHtmlExport.cpp @@ -75,7 +75,7 @@ void PlainHtmlExport::WriteGroup(bool, const std::wstring &time, const std::wstr { wchar_t buf[256]; EXP_FILE << L"
\n"; - mir_sntprintf(buf, TranslateT("Conversation started at %s"), time.c_str()); + mir_snwprintf(buf, TranslateT("Conversation started at %s"), time.c_str()); EXP_FILE << L"
" << buf << L"
\n"; EXP_FILE << L"
\n"; } diff --git a/plugins/BasicHistory/src/RichHtmlExport.cpp b/plugins/BasicHistory/src/RichHtmlExport.cpp index 45bc07ee5b..c1a639267e 100644 --- a/plugins/BasicHistory/src/RichHtmlExport.cpp +++ b/plugins/BasicHistory/src/RichHtmlExport.cpp @@ -256,7 +256,7 @@ void IcoSave(const std::wstring &fileName, HICON hicon) bool DeleteDirectory(LPCTSTR lpszDir, bool noRecycleBin = true) { - size_t len = mir_tstrlen(lpszDir); + size_t len = mir_wstrlen(lpszDir); wchar_t *pszFrom = new wchar_t[len+2]; wcscpy_s(pszFrom, len+2, lpszDir); pszFrom[len] = 0; diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 7ad20eb6b9..238a65cfdf 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -236,9 +236,9 @@ bool DoTask(TaskOptions& to) if (err.empty()) wcscpy_s(msg, TranslateT("Some value is invalid")); else if (errDescr.empty()) - mir_sntprintf(msg, TranslateT("Invalid '%s' value."), err.c_str()); + mir_snwprintf(msg, TranslateT("Invalid '%s' value."), err.c_str()); else - mir_sntprintf(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str()); + mir_snwprintf(msg, TranslateT("Invalid '%s' value.\n%s"), err.c_str(), errDescr.c_str()); DoError(to, msg); return true; @@ -395,7 +395,7 @@ bool DoTask(TaskOptions& to) errorStr += L"\n"; wchar_t msg[1024]; - mir_sntprintf(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str()); + mir_snwprintf(msg, TranslateT("Incorrect file format: %s."), GetName(*it).c_str()); errorStr += msg; } else { @@ -404,7 +404,7 @@ bool DoTask(TaskOptions& to) wchar_t msg[1024]; - mir_sntprintf(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str()); + mir_snwprintf(msg, TranslateT("Unknown contact in file: %s."), GetName(*it).c_str()); errorStr += msg; } } @@ -460,7 +460,7 @@ bool DoTask(TaskOptions& to) wchar_t msg[1024]; - mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); + mir_snwprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); errorStr += msg; } @@ -481,7 +481,7 @@ bool DoTask(TaskOptions& to) errorStr += L"\n"; wchar_t msg[1024]; - mir_sntprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); + mir_snwprintf(msg, TranslateT("Cannot export history for contact: %s."), exp->GetContactName().c_str()); errorStr += msg; break; } @@ -586,7 +586,7 @@ std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, 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); + mir_snwprintf(time, L"%d-%02d-%02d %02d%02d", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute); std::wstring str1 = str.substr(0, pos); str1 += time; str1 += str.substr(pos + 6); @@ -843,9 +843,9 @@ bool ExecuteCurrentTask(time_t now) size_t size = to.taskName.size() + 1024; wchar_t *name = new wchar_t[size]; if (error) - mir_sntprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str()); + mir_snwprintf(name, size, TranslateT("Task '%s' execution failed"), to.taskName.c_str()); else - mir_sntprintf(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str()); + mir_snwprintf(name, size, TranslateT("Task '%s' finished successfully"), to.taskName.c_str()); QueueUserAPC(DoTaskFinishInMainAPCFunc, g_hMainThread, (ULONG_PTR) name); } } @@ -1129,7 +1129,7 @@ bool FtpFiles(const std::wstring& dir, const std::wstring& filePath, const std:: DeleteFile(log.c_str()); wchar_t cmdLine[MAX_PATH]; - mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); + mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); STARTUPINFO startupInfo = { 0 }; startupInfo.cb = sizeof(STARTUPINFO); @@ -1220,7 +1220,7 @@ bool FtpGetFiles(const std::wstring& dir, const std::list& files, CreateDirectory(GetDirectoryName(log).c_str(), NULL); DeleteFile(log.c_str()); wchar_t cmdLine[MAX_PATH]; - mir_sntprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); + mir_snwprintf(cmdLine, L"\"%s\" /nointeractiveinput /log=\"%s\" /script=script.sc", Options::instance->ftpExePath.c_str(), log.c_str()); STARTUPINFO startupInfo = { 0 }; PROCESS_INFORMATION processInfo; startupInfo.cb = sizeof(STARTUPINFO); @@ -1250,7 +1250,7 @@ void CreatePath(const wchar_t *szDir) DWORD dwAttributes; wchar_t *pszLastBackslash, szTestDir[MAX_PATH]; - mir_tstrncpy(szTestDir, szDir, _countof(szTestDir)); + mir_wstrncpy(szTestDir, szDir, _countof(szTestDir)); if ((dwAttributes = GetFileAttributes(szTestDir)) != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) return; @@ -1283,7 +1283,7 @@ INT_PTR ExecuteTaskService(WPARAM wParam, LPARAM) void DoError(const TaskOptions& to, const std::wstring _error) { wchar_t msg[256]; - mir_sntprintf(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str()); + mir_snwprintf(msg, TranslateT("Task '%s' execution failed:"), to.taskName.c_str()); if (Options::instance->schedulerHistoryAlerts) { std::wstring error = msg; error += L"\n"; diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index a3c8b4f093..97158d7796 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -75,7 +75,7 @@ bool Searcher::CompareStr(std::wstring str, wchar_t *strFind) return str.find(strFind) < str.length(); size_t findid = str.find(strFind); - size_t findLen = mir_tstrlen(strFind); + size_t findLen = mir_wstrlen(strFind); while(findid < str.length()) { if ((findid == 0 || std::isspace(str[findid - 1], loc) || std::ispunct(str[findid - 1], loc)) && (findid + findLen >= str.length() || std::isspace(str[findid + findLen], loc) || std::ispunct(str[findid + findLen], loc))) @@ -105,13 +105,13 @@ void Searcher::Find() GetWindowText(context->findWindow, str, _countof(str)); if (!str[0]) { wchar_t buf[256]; - mir_sntprintf(buf, TranslateT("\"%s\" not found"), str); + mir_snwprintf(buf, TranslateT("\"%s\" not found"), str); MessageBox(context->m_hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION); return; } if (!matchCase) { std::locale loc; - std::transform(str, str + mir_tstrlen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc)); + std::transform(str, str + mir_wstrlen(str), str, std::bind2nd(std::ptr_fun(mytoupper), &loc)); } bool findBack1 = findBack ^ !searchForInMes; @@ -299,7 +299,7 @@ void Searcher::Find() if (isStart) { wchar_t buf[256]; GetWindowText(context->findWindow, str, _countof(str)); - mir_sntprintf(buf, TranslateT("\"%s\" not found"), str); + mir_snwprintf(buf, TranslateT("\"%s\" not found"), str); MessageBox(context->m_hWnd, buf, 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); -- cgit v1.2.3