summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/clist/clcmsgs.cpp16
-rw-r--r--src/modules/clist/clistevents.cpp12
-rw-r--r--src/modules/clist/clistmenus.cpp26
-rw-r--r--src/modules/clist/clistmod.cpp19
-rw-r--r--src/modules/clist/clistsettings.cpp45
-rw-r--r--src/modules/clist/clisttray.cpp9
-rw-r--r--src/modules/clist/genmenu.cpp15
-rw-r--r--src/modules/clist/groups.cpp12
-rw-r--r--src/modules/database/dbutils.cpp49
-rw-r--r--src/modules/database/profilemanager.cpp14
-rw-r--r--src/modules/findadd/searchresults.cpp13
-rw-r--r--src/modules/fonts/FontOptions.cpp24
-rw-r--r--src/modules/fonts/FontService.cpp2
-rw-r--r--src/modules/fonts/services.cpp57
-rw-r--r--src/modules/help/about.cpp6
-rw-r--r--src/modules/history/history.cpp12
-rw-r--r--src/modules/icolib/skin2icons.cpp37
-rw-r--r--src/modules/idle/idle.cpp8
-rw-r--r--src/modules/langpack/langpack.cpp4
-rw-r--r--src/modules/langpack/lpservices.cpp10
-rw-r--r--src/modules/netlib/netlib.h2
-rw-r--r--src/modules/netlib/netlibsecurity.cpp46
-rw-r--r--src/modules/options/options.cpp82
-rw-r--r--src/modules/plugins/newplugins.cpp4
-rw-r--r--src/modules/protocols/protoaccs.cpp6
-rw-r--r--src/modules/protocols/protocols.cpp38
-rw-r--r--src/modules/protocols/protoint.cpp31
-rw-r--r--src/modules/skin/hotkeys.cpp24
-rw-r--r--src/modules/skin/sounds.cpp13
-rw-r--r--src/modules/srawaymsg/awaymsg.cpp4
-rw-r--r--src/modules/srawaymsg/sendmsg.cpp10
-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
-rw-r--r--src/modules/updatenotify/updatenotify.cpp17
-rw-r--r--src/modules/userinfo/stdinfo.cpp7
-rw-r--r--src/modules/userinfo/userinfo.cpp4
-rw-r--r--src/modules/utils/bmpfilter.cpp10
-rw-r--r--src/modules/utils/path.cpp14
-rw-r--r--src/modules/utils/timeutils.cpp162
-rw-r--r--src/modules/utils/timezones.cpp22
-rw-r--r--src/modules/utils/utils.cpp2
-rw-r--r--src/modules/xml/xmlParser.h2
45 files changed, 215 insertions, 749 deletions
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index 116beb3486..6757f7ae41 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -61,16 +61,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return (LRESULT) (HANDLE) NULL;
group = groupContact->group;
}
- #if defined( _UNICODE )
- if ( msg == CLM_ADDINFOITEMA )
- { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
- i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
- mir_free( wszText );
- }
- else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- #else
- i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- #endif
+ if ( msg == CLM_ADDINFOITEMA )
+ { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
+ i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
+ mir_free( wszText );
+ }
+ else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
return (LRESULT) group->cl.items[i]->hContact | HCONTACT_ISINFO;
}
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index 9ccaa40c09..4a82c21ea8 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -171,14 +171,10 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle )
p->imlIconIndex = fnGetImlIconIndex(cli.events.items[i]->cle.hIcon);
p->flashesDone = 12;
p->cle.pszService = mir_strdup(cli.events.items[i]->cle.pszService);
- #if defined( _UNICODE )
- if (p->cle.flags & CLEF_UNICODE)
- p->cle.ptszTooltip = mir_tstrdup((TCHAR*)p->cle.ptszTooltip);
- else
- p->cle.ptszTooltip = mir_a2u((char*)p->cle.pszTooltip); //if no flag defined it handled as unicode
- #else
- p->cle.ptszTooltip = mir_tstrdup(p->cle.ptszTooltip);
- #endif
+ if (p->cle.flags & CLEF_UNICODE)
+ p->cle.ptszTooltip = mir_tstrdup((TCHAR*)p->cle.ptszTooltip);
+ else
+ p->cle.ptszTooltip = mir_a2u((char*)p->cle.pszTooltip); //if no flag defined it handled as unicode
if (cli.events.count == 1) {
char *szProto;
if (cle->hContact == NULL)
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index 12b8d75761..e26ca5f13f 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -524,13 +524,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
prot = smep->proto;
else
{
- #ifdef UNICODE
- char *prn=mir_u2a(timi->mi.ptszName);
- prot = NEWSTR_ALLOCA( prn );
- if (prn) mir_free(prn);
- #else
- prot = timi->mi.ptszName;
- #endif
+ char *prn=mir_u2a(timi->mi.ptszName);
+ prot = NEWSTR_ALLOCA( prn );
+ if (prn) mir_free(prn);
}
if ( Proto_GetAccount( prot ) == NULL )
return TRUE;
@@ -1192,13 +1188,9 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
MenuProto* mp = FindProtocolMenu( mi->pszContactOwner );
if ( mp && mi->pszPopupName ) {
if ( mp->pMenu ) {
- #if defined _UNICODE
- TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
- mir_free( ptszName );
- #else
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, mi->pszPopupName );
- #endif
+ TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
+ pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
+ mir_free( ptszName );
}
if ( pRoot == NULL ) {
TMO_MenuItem tmi = { 0 };
@@ -1241,15 +1233,13 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
smep->hMenuItem = menuHandle;
char buf[MAX_PATH+64];
- #if defined( _UNICODE )
+
{
char* p = ( pRoot ) ? mir_t2a( pRoot->mi.ptszName ) : NULL;
mir_snprintf( buf, SIZEOF(buf), "%s/%s", ( p ) ? p : "", mi->pszService ? mi->pszService : "" );
mir_free( p );
}
- #else
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", pRoot ? pRoot->mi.ptszName : _T(""), mi->pszService ? mi->pszService : "" );
- #endif
+
MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
return ( INT_PTR )menuHandle;
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index ff667bcb38..4c8df451d0 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -123,16 +123,15 @@ static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam)
{
TCHAR* buf1 = cli.pfnGetStatusModeDescription( wParam, lParam );
- #ifdef UNICODE
- if ( !( lParam & GSMDF_TCHAR ))
- {
- static char szMode[64];
- char *buf2 = mir_u2a(buf1);
- mir_snprintf(szMode, SIZEOF(szMode), "%s", buf2);
- mir_free(buf2);
- return (INT_PTR)szMode;
- }
- #endif
+ if ( !( lParam & GSMDF_TCHAR ))
+ {
+ static char szMode[64];
+ char *buf2 = mir_u2a(buf1);
+ mir_snprintf(szMode, SIZEOF(szMode), "%s", buf2);
+ mir_free(buf2);
+ return (INT_PTR)szMode;
+ }
+
return (INT_PTR)buf1;
}
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp
index f8a0501358..07684d5c0a 100644
--- a/src/modules/clist/clistsettings.cpp
+++ b/src/modules/clist/clistsettings.cpp
@@ -80,9 +80,7 @@ void fnCheckCacheItem( ClcCacheEntryBase* p )
void fnFreeCacheItem( ClcCacheEntryBase* p )
{
if ( p->name ) { mir_free( p->name ); p->name = NULL; }
- #if defined( _UNICODE )
- if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
- #endif
+ if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
if ( p->group ) { mir_free( p->group ); p->group = NULL; }
p->isHidden = -1;
}
@@ -141,9 +139,7 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
return ci.pszVal;
cacheEntry->name = ci.pszVal;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( ci.pszVal );
- #endif
+ cacheEntry->szName = mir_u2a( ci.pszVal );
return ci.pszVal;
}
@@ -157,9 +153,7 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
_ltot(ci.dVal, buffer, 10 );
cacheEntry->name = buffer;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( buffer );
- #endif
+ cacheEntry->szName = mir_u2a( buffer );
return buffer;
} } }
@@ -180,13 +174,8 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
if ((int) lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- #if defined( _UNICODE )
- if ( cacheEntry->szName )
- return (INT_PTR)cacheEntry->szName;
- #else
- if ( cacheEntry->name )
- return (INT_PTR)cacheEntry->name;
- #endif
+ if ( cacheEntry->szName )
+ return (INT_PTR)cacheEntry->szName;
}
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -197,22 +186,14 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL) {
- #if defined( _UNICODE )
- buffer = mir_u2a( ci.pszVal );
- mir_free(ci.pszVal);
- #else
- buffer = ci.pszVal;
- #endif
+ buffer = mir_u2a( ci.pszVal );
+ mir_free(ci.pszVal);
return (INT_PTR) buffer;
}
else {
cacheEntry->name = ci.pszVal;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( ci.pszVal );
- return (INT_PTR)cacheEntry->szName;
- #else
- return (INT_PTR)cacheEntry->name;
- #endif
+ cacheEntry->szName = mir_u2a( ci.pszVal );
+ return (INT_PTR)cacheEntry->szName;
}
}
if (ci.type == CNFT_DWORD) {
@@ -224,12 +205,8 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
else {
buffer = ( char* )mir_alloc(15);
_ltoa(ci.dVal, buffer, 10 );
- #if defined( _UNICODE )
- cacheEntry->szName = buffer;
- cacheEntry->name = mir_a2u( buffer );
- #else
- cacheEntry->name = buffer;
- #endif
+ cacheEntry->szName = buffer;
+ cacheEntry->name = mir_a2u( buffer );
return (INT_PTR) buffer;
} } }
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp
index 519cf0f875..50707c5de7 100644
--- a/src/modules/clist/clisttray.cpp
+++ b/src/modules/clist/clisttray.cpp
@@ -692,16 +692,12 @@ static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
ti.rcItem.bottom = pt.y + 10;
ti.cbSize = sizeof( ti );
ti.isTreeFocused = GetFocus() == cli.hwndContactList ? 1 : 0;
- #if defined( _UNICODE )
- if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
+ if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
{
char* p = mir_u2a( szTipCur );
CallService( "mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti );
mir_free( p );
}
- #else
- CallService( "mToolTip/ShowTip", (WPARAM)szTipCur, (LPARAM)&ti );
- #endif
GetCursorPos( &tray_hover_pos );
SetTimer( cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc );
g_trayTooltipActive = TRUE;
@@ -884,7 +880,6 @@ int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
}
else iconId = cli.trayIcon[0].id;
-#if defined(_UNICODE)
if ( msn->dwInfoFlags & NIIF_INTERN_UNICODE ) {
NOTIFYICONDATAW nid = {0};
nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
@@ -900,7 +895,7 @@ int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
return Shell_NotifyIconW( NIM_MODIFY, &nid ) == 0;
}
else
-#endif
+
{
NOTIFYICONDATAA nid = { 0 };
nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 9395bb1588..c6413ee556 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -1062,14 +1062,9 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
char *uname, *descr;
uname = pmi->UniqName;
if ( uname == NULL )
- #ifdef UNICODE
- uname = mir_u2a(pmi->CustomName);
- descr = mir_u2a(pmi->mi.ptszName);
- #else
- uname = pmi->CustomName;
- descr = pmi->mi.pszName;
- #endif
-
+ uname = mir_u2a(pmi->CustomName);
+ descr = mir_u2a(pmi->mi.ptszName);
+
if ( !uname && !descr )
return FALSE;
@@ -1110,11 +1105,11 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
IconLib_ReleaseIcon( hIcon, 0 );
} }
- #ifdef UNICODE
+
if ( !pmi->UniqName )
mir_free( uname );
mir_free( descr );
- #endif
+
return FALSE;
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp
index c958823ebb..75e18e0a4e 100644
--- a/src/modules/clist/groups.cpp
+++ b/src/modules/clist/groups.cpp
@@ -342,14 +342,10 @@ int fnRenameGroup( int groupID, TCHAR* newName )
static INT_PTR RenameGroup(WPARAM wParam, LPARAM lParam)
{
- #if defined( _UNICODE )
- WCHAR* temp = mir_a2u(( char* )lParam );
- int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
- mir_free( temp );
- return result;
- #else
- return -1 != RenameGroupWithMove(wParam - 1, (TCHAR*) lParam, 1);
- #endif
+ WCHAR* temp = mir_a2u(( char* )lParam );
+ int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
+ mir_free( temp );
+ return result;
}
static INT_PTR SetGroupExpandedState(WPARAM wParam, LPARAM lParam)
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp
index cd4168884d..6cad16035b 100644
--- a/src/modules/database/dbutils.cpp
+++ b/src/modules/database/dbutils.cpp
@@ -206,17 +206,10 @@ static INT_PTR DbEventGetStringT( WPARAM wParam, LPARAM lParam )
DBEVENTINFO* dbei = ( DBEVENTINFO* )wParam;
char* string = ( char* )lParam;
- #if defined( _UNICODE )
- if ( dbei->flags & DBEF_UTF )
- return ( INT_PTR )Utf8DecodeUcs2( string );
-
- return ( INT_PTR )mir_a2t( string );
- #else
- char* res = mir_strdup( string );
- if ( dbei->flags & DBEF_UTF )
- Utf8Decode( res, NULL );
- return ( INT_PTR )res;
- #endif
+ if ( dbei->flags & DBEF_UTF )
+ return ( INT_PTR )Utf8DecodeUcs2( string );
+
+ return ( INT_PTR )mir_a2t( string );
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -253,14 +246,10 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam)
char* dst = (char*)lParam;
- #if defined( _UNICODE )
- char* tmp = mir_t2a( g_profileDir );
- strncpy( dst, tmp, wParam );
- mir_free( tmp );
- #else
- strncpy( dst, g_profileDir, wParam );
- #endif
-
+ char* tmp = mir_t2a( g_profileDir );
+ strncpy( dst, tmp, wParam );
+ mir_free( tmp );
+
if (wParam <= _tcslen(g_profileName))
{
dst[wParam - 1] = 0;
@@ -276,14 +265,10 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
char* dst = (char*)lParam;
- #if defined( _UNICODE )
- char* tmp = makeFileName( g_profileName );
- strncpy( dst, tmp, wParam );
- mir_free( tmp );
- #else
- strncpy( dst, g_profileName, wParam );
- #endif
-
+ char* tmp = makeFileName( g_profileName );
+ strncpy( dst, tmp, wParam );
+ mir_free( tmp );
+
if (wParam <= _tcslen(g_profileName))
{
dst[wParam - 1] = 0;
@@ -292,8 +277,6 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
return 0;
}
-#if defined( _UNICODE )
-
static INT_PTR GetProfilePathW(WPARAM wParam, LPARAM lParam)
{
if (!wParam || !lParam)
@@ -321,8 +304,6 @@ static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam)
return 0;
}
-#endif
-
/////////////////////////////////////////////////////////////////////////////////////////
int InitUtils()
@@ -339,10 +320,8 @@ int InitUtils()
CreateServiceFunction(MS_DB_GETPROFILEPATH, GetProfilePath);
CreateServiceFunction(MS_DB_GETPROFILENAME, GetProfileName);
- #if defined( _UNICODE )
- CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW);
- CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW);
- #endif
+ CreateServiceFunction(MS_DB_GETPROFILEPATHW, GetProfilePathW);
+ CreateServiceFunction(MS_DB_GETPROFILENAMEW, GetProfileNameW);
return 0;
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp
index 3ee38c754c..7d362fd554 100644
--- a/src/modules/database/profilemanager.cpp
+++ b/src/modules/database/profilemanager.cpp
@@ -226,24 +226,16 @@ static int DetectDbProvider(const char*, DATABASELINK * dblink, LPARAM lParam)
{
int error;
-#ifdef _UNICODE
- char* fullpath = makeFileName(( TCHAR* )lParam );
-#else
- char* fullpath = (char*)lParam;
-#endif
+char* fullpath = makeFileName(( TCHAR* )lParam );
int ret = dblink->grokHeader(fullpath, &error);
-#ifdef _UNICODE
mir_free( fullpath );
-#endif
if ( ret == 0) {
-#ifdef _UNICODE
+
char tmp[ MAX_PATH ];
dblink->getFriendlyName(tmp, SIZEOF(tmp), 1);
MultiByteToWideChar(CP_ACP, 0, tmp, -1, (TCHAR*)lParam, MAX_PATH);
-#else
- dblink->getFriendlyName((TCHAR*)lParam, MAX_PATH, 1);
-#endif
+
return DBPE_HALT;
}
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp
index 827fe920b0..ab5fd3fdf8 100644
--- a/src/modules/findadd/searchresults.cpp
+++ b/src/modules/findadd/searchresults.cpp
@@ -86,12 +86,8 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
if (szProto)
{
- #if defined( _UNICODE )
- bNeedsFree = TRUE;
- lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
- #else
- lvc.pszText = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0);
- #endif
+ bNeedsFree = TRUE;
+ lvc.pszText = mir_a2t((char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDTEXT, 0));
}
else
lvc.pszText = _T("ID");
@@ -100,10 +96,9 @@ void LoadColumnSizes(HWND hwndResults, const char *szProto)
mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i);
lvc.cx = DBGetContactSettingWord(NULL, "FindAdd", szSetting, defaultColumnSizes[i]);
ListView_InsertColumn(hwndResults, i, (LPARAM)&lvc);
- #if defined( _UNICODE )
- if (bNeedsFree)
+
+ if (bNeedsFree)
mir_free(lvc.pszText);
- #endif
}
mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i);
columnOrder[i] = DBGetContactSettingByte(NULL, "FindAdd", szSetting, -1);
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index 12291fb933..34267a1ca6 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -84,11 +84,7 @@ typedef struct DrawTextWithEffectParam_tag
#define MS_DRAW_TEXT_WITH_EFFECTA "Modern/SkinEngine/DrawTextWithEffectA"
#define MS_DRAW_TEXT_WITH_EFFECTW "Modern/SkinEngine/DrawTextWithEffectW"
-#ifdef _UNICODE
- #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW
-#else
- #define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTA
-#endif
+#define MS_DRAW_TEXT_WITH_EFFECT MS_DRAW_TEXT_WITH_EFFECTW
// Helper
int __inline DrawTextWithEffect( HDC hdc, LPCTSTR lpchText, int cchText, RECT * lprc, UINT dwDTFormat, FONTEFFECT * pEffect )
@@ -164,13 +160,9 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST<TFontID>& flist, OBJL
else
mir_snprintf( buff, SIZEOF(buff), "%s=s", F.prefix );
- #if defined( _UNICODE )
- WideCharToMultiByte(code_page, 0, F.value.szFace, -1, abuff, 1024, 0, 0);
- abuff[1023]=0;
- strcat( buff, abuff );
- #else
- strcat( buff, F.value.szFace );
- #endif
+ WideCharToMultiByte(code_page, 0, F.value.szFace, -1, abuff, 1024, 0, 0);
+ abuff[1023]=0;
+ strcat( buff, abuff );
WriteLine(fhand, buff);
mir_snprintf(buff, SIZEOF(buff), "%sSize=b", F.prefix);
@@ -559,11 +551,9 @@ static void sttSaveFontData(HWND hwndDlg, TFontID &F)
mir_snprintf(str, SIZEOF(str), "%s", F.prefix);
if ( DBWriteContactSettingTString( NULL, F.dbSettingsGroup, str, F.value.szFace )) {
- #if defined( _UNICODE )
- char buff[1024];
- WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
- DBWriteContactSettingString(NULL, F.dbSettingsGroup, str, buff);
- #endif
+ char buff[1024];
+ WideCharToMultiByte(code_page, 0, F.value.szFace, -1, buff, 1024, 0, 0);
+ DBWriteContactSettingString(NULL, F.dbSettingsGroup, str, buff);
}
mir_snprintf(str, SIZEOF(str), "%sSize", F.prefix);
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp
index 7b19e962f4..050661aefb 100644
--- a/src/modules/fonts/FontService.cpp
+++ b/src/modules/fonts/FontService.cpp
@@ -80,7 +80,6 @@ int LoadFontserviceModule( void )
CreateServiceFunction(MS_EFFECT_REGISTER, RegisterEffect);
CreateServiceFunction(MS_EFFECT_GET, GetEffect);
-#if defined( _UNICODE )
CreateServiceFunction(MS_FONT_REGISTERW, RegisterFontW);
CreateServiceFunction(MS_FONT_GETW, GetFontW);
@@ -89,7 +88,6 @@ int LoadFontserviceModule( void )
CreateServiceFunction(MS_EFFECT_REGISTERW, RegisterEffectW);
CreateServiceFunction(MS_EFFECT_GETW, GetEffectW);
-#endif
hFontReloadEvent = CreateHookableEvent(ME_FONT_RELOAD);
hColourReloadEvent = CreateHookableEvent(ME_COLOUR_RELOAD);
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp
index 1ffed036c2..e53c0f0b43 100644
--- a/src/modules/fonts/services.cpp
+++ b/src/modules/fonts/services.cpp
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
COLORREF GetColorFromDefault(COLORREF cl);
-#if defined( _UNICODE )
+
void ConvertFontSettings( FontSettings* fs, TFontSettings* fsw)
{
fsw->colour = fs->colour;
@@ -104,7 +104,6 @@ void ConvertLOGFONT(LOGFONTW *lfw, LOGFONTA *lfa)
WideCharToMultiByte( code_page, 0, lfw->lfFaceName, -1, lfa->lfFaceName, LF_FACESIZE, 0, 0);
}
-#endif
static void GetDefaultFontSetting(LOGFONT* lf, COLORREF* colour)
{
@@ -301,22 +300,16 @@ static int sttRegisterFontWorker( TFontID* font_id )
return 0;
}
-#if defined( _UNICODE )
INT_PTR RegisterFontW(WPARAM wParam, LPARAM )
{
return sttRegisterFontWorker(( TFontID* )wParam );
}
-#endif
INT_PTR RegisterFont(WPARAM wParam, LPARAM)
{
- #if defined( _UNICODE )
- TFontID temp;
- ConvertFontID(( FontID* )wParam, &temp );
- return sttRegisterFontWorker( &temp );
- #else
- return sttRegisterFontWorker(( TFontID* )wParam );
- #endif
+ TFontID temp;
+ ConvertFontID(( FontID* )wParam, &temp );
+ return sttRegisterFontWorker( &temp );
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -341,12 +334,10 @@ static int sttGetFontWorker( TFontID* font_id, LOGFONT* lf )
return (int)colour;
}
-#if defined( _UNICODE )
INT_PTR GetFontW(WPARAM wParam, LPARAM lParam)
{
return sttGetFontWorker(( TFontID* )wParam, ( LOGFONT* )lParam );
}
-#endif
INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
{
@@ -386,22 +377,16 @@ static int sttRegisterColourWorker( TColourID* colour_id )
return 0;
}
-#if defined( _UNICODE )
INT_PTR RegisterColourW(WPARAM wParam, LPARAM)
{
return sttRegisterColourWorker(( TColourID* )wParam );
}
-#endif
INT_PTR RegisterColour(WPARAM wParam, LPARAM)
{
- #if defined( _UNICODE )
- TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttRegisterColourWorker( &temp );
- #else
- return sttRegisterColourWorker(( TColourID* )wParam );
- #endif
+ TColourID temp;
+ ConvertColourID(( ColourID* )wParam, &temp );
+ return sttRegisterColourWorker( &temp );
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -420,22 +405,16 @@ static int sttGetColourWorker( TColourID* colour_id )
return -1;
}
-#if defined( _UNICODE )
INT_PTR GetColourW(WPARAM wParam, LPARAM)
{
return sttGetColourWorker(( TColourID* )wParam );
}
-#endif
INT_PTR GetColour(WPARAM wParam, LPARAM)
{
- #if defined( _UNICODE )
- TColourID temp;
- ConvertColourID(( ColourID* )wParam, &temp );
- return sttGetColourWorker( &temp );
- #else
- return sttGetColourWorker(( TColourID* )wParam );
- #endif
+ TColourID temp;
+ ConvertColourID(( ColourID* )wParam, &temp );
+ return sttGetColourWorker( &temp );
}
@@ -475,22 +454,16 @@ static int sttRegisterEffectWorker( TEffectID* effect_id )
return 0;
}
-#if defined( _UNICODE )
INT_PTR RegisterEffectW(WPARAM wParam, LPARAM lParam)
{
return sttRegisterEffectWorker(( TEffectID* )wParam );
}
-#endif
INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam)
{
-#if defined( _UNICODE )
- TEffectID temp;
+ TEffectID temp;
ConvertEffectID(( EffectID* )wParam, &temp );
return sttRegisterEffectWorker( &temp );
-#else
- return sttRegisterEffectWorker(( TEffectID* )wParam );
-#endif
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -515,20 +488,14 @@ static int sttGetEffectWorker( TEffectID* effect_id, FONTEFFECT* effect )
return (int)FALSE;
}
-#if defined( _UNICODE )
INT_PTR GetEffectW(WPARAM wParam, LPARAM lParam)
{
return sttGetEffectWorker(( TEffectID* )wParam, ( FONTEFFECT* )lParam );
}
-#endif
INT_PTR GetEffect(WPARAM wParam, LPARAM lParam)
{
-#if defined( _UNICODE )
- TEffectID temp;
+ TEffectID temp;
ConvertEffectID((EffectID *)wParam, &temp);
return sttGetEffectWorker( &temp, ( FONTEFFECT* )lParam );
-#else
- return sttGetEffectWorker(( TEffectID* )wParam, ( FONTEFFECT* )lParam );
-#endif
}
diff --git a/src/modules/help/about.cpp b/src/modules/help/about.cpp
index d1dc8bac5c..de962109fb 100644
--- a/src/modules/help/about.cpp
+++ b/src/modules/help/about.cpp
@@ -22,11 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "..\..\core\commonheaders.h"
-#if defined( _UNICODE )
- #define STR_VERSION_FORMAT "%s%S%S"
-#else
- #define STR_VERSION_FORMAT "%s%s%s"
-#endif
+#define STR_VERSION_FORMAT "%s%S%S"
INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
diff --git a/src/modules/history/history.cpp b/src/modules/history/history.cpp
index ee3f039624..ccaf14fab0 100644
--- a/src/modules/history/history.cpp
+++ b/src/modules/history/history.cpp
@@ -93,11 +93,7 @@ static void GetUrlDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
if ( len >= cbBuf )
len = cbBuf-1;
- #if !defined( _UNICODE )
- memcpy( buf, dbei->pBlob, len );
- #else
- MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob, len, buf, cbBuf );
- #endif
+ MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob, len, buf, cbBuf );
buf[ len ] = 0;
if ( len < cbBuf-3 )
@@ -110,11 +106,7 @@ static void GetFileDescription( DBEVENTINFO *dbei, TCHAR* buf, int cbBuf )
if ( len >= cbBuf )
len = cbBuf-1;
- #if !defined( _UNICODE )
- memcpy( buf, dbei->pBlob + sizeof( DWORD ), len );
- #else
- MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob + sizeof( DWORD ), len, buf, cbBuf );
- #endif
+ MultiByteToWideChar( CP_ACP, 0, ( LPCSTR )dbei->pBlob + sizeof( DWORD ), len, buf, cbBuf );
buf[ len ] = 0;
if ( len < cbBuf-3 )
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp
index 29d69ad8f4..89fec8abf0 100644
--- a/src/modules/icolib/skin2icons.cpp
+++ b/src/modules/icolib/skin2icons.cpp
@@ -564,24 +564,13 @@ HANDLE IcoLib_AddNewIcon( SKINICONDESC* sid )
item->name = mir_strdup( sid->pszName );
if ( utf ) {
item->description = mir_u2t( sid->pwszDescription );
- #ifdef _UNICODE
- item->section = IcoLib_AddSection( sid->pwszSection, TRUE );
- #else
- char* pszSection = sid->pwszSection ? mir_u2a( sid->pwszSection ) : NULL;
- item->section = IcoLib_AddSection( pszSection, TRUE );
- SAFE_FREE(( void** )&pszSection );
- #endif
+ item->section = IcoLib_AddSection( sid->pwszSection, TRUE );
}
else {
item->description = mir_a2t( sid->pszDescription );
- #ifdef _UNICODE
- WCHAR* pwszSection = sid->pszSection ? mir_a2u( sid->pszSection ) : NULL;
-
- item->section = IcoLib_AddSection( pwszSection, TRUE );
- SAFE_FREE(( void** )&pwszSection );
- #else
- item->section = IcoLib_AddSection( sid->pszSection, TRUE );
- #endif
+ WCHAR* pwszSection = sid->pszSection ? mir_a2u( sid->pszSection ) : NULL;
+ item->section = IcoLib_AddSection( pwszSection, TRUE );
+ SAFE_FREE(( void** )&pwszSection );
}
if ( item->section ) {
item->section->ref_count++;
@@ -607,19 +596,11 @@ HANDLE IcoLib_AddNewIcon( SKINICONDESC* sid )
#endif
}
else {
- #ifdef _UNICODE
- WCHAR *file = mir_a2u( sid->pszDefaultFile );
- WCHAR fileFull[ MAX_PATH ];
-
- pathToAbsoluteW( file, fileFull, NULL );
- SAFE_FREE(( void** )&file );
- item->default_file = mir_wstrdup( fileFull );
- #else
- char fileFull[ MAX_PATH ];
-
- pathToAbsolute( sid->pszDefaultFile, fileFull, NULL );
- item->default_file = mir_strdup( fileFull );
- #endif
+ WCHAR *file = mir_a2u( sid->pszDefaultFile );
+ WCHAR fileFull[ MAX_PATH ];
+ pathToAbsoluteW( file, fileFull, NULL );
+ SAFE_FREE(( void** )&file );
+ item->default_file = mir_wstrdup( fileFull );
} }
item->default_indx = sid->iDefaultIndex;
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp
index dbd684b675..2fd41083d1 100644
--- a/src/modules/idle/idle.cpp
+++ b/src/modules/idle/idle.cpp
@@ -117,12 +117,8 @@ BOOL InitWTSAPI()
HMODULE hDll = LoadLibraryA("wtsapi32.dll");
if (hDll) {
_WTSFreeMemory = (VOID (WINAPI *)(PVOID))GetProcAddress(hDll, "WTSFreeMemory");
- #ifdef UNICODE
- _WTSQuerySessionInformation = (BOOL (WINAPI *)(HANDLE, DWORD, WTS_INFO_CLASS, PVOID, DWORD*))GetProcAddress(hDll, "WTSQuerySessionInformationW");
- #else
- _WTSQuerySessionInformation = (BOOL (WINAPI *)(HANDLE, DWORD, WTS_INFO_CLASS, PVOID, DWORD*))GetProcAddress(hDll, "WTSQuerySessionInformationA");
- #endif
-
+ _WTSQuerySessionInformation = (BOOL (WINAPI *)(HANDLE, DWORD, WTS_INFO_CLASS, PVOID, DWORD*))GetProcAddress(hDll, "WTSQuerySessionInformationW");
+
if (_WTSFreeMemory && _WTSQuerySessionInformation) return 1;
}
return 0;
diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp
index 71b0dddaf9..aaa02ec52c 100644
--- a/src/modules/langpack/langpack.cpp
+++ b/src/modules/langpack/langpack.cpp
@@ -449,16 +449,12 @@ TCHAR* LangPackPcharToTchar( const char* pszStr )
if ( pszStr == NULL )
return NULL;
- #if defined( _UNICODE )
{ int len = (int)strlen( pszStr );
TCHAR* result = ( TCHAR* )alloca(( len+1 )*sizeof( TCHAR ));
MultiByteToWideChar( LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len );
result[len] = 0;
return mir_wstrdup( TranslateW( result ));
}
- #else
- return mir_strdup( Translate( pszStr ));
- #endif
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/langpack/lpservices.cpp b/src/modules/langpack/lpservices.cpp
index 4cb0c597bb..88e94b8cfc 100644
--- a/src/modules/langpack/lpservices.cpp
+++ b/src/modules/langpack/lpservices.cpp
@@ -22,11 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "..\..\core\commonheaders.h"
-#if defined( _UNICODE )
- #define FLAGS LANG_UNICODE
-#else
- #define FLAGS 0
-#endif
+#define FLAGS LANG_UNICODE
LangPackMuuid* __fastcall LangPackLookupUuid( WPARAM );
int LangPackMarkPluginLoaded( PLUGININFOEX* pInfo );
@@ -153,16 +149,12 @@ static INT_PTR PcharToTchar(WPARAM wParam, LPARAM lParam)
LangPackMuuid* uuid = LangPackLookupUuid( wParam );
- #if defined( _UNICODE )
{ int len = (int)strlen( pszStr );
TCHAR* result = ( TCHAR* )alloca(( len+1 )*sizeof( TCHAR ));
MultiByteToWideChar( LangPackGetDefaultCodePage(), 0, pszStr, -1, result, len );
result[len] = 0;
return ( INT_PTR )mir_wstrdup(( wchar_t* )LangPackTranslateString( uuid, ( char* )result, 1 ));
}
- #else
- return ( INT_PTR )mir_strdup( LangPackTranslateString( uuid, pszStr, 0 ));
- #endif
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/netlib/netlib.h b/src/modules/netlib/netlib.h
index 88a1db2284..f152eafe10 100644
--- a/src/modules/netlib/netlib.h
+++ b/src/modules/netlib/netlib.h
@@ -204,9 +204,7 @@ void NetlibSecurityInit(void);
void NetlibSecurityDestroy(void);
void NetlibDestroySecurityProvider(HANDLE hSecurity);
HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrincipal);
-#ifdef UNICODE
HANDLE NetlibInitSecurityProvider(const char* szProvider, const char* szPrincipal);
-#endif
char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw,
bool http, unsigned& complete);
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp
index c97ee97c30..46756ff3cc 100644
--- a/src/modules/netlib/netlibsecurity.cpp
+++ b/src/modules/netlib/netlibsecurity.cpp
@@ -156,12 +156,10 @@ HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrinci
return hSecurity;
}
-#ifdef UNICODE
HANDLE NetlibInitSecurityProvider(const char* szProvider, const char* szPrincipal)
{
return NetlibInitSecurityProvider(StrConvT(szProvider), StrConvT(szPrincipal));
}
-#endif
void NetlibDestroySecurityProvider(HANDLE hSecurity)
{
@@ -307,7 +305,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
NtlmType2packet* pkt = ( NtlmType2packet* )nlb64.pbDecoded;
if (!strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2)
{
-#ifdef UNICODE
+
wchar_t* domainName = (wchar_t*)&nlb64.pbDecoded[pkt->targetName.offset];
int domainLen = pkt->targetName.len;
@@ -321,19 +319,6 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
}
else
domainLen /= sizeof(wchar_t);
-#else
- char* domainName = (char*)&nlb64.pbDecoded[pkt->targetName.offset];
- int domainLen = pkt->targetName.len;
-
- // Negotiate Unicode? if yes, convert the unicode name to ANSI
- if (pkt->flags & 1)
- {
- int bufsz = WideCharToMultiByte(CP_ACP, 0, (WCHAR*)domainName, domainLen, NULL, 0, NULL, NULL);
- char* buf = (char*)alloca(bufsz);
- domainLen = WideCharToMultiByte(CP_ACP, 0, (WCHAR*)domainName, domainLen, buf, bufsz, NULL, NULL) - 1;
- domainName = buf;
- }
-#endif
if (domainLen)
{
@@ -360,11 +345,9 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
if (login != NULL && login[0] != '\0')
{
memset(&auth, 0, sizeof(auth));
-#ifdef _UNICODE
+
NetlibLogf(NULL, "Security login requested, user: %S pssw: %s", login, psw ? "(exist)" : "(no psw)");
-#else
- NetlibLogf(NULL, "Security login requested, user: %s pssw: %s", login, psw ? "(exist)" : "(no psw)");
-#endif
+
const TCHAR* loginName = login;
const TCHAR* domainName = _tcschr(login, '\\');
@@ -384,7 +367,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
domainLen = lstrlen(++domainName);
}
-#ifdef UNICODE
+
auth.User = (PWORD)loginName;
auth.UserLength = loginLen;
auth.Password = (PWORD)psw;
@@ -392,15 +375,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
auth.Domain = (PWORD)domainName;
auth.DomainLength = domainLen;
auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
-#else
- auth.User = (PBYTE)loginName;
- auth.UserLength = loginLen;
- auth.Password = (PBYTE)psw;
- auth.PasswordLength = lstrlen(psw);
- auth.Domain = (PBYTE)domainName;
- auth.DomainLength = domainLen;
- auth.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
-#endif
+
hNtlm->hasDomain = domainLen != 0;
}
@@ -496,11 +471,11 @@ static INT_PTR InitSecurityProviderService2(WPARAM, LPARAM lParam)
HANDLE hSecurity;
-#ifdef UNICODE
+
if (req->flags & NNR_UNICODE)
hSecurity = NetlibInitSecurityProvider(req->szProviderName, req->szPrincipal);
else
-#endif
+
hSecurity = NetlibInitSecurityProvider((char*)req->szProviderName, (char*)req->szPrincipal);
return (INT_PTR)hSecurity;
@@ -530,7 +505,7 @@ static INT_PTR NtlmCreateResponseService2( WPARAM wParam, LPARAM lParam )
char* response;
-#ifdef UNICODE
+
if (req->flags & NNR_UNICODE)
{
response = NtlmCreateResponseFromChallenge(( HANDLE )wParam, req->szChallenge,
@@ -545,10 +520,7 @@ static INT_PTR NtlmCreateResponseService2( WPARAM wParam, LPARAM lParam )
mir_free(szLogin);
mir_free(szPassw);
}
-#else
- response = NtlmCreateResponseFromChallenge(( HANDLE )wParam, req->szChallenge,
- req->szUserName, req->szPassword, false, req->complete );
-#endif
+
return (INT_PTR)response;
}
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp
index d168a6f2c7..9f0abd7837 100644
--- a/src/modules/options/options.cpp
+++ b/src/modules/options/options.cpp
@@ -641,33 +641,21 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
if ( odp->pszTitle == NULL )
opd->pszTitle = NULL;
else if ( odp->flags & ODPF_UNICODE ) {
- #if defined ( _UNICODE )
- opd->pszTitle = ( TCHAR* )mir_wstrdup( odp->ptszTitle );
- #else
- opd->pszTitle = mir_u2a(( WCHAR* )odp->ptszTitle );
- #endif
+ opd->pszTitle = ( TCHAR* )mir_wstrdup( odp->ptszTitle );
}
else opd->pszTitle = ( TCHAR* )mir_strdup( odp->pszTitle );
if ( odp->pszGroup == NULL )
opd->pszGroup = NULL;
else if ( odp->flags & ODPF_UNICODE ) {
- #if defined ( _UNICODE )
- opd->pszGroup = ( TCHAR* )mir_wstrdup( odp->ptszGroup );
- #else
- opd->pszGroup = mir_u2a(( WCHAR* )odp->ptszGroup );
- #endif
+ opd->pszGroup = ( TCHAR* )mir_wstrdup( odp->ptszGroup );
}
else opd->pszGroup = ( TCHAR* )mir_strdup( odp->pszGroup );
if ( odp->pszTab == NULL )
opd->pszTab = NULL;
else if ( odp->flags & ODPF_UNICODE ) {
- #if defined ( _UNICODE )
- opd->pszTab = ( TCHAR* )mir_wstrdup( odp->ptszTab );
- #else
- opd->pszTab = mir_u2a(( WCHAR* )odp->ptszTab );
- #endif
+ opd->pszTab = ( TCHAR* )mir_wstrdup( odp->ptszTab );
}
else opd->pszTab = ( TCHAR* )mir_strdup( odp->pszTab );
@@ -1416,55 +1404,39 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
if ( odp->ptszTitle != NULL ) {
if ( odp->flags & ODPF_DONTTRANSLATE ) {
- #if defined( _UNICODE )
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTitle = mir_wstrdup( odp->ptszTitle );
- else {
- dst->ptszTitle = mir_a2u( odp->pszTitle );
- dst->flags |= ODPF_UNICODE;
- }
- #else
- dst->pszTitle = mir_strdup( odp->pszTitle );
- #endif
+ if ( odp->flags & ODPF_UNICODE )
+ dst->ptszTitle = mir_wstrdup( odp->ptszTitle );
+ else {
+ dst->ptszTitle = mir_a2u( odp->pszTitle );
+ dst->flags |= ODPF_UNICODE;
+ }
}
else {
- #if defined( _UNICODE )
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTitle = mir_wstrdup( TranslateW( odp->ptszTitle ));
- else {
- dst->ptszTitle = LangPackPcharToTchar( odp->pszTitle );
- dst->flags |= ODPF_UNICODE;
- }
- #else
- dst->pszTitle = mir_strdup( Translate( odp->pszTitle ));
- #endif
+ if ( odp->flags & ODPF_UNICODE )
+ dst->ptszTitle = mir_wstrdup( TranslateW( odp->ptszTitle ));
+ else {
+ dst->ptszTitle = LangPackPcharToTchar( odp->pszTitle );
+ dst->flags |= ODPF_UNICODE;
+ }
}
}
if ( odp->ptszGroup != NULL ) {
- #if defined( _UNICODE )
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszGroup = mir_wstrdup( TranslateW( odp->ptszGroup ));
- else {
- dst->ptszGroup = LangPackPcharToTchar( odp->pszGroup );
- dst->flags |= ODPF_UNICODE;
- }
- #else
- dst->pszGroup = mir_strdup( Translate( odp->pszGroup ));
- #endif
+ if ( odp->flags & ODPF_UNICODE )
+ dst->ptszGroup = mir_wstrdup( TranslateW( odp->ptszGroup ));
+ else {
+ dst->ptszGroup = LangPackPcharToTchar( odp->pszGroup );
+ dst->flags |= ODPF_UNICODE;
+ }
}
if ( odp->cbSize > OPTIONPAGE_OLD_SIZE2 && odp->ptszTab != NULL ) {
- #if defined( _UNICODE )
- if ( odp->flags & ODPF_UNICODE )
- dst->ptszTab = mir_wstrdup( TranslateW( odp->ptszTab ));
- else {
- dst->ptszTab = LangPackPcharToTchar( odp->pszTab );
- dst->flags |= ODPF_UNICODE;
- }
- #else
- dst->pszTab = mir_strdup( Translate( odp->pszTab ));
- #endif
+ if ( odp->flags & ODPF_UNICODE )
+ dst->ptszTab = mir_wstrdup( TranslateW( odp->ptszTab ));
+ else {
+ dst->ptszTab = LangPackPcharToTchar( odp->pszTab );
+ dst->flags |= ODPF_UNICODE;
+ }
}
if (( DWORD_PTR )odp->pszTemplate & 0xFFFF0000 )
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp
index 2f67ab297f..369e96fb19 100644
--- a/src/modules/plugins/newplugins.cpp
+++ b/src/modules/plugins/newplugins.cpp
@@ -318,9 +318,7 @@ LBL_Ok:
// check clist ?
if ( checkTypeAPI == CHECKAPI_CLIST ) {
bpi->clistlink = (CList_Initialise) GetProcAddress(h, "CListInitialise");
- #if defined( _UNICODE )
- if ( pi->flags & UNICODE_AWARE )
- #endif
+ if ( pi->flags & UNICODE_AWARE )
if ( bpi->clistlink )
goto LBL_Ok;
}
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index f2706ddb08..ccb88a3269 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -367,7 +367,6 @@ static INT_PTR stub42( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
{ return ppi->m_iStatus;
}
-#ifdef _UNICODE
static INT_PTR stub43( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
{
@@ -409,7 +408,6 @@ static INT_PTR stub45( PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam )
return CallProtoService( ppi->m_szModuleName, PS_SETMYAVATARW, wParam, ( LPARAM )( LPCTSTR )StrConvT(( char* )lParam ));
}
-#endif
static HANDLE CreateProtoServiceEx( const char* szModule, const char* szService, MIRANDASERVICEOBJ pFunc, void* param )
{
@@ -454,7 +452,7 @@ BOOL ActivateAccount( PROTOACCOUNT* pa )
CreateProtoServiceEx( pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro );
CreateProtoServiceEx( pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro );
-#ifdef _UNICODE
+
char szServiceName[ 200 ];
mir_snprintf( szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO );
if ( !ServiceExists( szServiceName )) {
@@ -476,7 +474,7 @@ BOOL ActivateAccount( PROTOACCOUNT* pa )
if ( ServiceExists( szServiceName ))
CreateProtoServiceEx( pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro );
}
- #endif
+
return TRUE;
}
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 80eefddc7c..7b8b3d647a 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -52,7 +52,7 @@ static LIST<PROTOCOLDESCRIPTOR> protos( 10, CompareProtos );
static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam)
{
-#ifdef _UNICODE
+
ACKDATA *ack = (ACKDATA*)lParam;
if (ack && ack->type == ACKTYPE_AVATAR && ack->hProcess) {
PROTO_AVATAR_INFORMATION* ai = (PROTO_AVATAR_INFORMATION*)ack->hProcess;
@@ -63,7 +63,7 @@ static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam)
ack->hProcess = &aiw;
}
}
-#endif
+
return NotifyEventHooks(hAckEvent, wParam, lParam);
}
@@ -320,7 +320,7 @@ void Proto_SetStatus(const char* szProto, unsigned status)
CallProtoService(szProto, PS_SETSTATUS, status, 0);
}
-#ifdef _UNICODE
+
char** __fastcall Proto_FilesMatrixA( wchar_t **files )
{
if ( files == NULL ) return NULL;
@@ -348,7 +348,7 @@ static wchar_t** __fastcall Proto_FilesMatrixU( char **files )
return filesU;
}
-#endif
+
/////////////////////////////////////////////////////////////////////////////////////////
// 0.8.0+ - accounts
@@ -410,7 +410,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
if ( item ) {
switch( item->id ) {
case 1:
-#ifdef _UNICODE
+
if ( ppi->m_iVersion > 1 || !((( PROTOSEARCHRESULT* )lParam)->flags & PSR_UNICODE))
return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
else {
@@ -432,9 +432,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
return res;
}
-#else
- return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
-#endif
+
case 2: return ( INT_PTR )ppi->AddToListByEvent( LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam );
case 3: return ( INT_PTR )ppi->Authorize(( HANDLE )wParam );
case 4:
@@ -462,7 +460,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
return ( INT_PTR )ppi->FileDeny( hContact, ( HANDLE )wParam, ( PROTOCHAR* )lParam );
case 11: {
PROTOFILERESUME* pfr = ( PROTOFILERESUME* )lParam;
-#ifdef _UNICODE
+
if ( ppi->m_iVersion > 1 ) {
PROTOCHAR* szFname = mir_a2t(( char* )pfr->szFilename );
INT_PTR res = ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
@@ -471,7 +469,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
pfr->szFilename = ( PROTOCHAR* )mir_t2a( szFname ); mir_free( szFname );
}
else
-#endif
+
return ( INT_PTR )ppi->FileResume(( HANDLE )wParam, &pfr->action,
( const PROTOCHAR** )&pfr->szFilename );
}
@@ -505,7 +503,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
case 24: return ( INT_PTR )ppi->SendContacts( hContact, LOWORD( wParam ), HIWORD( wParam ),
( HANDLE* )lParam );
case 25:
-#ifdef _UNICODE
+
if ( ppi->m_iVersion > 1 ) {
TCHAR** files = Proto_FilesMatrixU(( char** )lParam );
INT_PTR res = ( INT_PTR )ppi->SendFile( hContact, StrConvT(( char* )wParam ), ( TCHAR** )files );
@@ -513,7 +511,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
return res;
}
else
-#endif
+
return ( INT_PTR )ppi->SendFile( hContact, ( TCHAR* )wParam, ( TCHAR** )lParam );
case 26: return ( INT_PTR )ppi->SendMsg( hContact, wParam, ( const char* )lParam );
case 27: return ( INT_PTR )ppi->SendUrl( hContact, wParam, ( const char* )lParam );
@@ -531,7 +529,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
case 35: lstrcpynA(( char* )lParam, ppi->m_szModuleName, wParam ); return 0;
case 36: return ppi->m_iStatus;
-#ifdef _UNICODE
+
case 100:
if ( ppi->m_iVersion > 1 )
return ( INT_PTR )ppi->SetAwayMsg( wParam, ( TCHAR* )lParam );
@@ -595,10 +593,10 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
return ( INT_PTR )ppi->SearchByEmail(( const TCHAR* )lParam );
else
return ( INT_PTR )ppi->SearchByEmail(StrConvA(( const TCHAR* )lParam ));
-#endif
+
} } } }
-#ifdef _UNICODE
+
if ( !strcmp( szService, PS_ADDTOLIST )) {
PROTOSEARCHRESULT *psr = ( PROTOSEARCHRESULT* )lParam;
if ( !( psr->flags & PSR_UNICODE )) {
@@ -619,11 +617,11 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
return res;
}
}
-#endif
+
INT_PTR res = MyCallProtoService( szModule, szService, wParam, lParam );
-#ifdef _UNICODE
+
if ( res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr( szService, 'W' )) {
TServiceListItem *item = serviceItems.find(( TServiceListItem* )&szService );
if ( !item ) return res;
@@ -662,7 +660,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char *
case 110:
return ( INT_PTR )pa->ppro->SearchByEmail(( const TCHAR* )lParam );
} }
-#endif
+
return res;
}
@@ -763,7 +761,7 @@ int LoadProtocolsModule(void)
InsertServiceListItem( 35, PS_GETNAME );
InsertServiceListItem( 36, PS_GETSTATUS );
-#ifdef _UNICODE
+
InsertServiceListItem( 100, PS_SETAWAYMSGW );
InsertServiceListItem( 102, PSS_FILEW );
InsertServiceListItem( 103, PSS_FILEALLOWW );
@@ -774,7 +772,7 @@ int LoadProtocolsModule(void)
InsertServiceListItem( 108, PS_BASICSEARCHW );
InsertServiceListItem( 109, PS_SEARCHBYNAMEW );
InsertServiceListItem( 110, PS_SEARCHBYEMAILW );
-#endif
+
hAckEvent = CreateHookableEvent(ME_PROTO_ACK);
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp
index ccad4701d6..fa2ec3b729 100644
--- a/src/modules/protocols/protoint.cpp
+++ b/src/modules/protocols/protoint.cpp
@@ -70,14 +70,11 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl FileAllow( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szPath )
{ CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
-#ifdef _UNICODE
+
ccs.lParam = ( LPARAM )mir_t2a( szPath );
HANDLE res = ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs );
mir_free(( char* )ccs.lParam );
return res;
-#else
- return ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs );
-#endif
}
int __cdecl FileCancel( HANDLE hContact, HANDLE hTransfer )
@@ -87,27 +84,21 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
int __cdecl FileDeny( HANDLE hContact, HANDLE hTransfer, const PROTOCHAR* szReason )
{ CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
-#ifdef _UNICODE
+
ccs.lParam = ( LPARAM )mir_t2a( szReason );
int res = ( int )MyCallProtoService( m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs );
mir_free(( char* )ccs.lParam );
return res;
-#else
- return ( int )MyCallProtoService( m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs );
-#endif
}
int __cdecl FileResume( HANDLE hTransfer, int* action, const PROTOCHAR** szFilename )
{ PROTOFILERESUME pfr = { *action, *szFilename };
-#ifdef _UNICODE
+
pfr.szFilename = ( PROTOCHAR* )mir_t2a( pfr.szFilename );
int res = ( int )MyCallProtoService( m_szModuleName, PS_FILERESUME, ( WPARAM )hTransfer, ( LPARAM )&pfr);
mir_free(( PROTOCHAR* )*szFilename );
*action = pfr.action; *szFilename = (PROTOCHAR*)pfr.szFilename;
-#else
- int res = ( int )MyCallProtoService( m_szModuleName, PS_FILERESUME, ( WPARAM )hTransfer, ( LPARAM )&pfr );
- *action = pfr.action; *szFilename = (PROTOCHAR*)pfr.szFilename;
-#endif
+
return res;
}
@@ -134,7 +125,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl SearchByName( const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName )
{ PROTOSEARCHBYNAME psn;
-#ifdef _UNICODE
+
psn.pszNick = ( PROTOCHAR* )mir_t2a( nick );
psn.pszFirstName = ( PROTOCHAR* )mir_t2a( firstName );
psn.pszLastName = ( PROTOCHAR* )mir_t2a( lastName );
@@ -143,12 +134,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
mir_free( psn.pszFirstName );
mir_free( psn.pszLastName );
return res;
-#else
- psn.pszNick = ( char* )nick;
- psn.pszFirstName = ( char* )firstName;
- psn.pszLastName = ( char* )lastName;
- return ( HANDLE )MyCallProtoService( m_szModuleName, PS_SEARCHBYNAME, 0, ( LPARAM )&psn );
-#endif
+
}
HWND __cdecl SearchAdvanced( HWND owner )
@@ -186,16 +172,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl SendFile( HANDLE hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles )
{ CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles };
-#ifdef _UNICODE
+
ccs.wParam = ( WPARAM )mir_t2a( szDescription );
ccs.lParam = ( LPARAM )Proto_FilesMatrixA( ppszFiles );
HANDLE res = ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILE, 0, ( LPARAM )&ccs );
if ( res == 0 ) FreeFilesMatrix(( TCHAR*** )&ccs.lParam );
mir_free(( char* )ccs.wParam );
return res;
-#else
- return ( HANDLE )MyCallProtoService( m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs );
-#endif
}
int __cdecl SendMsg( HANDLE hContact, int flags, const char* msg )
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp
index 018411d7a1..64987b4aa4 100644
--- a/src/modules/skin/hotkeys.cpp
+++ b/src/modules/skin/hotkeys.cpp
@@ -170,20 +170,16 @@ static INT_PTR svcHotkeyRegister(WPARAM wParam, LPARAM lParam)
return 0;
THotkeyItem *item = ( THotkeyItem* )mir_alloc(sizeof(THotkeyItem));
- #if defined( _UNICODE )
- DWORD dwFlags = ( desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
- if ( dwFlags & HKD_UNICODE ) {
- item->ptszSection = mir_tstrdup( desc->ptszSection );
- item->ptszDescription = mir_tstrdup( desc->ptszDescription );
- }
- else {
- item->ptszSection = mir_a2u( desc->pszSection );
- item->ptszDescription = mir_a2u( desc->pszDescription );
- }
- #else
- item->ptszSection = mir_tstrdup( desc->pszSection );
- item->ptszDescription = mir_tstrdup( desc->pszDescription );
- #endif
+ DWORD dwFlags = ( desc->cbSize >= sizeof(HOTKEYDESC)) ? desc->dwFlags : 0;
+ if ( dwFlags & HKD_UNICODE ) {
+ item->ptszSection = mir_tstrdup( desc->ptszSection );
+ item->ptszDescription = mir_tstrdup( desc->ptszDescription );
+ }
+ else {
+ item->ptszSection = mir_a2u( desc->pszSection );
+ item->ptszDescription = mir_a2u( desc->pszDescription );
+ }
+
item->ptszSection_tr = TranslateTS(item->ptszSection);
item->ptszDescription_tr = TranslateTS(item->ptszDescription);
item->allowSubHotkeys = TRUE;
diff --git a/src/modules/skin/sounds.cpp b/src/modules/skin/sounds.cpp
index d9fb7fbb8e..fad684a80a 100644
--- a/src/modules/skin/sounds.cpp
+++ b/src/modules/skin/sounds.cpp
@@ -57,7 +57,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam)
SoundItem* item = &soundList[soundCount++];
item->name = mir_strdup( ssd->pszName );
item->tempFile = NULL;
- #if defined( _UNICODE )
+
TCHAR* ptszDefaultFile;
if ( dwFlags & SSDF_UNICODE ) {
item->description = mir_tstrdup( TranslateTS( ssd->ptszDescription ));
@@ -77,16 +77,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM, LPARAM lParam)
DBFreeVariant(&dbv);
mir_free( ptszDefaultFile );
}
- #else
- item->description = mir_tstrdup( TranslateTS( ssd->pszDescription ));
- item->section = mir_tstrdup( TranslateTS( ssd->cbSize != SKINSOUNDDESC_SIZE_V1 && ssd->pszSection != NULL ? ssd->pszSection : "Other" ));
- if ( ssd->pszDefaultFile ) {
- if ( DBGetContactSettingString(NULL, "SkinSounds", item->name, &dbv))
- DBWriteContactSettingString(NULL, "SkinSounds", item->name, ssd->pszDefaultFile);
- else
- DBFreeVariant(&dbv);
- }
- #endif
+
return 0;
}
diff --git a/src/modules/srawaymsg/awaymsg.cpp b/src/modules/srawaymsg/awaymsg.cpp
index f1c8bbc46e..d4435f8e3c 100644
--- a/src/modules/srawaymsg/awaymsg.cpp
+++ b/src/modules/srawaymsg/awaymsg.cpp
@@ -85,7 +85,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
if (ack->result != ACKRESULT_SUCCESS) break;
if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = NULL; }
-#ifdef _UNICODE
+
DBVARIANT dbv;
bool unicode = !DBGetContactSetting(dat->hContact, "CList", "StatusMsg", &dbv) &&
(dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
@@ -96,7 +96,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP
SetDlgItemText(hwndDlg, IDC_MSG, dbv.pwszVal);
}
else
-#endif
+
SetDlgItemTextA(hwndDlg, IDC_MSG, (const char*)ack->lParam);
ShowWindow(GetDlgItem(hwndDlg, IDC_RETRIEVING), SW_HIDE);
diff --git a/src/modules/srawaymsg/sendmsg.cpp b/src/modules/srawaymsg/sendmsg.cpp
index 015fdce3f8..4c5ceec8ab 100644
--- a/src/modules/srawaymsg/sendmsg.cpp
+++ b/src/modules/srawaymsg/sendmsg.cpp
@@ -612,7 +612,7 @@ static INT_PTR sttGetAwayMessageT(WPARAM wParam, LPARAM lParam)
return (INT_PTR)GetAwayMessage((int)wParam, (char*)lParam);
}
-#ifdef UNICODE
+
static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam)
{
TCHAR* msg = GetAwayMessage((int)wParam, (char*)lParam);
@@ -620,18 +620,16 @@ static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam)
mir_free(msg);
return (INT_PTR)res;
}
-#endif
+
int LoadAwayMessageSending(void)
{
HookEvent(ME_SYSTEM_MODULESLOADED, AwayMsgSendModulesLoaded);
HookEvent(ME_PROTO_ACCLISTCHANGED, AwayMsgSendAccountsChanged);
-#ifdef UNICODE
+
CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessage);
CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSGW, sttGetAwayMessageT);
-#else
- CreateServiceFunction(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessageT);
-#endif
+
return 0;
}
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)
diff --git a/src/modules/updatenotify/updatenotify.cpp b/src/modules/updatenotify/updatenotify.cpp
index 910b168687..5f7b3e67c4 100644
--- a/src/modules/updatenotify/updatenotify.cpp
+++ b/src/modules/updatenotify/updatenotify.cpp
@@ -236,10 +236,7 @@ static void UpdateNotifyReleaseLogUpdate(UpdateNotifyReleaseData *d) {
Netlib_Logf(hNetlibUser, "Update server version: %s [%s] [64-bit]", d->szVersionPublic, d->szVersion);
#elif defined(_UNICODE)
Netlib_Logf(hNetlibUser, "Update server version: %s [%s] [Unicode]", d->szVersionPublic, d->szVersion);
- #else
- Netlib_Logf(hNetlibUser, "Update server version: %s [%s] [ANSI]", d->szVersionPublic, d->szVersion);
#endif
-
}
static void UpdateNotifyReleaseCopyData(UpdateNotifyReleaseData *d, UpdateNotifyData *und) {
@@ -293,8 +290,6 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) {
mir_snprintf(szUserAgent, sizeof(szUserAgent), "Miranda/%s (x64)", szVersion);
#elif defined(_UNICODE)
mir_snprintf(szUserAgent, sizeof(szUserAgent), "Miranda/%s (Unicode)", szVersion);
- #else
- mir_snprintf(szUserAgent, sizeof(szUserAgent), "Miranda/%s (ANSI)", szVersion);
#endif
req.headersCount = 1;
req.headers = headers;
@@ -330,10 +325,6 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) {
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasestable/downloadunicodeexe"), 0)) != NULL && xun.getText(n)) {
rdStable.szDownload = mir_t2a(xun.getText(n));
}
- #else
- if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasestable/downloadansiexe"), 0)) != NULL && xun.getText(n)) {
- rdStable.szDownload = mir_t2a(xun.getText(n));
- }
#endif
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasestable/notesurl"), 0)) != NULL && xun.getText(n)) {
rdStable.szNotes = mir_t2a(xun.getText(n));
@@ -359,10 +350,6 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) {
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasebeta/downloadunicodeexe"), 0)) != NULL && xun.getText(n)) {
rdBeta.szDownload = mir_t2a(xun.getText(n));
}
- #else
- if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasebeta/downloadansiexe"), 0)) != NULL && xun.getText(n)) {
- rdBeta.szDownload = mir_t2a(xun.getText(n));
- }
#endif
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasebeta/notesurl"), 0)) != NULL && xun.getText(n)) {
rdBeta.szNotes = mir_t2a(xun.getText(n));
@@ -388,10 +375,6 @@ static int UpdateNotifyMakeRequest(UpdateNotifyData *und) {
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasealpha/downloadunicodezip"), 0)) != NULL && xun.getText(n)) {
rdAlpha.szDownload = mir_t2a(xun.getText(n));
}
- #else
- if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasealpha/downloadansizip"), 0)) != NULL && xun.getText(n)) {
- rdAlpha.szDownload = mir_t2a(xun.getText(n));
- }
#endif
if ((n = xun.getChildByPath(nodeDoc, _T("releases/releasealpha/notesurl"), 0)) != NULL && xun.getText(n)) {
rdAlpha.szNotes = mir_t2a(xun.getText(n));
diff --git a/src/modules/userinfo/stdinfo.cpp b/src/modules/userinfo/stdinfo.cpp
index be7863f358..7cc4e348ac 100644
--- a/src/modules/userinfo/stdinfo.cpp
+++ b/src/modules/userinfo/stdinfo.cpp
@@ -139,7 +139,6 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule,
break;
case DBVT_UTF8:
unspecified=(special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
- #if defined( _UNICODE )
if ( !unspecified )
{ WCHAR* wszStr;
Utf8Decode( dbv.pszVal, &wszStr );
@@ -147,7 +146,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule,
mir_free( wszStr );
goto LBL_Exit;
}
- #endif
+
pstr=dbv.pszVal;
Utf8Decode( dbv.pszVal, NULL );
break;
@@ -161,9 +160,9 @@ static void SetValue(HWND hwndDlg, int idCtrl, HANDLE hContact, char *szModule,
else
SetDlgItemTextA(hwndDlg, idCtrl, pstr);
-#if defined( _UNICODE )
+
LBL_Exit:
-#endif
+
EnableWindow(GetDlgItem(hwndDlg, idCtrl), !unspecified);
if (proto_service)
Proto_FreeInfoVariant(&dbv);
diff --git a/src/modules/userinfo/userinfo.cpp b/src/modules/userinfo/userinfo.cpp
index 0f07ea5ba3..7fb79822d5 100644
--- a/src/modules/userinfo/userinfo.cpp
+++ b/src/modules/userinfo/userinfo.cpp
@@ -132,14 +132,14 @@ static INT_PTR AddDetailsPage(WPARAM wParam, LPARAM lParam)
if ((DWORD_PTR)odp->pszTemplate&0xFFFF0000) dst->pszTemplate = mir_strdup(odp->pszTemplate);
else dst->pszTemplate = odp->pszTemplate;
- #if defined(_UNICODE)
+
if ( odp->flags & ODPF_UNICODE )
{
dst->ptszTitle = (odp->ptszTitle == 0) ? NULL : mir_wstrdup(odp->ptszTitle);
dst->ptszTab = (!(odp->flags & ODPF_USERINFOTAB) || !odp->ptszTab) ? NULL : mir_wstrdup(odp->ptszTab);
}
else
- #endif
+
{
if ( odp->flags & ODPF_DONTTRANSLATE )
dst->ptszTitle = (odp->pszTitle == 0) ? NULL : mir_a2t(odp->pszTitle);
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp
index 5dbf37b12f..8cedc1ba87 100644
--- a/src/modules/utils/bmpfilter.cpp
+++ b/src/modules/utils/bmpfilter.cpp
@@ -129,12 +129,10 @@ static INT_PTR BmpFilterLoadBitmap(WPARAM, LPARAM lParam)
return sttBitmapLoader( StrConvT(( const char* )lParam ));
}
-#if defined( _UNICODE )
static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam)
{
return sttBitmapLoader(( const wchar_t* )lParam );
}
-#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -183,7 +181,6 @@ static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam)
return 0;
}
-#if defined( _UNICODE )
static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam)
{
int bytesLeft=wParam;
@@ -228,15 +225,12 @@ static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam)
if (bytesLeft) *pfilter='\0';
return 0;
}
-#endif
int InitBitmapFilter(void)
{
CreateServiceFunction(MS_UTILS_LOADBITMAP, BmpFilterLoadBitmap);
CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGS, BmpFilterGetStrings);
- #if defined( _UNICODE )
- CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW, BmpFilterGetStringsW);
- CreateServiceFunction(MS_UTILS_LOADBITMAPW, BmpFilterLoadBitmapW);
- #endif
+ CreateServiceFunction(MS_UTILS_GETBITMAPFILTERSTRINGSW, BmpFilterGetStringsW);
+ CreateServiceFunction(MS_UTILS_LOADBITMAPW, BmpFilterLoadBitmapW);
return 0;
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp
index 49e5ae8bf4..c2915fb7ed 100644
--- a/src/modules/utils/path.cpp
+++ b/src/modules/utils/path.cpp
@@ -129,7 +129,6 @@ static INT_PTR createDirTree(WPARAM, LPARAM lParam)
return CreateDirectoryTree(( char* )lParam );
}
-#ifdef _UNICODE
static TCHAR szMirandaPathW[MAX_PATH];
static TCHAR szMirandaPathWLower[MAX_PATH];
@@ -241,7 +240,6 @@ int InitPathUtilsW(void)
CreateServiceFunction(MS_UTILS_CREATEDIRTREEW, createDirTreeW);
return 0;
}
-#endif
TCHAR *GetContactID(HANDLE hContact)
{
@@ -362,7 +360,6 @@ static __forceinline char *GetPathVarX(char *, int code)
return makeFileName( szFullPath );
}
-#ifdef _UNICODE
static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return _tcscmp(s1, s2); }
static __forceinline int _xcsncmp(const TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncmp(s1, s2, n); }
static __forceinline size_t _xcslen(const TCHAR *s1) { return _tcslen(s1); }
@@ -443,7 +440,6 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code)
}
return mir_tstrdup( szFullPath );
}
-#endif
template<typename XCHAR>
XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, HANDLE hContact)
@@ -572,11 +568,8 @@ static INT_PTR replaceVars(WPARAM wParam, LPARAM lParam)
if (!(data->dwFlags & RVF_UNICODE))
return (INT_PTR)ReplaceVariables<char>((char *)wParam, data);
-#ifdef _UNICODE
+
return (INT_PTR)ReplaceVariables<WCHAR>((WCHAR *)wParam, data);
-#else
- return NULL;
-#endif
}
int InitPathUtils(void)
@@ -592,9 +585,6 @@ int InitPathUtils(void)
CreateServiceFunction(MS_UTILS_PATHTOABSOLUTE, pathToAbsolute);
CreateServiceFunction(MS_UTILS_CREATEDIRTREE, createDirTree);
CreateServiceFunction(MS_UTILS_REPLACEVARS, replaceVars);
-#ifdef _UNICODE
+
return InitPathUtilsW();
-#else
- return 0;
-#endif
}
diff --git a/src/modules/utils/timeutils.cpp b/src/modules/utils/timeutils.cpp
index cea409ef82..5e921566d5 100644
--- a/src/modules/utils/timeutils.cpp
+++ b/src/modules/utils/timeutils.cpp
@@ -113,165 +113,3 @@ void FormatTime(const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int
}
*pDest = 0;
}
-
-
-#ifndef _UNICODE
-void ConvertToAbsolute (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstDst, SYSTEMTIME * pstDstAbs)
-{
- static int iDays [12] = { 31, 28, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31 } ;
- int iDay ;
-
- // Set up the aboluste date structure except for wDay, which we must find
-
- pstDstAbs->wYear = pstLoc->wYear ; // Notice from local date/time
- pstDstAbs->wMonth = pstDst->wMonth ;
- pstDstAbs->wDayOfWeek = pstDst->wDayOfWeek ;
-
- pstDstAbs->wHour = pstDst->wHour ;
- pstDstAbs->wMinute = pstDst->wMinute ;
- pstDstAbs->wSecond = pstDst->wSecond ;
- pstDstAbs->wMilliseconds = pstDst->wMilliseconds ;
-
- // Fix the iDays array for leap years
-
- if ((pstLoc->wYear % 4 == 0) && ((pstLoc->wYear % 100 != 0) ||
- (pstLoc->wYear % 400 == 0)))
- {
- iDays[1] = 29 ;
- }
-
- // Find a day of the month that falls on the same
- // day of the week as the transition.
-
- // Suppose today is the 20th of the month (pstLoc->wDay = 20)
- // Suppose today is a Wednesday (pstLoc->wDayOfWeek = 3)
- // Suppose the transition occurs on a Friday (pstDst->wDayOfWeek = 5)
- // Then iDay = 31, meaning that the 31st falls on a Friday
- // (The 7 is this formula avoids negatives.)
-
- iDay = pstLoc->wDay + pstDst->wDayOfWeek + 7 - pstLoc->wDayOfWeek ;
-
- // Now shrink iDay to a value between 1 and 7.
-
- iDay = (iDay - 1) % 7 + 1 ;
-
- // Now iDay is a day of the month ranging from 1 to 7.
- // Recall that the wDay field of the structure can range
- // from 1 to 5, 1 meaning "first", 2 meaning "second",
- // and 5 meaning "last".
- // So, increase iDay so it's the proper day of the month.
-
- iDay += 7 * (pstDst->wDay - 1) ;
-
- // Could be that iDay overshot the end of the month, so
- // fix it up using the number of days in each month
-
- if (iDay > iDays[pstDst->wMonth - 1])
- iDay -= 7 ;
-
- // Assign that day to the structure.
-
- pstDstAbs->wDay = iDay ;
-}
-
-BOOL LocalGreaterThanTransition (const SYSTEMTIME * pstLoc, const SYSTEMTIME * pstTran)
-{
- FILETIME ftLoc, ftTran ;
- LARGE_INTEGER liLoc, liTran ;
- SYSTEMTIME stTranAbs ;
-
- // Easy case: Just compare the two months
-
- if (pstLoc->wMonth != pstTran->wMonth)
- return (pstLoc->wMonth > pstTran->wMonth) ;
-
- // Well, we're in a transition month. That requires a bit more work.
-
- // Check if pstDst is in absolute or day-in-month format.
- // (See documentation of TIME_ZONE_INFORMATION, StandardDate field.)
-
- if (pstTran->wYear) // absolute format (haven't seen one yet!)
- {
- stTranAbs = * pstTran ;
- }
- else // day-in-month format
- {
- ConvertToAbsolute (pstLoc, pstTran, &stTranAbs) ;
- }
-
- // Now convert both date/time structures to large integers & compare
-
- SystemTimeToFileTime (pstLoc, &ftLoc) ;
- liLoc = * (LARGE_INTEGER *) (void *) &ftLoc ;
-
- SystemTimeToFileTime (&stTranAbs, &ftTran) ;
- liTran = * (LARGE_INTEGER *) (void *) &ftTran ;
-
- return (liLoc.QuadPart > liTran.QuadPart) ;
-}
-
-BOOL MySystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION ptzi, LPSYSTEMTIME pstUtc, LPSYSTEMTIME pstLoc)
-{
- // st is UTC
-
- FILETIME ft ;
- LARGE_INTEGER li ;
- SYSTEMTIME stDst ;
-
- if (IsWinVerNT())
- return SystemTimeToTzSpecificLocalTime(ptzi, pstUtc, pstLoc);
-
- // Convert time to a LARGE_INTEGER and subtract the bias
-
- SystemTimeToFileTime (pstUtc, &ft) ;
- li = * (LARGE_INTEGER *) (void *) &ft;
- li.QuadPart -= (LONGLONG) 600000000 * ptzi->Bias ;
-
- // Convert to a local date/time before application of daylight saving time.
- // The local date/time must be used to determine when the conversion occurs.
-
- ft = * (FILETIME *) (void *) &li ;
- FileTimeToSystemTime (&ft, pstLoc) ;
-
- // Find the time assuming Daylight Saving Time
-
- li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
- ft = * (FILETIME *) (void *) &li ;
- FileTimeToSystemTime (&ft, &stDst) ;
-
- // Now put li back the way it was
-
- li.QuadPart += (LONGLONG) 600000000 * ptzi->DaylightBias ;
-
- if (ptzi->StandardDate.wMonth) // ie, daylight savings time
- {
- // Northern hemisphere
- if ((ptzi->DaylightDate.wMonth < ptzi->StandardDate.wMonth) &&
-
- (stDst.wMonth >= pstLoc->wMonth) && // avoid the end of year problem
-
- LocalGreaterThanTransition (pstLoc, &ptzi->DaylightDate) &&
- !LocalGreaterThanTransition (&stDst, &ptzi->StandardDate))
- {
- li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
- }
- // Southern hemisphere
-
- else if ((ptzi->StandardDate.wMonth < ptzi->DaylightDate.wMonth) &&
- (!LocalGreaterThanTransition (&stDst, &ptzi->StandardDate) ||
- LocalGreaterThanTransition (pstLoc, &ptzi->DaylightDate)))
- {
- li.QuadPart -= (LONGLONG) 600000000 * ptzi->DaylightBias ;
- }
- else
- {
- li.QuadPart -= (LONGLONG) 600000000 * ptzi->StandardBias ;
- }
- }
-
- ft = * (FILETIME *) (void *) &li ;
- FileTimeToSystemTime (&ft, pstLoc) ;
- return TRUE ;
-}
-#endif
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp
index 1fe186d633..c562ce6460 100644
--- a/src/modules/utils/timezones.cpp
+++ b/src/modules/utils/timezones.cpp
@@ -97,13 +97,7 @@ void FormatTime (const SYSTEMTIME *st, const TCHAR *szFormat, TCHAR *szDest, int
void UnixTimeToFileTime(time_t ts, LPFILETIME pft);
time_t FileTimeToUnixTime(LPFILETIME pft);
-#ifdef _UNICODE
#define fnSystemTimeToTzSpecificLocalTime SystemTimeToTzSpecificLocalTime
-#else
-BOOL MySystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION ptzi, LPSYSTEMTIME pstUtc, LPSYSTEMTIME pstLoc);
-#define fnSystemTimeToTzSpecificLocalTime MySystemTimeToTzSpecificLocalTime
-#endif
-
static int timeapiGetTimeZoneTime(HANDLE hTZ, SYSTEMTIME *st)
{
@@ -490,7 +484,6 @@ static INT_PTR TimestampToStringT(WPARAM wParam, LPARAM lParam)
return 0;
}
-#ifdef _UNICODE
static INT_PTR TimestampToStringA(WPARAM wParam, LPARAM lParam)
{
DBTIMETOSTRING *tts = (DBTIMETOSTRING*)lParam;
@@ -501,7 +494,6 @@ static INT_PTR TimestampToStringA(WPARAM wParam, LPARAM lParam)
WideCharToMultiByte(CP_ACP, 0, szDest, -1, tts->szDest, tts->cbDest, NULL, NULL);
return 0;
}
-#endif
void GetLocalizedString(HKEY hSubKey, const TCHAR *szName, wchar_t *szBuf, DWORD cbLen)
{
@@ -522,15 +514,9 @@ void GetLocalizedString(HKEY hSubKey, const TCHAR *szName, wchar_t *szBuf, DWORD
{
DWORD dwLength = cbLen * sizeof(wchar_t);
-#ifdef _UNICODE
+
RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBuf, &dwLength);
szBuf[min(dwLength / sizeof(TCHAR), cbLen - 1)] = 0;
-#else
- char* szBufP = (char*)alloca(dwLength);
- RegQueryValueEx(hSubKey, szName, NULL, NULL, (unsigned char *)szBufP, &dwLength);
- szBufP[min(dwLength, cbLen * sizeof(wchar_t) - 1)] = 0;
- MultiByteToWideChar(CP_ACP, 0, szBufP, -1, szBuf, cbLen);
-#endif
}
}
@@ -644,11 +630,9 @@ void InitTimeZones(void)
CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOLOCAL, TimestampToLocal);
CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOSTRINGT, TimestampToStringT);
-#ifdef _UNICODE
+
CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOSTRING, TimestampToStringA);
-#else
- CreateServiceFunction(MS_DB_TIME_TIMESTAMPTOSTRING, TimestampToStringT);
-#endif
+
tmi.cbSize = sizeof(tmi);
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp
index de49be7ab1..50358ca6f9 100644
--- a/src/modules/utils/utils.cpp
+++ b/src/modules/utils/utils.cpp
@@ -460,7 +460,6 @@ static INT_PTR GenerateRandom(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-#if defined( _UNICODE )
char* __fastcall rtrim(char* str)
{
if (str == NULL) return NULL;
@@ -477,7 +476,6 @@ char* __fastcall rtrim(char* str)
}
return str;
}
-#endif
TCHAR* __fastcall rtrim(TCHAR *str)
{
diff --git a/src/modules/xml/xmlParser.h b/src/modules/xml/xmlParser.h
index 5c13e603c0..e973fcf712 100644
--- a/src/modules/xml/xmlParser.h
+++ b/src/modules/xml/xmlParser.h
@@ -88,14 +88,12 @@
#include <stdlib.h>
-#ifdef _UNICODE
// If you comment the next "define" line then the library will never "switch to" _UNICODE (wchar_t*) mode (16/32 bits per characters).
// This is useful when you get error messages like:
// 'XMLNode::openFileHelper' : cannot convert parameter 2 from 'const char [5]' to 'const wchar_t *'
// The _XMLWIDECHAR preprocessor variable force the XMLParser library into either utf16/32-mode (the proprocessor variable
// must be defined) or utf8-mode(the pre-processor variable must be undefined).
#define _XMLWIDECHAR
-#endif
#if defined(WIN32) || defined(UNDER_CE) || defined(_WIN32) || defined(WIN64) || defined(__BORLANDC__)
// comment the next line if you are under windows and the compiler is not Microsoft Visual Studio (6.0 or .NET) or Borland