summaryrefslogtreecommitdiff
path: root/src/core/stdfile
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
commit2f261839b60692e33d0e160344d0d636d49c90ba (patch)
tree187921722698b681d29df3f6e60fb18394a5e9d5 /src/core/stdfile
parent2e931a0b2780587d85f3902468c935f5adba70c8 (diff)
less TCHARs
git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdfile')
-rw-r--r--src/core/stdfile/src/file.cpp16
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp26
-rw-r--r--src/core/stdfile/src/fileopts.cpp6
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp32
-rw-r--r--src/core/stdfile/src/filesenddlg.cpp36
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp54
6 files changed, 85 insertions, 85 deletions
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 1886a29f1a..2d394b6ab0 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -62,7 +62,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam)
fsd.ppFiles = (const wchar_t**)alloca((count + 1) * sizeof(void*));
for (int i = 0; i < count; i++)
- fsd.ppFiles[i] = mir_a2t(ppFiles[i]);
+ fsd.ppFiles[i] = mir_a2u(ppFiles[i]);
fsd.ppFiles[count] = NULL;
HWND hWnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
@@ -83,7 +83,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
{
wchar_t buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
- char* dir = mir_t2a(buf);
+ char* dir = mir_u2a(buf);
mir_strncpy((char*)lParam, dir, MAX_PATH);
mir_free(dir);
return 0;
@@ -108,7 +108,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam)
SkinPlaySound("RecvFile");
wchar_t szTooltip[256];
- mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
cle.flags |= CLEF_TCHAR;
@@ -164,11 +164,11 @@ void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unit
*unitsUsed = unitsOverride;
switch (unitsOverride) {
- case UNITS_BYTES: mir_sntprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
- case UNITS_KBPOINT1: mir_sntprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
- case UNITS_KBPOINT0: mir_sntprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
- case UNITS_GBPOINT3: mir_sntprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
- default: mir_sntprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
+ case UNITS_BYTES: mir_snwprintf(szOut, cchOut, L"%u%s%s", (int)size, appendUnits ? L" " : L"", appendUnits ? TranslateT("bytes") : L""); break;
+ case UNITS_KBPOINT1: mir_snwprintf(szOut, cchOut, L"%.1lf%s", size / 1024.0, appendUnits ? L" KB" : L""); break;
+ case UNITS_KBPOINT0: mir_snwprintf(szOut, cchOut, L"%u%s", (int)(size / 1024), appendUnits ? L" KB" : L""); break;
+ case UNITS_GBPOINT3: mir_snwprintf(szOut, cchOut, L"%.3f%s", (size >> 20) / 1024.0, appendUnits ? L" GB" : L""); break;
+ default: mir_snwprintf(szOut, cchOut, L"%.2lf%s", size / 1048576.0, appendUnits ? L" MB" : L""); break;
}
}
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index d0650fec8d..95e5e65f99 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -149,24 +149,24 @@ void __cdecl LoadIconsAndTypesThread(void* param)
wchar_t *pszExtension = wcsrchr(pszFilename, '.');
if (pszExtension)
- mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
+ mir_wstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
else {
pszExtension = L".";
szExtension[0] = '\0';
}
CharUpper(szExtension);
if (fileInfo.szTypeName[0] == '\0')
- mir_sntprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
+ mir_snwprintf(fileInfo.szTypeName, TranslateT("%s file"), szExtension);
SetDlgItemText(info->hwndDlg, IDC_EXISTINGTYPE, fileInfo.szTypeName);
SetDlgItemText(info->hwndDlg, IDC_NEWTYPE, fileInfo.szTypeName);
SendDlgItemMessage(info->hwndDlg, IDC_EXISTINGICON, STM_SETICON, (WPARAM)fileInfo.hIcon, 0);
szIconFile[0] = '\0';
- if (!mir_tstrcmp(szExtension, L"EXE"))
+ if (!mir_wstrcmp(szExtension, L"EXE"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"2", szIconFile, _countof(szIconFile));
else {
wchar_t szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) {
- mir_tstrcat(szTypeName, L"\\DefaultIcon");
+ mir_wstrcat(szTypeName, L"\\DefaultIcon");
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) {
if (wcsstr(szIconFile, L"%1"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"0", szIconFile, _countof(szIconFile));
@@ -231,7 +231,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
loadiconsstartinfo *lisi = (loadiconsstartinfo*)mir_alloc(sizeof(loadiconsstartinfo));
lisi->hwndDlg = hwndDlg;
- lisi->szFilename = mir_tstrdup(fts->tszCurrentFile);
+ lisi->szFilename = mir_wstrdup(fts->tszCurrentFile);
//can be a little slow, so why not?
mir_forkthread(LoadIconsAndTypesThread, lisi);
SetFocus(hwndFocus);
@@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_OPENFOLDER:
{
wchar_t szFile[MAX_PATH];
- mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
+ mir_wstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
wchar_t *pszLastBackslash = wcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -283,15 +283,15 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
wchar_t filter[512], *pfilter;
wchar_t str[MAX_PATH];
- mir_tstrncpy(str, fts->tszCurrentFile, _countof(str));
+ mir_wstrncpy(str, fts->tszCurrentFile, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
wcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
- mir_tstrcat(filter, L" (*)");
- pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrcat(filter, L" (*)");
+ pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
@@ -300,7 +300,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (!GetSaveFileName(&ofn))
return FALSE;
- pfr.szFilename = mir_tstrdup(str);
+ pfr.szFilename = mir_wstrdup(str);
pfr.action = FILERESUME_RENAME;
}
break;
@@ -319,7 +319,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
memcpy(pfrCopy, &pfr, sizeof(pfr));
- PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
+ PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfrCopy);
DestroyWindow(hwndDlg);
}
break;
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 30979c1294..93aca138ae 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -127,7 +127,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (iScanner >= _countof(virusScanners) || iScanner < 0) break;
str[0] = '\0';
if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[iScanner].szExeRegPath, virusScanners[iScanner].szExeRegValue, szScanExe, _countof(szScanExe)))
- mir_sntprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
+ mir_snwprintf(str, virusScanners[iScanner].szCommandLine, szScanExe);
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
}
break;
@@ -180,7 +180,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t *pszQuote = wcschr(str + 1, '"');
if (pszQuote)
*pszQuote = 0;
- memmove(str, str + 1, (mir_tstrlen(str) * sizeof(wchar_t)));
+ memmove(str, str + 1, (mir_wstrlen(str) * sizeof(wchar_t)));
}
else {
wchar_t *pszSpace = wcschr(str, ' ');
@@ -191,7 +191,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (wcschr(str, ' ') != NULL) {
memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
- mir_tstrcat(str, L"\"");
+ mir_wstrcat(str, L"\"");
}
SetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str);
break;
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index 6df563406d..06f182cd42 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -38,7 +38,7 @@ static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExisti
DWORD dwAttributes;
wchar_t *pszLastBackslash;
- mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
+ mir_wstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash = wcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
@@ -94,7 +94,7 @@ int BrowseForFolder(HWND hwnd, wchar_t *szPath)
LPITEMIDLIST pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDList(pidlResult, szPath);
- mir_tstrcat(szPath, L"\\");
+ mir_wstrcat(szPath, L"\\");
CoTaskMemFree(pidlResult);
}
return pidlResult != NULL;
@@ -116,31 +116,31 @@ static void patchDir(wchar_t *str, size_t strSize)
mir_free(result);
}
- size_t len = mir_tstrlen(str);
+ size_t len = mir_wstrlen(str);
if (len + 1 < strSize && str[len - 1] != '\\')
- mir_tstrcpy(str + len, L"\\");
+ mir_wstrcpy(str + len, L"\\");
}
void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
if (hContact) {
hContact = db_mc_tryMeta(hContact);
REPLACEVARSARRAY rvaVarsToReplace[4];
rvaVarsToReplace[0].key.w = L"nick";
- rvaVarsToReplace[0].value.w = mir_tstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0));
+ rvaVarsToReplace[0].value.w = mir_wstrdup((wchar_t *)pcli->pfnGetContactDisplayName(hContact, 0));
rvaVarsToReplace[1].key.w = L"userid";
rvaVarsToReplace[1].value.w = GetContactID(hContact);
rvaVarsToReplace[2].key.w = L"proto";
- rvaVarsToReplace[2].value.w = mir_a2t(GetContactProto(hContact));
+ rvaVarsToReplace[2].value.w = mir_a2u(GetContactProto(hContact));
rvaVarsToReplace[3].key.w = NULL;
rvaVarsToReplace[3].value.w = NULL;
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
@@ -158,22 +158,22 @@ void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, B
if (patchVars)
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
void GetReceivedFilesDir(wchar_t *szDir, int cchDir)
{
wchar_t tszTemp[MAX_PATH];
- ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
+ ptrW tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
- mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
+ mir_snwprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
patchDir(tszTemp, _countof(tszTemp));
RemoveInvalidPathChars(tszTemp);
- mir_tstrncpy(szDir, tszTemp, cchDir);
+ mir_wstrncpy(szDir, tszTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -231,13 +231,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob;
char *str = (char*)dbei.pBlob + 4;
- ptrT ptszFileName(DbGetEventStringT(&dbei, str));
+ ptrW ptszFileName(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_FILENAMES, ptszFileName);
unsigned len = (unsigned)mir_strlen(str) + 1;
if (len + 4 < dbei.cbBlob) {
str += len;
- ptrT ptszDescription(DbGetEventStringT(&dbei, str));
+ ptrW ptszDescription(DbGetEventStringT(&dbei, str));
SetDlgItemText(hwndDlg, IDC_MSG, ptszDescription);
}
}
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0);
SetDlgItemText(hwndDlg, IDC_DATE, datetimestr);
- ptrT info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW info(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (info) ? info : contactName);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
@@ -307,7 +307,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE);
- if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
+ if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_wstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
DBVARIANT dbv;
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp
index 7d1c780807..4c6089c8c5 100644
--- a/src/core/stdfile/src/filesenddlg.cpp
+++ b/src/core/stdfile/src/filesenddlg.cpp
@@ -49,16 +49,16 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat)
if (i > 1) {
wchar_t szFormat[32];
if (fileCount && dirCount) {
- mir_sntprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories"));
- mir_sntprintf(str, szFormat, fileCount, dirCount);
+ mir_snwprintf(szFormat, L"%s, %s", TranslateTS(fileCount == 1 ? L"%d file" : L"%d files"), TranslateTS(dirCount == 1 ? L"%d directory" : L"%d directories"));
+ mir_snwprintf(str, szFormat, fileCount, dirCount);
}
else if (fileCount) {
- mir_tstrcpy(szFormat, TranslateT("%d files"));
- mir_sntprintf(str, szFormat, fileCount);
+ mir_wstrcpy(szFormat, TranslateT("%d files"));
+ mir_snwprintf(str, szFormat, fileCount);
}
else {
- mir_tstrcpy(szFormat, TranslateT("%d directories"));
- mir_sntprintf(str, szFormat, dirCount);
+ mir_wstrcpy(szFormat, TranslateT("%d directories"));
+ mir_snwprintf(str, szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
}
@@ -87,12 +87,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
// NULL separated list of all files
// fileOffset is the offset to the first file.
- size_t fileOffset = mir_tstrlen(buf) + 1;
+ size_t fileOffset = mir_wstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
while (*pBuf) {
- pBuf += mir_tstrlen(pBuf) + 1;
+ pBuf += mir_wstrlen(pBuf) + 1;
nNumberOfFiles++;
}
@@ -105,13 +105,13 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- size_t cbFileNameLen = mir_tstrlen(pBuf);
+ size_t cbFileNameLen = mir_wstrlen(pBuf);
dat->files[nTemp] = (wchar_t*)mir_alloc(sizeof(wchar_t)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
memcpy(dat->files[nTemp], buf, (fileOffset - 1)*sizeof(wchar_t));
dat->files[nTemp][fileOffset - 1] = '\\';
- mir_tstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
+ mir_wstrcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset - 2] == '\\' ? 1 : 0), pBuf);
// Move pointers to next file...
pBuf += cbFileNameLen + 1;
@@ -125,7 +125,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *bu
if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted
return;
- dat->files[0] = mir_tstrdup(buf);
+ dat->files[0] = mir_wstrdup(buf);
dat->files[1] = NULL;
}
@@ -146,11 +146,11 @@ void __cdecl ChooseFilesThread(void* param)
}
wchar_t filter[128];
- mir_tstrcpy(filter, TranslateT("All files"));
- mir_tstrcat(filter, L" (*)");
- wchar_t *pfilter = filter + mir_tstrlen(filter) + 1;
- mir_tstrcpy(pfilter, L"*");
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrcpy(filter, TranslateT("All files"));
+ mir_wstrcat(filter, L" (*)");
+ wchar_t *pfilter = filter + mir_wstrlen(filter) + 1;
+ mir_wstrcpy(pfilter, L"*");
+ pfilter = filter + mir_wstrlen(filter) + 1;
pfilter[0] = '\0';
OPENFILENAME ofn = { 0 };
@@ -230,7 +230,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
dat->files = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(totalCount + 1)); // Leaks
for (i = 0; i < totalCount; i++)
- dat->files[i] = mir_tstrdup(fsd->ppFiles[i]);
+ dat->files[i] = mir_wstrdup(fsd->ppFiles[i]);
dat->files[totalCount] = NULL;
SetFileListAndSizeControls(hwndDlg, dat);
}
@@ -238,7 +238,7 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
- ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
+ ptrW id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
if (fsd->ppFiles == NULL) {
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 7be203e9bb..ed513f02bb 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -47,23 +47,23 @@ wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s)
if (flags & PFTS_UTF)
return Utf8DecodeW((char*)s);
if (flags & PFTS_UNICODE)
- return mir_tstrdup(s);
- return mir_a2t((char*)s);
+ return mir_wstrdup(s);
+ return mir_a2u((char*)s);
}
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r)
{
if (ft->flags & PFTS_UTF) {
wchar_t *ts = Utf8DecodeW((char*)s);
- int res = mir_tstrcmp(ts, r);
+ int res = mir_wstrcmp(ts, r);
mir_free(ts);
return res;
}
if (ft->flags & PFTS_UNICODE)
- return mir_tstrcmp(s, r);
+ return mir_wstrcmp(s, r);
- wchar_t *ts = mir_a2t((char*)s);
- int res = mir_tstrcmp(ts, r);
+ wchar_t *ts = mir_a2u((char*)s);
+ int res = mir_wstrcmp(ts, r);
mir_free(ts);
return res;
}
@@ -102,10 +102,10 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
wchar_t *pszReplace = wcsstr(dbv.ptszVal, L"%f");
wchar_t szCmdLine[768];
if (pszReplace) {
- if (info->szFile[mir_tstrlen(info->szFile) - 1] == '\\')
- info->szFile[mir_tstrlen(info->szFile) - 1] = '\0';
+ if (info->szFile[mir_wstrlen(info->szFile) - 1] == '\\')
+ info->szFile[mir_wstrlen(info->szFile) - 1] = '\0';
*pszReplace = 0;
- mir_sntprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2);
+ mir_snwprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2);
} else
wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE);
@@ -130,7 +130,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
SHFILEINFO shfi = { 0 };
if (fts->tszCurrentFile) {
- fnbuf = mir_tstrdup(fts->tszCurrentFile);
+ fnbuf = mir_wstrdup(fts->tszCurrentFile);
if ((fn = wcsrchr(fnbuf, '\\')) == NULL)
fn = fnbuf;
else fn++;
@@ -139,7 +139,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
if (dat->hIcon) DestroyIcon(dat->hIcon); dat->hIcon = NULL;
if (fn && (fts->totalFiles > 1)) {
- mir_sntprintf(msg, L"%s: %s (%d %s %d)",
+ mir_snwprintf(msg, L"%s: %s (%d %s %d)",
pcli->pfnGetContactDisplayName(fts->hContact, 0),
fn, fts->currentFileNumber + 1, TranslateT("of"), fts->totalFiles);
@@ -147,13 +147,13 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
dat->hIcon = shfi.hIcon;
}
else if (fn) {
- mir_sntprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
+ mir_snwprintf(msg, L"%s: %s", pcli->pfnGetContactDisplayName(fts->hContact, 0), fn);
SHGetFileInfo(fn, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_SMALLICON);
dat->hIcon = shfi.hIcon;
}
else {
- mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg));
+ mir_wstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), _countof(msg));
HICON hIcon = Skin_LoadIcon(SKINICON_OTHER_DOWNARROW);
dat->hIcon = CopyIcon(hIcon);
IcoLib_ReleaseIcon(hIcon, NULL);
@@ -247,7 +247,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else { //recv
CreateDirectoryTreeT(dat->szSavePath);
dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
- dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
+ dat->transferStatus.tszWorkingDir = mir_wstrdup(dat->szSavePath);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT);
@@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, _countof(szSpeed), 0, 1, NULL);
if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1])
- mir_tstrcpy(szTime, L"??:??:??");
+ mir_wstrcpy(szTime, L"??:??:??");
else {
li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize - dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]);
ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart;
@@ -322,7 +322,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetTimeFormat(LOCALE_USER_DEFAULT, TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER, &st, NULL, szTime, _countof(szTime));
}
- mir_sntprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
+ mir_snwprintf(szDisplay, L"%s/%s (%s %s)", szSpeed, TranslateT("sec"), szTime, TranslateT("remaining"));
SetDlgItemText(hwndDlg, IDC_ALLSPEED, szDisplay);
}
break;
@@ -414,7 +414,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
pszFilename++;
if (pszFilename) {
- size_t cbFileNameLen = mir_tstrlen(pszFilename);
+ size_t cbFileNameLen = mir_wstrlen(pszFilename);
pszNewFileName = (wchar_t*)mir_alloc(cbFileNameLen * 2 * sizeof(wchar_t));
wchar_t *p = pszNewFileName;
@@ -478,12 +478,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
wchar_t *pszExtension, *pszFilename;
if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename;
- if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename);
+ if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_wstrlen(pszFilename);
if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename);
- size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension);
+ size_t size = (pszExtension - szOriginalFilename) + 21 + mir_wstrlen(pszExtension);
pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size);
for (int i = 1;; i++) {
- mir_sntprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension);
+ mir_snwprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension);
if (_waccess(pfr->szFilename, 0) != 0)
break;
}
@@ -528,7 +528,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
virusscanthreadstartinfo *vstsi;
vstsi = (struct virusscanthreadstartinfo*)mir_alloc(sizeof(struct virusscanthreadstartinfo));
vstsi->hwndReply = hwndDlg;
- vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]);
+ vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);
vstsi->returnCode = dat->transferStatus.currentFileNumber;
mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi);
}
@@ -554,7 +554,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME));
pfr->action = dat->resumeBehaviour;
pfr->szFilename = NULL;
- PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_tstrdup(fts->tszCurrentFile), (LPARAM)pfr);
+ PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->tszCurrentFile), (LPARAM)pfr);
}
}
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, 1);
@@ -596,17 +596,17 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
const unsigned long nextPos = fts->totalBytes ? (BIGI(100) * fts->totalProgress / fts->totalBytes) : 0;
if (lastPos != nextPos || firstTime) {
SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0);
- mir_sntprintf(str, L"%u%%", nextPos);
+ mir_snwprintf(str, L"%u%%", nextPos);
SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str);
}
int units;
GetSensiblyFormattedSize(fts->totalBytes, szSizeTotal, _countof(szSizeTotal), 0, 1, &units);
GetSensiblyFormattedSize(fts->totalProgress, szSizeDone, _countof(szSizeDone), units, 0, NULL);
- mir_sntprintf(str, L"%s/%s", szSizeDone, szSizeTotal);
+ mir_snwprintf(str, L"%s/%s", szSizeDone, szSizeTotal);
str2[0] = 0;
GetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str2, _countof(str2));
- if (mir_tstrcmp(str, str2))
+ if (mir_wstrcmp(str, str2))
SetDlgItemText(hwndDlg, IDC_ALLTRANSFERRED, str);
}
break;
@@ -665,10 +665,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
mir_free(vstsi);
vstsi = NULL;
}
- else vstsi->szFile = mir_tstrdup(dat->files[dat->transferStatus.currentFileNumber]);
+ else vstsi->szFile = mir_wstrdup(dat->files[dat->transferStatus.currentFileNumber]);
}
else {
- vstsi->szFile = mir_tstrdup(dat->transferStatus.tszWorkingDir);
+ vstsi->szFile = mir_wstrdup(dat->transferStatus.tszWorkingDir);
vstsi->returnCode = -1;
}
SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT);