diff options
Diffstat (limited to 'src/core/stdfile/src/filerecvdlg.cpp')
-rw-r--r-- | src/core/stdfile/src/filerecvdlg.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index 3c75d282c0..6df563406d 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -33,14 +33,14 @@ static BOOL CALLBACK ClipSiblingsChildEnumProc(HWND hwnd, LPARAM) return TRUE;
}
-static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDir, int cchExistingDir)
+static void GetLowestExistingDirName(const wchar_t *szTestDir, wchar_t *szExistingDir, int cchExistingDir)
{
DWORD dwAttributes;
- TCHAR *pszLastBackslash;
+ wchar_t *pszLastBackslash;
mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
- pszLastBackslash = _tcsrchr(szExistingDir, '\\');
+ pszLastBackslash = wcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
*pszLastBackslash = '\0';
}
@@ -48,27 +48,27 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDi GetCurrentDirectory(cchExistingDir, szExistingDir);
}
-static const TCHAR InvalidFilenameChars[] = L"\\/:*?\"<>|";
-void RemoveInvalidFilenameChars(TCHAR *tszString)
+static const wchar_t InvalidFilenameChars[] = L"\\/:*?\"<>|";
+void RemoveInvalidFilenameChars(wchar_t *tszString)
{
size_t i;
if (tszString) {
- for (i = _tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1)
- tszString[i] = _T('_');
+ for (i = wcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=wcscspn(tszString+i+1, InvalidFilenameChars)+1)
+ tszString[i] = '_';
}
}
-static const TCHAR InvalidPathChars[] = L"*?\"<>|"; // "\/:" are excluded as they are allowed in file path
-void RemoveInvalidPathChars(TCHAR *tszString)
+static const wchar_t InvalidPathChars[] = L"*?\"<>|"; // "\/:" are excluded as they are allowed in file path
+void RemoveInvalidPathChars(wchar_t *tszString)
{
if (tszString)
- for (size_t i = _tcscspn(tszString, InvalidPathChars); tszString[i]; i += _tcscspn(tszString + i + 1, InvalidPathChars) + 1)
- tszString[i] = _T('_');
+ for (size_t i = wcscspn(tszString, InvalidPathChars); tszString[i]; i += wcscspn(tszString + i + 1, InvalidPathChars) + 1)
+ tszString[i] = '_';
}
static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
{
- TCHAR szDir[MAX_PATH];
+ wchar_t szDir[MAX_PATH];
switch (uMsg) {
case BFFM_INITIALIZED:
SendMessage(hwnd, BFFM_SETSELECTION, TRUE, pData);
@@ -81,7 +81,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p return 0;
}
-int BrowseForFolder(HWND hwnd, TCHAR *szPath)
+int BrowseForFolder(HWND hwnd, wchar_t *szPath)
{
BROWSEINFO bi = { 0 };
bi.hwndOwner = hwnd;
@@ -108,11 +108,11 @@ static REPLACEVARSARRAY sttVarsToReplace[] = { NULL, NULL }
};
-static void patchDir(TCHAR *str, size_t strSize)
+static void patchDir(wchar_t *str, size_t strSize)
{
- TCHAR *result = Utils_ReplaceVarsT(str, 0, sttVarsToReplace);
+ wchar_t *result = Utils_ReplaceVarsT(str, 0, sttVarsToReplace);
if (result) {
- _tcsncpy(str, result, strSize);
+ wcsncpy(str, result, strSize);
mir_free(result);
}
@@ -121,13 +121,13 @@ static void patchDir(TCHAR *str, size_t strSize) mir_tstrcpy(str + len, L"\\");
}
-void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars)
+void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL patchVars)
{
- TCHAR tszTemp[MAX_PATH];
+ wchar_t tszTemp[MAX_PATH];
ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
- _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
+ wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
@@ -135,23 +135,23 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO hContact = db_mc_tryMeta(hContact);
REPLACEVARSARRAY rvaVarsToReplace[4];
- rvaVarsToReplace[0].key.t = L"nick";
- rvaVarsToReplace[0].value.t = mir_tstrdup((TCHAR *)pcli->pfnGetContactDisplayName(hContact, 0));
- rvaVarsToReplace[1].key.t = L"userid";
- rvaVarsToReplace[1].value.t = GetContactID(hContact);
- rvaVarsToReplace[2].key.t = L"proto";
- rvaVarsToReplace[2].value.t = mir_a2t(GetContactProto(hContact));
- rvaVarsToReplace[3].key.t = NULL;
- rvaVarsToReplace[3].value.t = NULL;
+ rvaVarsToReplace[0].key.w = L"nick";
+ rvaVarsToReplace[0].value.w = mir_tstrdup((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[3].key.w = NULL;
+ rvaVarsToReplace[3].value.w = NULL;
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
- RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.t);
+ RemoveInvalidFilenameChars(rvaVarsToReplace[i].value.w);
- TCHAR *result = Utils_ReplaceVarsT(tszTemp, hContact, rvaVarsToReplace);
+ wchar_t *result = Utils_ReplaceVarsT(tszTemp, hContact, rvaVarsToReplace);
if (result) {
- _tcsncpy(tszTemp, result, _countof(tszTemp));
+ wcsncpy(tszTemp, result, _countof(tszTemp));
mir_free(result);
for (int i = 0; i < (_countof(rvaVarsToReplace) - 1); i++)
- mir_free(rvaVarsToReplace[i].value.t);
+ mir_free(rvaVarsToReplace[i].value.w);
}
}
@@ -161,13 +161,13 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO mir_tstrncpy(szDir, tszTemp, cchDir);
}
-void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
+void GetReceivedFilesDir(wchar_t *szDir, int cchDir)
{
- TCHAR tszTemp[MAX_PATH];
+ wchar_t tszTemp[MAX_PATH];
ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
- _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
+ wcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
mir_sntprintf(tszTemp, L"%%mydocuments%%\\%s\\%%userid%%", TranslateT("My received files"));
@@ -184,7 +184,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- TCHAR szPath[450];
+ wchar_t szPath[450];
CLISTEVENT* cle = (CLISTEVENT*)lParam;
dat = (FileDlgData*)mir_calloc(sizeof(FileDlgData));
@@ -203,7 +203,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l Button_SetIcon_IcoLib(hwndDlg, IDC_HISTORY, SKINICON_OTHER_HISTORY, LPGEN("View user's history"));
Button_SetIcon_IcoLib(hwndDlg, IDC_USERMENU, SKINICON_OTHER_DOWNARROW, LPGEN("User menu"));
- TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_FROM, contactName);
GetContactReceivedFilesDir(dat->hContact, szPath, _countof(szPath), TRUE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, szPath);
@@ -243,7 +243,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l }
else DestroyWindow(hwndDlg);
- TCHAR datetimestr[64];
+ wchar_t datetimestr[64];
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0);
SetDlgItemText(hwndDlg, IDC_DATE, datetimestr);
@@ -292,7 +292,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l switch (LOWORD(wParam)) {
case IDC_FILEDIRBROWSE:
{
- TCHAR szDirName[MAX_PATH], szExistingDirName[MAX_PATH];
+ wchar_t szDirName[MAX_PATH], szExistingDirName[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILEDIR, szDirName, _countof(szDirName));
GetLowestExistingDirName(szDirName, szExistingDirName, _countof(szExistingDirName));
@@ -303,11 +303,11 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDOK:
{ //most recently used directories
- TCHAR szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH];
+ wchar_t szRecvDir[MAX_PATH], szDefaultRecvDir[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, _countof(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, _countof(szDefaultRecvDir), TRUE);
- if (_tcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
+ if (wcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
DBVARIANT dbv;
|