summaryrefslogtreecommitdiff
path: root/src/modules/srfile
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 14:13:45 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 14:13:45 +0000
commit4aa6229698b946e52ce19018aaf13f8b92fb168e (patch)
tree29334e8c5ee492a80f11a97fedab2373b8fbb392 /src/modules/srfile
parent5e8e561a80d1ac9ca1c2f1c3d388105733ed4e4e (diff)
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/srfile')
-rw-r--r--src/modules/srfile/file.cpp10
-rw-r--r--src/modules/srfile/fileexistsdlg.cpp8
-rw-r--r--src/modules/srfile/filerecvdlg.cpp12
-rw-r--r--src/modules/srfile/filesenddlg.cpp13
-rw-r--r--src/modules/srfile/filexferdlg.cpp31
5 files changed, 17 insertions, 57 deletions
diff --git a/src/modules/srfile/file.cpp b/src/modules/srfile/file.cpp
index 3a39014162..6570bc296a 100644
--- a/src/modules/srfile/file.cpp
+++ b/src/modules/srfile/file.cpp
@@ -41,7 +41,7 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam)
{
FileSendData fsd;
fsd.hContact=(HANDLE)wParam;
- #if defined( _UNICODE )
+
char** ppFiles = ( char** )lParam;
int count = 0;
while ( ppFiles[count] != NULL )
@@ -51,14 +51,10 @@ static INT_PTR SendSpecificFiles(WPARAM wParam, LPARAM lParam)
for ( int i=0; i < count; i++ )
fsd.ppFiles[i] = ( const TCHAR* )mir_a2t( ppFiles[i] );
fsd.ppFiles[ count ] = NULL;
- #else
- fsd.ppFiles=(const char**)lParam;
- #endif
+
CreateDialogParam(hMirandaInst, MAKEINTRESOURCE(IDD_FILESEND), NULL, DlgProcSendFile, (LPARAM)&fsd);
- #if defined( _UNICODE )
- for ( int j=0; j < count; j++ )
+ for ( int j=0; j < count; j++ )
mir_free(( void* )fsd.ppFiles[j] );
- #endif
return 0;
}
diff --git a/src/modules/srfile/fileexistsdlg.cpp b/src/modules/srfile/fileexistsdlg.cpp
index 5fd82cb76b..4414e69c2a 100644
--- a/src/modules/srfile/fileexistsdlg.cpp
+++ b/src/modules/srfile/fileexistsdlg.cpp
@@ -54,12 +54,8 @@ static void DoAnnoyingShellCommand(HWND hwnd, const TCHAR *szFilename, int cmd,
IShellFolder *pDesktopFolder;
if (SHGetDesktopFolder(&pDesktopFolder) == NOERROR) {
ITEMIDLIST *pCurrentIdl;
- #if defined( _UNICODE )
- WCHAR* wszFilename = ( LPWSTR )szFilename;
- #else
- WCHAR wszFilename[MAX_PATH];
- MultiByteToWideChar(CP_ACP, 0, szFilename, -1, wszFilename, SIZEOF(wszFilename));
- #endif
+ WCHAR* wszFilename = ( LPWSTR )szFilename;
+
if (pDesktopFolder->ParseDisplayName(NULL, NULL, wszFilename, NULL, &pCurrentIdl, NULL) == NOERROR) {
if (pCurrentIdl->mkid.cb) {
ITEMIDLIST *pidl, *pidlNext, *pidlFilename;
diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp
index 35ed892544..5b10dfbf16 100644
--- a/src/modules/srfile/filerecvdlg.cpp
+++ b/src/modules/srfile/filerecvdlg.cpp
@@ -142,11 +142,9 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL
}
if ( !szTemp[0] )
-#ifdef _UNICODE
+
mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My Received Files"));
-#else
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), "My Received Files");
-#endif
+
if ( hContact ) {
REPLACEVARSDATA dat = { 0 };
@@ -193,11 +191,9 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
}
if ( !szTemp[0] )
-#ifdef _UNICODE
+
mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s"), TranslateT("My Received Files"));
-#else
- mir_sntprintf( szTemp, SIZEOF(szTemp), _T("%%mydocuments%%\\%s"), "My Received Files");
-#endif
+
patchDir( szTemp, SIZEOF(szTemp));
RemoveInvalidPathChars(szTemp);
diff --git a/src/modules/srfile/filesenddlg.cpp b/src/modules/srfile/filesenddlg.cpp
index 228fc18059..7d35eec275 100644
--- a/src/modules/srfile/filesenddlg.cpp
+++ b/src/modules/srfile/filesenddlg.cpp
@@ -109,15 +109,10 @@ static void FilenameToFileList(HWND hwndDlg, struct FileDlgData* dat, const TCHA
dat->files[nTemp] = ( TCHAR* )mir_alloc( sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
- #if defined( _UNICODE )
- CopyMemory(dat->files[nTemp], buf, (fileOffset-1)*sizeof( TCHAR ));
- dat->files[nTemp][fileOffset-1] = '\\';
- _tcscpy(dat->files[nTemp] + fileOffset - (buf[fileOffset-2] == '\\'?1:0), pBuf);
- #else
- CopyMemory(dat->files[nTemp], buf, fileOffset-1 );
- dat->files[nTemp][fileOffset-1] = '\\';
- strcpy(dat->files[nTemp] + fileOffset - (buf[fileOffset-2] == '\\'?1:0), pBuf);
- #endif
+ CopyMemory(dat->files[nTemp], buf, (fileOffset-1)*sizeof( TCHAR ));
+ dat->files[nTemp][fileOffset-1] = '\\';
+ _tcscpy(dat->files[nTemp] + fileOffset - (buf[fileOffset-2] == '\\'?1:0), pBuf);
+
// Move pointers to next file...
pBuf += cbFileNameLen + 1;
nTemp++;
diff --git a/src/modules/srfile/filexferdlg.cpp b/src/modules/srfile/filexferdlg.cpp
index ab7090166b..5775f29265 100644
--- a/src/modules/srfile/filexferdlg.cpp
+++ b/src/modules/srfile/filexferdlg.cpp
@@ -44,26 +44,16 @@ struct virusscanthreadstartinfo {
TCHAR* PFTS_StringToTchar( int flags, const PROTOCHAR* s )
{
-#ifdef _UNICODE
if ( flags & PFTS_UTF )
return Utf8DecodeUcs2(( char* )s );
else if ( flags & PFTS_UNICODE )
return mir_tstrdup( s );
else
return mir_a2t(( char* )s );
-#else
- if ( flags & PFTS_UTF ) {
- char *szAnsi = mir_strdup(( char* )s );
- return Utf8Decode(szAnsi, NULL);
- }
- else
- return mir_strdup( s );
-#endif
}
int PFTS_CompareWithTchar( PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHAR* r )
{
-#ifdef _UNICODE
if ( ft->flags & PFTS_UTF ) {
TCHAR* ts = Utf8DecodeUcs2(( char* )s );
int res = _tcscmp( ts, r );
@@ -78,14 +68,6 @@ int PFTS_CompareWithTchar( PROTOFILETRANSFERSTATUS* ft, const PROTOCHAR* s, TCHA
mir_free( ts );
return res;
}
-#else
- if ( ft->flags & PFTS_UTF ) {
- char *ts = NEWSTR_ALLOCA(( char* )s );
- return _tcscmp( Utf8Decode(( char* )ts, NULL), r );
- }
- else
- return _tcscmp( s, r );
-#endif
}
static void SetOpenFileButtonStyle(HWND hwndButton, int enabled)
@@ -100,12 +82,8 @@ void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei )
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_SENT;
dbei.timestamp = time(NULL);
- #if defined( _UNICODE )
- char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg);
- dbei.flags |= DBEF_UTF;
- #else
- char *szFileNames = dat->szFilenames, *szMsg = dat->szMsg;
- #endif
+ char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg);
+ dbei.flags |= DBEF_UTF;
dbei.cbBlob = sizeof(DWORD) + lstrlenA(szFileNames)+lstrlenA(szMsg)+2;
dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob);
@@ -113,9 +91,8 @@ void FillSendData( FileDlgData* dat, DBEVENTINFO& dbei )
lstrcpyA((char*)dbei.pBlob+sizeof(DWORD), szFileNames);
lstrcpyA((char*)dbei.pBlob+sizeof(DWORD)+lstrlenA(szFileNames)+1, szMsg);
- #if defined( _UNICODE )
- mir_free( szFileNames ), mir_free( szMsg );
- #endif
+ mir_free( szFileNames ), mir_free( szMsg );
+
}
static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info)