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/FTPFileYM/src/dialog.cpp | 14 +++++++------- plugins/FTPFileYM/src/ftpfile.cpp | 2 +- plugins/FTPFileYM/src/job_delete.cpp | 4 ++-- plugins/FTPFileYM/src/job_generic.cpp | 24 ++++++++++++------------ plugins/FTPFileYM/src/job_packer.cpp | 26 +++++++++++++------------- plugins/FTPFileYM/src/job_upload.cpp | 22 +++++++++++----------- plugins/FTPFileYM/src/manager.cpp | 2 +- plugins/FTPFileYM/src/mir_db.cpp | 2 +- plugins/FTPFileYM/src/serverlist.cpp | 2 +- plugins/FTPFileYM/src/utils.cpp | 16 ++++++++-------- 10 files changed, 57 insertions(+), 57 deletions(-) (limited to 'plugins/FTPFileYM') diff --git a/plugins/FTPFileYM/src/dialog.cpp b/plugins/FTPFileYM/src/dialog.cpp index 39192e6583..06c914070c 100644 --- a/plugins/FTPFileYM/src/dialog.cpp +++ b/plugins/FTPFileYM/src/dialog.cpp @@ -131,7 +131,7 @@ void UploadDialog::Tab::select() void UploadDialog::Tab::labelCompleted() { wchar_t buff[64], buff2[256]; - mir_sntprintf(buff2, L"* %s", Utils::getTextFragment(m_job->m_tszFileName, 20, buff)); + mir_snwprintf(buff2, L"* %s", Utils::getTextFragment(m_job->m_tszFileName, 20, buff)); TCITEM tab = { 0 }; tab.mask = TCIF_TEXT; @@ -293,11 +293,11 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0); if (i < 3) - mir_sntprintf(buff, TranslateT("%d minutes"), times[i]); + mir_snwprintf(buff, TranslateT("%d minutes"), times[i]); else if (i < 7) - mir_sntprintf(buff, TranslateT("%d hours"), times[i] / 60); + mir_snwprintf(buff, TranslateT("%d hours"), times[i] / 60); else - mir_sntprintf(buff, TranslateT("%d days"), times[i] / 60 / 24); + mir_snwprintf(buff, TranslateT("%d days"), times[i] / 60 / 24); UINT check = MF_UNCHECKED; if (!bChecked && tab->m_iOptAutoDelete == times[i]) { @@ -310,9 +310,9 @@ INT_PTR CALLBACK UploadDialog::UploadDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar if (opt.bAutoDelete) { switch (opt.timeRange) { - case Options::TR_MINUTES: mir_sntprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break; - case Options::TR_HOURS: mir_sntprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break; - case Options::TR_DAYS: mir_sntprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break; + case Options::TR_MINUTES: mir_snwprintf(buff, TranslateT("%d minutes"), opt.iDeleteTime); break; + case Options::TR_HOURS: mir_snwprintf(buff, TranslateT("%d hours"), opt.iDeleteTime); break; + case Options::TR_DAYS: mir_snwprintf(buff, TranslateT("%d days"), opt.iDeleteTime); break; } AppendMenu(hTimeMenu, MF_SEPARATOR, 0, 0); diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index c5e4d548b3..f2681e24c4 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -112,7 +112,7 @@ void InitMenuItems() for (int i = 0; i < ServerList::FTP_COUNT; i++) { if (DB::getStringF(0, MODULE, "Name%d", i, stzName)) - mir_sntprintf(stzName, TranslateT("FTP Server %d"), i + 1); + mir_snwprintf(stzName, TranslateT("FTP Server %d"), i + 1); mi.root = (opt.bUseSubmenu) ? hMenu : 0; mi.hIcolibItem = iconList[i].hIcolib; diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp index 2449d1e91a..858bb9e58e 100644 --- a/plugins/FTPFileYM/src/job_delete.cpp +++ b/plugins/FTPFileYM/src/job_delete.cpp @@ -89,8 +89,8 @@ void DeleteJob::run() DBEntry::remove(m_entry->m_fileID); } else if (manDlg != NULL && m_treeItem) { - wchar_t *error = mir_a2t(szError); - mir_tstrcpy(m_treeItem->m_tszToolTip, error); + wchar_t *error = mir_a2u(szError); + mir_wstrcpy(m_treeItem->m_tszToolTip, error); m_treeItem->setState(Manager::TreeItem::_ERROR()); FREE(error); } diff --git a/plugins/FTPFileYM/src/job_generic.cpp b/plugins/FTPFileYM/src/job_generic.cpp index 9d4adf6013..ddeb5ee282 100644 --- a/plugins/FTPFileYM/src/job_generic.cpp +++ b/plugins/FTPFileYM/src/job_generic.cpp @@ -41,8 +41,8 @@ GenericJob::GenericJob(GenericJob *job) : m_ftp(job->m_ftp), m_tab(job->m_tab) { - mir_tstrcpy(m_tszFilePath, job->m_tszFilePath); - mir_tstrcpy(m_tszFileName, job->m_tszFileName); + mir_wstrcpy(m_tszFilePath, job->m_tszFilePath); + mir_wstrcpy(m_tszFileName, job->m_tszFileName); mir_strcpy(m_szSafeFileName, job->m_szSafeFileName); } @@ -55,7 +55,7 @@ GenericJob::~GenericJob() int GenericJob::openFileDialog() { wchar_t temp[MAX_PATH] = L""; - mir_sntprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)")); + mir_snwprintf(temp, L"%s\0*.*\0", TranslateT("All Files (*.*)")); OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = 0; @@ -87,14 +87,14 @@ void GenericJob::getFilesFromOpenDialog() { wchar_t stzFile[MAX_PATH]; - size_t length = mir_tstrlen(m_tszFilePath); + size_t length = mir_wstrlen(m_tszFilePath); if (m_tszFilePath[0] && m_tszFilePath[length + 1]) // multiple files { wchar_t *ptr = m_tszFilePath + length + 1; while (ptr[0]) { - mir_sntprintf(stzFile, L"%s\\%s", m_tszFilePath, ptr); + mir_snwprintf(stzFile, L"%s\\%s", m_tszFilePath, ptr); addFile(stzFile); - ptr += mir_tstrlen(ptr) + 1; + ptr += mir_wstrlen(ptr) + 1; } } else { @@ -116,7 +116,7 @@ int GenericJob::getFilesFromFolder(wchar_t *stzFolder) HANDLE hFind = FindFirstFile(L"*.*", &ffd); while (hFind != INVALID_HANDLE_VALUE) { if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - mir_sntprintf(stzFile, L"%s\\%s", stzFolder, ffd.cFileName); + mir_snwprintf(stzFile, L"%s\\%s", stzFolder, ffd.cFileName); addFile(stzFile); } @@ -154,9 +154,9 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) if (m_mode == FTP_ZIPFOLDER) { wchar_t *folder; if (flags & FUPL_UNICODE) - folder = mir_u2t((wchar_t *)objects[0]); + folder = mir_wstrdup((wchar_t *)objects[0]); else - folder = mir_a2t((char *)objects[0]); + folder = mir_a2u((char *)objects[0]); int result = getFilesFromFolder(folder); FREE(folder); @@ -166,9 +166,9 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) for (int i = 0; i < objCount; i++) { wchar_t *fileName; if (flags & FUPL_UNICODE) - fileName = mir_u2t((wchar_t *)objects[i]); + fileName = mir_wstrdup((wchar_t *)objects[i]); else - fileName = mir_a2t((char *)objects[i]); + fileName = mir_a2u((char *)objects[i]); addFile(fileName); FREE(fileName); @@ -180,7 +180,7 @@ int GenericJob::getFiles(void **objects, int objCount, DWORD flags) void GenericJob::addFile(wchar_t *fileName) { - wchar_t *buff = mir_tstrdup(fileName); + wchar_t *buff = mir_wstrdup(fileName); m_files.push_back(buff); } diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp index 135b06e665..29ec91c4b8 100644 --- a/plugins/FTPFileYM/src/job_packer.cpp +++ b/plugins/FTPFileYM/src/job_packer.cpp @@ -39,27 +39,27 @@ void PackerJob::getZipFilePath() wchar_t *pch; if (m_files.size() == 1) { - mir_tstrcpy(stzFileName, Utils::getFileNameFromPath(m_files[0])); + mir_wstrcpy(stzFileName, Utils::getFileNameFromPath(m_files[0])); pch = wcsrchr(stzFileName, '.'); if (pch) *pch = 0; } else { - mir_tstrcpy(buff, m_files[0]); + mir_wstrcpy(buff, m_files[0]); pch = wcsrchr(buff, '\\'); if (pch) { *pch = 0; pch = wcsrchr(buff, '\\'); - if (pch) mir_tstrcpy(stzFileName, pch + 1); + if (pch) mir_wstrcpy(stzFileName, pch + 1); } } if (stzFileName[0] == '\0') - mir_tstrcpy(stzFileName, L"archive"); + mir_wstrcpy(stzFileName, L"archive"); GetTempPath(_countof(buff), buff); - mir_sntprintf(m_tszFilePath, L"%s%s.zip", buff, stzFileName); - mir_tstrcpy(m_tszFileName, Utils::getFileNameFromPath(m_tszFilePath)); + mir_snwprintf(m_tszFilePath, L"%s%s.zip", buff, stzFileName); + mir_wstrcpy(m_tszFileName, Utils::getFileNameFromPath(m_tszFilePath)); if (opt.bSetZipName) Utils::setFileNameDlg(m_tszFileName); @@ -156,7 +156,7 @@ int PackerJob::createZipFile() getFileTime(m_files[i], &zi.tmz_date, &zi.dosDate); - char *file = mir_t2a(Utils::getFileNameFromPath(m_files[i])); + char *file = mir_u2a(Utils::getFileNameFromPath(m_files[i])); int err = zipOpenNewFileInZip(zf, file, &zi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, opt.iCompressionLevel); FREE(file); @@ -233,10 +233,10 @@ void PackerJob::updateStats() m_lastUpdateTick = dwNewTick; double speed = ((double)m_uiReaded / 1024) / (time(NULL) - m_startTS); - mir_sntprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed); + mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed); double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0; - mir_sntprintf(m_tab->m_stzComplet, TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)m_uiReaded / 1024, (int)m_uiFileSize / 1024); + mir_snwprintf(m_tab->m_stzComplet, TranslateT("%0.1f%% (%d kB/%d kB)"), perc, (int)m_uiReaded / 1024, (int)m_uiFileSize / 1024); wchar_t buff[256]; long s = (m_uiFileSize - m_uiReaded) / (long)(speed * 1024); @@ -245,9 +245,9 @@ void PackerJob::updateStats() int m = (s - d * 60 * 60 * 24 - h * 60 * 60) / 60; s = s - (d * 24 * 60 * 60) - (h * 60 * 60) - (m * 60); - if (d > 0) mir_sntprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s); - else mir_sntprintf(buff, L"%02d:%02d:%02d", h, m, s); - mir_sntprintf(m_tab->m_stzRemain, TranslateT("%s (%d kB/%d kB)"), buff, (m_uiFileSize - m_uiReaded) / 1024, m_uiFileSize / 1024); + if (d > 0) mir_snwprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s); + else mir_snwprintf(buff, L"%02d:%02d:%02d", h, m, s); + mir_snwprintf(m_tab->m_stzRemain, TranslateT("%s (%d kB/%d kB)"), buff, (m_uiFileSize - m_uiReaded) / 1024, m_uiFileSize / 1024); refreshTab(false); } @@ -313,6 +313,6 @@ void PackerJob::closeAllTabs() void PackerJob::createToolTip() { - mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"), + mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"), getStatusString(), m_tszFileName, m_ftp->m_szServer); } diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index b6c1e9a20c..5bd60536f5 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -64,8 +64,8 @@ void UploadJob::addToUploadDlg() { for (UINT i = 0; i < m_files.size(); i++) { UploadJob *jobCopy = new UploadJob(this); - mir_tstrcpy(jobCopy->m_tszFilePath, m_files[i]); - mir_tstrcpy(jobCopy->m_tszFileName, Utils::getFileNameFromPath(jobCopy->m_tszFilePath)); + mir_wstrcpy(jobCopy->m_tszFilePath, m_files[i]); + mir_wstrcpy(jobCopy->m_tszFileName, Utils::getFileNameFromPath(jobCopy->m_tszFilePath)); Utils::makeSafeString(jobCopy->m_tszFileName, jobCopy->m_szSafeFileName); UploadDialog::Tab *newTab = new UploadDialog::Tab(jobCopy); @@ -246,8 +246,8 @@ INT_PTR CALLBACK UploadJob::DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wPa TranslateDialogDefault(hwndDlg); { wchar_t buff[256]; - wchar_t *fileName = mir_a2t((char *)lParam); - mir_sntprintf(buff, TranslateT("File exists - %s"), fileName); + wchar_t *fileName = mir_a2u((char *)lParam); + mir_snwprintf(buff, TranslateT("File exists - %s"), fileName); SetWindowText(hwndDlg, buff); FREE(fileName); } @@ -391,10 +391,10 @@ void UploadJob::updateStats() m_avgSpeed /= _countof(m_lastSpeed) + 1; m_lastSpeed[0] = speed; - mir_sntprintf(m_tab->m_stzSpeed, L"%0.1f kB/s", m_avgSpeed); + mir_snwprintf(m_tab->m_stzSpeed, L"%0.1f kB/s", m_avgSpeed); double perc = m_uiFileSize ? ((double)m_uiTotalSent / m_uiFileSize) * 100 : 0; - mir_sntprintf(m_tab->m_stzComplet, L"%0.1f%% (%d kB/%d kB)", perc, (int)m_uiTotalSent / 1024, (int)m_uiFileSize / 1024); + mir_snwprintf(m_tab->m_stzComplet, L"%0.1f%% (%d kB/%d kB)", perc, (int)m_uiTotalSent / 1024, (int)m_uiFileSize / 1024); long s = (m_uiFileSize - m_uiTotalSent) / (long)(m_avgSpeed * 1024); int d = (s / 60 / 60 / 24); @@ -403,9 +403,9 @@ void UploadJob::updateStats() s = s - (d * 24 * 60 * 60) - (h * 60 * 60) - (m * 60); wchar_t buff[256]; - if (d > 0) mir_sntprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s); - else mir_sntprintf(buff, L"%02d:%02d:%02d", h, m, s); - mir_sntprintf(m_tab->m_stzRemain, L"%s (%d kB/%d kB)", buff, (m_uiFileSize - m_uiTotalSent) / 1024, m_uiFileSize / 1024); + if (d > 0) mir_snwprintf(buff, L"%dd %02d:%02d:%02d", d, h, m, s); + else mir_snwprintf(buff, L"%02d:%02d:%02d", h, m, s); + mir_snwprintf(m_tab->m_stzRemain, L"%s (%d kB/%d kB)", buff, (m_uiFileSize - m_uiTotalSent) / 1024, m_uiFileSize / 1024); refreshTab(false); } @@ -493,10 +493,10 @@ void UploadJob::closeAllTabs() void UploadJob::createToolTip() { - mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"), + mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("Status: %s\r\nFile: %s\r\nServer: %S"), getStatusString(), m_tszFileName, m_ftp->m_szServer); if (m_tab->m_stzSpeed[0] && m_tab->m_stzComplet[0] && m_tab->m_stzRemain[0]) - mir_sntprintf(uDlg->m_tszToolTipText, TranslateT("%s\r\nSpeed: %s\r\nCompleted: %s\r\nRemaining: %s"), + mir_snwprintf(uDlg->m_tszToolTipText, TranslateT("%s\r\nSpeed: %s\r\nCompleted: %s\r\nRemaining: %s"), uDlg->m_tszToolTipText, m_tab->m_stzSpeed, m_tab->m_stzComplet, m_tab->m_stzRemain); } diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index d838e77884..84e648bcfd 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -121,7 +121,7 @@ void Manager::fillTree() DBEntry *entry = DBEntry::getFirst(); while (entry != NULL) { if ((UINT)entry->m_iFtpNum < m_rootItems.size()) { - tvi.item.pszText = mir_a2t(entry->m_szFileName); + tvi.item.pszText = mir_a2u(entry->m_szFileName); tvi.hParent = m_rootItems[entry->m_iFtpNum]->m_handle; HTREEITEM hItem = TreeView_InsertItem(m_hwndFileTree, &tvi); AddLeaf(hItem, tvi.hParent, entry->m_fileID); diff --git a/plugins/FTPFileYM/src/mir_db.cpp b/plugins/FTPFileYM/src/mir_db.cpp index e14e2caccc..dadc502028 100644 --- a/plugins/FTPFileYM/src/mir_db.cpp +++ b/plugins/FTPFileYM/src/mir_db.cpp @@ -98,7 +98,7 @@ int DB::getString(MCONTACT hContact, char *szModule, char *szSetting, wchar_t *b { DBVARIANT dbv; if (!db_get_ts(hContact, szModule, szSetting, &dbv)) { - mir_tstrcpy(buff, dbv.ptszVal); + mir_wstrcpy(buff, dbv.ptszVal); db_free(&dbv); return 0; } diff --git a/plugins/FTPFileYM/src/serverlist.cpp b/plugins/FTPFileYM/src/serverlist.cpp index b5be374920..b4a854b3d1 100644 --- a/plugins/FTPFileYM/src/serverlist.cpp +++ b/plugins/FTPFileYM/src/serverlist.cpp @@ -64,7 +64,7 @@ void ServerList::saveToDb() const ServerList::FTP::FTP(int index) { if (DB::getStringF(0, MODULE, "Name%d", index, m_stzName)) - mir_sntprintf(m_stzName, TranslateT("FTP Server %d"), index + 1); + mir_snwprintf(m_stzName, TranslateT("FTP Server %d"), index + 1); DB::getAStringF(0, MODULE, "Password%d", index, m_szPass); DB::getAStringF(0, MODULE, "Server%d", index, m_szServer); diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index d15a706055..eb2c8a2dc1 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -67,10 +67,10 @@ wchar_t* Utils::getFileNameFromPath(wchar_t *stzPath) wchar_t* Utils::getTextFragment(wchar_t *stzText, size_t length, wchar_t *buff) { - if (mir_tstrlen(stzText) > length) { - mir_tstrcpy(buff, stzText); + if (mir_wstrlen(stzText) > length) { + mir_wstrcpy(buff, stzText); buff[length - 1] = 0; - mir_tstrcat(buff, L"..."); + mir_wstrcat(buff, L"..."); return buff; } @@ -97,7 +97,7 @@ const char to_chars[] = "abvgdeezziiklmnoprstufhccwwqyqeuaABVGDEEZZIIKLMNOPRSTUF char* Utils::makeSafeString(wchar_t *input, char *output) { - char *buff = mir_t2a(input); + char *buff = mir_u2a(input); size_t length = mir_strlen(buff); for (UINT i = 0; i < length; i++) { @@ -166,7 +166,7 @@ INT_PTR CALLBACK Utils::DlgProcSetFileName(HWND hwndDlg, UINT msg, WPARAM wParam if (GetDlgCtrlID((HWND)wParam) != IDC_NAME) { SetFocus(GetDlgItem(hwndDlg, IDC_NAME)); - SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, mir_tstrlen(fileName) - 4); + SendDlgItemMessage(hwndDlg, IDC_NAME, EM_SETSEL, 0, mir_wstrlen(fileName) - 4); return FALSE; } @@ -200,13 +200,13 @@ bool Utils::setFileNameDlg(wchar_t *nameBuff) bool Utils::setFileNameDlgA(char *nameBuff) { wchar_t buff[64]; - wchar_t *tmp = mir_a2t(nameBuff); - mir_tstrcpy(buff, tmp); + wchar_t *tmp = mir_a2u(nameBuff); + mir_wstrcpy(buff, tmp); FREE(tmp); bool res = setFileNameDlg(buff); if (res) { - char *p = mir_t2a(buff); + char *p = mir_u2a(buff); mir_strcpy(nameBuff, p); FREE(p); } -- cgit v1.2.3