summaryrefslogtreecommitdiff
path: root/src/core/stdfile
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/stdfile')
-rw-r--r--src/core/stdfile/file.cpp8
-rw-r--r--src/core/stdfile/fileexistsdlg.cpp8
-rw-r--r--src/core/stdfile/filerecvdlg.cpp14
-rw-r--r--src/core/stdfile/filesenddlg.cpp20
-rw-r--r--src/core/stdfile/filexferdlg.cpp16
5 files changed, 33 insertions, 33 deletions
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp
index 004eb72ccd..5e5b32da4d 100644
--- a/src/core/stdfile/file.cpp
+++ b/src/core/stdfile/file.cpp
@@ -98,7 +98,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
TCHAR buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
char* dir = mir_t2a(buf);
- lstrcpynA((char*)lParam, dir, MAX_PATH);
+ mir_strncpy((char*)lParam, dir, MAX_PATH);
mir_free(dir);
return 0;
}
@@ -358,9 +358,9 @@ static void sttRecvCreateBlob(DBEVENTINFO &dbei, int fileCount, char **pszFiles,
dbei.cbBlob = sizeof(DWORD);
for (int i = 0; i < fileCount; i++)
- dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
+ dbei.cbBlob += mir_strlen(pszFiles[i]) + 1;
- dbei.cbBlob += lstrlenA(szDescr) + 1;
+ dbei.cbBlob += mir_strlen(szDescr) + 1;
if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
return;
@@ -369,7 +369,7 @@ static void sttRecvCreateBlob(DBEVENTINFO &dbei, int fileCount, char **pszFiles,
BYTE* p = dbei.pBlob + sizeof(DWORD);
for (int i = 0; i < fileCount; i++) {
strcpy((char*)p, pszFiles[i]);
- p += lstrlenA(pszFiles[i]) + 1;
+ p += mir_strlen(pszFiles[i]) + 1;
}
strcpy((char*)p, (szDescr == NULL) ? "" : szDescr);
}
diff --git a/src/core/stdfile/fileexistsdlg.cpp b/src/core/stdfile/fileexistsdlg.cpp
index 1e604c2947..4bf7da405a 100644
--- a/src/core/stdfile/fileexistsdlg.cpp
+++ b/src/core/stdfile/fileexistsdlg.cpp
@@ -149,7 +149,7 @@ void __cdecl LoadIconsAndTypesThread(void* param)
TCHAR *pszExtension = _tcsrchr(pszFilename, '.');
if (pszExtension)
- lstrcpyn(szExtension, pszExtension + 1, SIZEOF(szExtension));
+ mir_tstrncpy(szExtension, pszExtension + 1, SIZEOF(szExtension));
else {
pszExtension = _T(".");
szExtension[0] = '\0';
@@ -166,7 +166,7 @@ void __cdecl LoadIconsAndTypesThread(void* param)
else {
TCHAR szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, SIZEOF(szTypeName))) {
- lstrcat(szTypeName, _T("\\DefaultIcon"));
+ mir_tstrcat(szTypeName, _T("\\DefaultIcon"));
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, SIZEOF(szIconFile))) {
if (_tcsstr(szIconFile, _T("%1")))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, SIZEOF(szIconFile));
@@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case IDC_OPENFOLDER:
{
TCHAR szFile[MAX_PATH];
- lstrcpyn(szFile, fts->tszCurrentFile, SIZEOF(szFile));
+ mir_tstrncpy(szFile, fts->tszCurrentFile, SIZEOF(szFile));
TCHAR *pszLastBackslash = _tcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TCHAR filter[512], *pfilter;
TCHAR str[MAX_PATH];
- lstrcpyn(str, fts->tszCurrentFile, SIZEOF(str));
+ mir_tstrncpy(str, fts->tszCurrentFile, SIZEOF(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp
index 68e84dcf73..9509e14dda 100644
--- a/src/core/stdfile/filerecvdlg.cpp
+++ b/src/core/stdfile/filerecvdlg.cpp
@@ -38,7 +38,7 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDi
DWORD dwAttributes;
TCHAR *pszLastBackslash;
- lstrcpyn(szExistingDir, szTestDir, cchExistingDir);
+ mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash = _tcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
@@ -96,7 +96,7 @@ int BrowseForFolder(HWND hwnd, TCHAR *szPath)
LPITEMIDLIST pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDList(pidlResult, szPath);
- lstrcat(szPath, _T("\\"));
+ mir_tstrcat(szPath, _T("\\"));
CoTaskMemFree(pidlResult);
}
return pidlResult != NULL;
@@ -123,9 +123,9 @@ static void patchDir(TCHAR *str, size_t strSize)
mir_free(result);
}
- size_t len = lstrlen(str);
+ size_t len = mir_tstrlen(str);
if (len + 1 < strSize && str[len - 1] != '\\')
- lstrcpy(str + len, _T("\\"));
+ mir_tstrcpy(str + len, _T("\\"));
}
void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars)
@@ -170,7 +170,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO
if (patchVars)
patchDir(tszTemp, SIZEOF(tszTemp));
RemoveInvalidPathChars(tszTemp);
- lstrcpyn(szDir, tszTemp, cchDir);
+ mir_tstrncpy(szDir, tszTemp, cchDir);
}
void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
@@ -185,7 +185,7 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
patchDir(tszTemp, SIZEOF(tszTemp));
RemoveInvalidPathChars(tszTemp);
- lstrcpyn(szDir, tszTemp, cchDir);
+ mir_tstrncpy(szDir, tszTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, SIZEOF(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, SIZEOF(szDefaultRecvDir), TRUE);
- if (_tcsnicmp(szRecvDir, szDefaultRecvDir, lstrlen(szDefaultRecvDir))) {
+ if (_tcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
DBVARIANT dbv;
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp
index b6fdfe2ec4..c207cb9ff0 100644
--- a/src/core/stdfile/filesenddlg.cpp
+++ b/src/core/stdfile/filesenddlg.cpp
@@ -53,11 +53,11 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat)
mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount);
}
else if (fileCount) {
- lstrcpy(szFormat, TranslateT("%d files"));
+ mir_tstrcpy(szFormat, TranslateT("%d files"));
mir_sntprintf(str, SIZEOF(str), szFormat, fileCount);
}
else {
- lstrcpy(szFormat, TranslateT("%d directories"));
+ mir_tstrcpy(szFormat, TranslateT("%d directories"));
mir_sntprintf(str, SIZEOF(str), szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
@@ -88,12 +88,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
// NULL separated list of all files
// fileOffset is the offset to the first file.
- fileOffset = lstrlen(buf) + 1;
+ fileOffset = mir_tstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
while (*pBuf) {
- pBuf += lstrlen(pBuf) + 1;
+ pBuf += mir_tstrlen(pBuf) + 1;
nNumberOfFiles++;
}
@@ -106,7 +106,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- int cbFileNameLen = lstrlen(pBuf);
+ int cbFileNameLen = mir_tstrlen(pBuf);
dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
@@ -147,11 +147,11 @@ void __cdecl ChooseFilesThread(void* param)
}
TCHAR filter[128];
- lstrcpy(filter, TranslateT("All files"));
- lstrcat(filter, _T(" (*)"));
- TCHAR *pfilter = filter + lstrlen(filter) + 1;
- lstrcpy(pfilter, _T("*"));
- pfilter = filter + lstrlen(filter) + 1;
+ mir_tstrcpy(filter, TranslateT("All files"));
+ mir_tstrcat(filter, _T(" (*)"));
+ TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_tstrcpy(pfilter, _T("*"));
+ pfilter = filter + mir_tstrlen(filter) + 1;
pfilter[0] = '\0';
OPENFILENAME ofn = { 0 };
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp
index 18c8e3b5a4..f5eeeec531 100644
--- a/src/core/stdfile/filexferdlg.cpp
+++ b/src/core/stdfile/filexferdlg.cpp
@@ -85,11 +85,11 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg);
dbei.flags |= DBEF_UTF;
- dbei.cbBlob = sizeof(DWORD) + lstrlenA(szFileNames) + lstrlenA(szMsg) + 2;
+ dbei.cbBlob = sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2;
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
*(PDWORD)dbei.pBlob = 0;
- lstrcpyA((char*)dbei.pBlob + sizeof(DWORD), szFileNames);
- lstrcpyA((char*)dbei.pBlob + sizeof(DWORD) + lstrlenA(szFileNames) + 1, szMsg);
+ mir_strcpy((char*)dbei.pBlob + sizeof(DWORD), szFileNames);
+ mir_strcpy((char*)dbei.pBlob + sizeof(DWORD) + mir_strlen(szFileNames) + 1, szMsg);
mir_free(szFileNames), mir_free(szMsg);
}
@@ -109,7 +109,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)
*pszReplace = 0;
mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2);
}
- else lstrcpyn(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine));
+ else mir_tstrncpy(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine));
PROCESS_INFORMATION pi;
if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
@@ -155,7 +155,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE
dat->hIcon = shfi.hIcon;
}
else {
- lstrcpyn(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg));
+ mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg));
HICON hIcon = LoadSkinIcon(SKINICON_OTHER_DOWNARROW);
dat->hIcon = CopyIcon(hIcon);
IcoLib_ReleaseIcon(hIcon, NULL);
@@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, SIZEOF(szSpeed), 0, 1, NULL);
if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1])
- lstrcpy(szTime, _T("??:??:??"));
+ mir_tstrcpy(szTime, _T("??:??:??"));
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;
@@ -477,9 +477,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
TCHAR *pszExtension, *pszFilename;
if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename;
- if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + lstrlen(pszFilename);
+ if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename);
if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename);
- size_t size = (pszExtension - szOriginalFilename) + 21 + lstrlen(pszExtension);
+ size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension);
pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size);
for (int i = 1;; i++) {
mir_sntprintf((TCHAR*)pfr->szFilename, size, _T("%.*s (%u)%s"), pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension);