diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /src/core/stdfile | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdfile')
-rw-r--r-- | src/core/stdfile/src/file.cpp | 36 | ||||
-rw-r--r-- | src/core/stdfile/src/file.h | 26 | ||||
-rw-r--r-- | src/core/stdfile/src/fileexistsdlg.cpp | 32 | ||||
-rw-r--r-- | src/core/stdfile/src/fileopts.cpp | 32 | ||||
-rw-r--r-- | src/core/stdfile/src/filerecvdlg.cpp | 80 | ||||
-rw-r--r-- | src/core/stdfile/src/filesenddlg.cpp | 32 | ||||
-rw-r--r-- | src/core/stdfile/src/filexferdlg.cpp | 108 | ||||
-rw-r--r-- | src/core/stdfile/src/stdafx.h | 1 |
8 files changed, 173 insertions, 174 deletions
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index a9f28f51d9..1886a29f1a 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -27,16 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HANDLE hDlgSucceeded, hDlgCanceled;
-TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s);
-int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const TCHAR* s, TCHAR *r);
+wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s);
+int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS* ft, const wchar_t* s, wchar_t *r);
static HGENMENU hSRFileMenuItem;
-TCHAR* GetContactID(MCONTACT hContact)
+wchar_t* GetContactID(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
- if (TCHAR *theValue = db_get_tsa(hContact, szProto, "ChatRoomID"))
+ if (wchar_t *theValue = db_get_tsa(hContact, szProto, "ChatRoomID"))
return theValue;
return Contact_GetInfo(CNF_UNIQUEID, hContact, szProto);
@@ -60,7 +60,7 @@ static INT_PTR SendSpecificFiles(WPARAM hContact, LPARAM lParam) while (ppFiles[count] != NULL)
count++;
- fsd.ppFiles = (const TCHAR**)alloca((count + 1) * sizeof(void*));
+ 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[count] = NULL;
@@ -75,13 +75,13 @@ static INT_PTR SendSpecificFilesT(WPARAM hContact, LPARAM lParam) {
FileSendData fsd;
fsd.hContact = hContact;
- fsd.ppFiles = (const TCHAR**)lParam;
+ fsd.ppFiles = (const wchar_t**)lParam;
return (INT_PTR)CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
}
static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam)
{
- TCHAR buf[MAX_PATH];
+ wchar_t buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
char* dir = mir_t2a(buf);
mir_strncpy((char*)lParam, dir, MAX_PATH);
@@ -107,7 +107,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) else {
SkinPlaySound("RecvFile");
- TCHAR szTooltip[256];
+ wchar_t szTooltip[256];
mir_sntprintf(szTooltip, TranslateT("File from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
@@ -133,7 +133,7 @@ static int FileEventAdded(WPARAM wParam, LPARAM lParam) return 0;
}
-int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput)
+int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *szValue, wchar_t *szOutput, int cbOutput)
{
HKEY hKey;
DWORD cbOut = cbOutput;
@@ -150,7 +150,7 @@ int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValu return 1;
}
-void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed)
+void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed)
{
if (!unitsOverride) {
if (size < 1000) unitsOverride = UNITS_BYTES;
@@ -173,13 +173,13 @@ void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsO }
// Tripple redirection sucks but is needed to nullify the array pointer
-void FreeFilesMatrix(TCHAR ***files)
+void FreeFilesMatrix(wchar_t ***files)
{
if (*files == NULL)
return;
// Free each filename in the pointer array
- TCHAR **pFile = *files;
+ wchar_t **pFile = *files;
while (*pFile != NULL) {
mir_free(*pFile);
*pFile = NULL;
@@ -206,7 +206,7 @@ void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFE *dest = *src;
if (src->tszCurrentFile) dest->tszCurrentFile = PFTS_StringToTchar(src->flags, src->tszCurrentFile);
if (src->ptszFiles) {
- dest->ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*src->totalFiles);
+ dest->ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*src->totalFiles);
for (int i = 0; i < src->totalFiles; i++)
dest->ptszFiles[i] = PFTS_StringToTchar(src->flags, src->ptszFiles[i]);
}
@@ -227,7 +227,7 @@ void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANS }
if (src->ptszFiles) {
if (!dest->ptszFiles)
- dest->ptszFiles = (TCHAR**)mir_calloc(sizeof(TCHAR*)*src->totalFiles);
+ dest->ptszFiles = (wchar_t**)mir_calloc(sizeof(wchar_t*)*src->totalFiles);
for (int i = 0; i < src->totalFiles; i++)
if (!dest->ptszFiles[i] || !src->ptszFiles[i] || PFTS_CompareWithTchar(src, src->ptszFiles[i], dest->ptszFiles[i])) {
mir_free(dest->ptszFiles[i]);
@@ -336,7 +336,7 @@ INT_PTR FtMgrShowCommand(WPARAM, LPARAM) INT_PTR openContRecDir(WPARAM hContact, LPARAM)
{
- TCHAR szContRecDir[MAX_PATH];
+ wchar_t szContRecDir[MAX_PATH];
GetContactReceivedFilesDir(hContact, szContRecDir, _countof(szContRecDir), TRUE);
ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW);
return 0;
@@ -344,7 +344,7 @@ INT_PTR openContRecDir(WPARAM hContact, LPARAM) INT_PTR openRecDir(WPARAM, LPARAM)
{
- TCHAR szContRecDir[MAX_PATH];
+ wchar_t szContRecDir[MAX_PATH];
GetReceivedFilesDir(szContRecDir, _countof(szContRecDir));
ShellExecute(0, L"open", szContRecDir, 0, 0, SW_SHOW);
return 0;
@@ -373,9 +373,9 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) if (bUnicode) {
pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
for (int i = 0; i < pre->fileCount; i++)
- pszFiles[i] = Utf8EncodeT(pre->files.t[i]);
+ pszFiles[i] = Utf8EncodeT(pre->files.w[i]);
- szDescr = Utf8EncodeT(pre->descr.t);
+ szDescr = Utf8EncodeT(pre->descr.w);
}
else {
pszFiles = pre->files.a;
diff --git a/src/core/stdfile/src/file.h b/src/core/stdfile/src/file.h index d279789ddd..a41d169fae 100644 --- a/src/core/stdfile/src/file.h +++ b/src/core/stdfile/src/file.h @@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct FileSendData
{
MCONTACT hContact;
- const TCHAR **ppFiles;
+ const wchar_t **ppFiles;
};
#define BYTESRECVEDHISTORYCOUNT 10 //the number of bytes recved is sampled once a second and the last 10 are used to get the transfer speed
@@ -51,7 +51,7 @@ struct FileDlgData MCONTACT hContact;
MEVENT hDbEvent;
HANDLE hNotifyEvent;
- TCHAR **files;
+ wchar_t **files;
int send;
int closeIfFileChooseCancelled;
int resumeBehaviour;
@@ -63,8 +63,8 @@ struct FileDlgData HANDLE hPreshutdownEvent;
DWORD dwTicks;
- TCHAR szSavePath[MAX_PATH];
- TCHAR szMsg[450], szFilenames[1024];
+ wchar_t szSavePath[MAX_PATH];
+ wchar_t szMsg[450], szFilenames[1024];
HICON hIcon, hIconFolder;
};
@@ -75,21 +75,21 @@ struct FileDlgData #define UNITS_MBPOINT2 4 // 1024*1024 <= size: "%.2f MB"
#define UNITS_GBPOINT3 5 // 1024*1024*1024 <= size: "%.3f GB"
-void GetSensiblyFormattedSize(__int64 size, TCHAR *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed);
-void FreeFilesMatrix(TCHAR ***files); //loving that triple indirection
+void GetSensiblyFormattedSize(__int64 size, wchar_t *szOut, int cchOut, int unitsOverride, int appendUnits, int *unitsUsed);
+void FreeFilesMatrix(wchar_t ***files); //loving that triple indirection
void FreeProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *fts);
void CopyProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src);
void UpdateProtoFileTransferStatus(PROTOFILETRANSFERSTATUS *dest, PROTOFILETRANSFERSTATUS *src);
-int SRFile_GetRegValue(HKEY hKeyBase, const TCHAR *szSubKey, const TCHAR *szValue, TCHAR *szOutput, int cbOutput);
+int SRFile_GetRegValue(HKEY hKeyBase, const wchar_t *szSubKey, const wchar_t *szValue, wchar_t *szOutput, int cbOutput);
//filesenddlg.c
INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
//filerecv.c
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-void RemoveInvalidFilenameChars(TCHAR *tszString);
-void RemoveInvalidPathChars(TCHAR *tszString);
-void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL substVars);
-void GetReceivedFilesDir(TCHAR *szDir, int cchDir);
-int BrowseForFolder(HWND hwnd, TCHAR *szPath);
+void RemoveInvalidFilenameChars(wchar_t *tszString);
+void RemoveInvalidPathChars(wchar_t *tszString);
+void GetContactReceivedFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir, BOOL substVars);
+void GetReceivedFilesDir(wchar_t *szDir, int cchDir);
+int BrowseForFolder(HWND hwnd, wchar_t *szPath);
//fileexistsdlg.c
struct TDlgProcFileExistsParam
{
@@ -117,6 +117,6 @@ HWND FtMgr_AddTransfer(FileDlgData *dat); void FreeFileDlgData(FileDlgData* dat);
-TCHAR *GetContactID(MCONTACT hContact);
+wchar_t *GetContactID(MCONTACT hContact);
extern HANDLE hDlgSucceeded, hDlgCanceled;
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index a5243ee528..d0650fec8d 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -47,7 +47,7 @@ static void SetControlToUnixTime(HWND hwndDlg, UINT idCtrl, time_t unixTime) #ifndef CMF_EXTENDEDVERBS
#define CMF_EXTENDEDVERBS 0x00000100
#endif
-static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd, POINT *ptCursor)
+static void DoAnnoyingShellCommand(HWND hwnd, const wchar_t *szFilename, int cmd, POINT *ptCursor)
{
IShellFolder *pDesktopFolder;
if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) {
@@ -132,7 +132,7 @@ static LRESULT CALLBACK IconCtrlSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, struct loadiconsstartinfo {
HWND hwndDlg;
- TCHAR *szFilename;
+ wchar_t *szFilename;
};
void __cdecl LoadIconsAndTypesThread(void* param)
@@ -141,13 +141,13 @@ void __cdecl LoadIconsAndTypesThread(void* param) SHFILEINFO fileInfo;
if (SHGetFileInfo(info->szFilename, 0, &fileInfo, sizeof(fileInfo), SHGFI_TYPENAME | SHGFI_ICON | SHGFI_LARGEICON)) {
- TCHAR szExtension[64], szIconFile[MAX_PATH];
+ wchar_t szExtension[64], szIconFile[MAX_PATH];
- TCHAR *pszFilename = _tcsrchr(info->szFilename, '\\');
+ wchar_t *pszFilename = wcsrchr(info->szFilename, '\\');
if (pszFilename == NULL)
pszFilename = info->szFilename;
- TCHAR *pszExtension = _tcsrchr(pszFilename, '.');
+ wchar_t *pszExtension = wcsrchr(pszFilename, '.');
if (pszExtension)
mir_tstrncpy(szExtension, pszExtension + 1, _countof(szExtension));
else {
@@ -164,11 +164,11 @@ void __cdecl LoadIconsAndTypesThread(void* param) if (!mir_tstrcmp(szExtension, L"EXE"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"2", szIconFile, _countof(szIconFile));
else {
- TCHAR szTypeName[MAX_PATH];
+ wchar_t szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, _countof(szTypeName))) {
mir_tstrcat(szTypeName, L"\\DefaultIcon");
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, _countof(szIconFile))) {
- if (_tcsstr(szIconFile, L"%1"))
+ if (wcsstr(szIconFile, L"%1"))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons", L"0", szIconFile, _countof(szIconFile));
else szIconFile[0] = '\0';
}
@@ -176,10 +176,10 @@ void __cdecl LoadIconsAndTypesThread(void* param) }
if (szIconFile[0]) {
- TCHAR *pszComma = _tcsrchr(szIconFile, ',');
+ wchar_t *pszComma = wcsrchr(szIconFile, ',');
int iconIndex;
if (pszComma) {
- iconIndex = _ttoi(pszComma + 1);
+ iconIndex = _wtoi(pszComma + 1);
*pszComma = '\0';
}
else
@@ -201,7 +201,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- TCHAR szSize[64];
+ wchar_t szSize[64];
struct _stati64 statbuf;
struct TDlgProcFileExistsParam *dat = (struct TDlgProcFileExistsParam *)lParam;
@@ -219,7 +219,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM mir_subclassWindow(GetDlgItem(hwndDlg, IDC_EXISTINGICON), IconCtrlSubclassProc);
HWND hwndFocus = GetDlgItem(hwndDlg, IDC_RESUME);
- if (_tstati64(fts->tszCurrentFile, &statbuf) == 0) {
+ if (_wstat64(fts->tszCurrentFile, &statbuf) == 0) {
SetControlToUnixTime(hwndDlg, IDC_EXISTINGDATE, statbuf.st_mtime);
GetSensiblyFormattedSize(statbuf.st_size, szSize, _countof(szSize), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_EXISTINGSIZE, szSize);
@@ -249,9 +249,9 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_OPENFOLDER:
{
- TCHAR szFile[MAX_PATH];
+ wchar_t szFile[MAX_PATH];
mir_tstrncpy(szFile, fts->tszCurrentFile, _countof(szFile));
- TCHAR *pszLastBackslash = _tcsrchr(szFile, '\\');
+ wchar_t *pszLastBackslash = wcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
ShellExecute(hwndDlg, NULL, szFile, NULL, NULL, SW_SHOW);
@@ -280,14 +280,14 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_SAVEAS:
{
OPENFILENAME ofn = { 0 };
- TCHAR filter[512], *pfilter;
- TCHAR str[MAX_PATH];
+ wchar_t filter[512], *pfilter;
+ wchar_t str[MAX_PATH];
mir_tstrncpy(str, fts->tszCurrentFile, _countof(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- _tcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
+ wcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
mir_tstrcat(filter, L" (*)");
pfilter = filter + mir_tstrlen(filter) + 1;
mir_tstrcpy(pfilter, L"*");
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp index c608f7311a..30979c1294 100644 --- a/src/core/stdfile/src/fileopts.cpp +++ b/src/core/stdfile/src/fileopts.cpp @@ -30,10 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define VSCAN_CA 4
struct virusscannerinfo {
- const TCHAR *szProductName;
- const TCHAR *szExeRegPath;
- const TCHAR *szExeRegValue;
- const TCHAR *szCommandLine;
+ const wchar_t *szProductName;
+ const wchar_t *szExeRegPath;
+ const wchar_t *szExeRegValue;
+ const wchar_t *szCommandLine;
} virusScanners[] = {
{L"Network Associates/McAfee VirusScan", L"SOFTWARE\\McAfee\\VirusScan", L"Scan32EXE", L"\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot"},
{L"Dr Solomon's VirusScan (Network Associates)", L"SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General", L"szScannerExe", L"\"%s\" %%f /uinone /noboot /comp /prompt /autoexit"},
@@ -62,7 +62,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L {
SHAutoComplete(GetDlgItem(hwndDlg, IDC_FILEDIR), SHACF_FILESYS_DIRS);
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
GetContactReceivedFilesDir(NULL, str, _countof(str), FALSE);
SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
@@ -78,7 +78,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_WARNBEFOREOPENING, db_get_b(NULL, "SRFile", "WarnBeforeOpening", 1) ? BST_CHECKED : BST_UNCHECKED);
for (int i = 0; i < _countof(virusScanners); i++) {
- TCHAR szScanExe[MAX_PATH];
+ wchar_t szScanExe[MAX_PATH];
if (SRFile_GetRegValue(HKEY_LOCAL_MACHINE, virusScanners[i].szExeRegPath, virusScanners[i].szExeRegValue, szScanExe, _countof(szScanExe))) {
int iItem = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_ADDSTRING, 0, (LPARAM)virusScanners[i].szProductName);
SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_SETITEMDATA, iItem, i);
@@ -121,8 +121,8 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case M_SCANCMDLINESELCHANGE:
{
- TCHAR str[512];
- TCHAR szScanExe[MAX_PATH];
+ wchar_t str[512];
+ wchar_t szScanExe[MAX_PATH];
int iScanner = SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_SCANCMDLINE, CB_GETCURSEL, 0, 0), 0);
if (iScanner >= _countof(virusScanners) || iScanner < 0) break;
str[0] = '\0';
@@ -140,7 +140,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_FILEDIRBROWSE:
{
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str));
if (BrowseForFolder(hwndDlg, str))
SetDlgItemText(hwndDlg, IDC_FILEDIR, str);
@@ -162,7 +162,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L break;
case IDC_SCANCMDLINEBROWSE:
- TCHAR str[MAX_PATH + 2];
+ wchar_t str[MAX_PATH + 2];
GetDlgItemText(hwndDlg, IDC_SCANCMDLINE, str, _countof(str));
CMString tszFilter;
@@ -177,19 +177,19 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.lpstrFile = str;
ofn.nMaxFile = _countof(str) - 2;
if (str[0] == '"') {
- TCHAR *pszQuote = _tcschr(str + 1, '"');
+ wchar_t *pszQuote = wcschr(str + 1, '"');
if (pszQuote)
*pszQuote = 0;
- memmove(str, str + 1, (mir_tstrlen(str) * sizeof(TCHAR)));
+ memmove(str, str + 1, (mir_tstrlen(str) * sizeof(wchar_t)));
}
else {
- TCHAR *pszSpace = _tcschr(str, ' ');
+ wchar_t *pszSpace = wcschr(str, ' ');
if (pszSpace) *pszSpace = 0;
}
ofn.nMaxFileTitle = MAX_PATH;
if (!GetOpenFileName(&ofn)) break;
- if (_tcschr(str, ' ') != NULL) {
- memmove(str + 1, str, ((_countof(str) - 2) * sizeof(TCHAR)));
+ if (wcschr(str, ' ') != NULL) {
+ memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
mir_tstrcat(str, L"\"");
}
@@ -202,7 +202,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
- TCHAR str[512];
+ wchar_t str[512];
GetDlgItemText(hwndDlg, IDC_FILEDIR, str, _countof(str));
RemoveInvalidPathChars(str);
db_set_ts(NULL, "SRFile", "RecvFilesDirAdv", str);
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;
diff --git a/src/core/stdfile/src/filesenddlg.cpp b/src/core/stdfile/src/filesenddlg.cpp index 318dcab932..7d1c780807 100644 --- a/src/core/stdfile/src/filesenddlg.cpp +++ b/src/core/stdfile/src/filesenddlg.cpp @@ -32,10 +32,10 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) int fileCount = 0, dirCount = 0, i;
__int64 totalSize = 0;
struct _stati64 statbuf;
- TCHAR str[64];
+ wchar_t str[64];
for (i = 0; dat->files[i]; i++) {
- if (_tstati64(dat->files[i], &statbuf) == 0) {
+ if (_wstat64(dat->files[i], &statbuf) == 0) {
if (statbuf.st_mode & _S_IFDIR)
dirCount++;
else
@@ -47,7 +47,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) GetSensiblyFormattedSize(totalSize, str, _countof(str), 0, 1, NULL);
SetDlgItemText(hwndDlg, IDC_TOTALSIZE, str);
if (i > 1) {
- TCHAR szFormat[32];
+ 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);
@@ -67,7 +67,7 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) EnableWindow(GetDlgItem(hwndDlg, IDOK), fileCount || dirCount);
}
-static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
+static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const wchar_t *buf)
{
// Make sure that the file matrix is empty (the user may select files several times)
FreeFilesMatrix(&dat->files);
@@ -79,7 +79,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) // Check if the selection is a directory or a file
if (GetFileAttributes(buf) & FILE_ATTRIBUTE_DIRECTORY) {
- const TCHAR *pBuf;
+ const wchar_t *pBuf;
int nNumberOfFiles = 0;
int nTemp;
@@ -97,7 +97,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) }
// Allocate memory for a pointer array
- if ((dat->files = (TCHAR**)mir_alloc((nNumberOfFiles + 1) * sizeof(TCHAR*))) == NULL)
+ if ((dat->files = (wchar_t**)mir_alloc((nNumberOfFiles + 1) * sizeof(wchar_t*))) == NULL)
return;
// Fill the array
@@ -106,10 +106,10 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) while (*pBuf) {
// Allocate space for path+filename
size_t cbFileNameLen = mir_tstrlen(pBuf);
- dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
+ 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(TCHAR));
+ 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);
@@ -122,7 +122,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) }
// ...the selection is a single file
else {
- if ((dat->files = (TCHAR **)mir_alloc(2 * sizeof(TCHAR*))) == NULL) // Leaks when aborted
+ if ((dat->files = (wchar_t **)mir_alloc(2 * sizeof(wchar_t*))) == NULL) // Leaks when aborted
return;
dat->files[0] = mir_tstrdup(buf);
@@ -139,16 +139,16 @@ void __cdecl ChooseFilesThread(void* param) HWND hwndDlg = (HWND)param;
FileDlgData *dat = (FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- TCHAR *buf = (TCHAR*)mir_alloc(sizeof(TCHAR) * 32767);
+ wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t) * 32767);
if (buf == NULL) {
PostMessage(hwndDlg, M_FILECHOOSEDONE, 0, NULL);
return;
}
- TCHAR filter[128];
+ wchar_t filter[128];
mir_tstrcpy(filter, TranslateT("All files"));
mir_tstrcat(filter, L" (*)");
- TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
+ wchar_t *pfilter = filter + mir_tstrlen(filter) + 1;
mir_tstrcpy(pfilter, L"*");
pfilter = filter + mir_tstrlen(filter) + 1;
pfilter[0] = '\0';
@@ -228,14 +228,14 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (fsd->ppFiles != NULL && fsd->ppFiles[0] != NULL) {
int totalCount, i;
for (totalCount = 0; fsd->ppFiles[totalCount]; totalCount++);
- dat->files = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(totalCount + 1)); // Leaks
+ 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[totalCount] = NULL;
SetFileListAndSizeControls(hwndDlg, dat);
}
- TCHAR *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
+ wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
SetDlgItemText(hwndDlg, IDC_TO, contactName);
ptrT id(Contact_GetInfo(CNF_UNIQUEID, dat->hContact));
@@ -270,8 +270,8 @@ INT_PTR CALLBACK DlgProcSendFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case M_FILECHOOSEDONE:
if (lParam != 0) {
- FilenameToFileList(hwndDlg, dat, (TCHAR*)lParam);
- mir_free((TCHAR*)lParam);
+ FilenameToFileList(hwndDlg, dat, (wchar_t*)lParam);
+ mir_free((wchar_t*)lParam);
dat->closeIfFileChooseCancelled = 0;
}
else if (dat->closeIfFileChooseCancelled)
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index 036e75068e..7be203e9bb 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -37,12 +37,12 @@ static int CheckVirusScanned(HWND hwnd, FileDlgData *dat, int i) #define M_VIRUSSCANDONE (WM_USER+100) struct virusscanthreadstartinfo { - TCHAR *szFile; + wchar_t *szFile; int returnCode; HWND hwndReply; }; -TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s) +wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s) { if (flags & PFTS_UTF) return Utf8DecodeW((char*)s); @@ -51,10 +51,10 @@ TCHAR* PFTS_StringToTchar(int flags, const TCHAR* s) return mir_a2t((char*)s); } -int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const TCHAR *s, TCHAR *r) +int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r) { if (ft->flags & PFTS_UTF) { - TCHAR *ts = Utf8DecodeW((char*)s); + wchar_t *ts = Utf8DecodeW((char*)s); int res = mir_tstrcmp(ts, r); mir_free(ts); return res; @@ -62,7 +62,7 @@ int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const TCHAR *s, TCHAR *r) if (ft->flags & PFTS_UNICODE) return mir_tstrcmp(s, r); - TCHAR *ts = mir_a2t((char*)s); + wchar_t *ts = mir_a2t((char*)s); int res = mir_tstrcmp(ts, r); mir_free(ts); return res; @@ -99,15 +99,15 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) if (dbv.ptszVal[0]) { STARTUPINFO si = { 0 }; si.cb = sizeof(si); - TCHAR *pszReplace = _tcsstr(dbv.ptszVal, L"%f"); - TCHAR szCmdLine[768]; + 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'; *pszReplace = 0; mir_sntprintf(szCmdLine, L"%s\"%s\"%s", dbv.ptszVal, info->szFile, pszReplace + 2); } else - _tcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); + wcsncpy_s(szCmdLine, dbv.ptszVal, _TRUNCATE); PROCESS_INFORMATION pi; if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { @@ -125,13 +125,13 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFERSTATUS *fts) { - TCHAR msg[MAX_PATH]; - TCHAR *fnbuf = NULL, *fn = NULL; + wchar_t msg[MAX_PATH]; + wchar_t *fnbuf = NULL, *fn = NULL; SHFILEINFO shfi = { 0 }; if (fts->tszCurrentFile) { fnbuf = mir_tstrdup(fts->tszCurrentFile); - if ((fn = _tcsrchr(fnbuf, '\\')) == NULL) + if ((fn = wcsrchr(fnbuf, '\\')) == NULL) fn = fnbuf; else fn++; } @@ -166,7 +166,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE } enum { FTS_TEXT, FTS_PROGRESS, FTS_OPEN }; -static void SetFtStatus(HWND hwndDlg, TCHAR *text, int mode) +static void SetFtStatus(HWND hwndDlg, wchar_t *text, int mode) { SetDlgItemText(hwndDlg, IDC_STATUS, TranslateTS(text)); SetDlgItemText(hwndDlg, IDC_TRANSFERCOMPLETED, TranslateTS(text)); @@ -237,7 +237,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (db_mc_isMeta(dat->hContact)) dat->hContact = db_mc_getMostOnline(dat->hContact); dat->fs = (HANDLE)ProtoChainSend(dat->hContact, PSS_FILE, (WPARAM)dat->szMsg, (LPARAM)dat->files); - SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Request sent, waiting for acceptance..."), FTS_TEXT); SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); dat->waitingForAcceptance = 1; // hide "open" button since it may cause potential access violations... @@ -250,12 +250,12 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->transferStatus.tszWorkingDir = mir_tstrdup(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, LPGENT("Waiting for connection..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); } /* check we actually got an fs handle back from the protocol */ if (!dat->fs) { - SetFtStatus(hwndDlg, LPGENT("Unable to initiate transfer."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Unable to initiate transfer."), FTS_TEXT); dat->waitingForAcceptance = 0; } { @@ -301,7 +301,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->bytesRecvedHistorySize++; { - TCHAR szSpeed[32], szTime[32], szDisplay[96]; + wchar_t szSpeed[32], szTime[32], szDisplay[96]; SYSTEMTIME st; ULARGE_INTEGER li; FILETIME ft; @@ -372,10 +372,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_OPENFOLDER: { - TCHAR *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.tszWorkingDir; if (!path || !path[0]) { - path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile); - TCHAR *p = _tcsrchr(path, '\\'); if (p) *p = 0; + path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; } if (path) ShellExecute(NULL, L"open", path, NULL, NULL, SW_SHOW); @@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR break; case IDC_OPENFILE: - TCHAR **files; + wchar_t **files; if (dat->send) { if (dat->files == NULL) files = dat->transferStatus.ptszFiles; @@ -398,7 +398,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (files && *files) { int limit; - TCHAR *pszFilename, *pszNewFileName; + wchar_t *pszFilename, *pszNewFileName; if (dat->send) limit = dat->transferStatus.totalFiles; @@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // Loop over all transfered files and add them to the menu for (int i = 0; i < limit; i++) { - pszFilename = _tcsrchr(files[i], '\\'); + pszFilename = wcsrchr(files[i], '\\'); if (pszFilename == NULL) pszFilename = files[i]; else @@ -416,8 +416,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (pszFilename) { size_t cbFileNameLen = mir_tstrlen(pszFilename); - pszNewFileName = (TCHAR*)mir_alloc(cbFileNameLen * 2 * sizeof(TCHAR)); - TCHAR *p = pszNewFileName; + pszNewFileName = (wchar_t*)mir_alloc(cbFileNameLen * 2 * sizeof(wchar_t)); + wchar_t *p = pszNewFileName; for (size_t pszlen = 0; pszlen < cbFileNameLen; pszlen++) { *p++ = pszFilename[pszlen]; if (pszFilename[pszlen] == '&') @@ -438,10 +438,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DestroyMenu(hMenu); if (ret == 1) { - TCHAR *path = dat->transferStatus.tszWorkingDir; + wchar_t *path = dat->transferStatus.tszWorkingDir; if (!path || !path[0]) { - path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile); - TCHAR *p = _tcsrchr(path, '\\'); + path = NEWWSTR_ALLOCA(dat->transferStatus.tszCurrentFile); + wchar_t *p = wcsrchr(path, '\\'); if (p) *p = 0; } @@ -457,7 +457,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(hwndDlg, TRUE); { PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam; - TCHAR *szOriginalFilename = (TCHAR*)wParam; + wchar_t *szOriginalFilename = (wchar_t*)wParam; char *szProto = GetContactProto(dat->hContact); switch (pfr->action) { @@ -476,15 +476,15 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case FILERESUME_RENAMEALL: pfr->action = FILERESUME_RENAME; { - TCHAR *pszExtension, *pszFilename; - if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; - if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); - if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename); + wchar_t *pszExtension, *pszFilename; + if ((pszFilename = wcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; + if ((pszExtension = wcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); + if (pfr->szFilename) mir_free((wchar_t*)pfr->szFilename); size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension); - pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); + pfr->szFilename = (wchar_t*)mir_alloc(sizeof(wchar_t)*size); for (int i = 1;; i++) { - mir_sntprintf((TCHAR*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); - if (_taccess(pfr->szFilename, 0) != 0) + mir_sntprintf((wchar_t*)pfr->szFilename, size, L"%.*s (%u)%s", pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); + if (_waccess(pfr->szFilename, 0) != 0) break; } } @@ -510,14 +510,14 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } switch (ack->result) { - case ACKRESULT_SENTREQUEST: SetFtStatus(hwndDlg, LPGENT("Decision sent"), FTS_TEXT); break; - case ACKRESULT_CONNECTING: SetFtStatus(hwndDlg, LPGENT("Connecting..."), FTS_TEXT); break; - case ACKRESULT_CONNECTPROXY: SetFtStatus(hwndDlg, LPGENT("Connecting to proxy..."), FTS_TEXT); break; - case ACKRESULT_CONNECTED: SetFtStatus(hwndDlg, LPGENT("Connected"), FTS_TEXT); break; - case ACKRESULT_LISTENING: SetFtStatus(hwndDlg, LPGENT("Waiting for connection..."), FTS_TEXT); break; - case ACKRESULT_INITIALISING: SetFtStatus(hwndDlg, LPGENT("Initializing..."), FTS_TEXT); break; + case ACKRESULT_SENTREQUEST: SetFtStatus(hwndDlg, LPGENW("Decision sent"), FTS_TEXT); break; + case ACKRESULT_CONNECTING: SetFtStatus(hwndDlg, LPGENW("Connecting..."), FTS_TEXT); break; + case ACKRESULT_CONNECTPROXY: SetFtStatus(hwndDlg, LPGENW("Connecting to proxy..."), FTS_TEXT); break; + case ACKRESULT_CONNECTED: SetFtStatus(hwndDlg, LPGENW("Connected"), FTS_TEXT); break; + case ACKRESULT_LISTENING: SetFtStatus(hwndDlg, LPGENW("Waiting for connection..."), FTS_TEXT); break; + case ACKRESULT_INITIALISING: SetFtStatus(hwndDlg, LPGENW("Initializing..."), FTS_TEXT); break; case ACKRESULT_NEXTFILE: - SetFtStatus(hwndDlg, LPGENT("Moving to next file..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Moving to next file..."), FTS_TEXT); SetDlgItemTextA(hwndDlg, IDC_FILENAME, ""); if (dat->transferStatus.currentFileNumber == 1 && dat->transferStatus.totalFiles > 1 && !dat->send) SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1); @@ -540,10 +540,10 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { PROTOFILETRANSFERSTATUS *fts = &dat->transferStatus; SetFilenameControls(hwndDlg, dat, fts); - if (_taccess(fts->tszCurrentFile, 0)) + if (_waccess(fts->tszCurrentFile, 0)) break; - SetFtStatus(hwndDlg, LPGENT("File already exists"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File already exists"), FTS_TEXT); if (dat->resumeBehaviour == FILERESUME_ASK) { TDlgProcFileExistsParam param = { hwndDlg, fts }; ShowWindow(hwndDlg, SW_SHOWNORMAL); @@ -563,7 +563,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case ACKRESULT_DATA: { PROTOFILETRANSFERSTATUS *fts = (PROTOFILETRANSFERSTATUS*)ack->lParam; - TCHAR str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; + wchar_t str[64], str2[64], szSizeDone[32], szSizeTotal[32];//, *contactName; if (dat->fileVirusScanned == NULL) dat->fileVirusScanned = (int*)mir_calloc(sizeof(int) * fts->totalFiles); @@ -571,7 +571,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // This needs to be here - otherwise we get holes in the files array if (!dat->send) { if (dat->files == NULL) - dat->files = (TCHAR**)mir_calloc((fts->totalFiles + 1) * sizeof(TCHAR*)); + dat->files = (wchar_t**)mir_calloc((fts->totalFiles + 1) * sizeof(wchar_t*)); if (fts->currentFileNumber < fts->totalFiles && dat->files[fts->currentFileNumber] == NULL) dat->files[fts->currentFileNumber] = PFTS_StringToTchar(fts->flags, fts->tszCurrentFile); } @@ -587,7 +587,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool firstTime = false; if ((GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_ALLFILESPROGRESS), GWL_STYLE) & WS_VISIBLE) == 0) { - SetFtStatus(hwndDlg, (fts->flags & PFTS_SENDING) ? LPGENT("Sending...") : LPGENT("Receiving..."), FTS_PROGRESS); + SetFtStatus(hwndDlg, (fts->flags & PFTS_SENDING) ? LPGENW("Sending...") : LPGENW("Receiving..."), FTS_PROGRESS); SetFilenameControls(hwndDlg, dat, fts); firstTime = true; } @@ -626,18 +626,18 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (ack->result == ACKRESULT_DENIED) { dat->fs = NULL; /* protocol will free structure */ SkinPlaySound("FileDenied"); - SetFtStatus(hwndDlg, LPGENT("File transfer denied"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File transfer denied"), FTS_TEXT); } else if (ack->result == ACKRESULT_FAILED) { dat->fs = NULL; /* protocol will free structure */ SkinPlaySound("FileFailed"); - SetFtStatus(hwndDlg, LPGENT("File transfer failed"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("File transfer failed"), FTS_TEXT); } else { SkinPlaySound("FileDone"); if (dat->send) { dat->fs = NULL; /* protocol will free structure */ - SetFtStatus(hwndDlg, LPGENT("Transfer completed."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Transfer completed."), FTS_TEXT); DBEVENTINFO dbei = { 0 }; FillSendData(dat, dbei); @@ -649,8 +649,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else { SetFtStatus(hwndDlg, (dat->transferStatus.totalFiles == 1) ? - LPGENT("Transfer completed, open file.") : - LPGENT("Transfer completed, open folder."), + LPGENW("Transfer completed, open file.") : + LPGENW("Transfer completed, open folder."), FTS_OPEN); int useScanner = db_get_b(NULL, "SRFile", "UseScanner", VIRUSSCAN_DISABLE); @@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR vstsi->szFile = mir_tstrdup(dat->transferStatus.tszWorkingDir); vstsi->returnCode = -1; } - SetFtStatus(hwndDlg, LPGENT("Scanning for viruses..."), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Scanning for viruses..."), FTS_TEXT); if (vstsi) mir_forkthread((void(*)(void*))RunVirusScannerThread, vstsi); } @@ -705,7 +705,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } if (done) { dat->fs = NULL; /* protocol will free structure */ - SetFtStatus(hwndDlg, LPGENT("Transfer and virus scan complete"), FTS_TEXT); + SetFtStatus(hwndDlg, LPGENW("Transfer and virus scan complete"), FTS_TEXT); } } break; diff --git a/src/core/stdfile/src/stdafx.h b/src/core/stdfile/src/stdafx.h index 4be0919b51..0bb8cc54f6 100644 --- a/src/core/stdfile/src/stdafx.h +++ b/src/core/stdfile/src/stdafx.h @@ -22,7 +22,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <tchar.h>
#include <winsock2.h>
#include <shlobj.h>
#include <commctrl.h>
|