summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-14 16:22:13 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-14 16:22:13 +0000
commitd5d023f683b23fe26ddea93738cb721d532804f0 (patch)
tree21e7398686c7a5d1604d58bfb71ca4329c84be66
parente58823d961a630eb62e60d2ccb443761ba5f1704 (diff)
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@411 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Folders/version.h2
-rw-r--r--plugins/SRMM/msgdialog.c26
-rw-r--r--plugins/SRMM/msglog.c6
-rw-r--r--plugins/SRMM/msgoptions.c66
-rw-r--r--plugins/SRMM/msgs.c6
-rw-r--r--plugins/TabSRMM/chat/log.cpp14
-rw-r--r--plugins/TabSRMM/src/themes.cpp2
-rw-r--r--protocols/AimOscar/server.cpp6
-rw-r--r--protocols/IRCG/commandmonitor.cpp33
-rw-r--r--protocols/IRCG/irc.h14
-rw-r--r--protocols/IRCG/irclib.cpp11
-rw-r--r--protocols/IRCG/ircproto.cpp7
-rw-r--r--protocols/IRCG/options.cpp17
-rw-r--r--protocols/IRCG/tools.cpp4
-rw-r--r--protocols/IRCG/ui_utils.cpp22
-rw-r--r--protocols/IRCG/ui_utils.h9
-rw-r--r--protocols/IRCG/windows.cpp21
-rw-r--r--protocols/IcqOscarJ/UI/userinfotab.cpp4
-rw-r--r--protocols/IcqOscarJ/changeinfo/dlgproc.cpp19
-rw-r--r--protocols/IcqOscarJ/fam_01service.cpp6
-rw-r--r--protocols/IcqOscarJ/i18n.h20
-rw-r--r--protocols/IcqOscarJ/icq_popups.cpp3
-rw-r--r--protocols/IcqOscarJ/icq_proto.cpp2
-rw-r--r--protocols/IcqOscarJ/icq_uploadui.cpp16
-rw-r--r--protocols/IcqOscarJ/init.cpp9
-rw-r--r--protocols/IcqOscarJ/log.cpp8
-rw-r--r--protocols/IcqOscarJ/utilities.cpp51
-rw-r--r--protocols/JabberG/jabber.h13
-rw-r--r--protocols/JabberG/jabber_caps.cpp6
-rw-r--r--protocols/JabberG/jabber_console.cpp42
-rw-r--r--protocols/JabberG/jabber_disco.h6
-rw-r--r--protocols/JabberG/jabber_groupchat.cpp5
-rw-r--r--protocols/JabberG/jabber_iq_handlers.cpp6
-rw-r--r--protocols/JabberG/jabber_libstr.cpp2
-rw-r--r--protocols/JabberG/jabber_opt.cpp10
-rw-r--r--protocols/JabberG/jabber_secur.cpp6
-rw-r--r--protocols/JabberG/jabber_std.cpp7
-rw-r--r--protocols/JabberG/jabber_svc.cpp13
-rw-r--r--protocols/JabberG/jabber_thread.cpp36
-rw-r--r--protocols/JabberG/jabber_util.cpp15
-rw-r--r--protocols/JabberG/jabber_xml.cpp26
-rw-r--r--protocols/JabberG/jabber_xml.h2
-rw-r--r--protocols/JabberG/jabber_xstatus.cpp6
-rw-r--r--protocols/JabberG/ui_utils.cpp35
-rw-r--r--protocols/JabberG/ui_utils.h9
-rw-r--r--protocols/Yahoo/avatar.cpp12
-rw-r--r--src/core/miranda.cpp6
-rw-r--r--src/core/miranda.h45
-rw-r--r--src/modules/button/button.cpp16
-rw-r--r--src/modules/clist/clc.cpp23
50 files changed, 125 insertions, 626 deletions
diff --git a/plugins/Folders/version.h b/plugins/Folders/version.h
index 0e144ef86d..5aff03dd5a 100644
--- a/plugins/Folders/version.h
+++ b/plugins/Folders/version.h
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 6
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM)
diff --git a/plugins/SRMM/msgdialog.c b/plugins/SRMM/msgdialog.c
index 1a90a861c6..c5fce0f782 100644
--- a/plugins/SRMM/msgdialog.c
+++ b/plugins/SRMM/msgdialog.c
@@ -57,7 +57,6 @@ static void NotifyLocalWinEvent(HANDLE hContact, HWND hwnd, unsigned int type) {
static char *MsgServiceName(HANDLE hContact)
{
-#ifdef _UNICODE
char szServiceName[100];
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
@@ -66,7 +65,6 @@ static char *MsgServiceName(HANDLE hContact)
mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%sW", szProto, PSS_MESSAGE);
if (ServiceExists(szServiceName))
return PSS_MESSAGE "W";
-#endif
return PSS_MESSAGE;
}
@@ -124,7 +122,7 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto)
return NULL;
}
bufSize = (int)strlen(sendBuffer) + 1;
-#ifdef _UNICODE
+
{
size_t bufSizeT = (_tcslen(szMsg) + 1) * sizeof(TCHAR) ;
@@ -132,7 +130,7 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto)
memcpy((TCHAR*)&sendBuffer[bufSize], szMsg, bufSizeT);
bufSize += (int)bufSizeT;
}
-#endif
+
}
if (hContact == NULL)
@@ -772,11 +770,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (newData->szInitialText)
{
int len;
-#ifdef _UNICODE
+
if(newData->isWchar)
SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
else
-#endif
+
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
PostMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_SETSEL, len, len);
@@ -1133,11 +1131,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
hData = GlobalAlloc(GMEM_MOVEABLE, _tcslen(buf) * sizeof(TCHAR) + 1);
_tcscpy(GlobalLock(hData), buf);
GlobalUnlock(hData);
-#ifdef _UNICODE
SetClipboardData(CF_UNICODETEXT, hData);
-#else
- SetClipboardData(CF_TEXT, hData);
-#endif
CloseClipboard();
}
}
@@ -1298,17 +1292,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
char* blob = ( char* )alloca(1000);
-#if defined( _UNICODE )
int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, 1000, 0, 0);
memcpy( blob+ansiLen, buffer, sizeof(TCHAR)*(iLen+1));
dbei.cbBlob = ansiLen + sizeof(TCHAR)*(iLen+1);
-#else
- int wLen = MultiByteToWideChar(CP_ACP, 0, buffer, -1, NULL, 0 );
- memcpy( blob, buffer, iLen+1 );
- MultiByteToWideChar(CP_ACP, 0, buffer, -1, (WCHAR*)&blob[iLen+1], wLen+1 );
- dbei.cbBlob = iLen+1 + sizeof(WCHAR)*wLen;
-#endif
-
dbei.cbSize = sizeof(dbei);
dbei.pBlob = (PBYTE) blob;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
@@ -1936,11 +1922,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
hData = GlobalAlloc(GMEM_MOVEABLE, (_tcslen(tr.lpstrText) + 1) * sizeof(TCHAR));
_tcscpy(GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
-#ifdef _UNICODE
SetClipboardData(CF_UNICODETEXT, hData);
-#else
- SetClipboardData(CF_TEXT, hData);
-#endif
CloseClipboard();
}
break;
diff --git a/plugins/SRMM/msglog.c b/plugins/SRMM/msglog.c
index 00a8b682e4..82bb0f8da5 100644
--- a/plugins/SRMM/msglog.c
+++ b/plugins/SRMM/msglog.c
@@ -180,11 +180,7 @@ static int AppendToBufferWithRTF(char **buffer, int *cbBufferEnd, int *cbBufferA
return textCharsCount;
}
-#ifdef _UNICODE
- #define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %S;}"
-#else
- #define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %s;}"
-#endif
+#define FONT_FORMAT "{\\f%u\\fnil\\fcharset%u %S;}"
static char *CreateRTFHeader(struct MessageWindowData *dat)
{
diff --git a/plugins/SRMM/msgoptions.c b/plugins/SRMM/msgoptions.c
index 0cdfca4562..3542902fb4 100644
--- a/plugins/SRMM/msgoptions.c
+++ b/plugins/SRMM/msgoptions.c
@@ -48,76 +48,10 @@ static const fontOptionsList[] =
const int msgDlgFontCount = SIZEOF(fontOptionsList);
-#if defined( _UNICODE )
static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
{
return DEFAULT_CHARSET;
}
-#else
-// get font charset according to current CP
-static BYTE MsgDlgGetCPDefaultCharset()
-{
- switch (GetACP()) {
- case 1250:
- return EASTEUROPE_CHARSET;
- case 1251:
- return RUSSIAN_CHARSET;
- case 1252:
- return ANSI_CHARSET;
- case 1253:
- return GREEK_CHARSET;
- case 1254:
- return TURKISH_CHARSET;
- case 1255:
- return HEBREW_CHARSET;
- case 1256:
- return ARABIC_CHARSET;
- case 1257:
- return BALTIC_CHARSET;
- case 1361:
- return JOHAB_CHARSET;
- case 874:
- return THAI_CHARSET;
- case 932:
- return SHIFTJIS_CHARSET;
- case 936:
- return GB2312_CHARSET;
- case 949:
- return HANGEUL_CHARSET;
- case 950:
- return CHINESEBIG5_CHARSET;
- default:
- return DEFAULT_CHARSET;
- }
-}
-
-static int CALLBACK EnumFontFamExProc(const LOGFONT *lpelfe, const TEXTMETRIC *lpntme, DWORD FontType, LPARAM lParam)
-{
- *(int*)lParam = 1;
- return 0;
-}
-
-// get font charset according to current CP, if available for specified font
-static BYTE MsgDlgGetFontDefaultCharset(const TCHAR* szFont)
-{
- HDC hdc;
- LOGFONT lf = {0};
- int found = 0;
-
- _tcscpy(lf.lfFaceName, szFont);
- lf.lfCharSet = MsgDlgGetCPDefaultCharset();
-
- // check if the font supports specified charset
- hdc = GetDC(0);
- EnumFontFamiliesEx(hdc, &lf, &EnumFontFamExProc, (LPARAM)&found, 0);
- ReleaseDC(0, hdc);
-
- if (found)
- return lf.lfCharSet;
- else // no, give default
- return DEFAULT_CHARSET;
-}
-#endif
void LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
{
diff --git a/plugins/SRMM/msgs.c b/plugins/SRMM/msgs.c
index 8b822c2b42..ac7a615703 100644
--- a/plugins/SRMM/msgs.c
+++ b/plugins/SRMM/msgs.c
@@ -149,12 +149,10 @@ INT_PTR SendMessageCmd(HANDLE hContact, char* msg, int isWchar)
return 0;
}
-#if defined(_UNICODE)
static INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam)
{
return SendMessageCmd((HANDLE)wParam, (char*)lParam, TRUE);
}
-#endif
static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam)
{
@@ -192,9 +190,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam)
tn.tszInfoTitle = TranslateT("Typing Notification");
tn.tszInfo = szTip;
tn.dwInfoFlags = NIIF_INFO;
-#ifdef _UNICODE
tn.dwInfoFlags |= NIIF_INTERN_UNICODE;
-#endif
tn.uTimeout = 1000 * 4;
CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & tn);
}
@@ -458,9 +454,7 @@ int LoadSendRecvMessageModule(void)
hHooks[7] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
hServices[0] = CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
-#ifdef _UNICODE
hServices[1] = CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
-#endif
hServices[2] = CreateServiceFunction(MS_MSG_GETWINDOWAPI, GetWindowAPI);
hServices[3] = CreateServiceFunction(MS_MSG_GETWINDOWCLASS, GetWindowClass);
hServices[4] = CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
diff --git a/plugins/TabSRMM/chat/log.cpp b/plugins/TabSRMM/chat/log.cpp
index a297c9b006..d0fcf2e299 100644
--- a/plugins/TabSRMM/chat/log.cpp
+++ b/plugins/TabSRMM/chat/log.cpp
@@ -76,25 +76,17 @@ static char* u2a( const wchar_t* src, int codepage ) {
}
static char* t2acp( const TCHAR* src, int codepage ) {
- #if defined( _UNICODE )
- return u2a( src, codepage );
- #else
- return mir_strdup( src );
- #endif
+ return u2a( src, codepage );
}
static TCHAR *a2tcp(const char *text, int cp) {
if ( text != NULL ) {
- #if defined ( _UNICODE )
int cbLen = MultiByteToWideChar( cp, 0, text, -1, NULL, 0 );
TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
if ( result == NULL )
return NULL;
MultiByteToWideChar(cp, 0, text, -1, result, cbLen);
return result;
- #else
- return mir_strdup(text);
- #endif
}
return NULL;
}
@@ -200,13 +192,11 @@ static void AddEventToBufferIEView(TCHAR **buffer, int *bufferEnd, int *bufferAl
if ( streamData->lin->ptszText ) {
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
- #if defined( _UNICODE )
if (streamData->dat->codePage != CP_ACP) {
char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
ptszText = ptszTemp = a2tcp(aText, streamData->dat->codePage);
mir_free(aText);
}
- #endif
Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
mir_free(ptszTemp);
}
@@ -344,9 +334,7 @@ static void LogEventIEView(LOGSTREAMDATA *streamData, TCHAR *ptszNick)
}
ied.dwData |= g_Settings.ShowTime ? IEEDD_GC_SHOW_TIME : 0;
ied.dwData |= IEEDD_GC_SHOW_ICON;
-#if defined( _UNICODE )
ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
ied.next = NULL;
CallService(streamData->dat->hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event);
mir_free(buffer);
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 426a90d2d2..dd475d1a19 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1620,9 +1620,7 @@ create_it:
newItem->nextItem = 0;
curItem->nextItem = newItem;
}
-#ifdef _UNICODE
mir_free((void *)szItemNameA);
-#endif
return;
}
diff --git a/protocols/AimOscar/server.cpp b/protocols/AimOscar/server.cpp
index 490444303b..7cd4601dcd 100644
--- a/protocols/AimOscar/server.cpp
+++ b/protocols/AimOscar/server.cpp
@@ -1925,13 +1925,9 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018
if (new_mail && num_msgs)
{
TCHAR msg[1024];
-#ifdef _UNICODE
+
int len = mir_sntprintf(msg, SIZEOF(msg), _T("%S@%S (%d)\r\n%s "), sn, address, num_msgs,
TranslateT("You've got mail! Checked at")) ;
-#else
- int len = mir_sntprintf(msg, SIZEOF(msg), _T("%s@%s (%d)\r\n%s "), sn, address, num_msgs,
- TranslateT("You've got mail! Checked at")) ;
-#endif
SYSTEMTIME stLocal;
GetLocalTime(&stLocal);
diff --git a/protocols/IRCG/commandmonitor.cpp b/protocols/IRCG/commandmonitor.cpp
index 0f39828891..352d162c48 100644
--- a/protocols/IRCG/commandmonitor.cpp
+++ b/protocols/IRCG/commandmonitor.cpp
@@ -228,18 +228,11 @@ int CIrcProto::AddOutgoingMessageToDB(HANDLE hContact, TCHAR* msg)
dbei.szModule = m_szModuleName;
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.timestamp = (DWORD)time(NULL);
- #if defined( _UNICODE )
- dbei.flags = DBEF_SENT + DBEF_UTF;
- dbei.pBlob = ( PBYTE )mir_utf8encodeW( S.c_str());
- #else
- dbei.flags = DBEF_SENT;
- dbei.pBlob = ( PBYTE )S.c_str();
- #endif
+ dbei.flags = DBEF_SENT + DBEF_UTF;
+ dbei.pBlob = ( PBYTE )mir_utf8encodeW( S.c_str());
dbei.cbBlob = (DWORD)strlen(( char* )dbei.pBlob) + 1;
CallService( MS_DB_EVENT_ADD, (WPARAM) hContact, (LPARAM) & dbei);
- #if defined( _UNICODE )
- mir_free( dbei.pBlob );
- #endif
+ mir_free( dbei.pBlob );
return 1;
}
@@ -733,18 +726,12 @@ bool CIrcProto::OnIrc_PRIVMSG( const CIrcMessage* pmsg )
ccs.hContact = CList_AddContact( &user, false, true );
ccs.lParam = (LPARAM)&pre;
pre.timestamp = (DWORD)time(NULL);
- #if defined( _UNICODE )
- pre.flags = PREF_UTF;
- pre.szMessage = mir_utf8encodeW( mess.c_str());
- #else
- pre.szMessage = ( char* )mess.c_str();
- #endif
+ pre.flags = PREF_UTF;
+ pre.szMessage = mir_utf8encodeW( mess.c_str());
setTString(ccs.hContact, "User", pmsg->prefix.sUser.c_str());
setTString(ccs.hContact, "Host", pmsg->prefix.sHost.c_str());
CallService( MS_PROTO_CHAINRECV, 0, (LPARAM) & ccs);
- #if defined( _UNICODE )
- mir_free( pre.szMessage );
- #endif
+ mir_free( pre.szMessage );
return true;
}
@@ -841,12 +828,8 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg )
else if (pmsg->m_bIncoming && command == _T("version")) {
PostIrcMessage( _T("/NOTICE %s \001VERSION Miranda IM %s (IRC v.%s%s), (c) 2003-09 J.Persson, G.Hazan\001"),
pmsg->prefix.sNick.c_str(), _T("%mirver"), _T("%version"),
- #if defined( _UNICODE )
- _T(" Unicode"));
- #else
- "" );
- #endif
-
+ _T(" Unicode"));
+
TCHAR temp[300];
mir_sntprintf( temp, SIZEOF(temp), TranslateT("CTCP VERSION requested by %s"), pmsg->prefix.sNick.c_str());
DoEvent(GC_EVENT_INFORMATION, SERVERWINDOW, NULL, temp, NULL, NULL, NULL, true, false);
diff --git a/protocols/IRCG/irc.h b/protocols/IRCG/irc.h
index 13ec720381..823efec68e 100644
--- a/protocols/IRCG/irc.h
+++ b/protocols/IRCG/irc.h
@@ -515,9 +515,7 @@ struct CIrcProto : public PROTO_INTERFACE, public CCallocBase
INT_PTR DoEvent(int iEvent, const TCHAR* pszWindow, const TCHAR* pszNick, const TCHAR* pszText, const TCHAR* pszStatus, const TCHAR* pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe,time_t timestamp = 1);
void FindLocalIP(HANDLE con);
bool FreeWindowItemData(CMString window, CHANNELINFO* wis);
- #if defined( _UNICODE )
- bool IsChannel(const char* sName);
- #endif
+ bool IsChannel(const char* sName);
bool IsChannel(const TCHAR* sName);
void KillChatTimer(UINT_PTR &nIDEvent);
CMString MakeWndID(const TCHAR* sWindow);
@@ -578,9 +576,7 @@ struct CIrcProto : public PROTO_INTERFACE, public CCallocBase
void Disconnect(void);
void KillIdent(void);
- #if defined( _UNICODE )
- int NLSend(const TCHAR* fmt, ...);
- #endif
+ int NLSend(const TCHAR* fmt, ...);
int NLSend(const char* fmt, ...);
int NLSend(const unsigned char* buf, int cbBuf);
int NLSendNoScript( const unsigned char* buf, int cbBuf);
@@ -733,10 +729,8 @@ TCHAR* __stdcall my_strstri(const TCHAR *s1, const TCHAR *s2) ;
TCHAR* __stdcall DoColorCodes (const TCHAR* text, bool bStrip, bool bReplacePercent);
char* __stdcall rtrim( char *string );
-#if defined( _UNICODE )
- String& __stdcall ReplaceString (String& text, const char* replaceme, const char* newword);
- String __stdcall GetWord(const char* text, int index);
-#endif
+String& __stdcall ReplaceString (String& text, const char* replaceme, const char* newword);
+String __stdcall GetWord(const char* text, int index);
#define NEWSTR_ALLOCA(A) (A==NULL)?NULL:strcpy((char*)alloca(strlen(A)+1),A)
#define NEWTSTR_ALLOCA(A) (A==NULL)?NULL:_tcscpy((TCHAR*)alloca(sizeof(TCHAR)*(_tcslen(A)+1)),A)
diff --git a/protocols/IRCG/irclib.cpp b/protocols/IRCG/irclib.cpp
index a5d3ad1537..78d33f11dc 100644
--- a/protocols/IRCG/irclib.cpp
+++ b/protocols/IRCG/irclib.cpp
@@ -308,7 +308,6 @@ int CIrcProto::NLSend( const TCHAR* fmt, ...)
return result;
}
-#if defined( _UNICODE )
int CIrcProto::NLSend( const char* fmt, ...)
{
va_list marker;
@@ -320,7 +319,6 @@ int CIrcProto::NLSend( const char* fmt, ...)
return NLSend((unsigned char*)szBuf, cbLen );
}
-#endif
int CIrcProto::NLSendNoScript( const unsigned char* buf, int cbBuf)
{
@@ -355,15 +353,8 @@ void CIrcProto::createMessageFromPchar( const char* p )
{
TCHAR* ptszMsg;
if ( codepage != CP_UTF8 && m_utfAutodetect ) {
- #if defined( _UNICODE )
- if ( mir_utf8decodecp( NEWSTR_ALLOCA(p), codepage, &ptszMsg ) == NULL )
+ if ( mir_utf8decodecp( NEWSTR_ALLOCA(p), codepage, &ptszMsg ) == NULL )
ptszMsg = mir_a2t_cp( p, codepage );
- #else
- if ( mir_utf8decodecp( NEWSTR_ALLOCA(p), codepage, NULL ) == NULL )
- ptszMsg = mir_a2t_cp( p, codepage );
- else
- ptszMsg = mir_strdup( p );
- #endif
}
else ptszMsg = mir_a2t_cp( p, codepage );
CIrcMessage msg( this, ptszMsg, codepage, true );
diff --git a/protocols/IRCG/ircproto.cpp b/protocols/IRCG/ircproto.cpp
index 1d72f2ac88..f167eddad6 100644
--- a/protocols/IRCG/ircproto.cpp
+++ b/protocols/IRCG/ircproto.cpp
@@ -859,12 +859,7 @@ int __cdecl CIrcProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc )
else result = mir_a2t_cp( pszSrc, codepage );
}
else if ( flags & PREF_UTF ) {
- #if defined( _UNICODE )
- mir_utf8decode( NEWSTR_ALLOCA(pszSrc), &result );
- #else
- result = mir_strdup( pszSrc );
- mir_utf8decodecp( result, codepage, NULL );
- #endif
+ mir_utf8decode( NEWSTR_ALLOCA(pszSrc), &result );
}
else result = mir_a2t_cp( pszSrc, codepage );
diff --git a/protocols/IRCG/options.cpp b/protocols/IRCG/options.cpp
index 76f6a97afe..25cf9d38b1 100644
--- a/protocols/IRCG/options.cpp
+++ b/protocols/IRCG/options.cpp
@@ -66,7 +66,6 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count )
*( char** )ptr = NULL;
}
break;
- #if defined( _UNICODE )
case DBVT_TCHAR:
if ( !getTString( p->name, &dbv )) {
if ( p->size != -1 ) {
@@ -87,7 +86,6 @@ void CIrcProto::ReadSettings( TDbSetting* sets, int count )
else *( TCHAR** )ptr = mir_tstrdup( p->defStr );
}
break;
- #endif
} } }
void CIrcProto::WriteSettings( TDbSetting* sets, int count )
@@ -109,14 +107,12 @@ void CIrcProto::WriteSettings( TDbSetting* sets, int count )
setString( p->name, (char*)ptr );
break;
- #if defined( _UNICODE )
case DBVT_TCHAR:
if ( p->size == -1 )
setTString( p->name, *(TCHAR**)ptr );
else
setTString( p->name, (TCHAR*)ptr );
break;
- #endif
} } }
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1098,12 +1094,8 @@ void COtherPrefsDlg::OnInitDialog()
m_add.Enable( m_proto->m_perform );
m_delete.Enable( m_proto->m_perform );
- #if defined( _UNICODE )
- fnGetCPInfoEx = ( pfnGetCPInfoEx )GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetCPInfoExW" );
- #else
- fnGetCPInfoEx = ( pfnGetCPInfoEx )GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetCPInfoExA" );
- #endif
-
+ fnGetCPInfoEx = ( pfnGetCPInfoEx )GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetCPInfoExW" );
+
m_codepage.AddString( TranslateT("Default ANSI codepage"), CP_ACP );
if ( fnGetCPInfoEx == NULL )
m_codepage.AddString( TranslateT("UTF-8"), CP_UTF8 );
@@ -1118,10 +1110,7 @@ void COtherPrefsDlg::OnInitDialog()
break;
} }
- #if !defined( _UNICODE )
- m_codepage.Enable( FALSE );
- #endif
-
+
if ( m_proto->m_codepage == CP_UTF8 )
m_autodetect.Disable();
diff --git a/protocols/IRCG/tools.cpp b/protocols/IRCG/tools.cpp
index f2424c5689..5044c12715 100644
--- a/protocols/IRCG/tools.cpp
+++ b/protocols/IRCG/tools.cpp
@@ -231,7 +231,6 @@ void __stdcall RemoveLinebreaks( CMString& Message )
Message.Delete(Message.GetLength()-2, 2);
}
-#if defined( _UNICODE )
String& __stdcall ReplaceString ( String& text, const char* replaceme, const char* newword )
{
if ( !text.IsEmpty() && replaceme != NULL) {
@@ -244,7 +243,6 @@ String& __stdcall ReplaceString ( String& text, const char* replaceme, const cha
return text;
}
-#endif
CMString& __stdcall ReplaceString ( CMString& text, const TCHAR* replaceme, const TCHAR* newword)
{
@@ -321,7 +319,6 @@ bool CIrcProto::IsChannel(const TCHAR* sName)
return ( sChannelPrefixes.Find( sName[0] ) != -1 );
}
-#if defined( _UNICODE )
String __stdcall GetWord(const char* text, int index)
{
if ( text && text[0] ) {
@@ -358,7 +355,6 @@ bool CIrcProto::IsChannel(const char* sName)
{
return ( sChannelPrefixes.Find( sName[0] ) != -1 );
}
-#endif
TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2)
{
diff --git a/protocols/IRCG/ui_utils.cpp b/protocols/IRCG/ui_utils.cpp
index a7c6477e29..5e3a41fb87 100644
--- a/protocols/IRCG/ui_utils.cpp
+++ b/protocols/IRCG/ui_utils.cpp
@@ -1685,14 +1685,10 @@ TCHAR* CCtrlBase::GetText()
char* CCtrlBase::GetTextA()
{
- #ifdef UNICODE
- int length = GetWindowTextLength(m_hwnd) + 1;
- char *result = (char *)mir_alloc(length * sizeof(char));
- GetWindowTextA(m_hwnd, result, length);
- return result;
- #else
- return GetText();
- #endif
+ int length = GetWindowTextLength(m_hwnd) + 1;
+ char *result = (char *)mir_alloc(length * sizeof(char));
+ GetWindowTextA(m_hwnd, result, length);
+ return result;
}
TCHAR* CCtrlBase::GetText(TCHAR *buf, int size)
@@ -1704,13 +1700,9 @@ TCHAR* CCtrlBase::GetText(TCHAR *buf, int size)
char* CCtrlBase::GetTextA(char *buf, int size)
{
- #ifdef UNICODE
- GetWindowTextA(m_hwnd, buf, size);
- buf[size-1] = 0;
- return buf;
- #else
- return GetText(buf, size);
- #endif
+ GetWindowTextA(m_hwnd, buf, size);
+ buf[size-1] = 0;
+ return buf;
}
int CCtrlBase::GetInt()
diff --git a/protocols/IRCG/ui_utils.h b/protocols/IRCG/ui_utils.h
index b8d6cc0eca..60566ce913 100644
--- a/protocols/IRCG/ui_utils.h
+++ b/protocols/IRCG/ui_utils.h
@@ -105,13 +105,8 @@ typedef struct tagLVSETINFOTIP
int iItem;
int iSubItem;
} LVSETINFOTIP, *PLVSETINFOTIP;
-#ifndef _UNICODE
- #define LPLVCOLUMN LPLVCOLUMNA
- #define LPLVITEM LPLVITEMA
-#else
- #define LPLVCOLUMN LPLVCOLUMNW
- #define LPLVITEM LPLVITEMW
-#endif
+#define LPLVCOLUMN LPLVCOLUMNA
+#define LPLVITEM LPLVITEMA
#define LVN_BEGINSCROLL (LVN_FIRST-80)
#define LVN_ENDSCROLL (LVN_FIRST-81)
#define LVN_HOTTRACK (LVN_FIRST-21)
diff --git a/protocols/IRCG/windows.cpp b/protocols/IRCG/windows.cpp
index 79a1b8011f..6eef163d34 100644
--- a/protocols/IRCG/windows.cpp
+++ b/protocols/IRCG/windows.cpp
@@ -928,13 +928,9 @@ void CManagerDlg::OnClose()
if ( !S.IsEmpty() && m_proto->IsConnected() ) {
mir_sntprintf( temp, SIZEOF(temp), _T("Topic%s%s"), window, m_proto->m_info.sNetwork.c_str());
- #if defined( _UNICODE )
- char* p = mir_t2a(temp);
- m_proto->setTString(p, S.c_str());
- mir_free(p);
- #else
- m_proto->setString(temp, S.c_str());
- #endif
+ char* p = mir_t2a(temp);
+ m_proto->setTString(p, S.c_str());
+ mir_free(p);
}
DestroyWindow( m_hwnd);
}
@@ -1280,11 +1276,8 @@ void CManagerDlg::InitManager( int mode, const TCHAR* window )
TCHAR temp[1000];
mir_sntprintf(temp, SIZEOF(temp), _T("Topic%s%s"), window, m_proto->m_info.sNetwork.c_str());
- #if defined( _UNICODE )
- char* p = mir_t2a(temp);
- #else
- char* p = temp;
- #endif
+ char* p = mir_t2a(temp);
+
DBVARIANT dbv;
if ( !m_proto->getTString( p, &dbv )) {
for ( int i = 0; i<5; i++ ) {
@@ -1298,9 +1291,7 @@ void CManagerDlg::InitManager( int mode, const TCHAR* window )
} }
DBFreeVariant(&dbv);
}
- #if defined( _UNICODE )
- mir_free(p);
- #endif
+ mir_free(p);
}
if ( wi->pszTopic )
diff --git a/protocols/IcqOscarJ/UI/userinfotab.cpp b/protocols/IcqOscarJ/UI/userinfotab.cpp
index 36f90347ca..788dd2ca31 100644
--- a/protocols/IcqOscarJ/UI/userinfotab.cpp
+++ b/protocols/IcqOscarJ/UI/userinfotab.cpp
@@ -266,11 +266,7 @@ static INT_PTR CALLBACK IcqDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SetValue(ppro, hwndDlg, IDC_PORT, hContact, (char*)DBVT_WORD, (char*)ppro->wListenPort, SVS_ZEROISUNSPEC);
SetValue(ppro, hwndDlg, IDC_VERSION, hContact, (char*)DBVT_WORD, (char*)ICQ_VERSION, SVS_ICQVERSION);
-#if defined( _UNICODE )
SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, MirandaVersionToString(str, TRUE, ICQ_PLUG_VERSION, MIRANDA_VERSION), SVS_ZEROISUNSPEC);
-#else
- SetValue(ppro, hwndDlg, IDC_MIRVER, hContact, (char*)DBVT_ASCIIZ, MirandaVersionToString(str, FALSE, ICQ_PLUG_VERSION, MIRANDA_VERSION), SVS_ZEROISUNSPEC);
-#endif
SetDlgItemTextUtf(hwndDlg, IDC_SUPTIME, ICQTranslateUtfStatic(LPGEN("Member since:"), str, MAX_PATH));
SetValue(ppro, hwndDlg, IDC_SYSTEMUPTIME, hContact, szProto, "MemberTS", SVS_TIMESTAMP);
SetValue(ppro, hwndDlg, IDC_STATUS, hContact, (char*)DBVT_WORD, (char*)ppro->m_iStatus, SVS_STATUSID);
diff --git a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp
index 127521eafc..a78fc64016 100644
--- a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp
+++ b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp
@@ -41,19 +41,12 @@ static int DrawTextUtf(HDC hDC, char *text, LPRECT lpRect, UINT uFormat, LPSIZE
{
int res;
- #if defined( _UNICODE )
- WCHAR *tmp = make_unicode_string(text);
- res = DrawTextW(hDC, tmp, -1, lpRect, uFormat);
- if (lpSize)
- GetTextExtentPoint32W(hDC, tmp, strlennull(tmp), lpSize);
- SAFE_FREE((void**)&tmp);
- #else
- // caution, here we change text's contents
- utf8_decode_static(text, (char*)text, strlennull(text) + 1);
- res = DrawTextA(hDC, (char*)text, -1, lpRect, uFormat);
- if (lpSize)
- GetTextExtentPoint32A(hDC, (char*)text, strlennull(text), lpSize);
- #endif
+ WCHAR *tmp = make_unicode_string(text);
+ res = DrawTextW(hDC, tmp, -1, lpRect, uFormat);
+ if (lpSize)
+ GetTextExtentPoint32W(hDC, tmp, strlennull(tmp), lpSize);
+ SAFE_FREE((void**)&tmp);
+
return res;
}
diff --git a/protocols/IcqOscarJ/fam_01service.cpp b/protocols/IcqOscarJ/fam_01service.cpp
index 1d46fad6c1..e12474d375 100644
--- a/protocols/IcqOscarJ/fam_01service.cpp
+++ b/protocols/IcqOscarJ/fam_01service.cpp
@@ -845,11 +845,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info)
packDWord(&packet, dwDirectCookie); // DC Cookie
packDWord(&packet, WEBFRONTPORT); // Web front port
packDWord(&packet, CLIENTFEATURES); // Client features
-#if defined( _UNICODE )
- packDWord(&packet, 0x7fffffff); // Abused timestamp
-#else
- packDWord(&packet, 0xffffffff); // Abused timestamp
-#endif
+ packDWord(&packet, 0x7fffffff); // Abused timestamp
packDWord(&packet, ICQ_PLUG_VERSION); // Abused timestamp
if (ServiceExists("SecureIM/IsContactSecured"))
packDWord(&packet, 0x5AFEC0DE); // SecureIM Abuse
diff --git a/protocols/IcqOscarJ/i18n.h b/protocols/IcqOscarJ/i18n.h
index d1e1f48af9..2721779ec9 100644
--- a/protocols/IcqOscarJ/i18n.h
+++ b/protocols/IcqOscarJ/i18n.h
@@ -65,21 +65,11 @@ int __stdcall utf8_decode(const char *from, char **to);
int __stdcall utf8_decode_codepage(const char *from, char **to, WORD wCp);
int __stdcall utf8_decode_static(const char *from, char *to, int to_size);
-#ifdef _UNICODE
- #define tchar_to_utf8 make_utf8_string
- #define utf8_to_tchar_static make_unicode_string_static
- #define utf8_to_tchar make_unicode_string
- #define ansi_to_tchar ansi_to_unicode
- #define tchar_to_ansi unicode_to_ansi
-#else
- __inline char* utf8_decode_func(const char *utf8) { char *ansi = NULL; utf8_decode(utf8, &ansi); return ansi; };
-
- #define tchar_to_utf8 ansi_to_utf8
- #define utf8_to_tchar_static utf8_decode_static
- #define utf8_to_tchar utf8_decode_func
- #define ansi_to_tchar null_strdup
- #define tchar_to_ansi null_strdup
-#endif
+#define tchar_to_utf8 make_utf8_string
+#define utf8_to_tchar_static make_unicode_string_static
+#define utf8_to_tchar make_unicode_string
+#define ansi_to_tchar ansi_to_unicode
+#define tchar_to_ansi unicode_to_ansi
void InitI18N(void);
diff --git a/protocols/IcqOscarJ/icq_popups.cpp b/protocols/IcqOscarJ/icq_popups.cpp
index 3bc1382ef2..c593dd6367 100644
--- a/protocols/IcqOscarJ/icq_popups.cpp
+++ b/protocols/IcqOscarJ/icq_popups.cpp
@@ -235,7 +235,6 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz
strcat(szSetting, "Timeout");
ppd.iSeconds = getSettingDword(NULL, szSetting, ppd.iSeconds);
-#if defined( _UNICODE )
// call unicode popup module - only on unicode OS otherwise it will not work properly :(
// due to Popup Plug bug in ADDPOPUPW implementation
if ( ServiceExists( MS_POPUP_ADDPOPUPW ))
@@ -254,7 +253,7 @@ int CIcqProto::ShowPopUpMsg(HANDLE hContact, const char *szTitle, const char *sz
return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppdw, 0);
}
else
-#endif
+
{
char str[MAX_PATH];
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp
index b87f21180a..685c3142a5 100644
--- a/protocols/IcqOscarJ/icq_proto.cpp
+++ b/protocols/IcqOscarJ/icq_proto.cpp
@@ -940,9 +940,7 @@ HANDLE __cdecl CIcqProto::SearchBasic( const PROTOCHAR *pszSearch )
{ // we remove spaces and slashes
if ((pszSearch[i]!=0x20) && (pszSearch[i]!='-'))
{
-#ifdef _UNICODE
if (pszSearch[i] >= 0x80) continue;
-#endif
pszUIN[j] = pszSearch[i];
j++;
}
diff --git a/protocols/IcqOscarJ/icq_uploadui.cpp b/protocols/IcqOscarJ/icq_uploadui.cpp
index 1de6ebf08e..6073de6b10 100644
--- a/protocols/IcqOscarJ/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/icq_uploadui.cpp
@@ -156,19 +156,9 @@ static void DeleteLastUploadLogLine(HWND hwndDlg)
static void GetLastUploadLogLine(HWND hwndDlg, char *szBuf, size_t cbBuf)
{
- #if defined( _UNICODE )
- WCHAR str[MAX_PATH];
- SendDlgItemMessageW(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
- make_utf8_string_static(str, szBuf, cbBuf);
- #else
- char str[MAX_PATH];
- char *ustr = NULL;
-
- SendDlgItemMessageA(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
- utf8_encode(str, &ustr);
- strcpy((char*)szBuf, (char*)ustr);
- SAFE_FREE((void**)&ustr);
- #endif
+ WCHAR str[MAX_PATH];
+ SendDlgItemMessageW(hwndDlg, IDC_LOG, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_LOG, LB_GETCOUNT, 0, 0)-1, (LPARAM)str);
+ make_utf8_string_static(str, szBuf, cbBuf);
}
static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
diff --git a/protocols/IcqOscarJ/init.cpp b/protocols/IcqOscarJ/init.cpp
index c9413ab977..ada5e55a93 100644
--- a/protocols/IcqOscarJ/init.cpp
+++ b/protocols/IcqOscarJ/init.cpp
@@ -136,7 +136,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
}
// Check if _UNICODE matches Miranda's _UNICODE
-#if defined( _UNICODE )
if (strstrnull(szVer, "unicode") == NULL)
{
char szMsg[MAX_PATH], szCaption[100];
@@ -145,14 +144,6 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
ICQTranslateUtfStatic("ICQ Plugin", szCaption, 100), MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
return 1; // Failure
}
-#else
- if (strstrnull(szVer, "unicode") != NULL)
- {
- MessageBox(NULL, Translate("You cannot use Ansi version of ICQ Protocol plug-in with Unicode version of Miranda IM."), Translate("ICQ Plugin"),
- MB_OK|MB_ICONWARNING|MB_SETFOREGROUND|MB_TOPMOST);
- return 1; // Failure
- }
-#endif
}
srand(time(NULL));
diff --git a/protocols/IcqOscarJ/log.cpp b/protocols/IcqOscarJ/log.cpp
index c6ff958f70..cb8f923b36 100644
--- a/protocols/IcqOscarJ/log.cpp
+++ b/protocols/IcqOscarJ/log.cpp
@@ -136,11 +136,9 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, SIZEOF(err), NULL))
{
-#if defined( _UNICODE )
- pszErrorMsg = make_utf8_string(err);
-#else
- utf8_encode(err, &pszErrorMsg);
-#endif
+
+ pszErrorMsg = make_utf8_string(err);
+
bNeedFree = TRUE;
}
break;
diff --git a/protocols/IcqOscarJ/utilities.cpp b/protocols/IcqOscarJ/utilities.cpp
index c9124a0aa1..d80457d11b 100644
--- a/protocols/IcqOscarJ/utilities.cpp
+++ b/protocols/IcqOscarJ/utilities.cpp
@@ -1964,7 +1964,6 @@ const char* ExtractFileName(const char *fullname)
char* FileNameToUtf(const TCHAR *filename)
{
-#if defined( _UNICODE )
// reasonable only on NT systems
HINSTANCE hKernel = GetModuleHandle(_T("KERNEL32"));
DWORD (CALLBACK *RealGetLongPathName)(LPCWSTR, LPWSTR, DWORD);
@@ -1981,9 +1980,6 @@ char* FileNameToUtf(const TCHAR *filename)
return make_utf8_string(usFileName);
}
return make_utf8_string(filename);
-#else
- return ansi_to_utf8(filename);
-#endif
}
@@ -2059,41 +2055,16 @@ int OpenFileUtf(const char *filename, int oflag, int pmode)
WCHAR *GetWindowTextUcs(HWND hWnd)
{
WCHAR *utext;
-
-#if defined( _UNICODE )
int nLen = GetWindowTextLengthW(hWnd);
-
utext = (WCHAR*)SAFE_MALLOC((nLen+2)*sizeof(WCHAR));
GetWindowTextW(hWnd, utext, nLen + 1);
-#else
- char *text;
- int wchars, nLen = GetWindowTextLengthA(hWnd);
-
- text = (char*)_alloca(nLen+2);
- GetWindowTextA(hWnd, text, nLen + 1);
-
- wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text,
- strlennull(text), NULL, 0);
-
- utext = (WCHAR*)SAFE_MALLOC((wchars + 1)*sizeof(WCHAR));
-
- MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, text,
- strlennull(text), utext, wchars);
-#endif
return utext;
}
void SetWindowTextUcs(HWND hWnd, WCHAR *text)
{
-#if defined( _UNICODE )
SetWindowTextW(hWnd, text);
-#else
- char *tmp = (char*)SAFE_MALLOC(strlennull(text) + 1);
- WideCharToMultiByte(CP_ACP, 0, text, -1, tmp, strlennull(text)+1, NULL, NULL);
- SetWindowTextA(hWnd, tmp);
- SAFE_FREE((void**)&tmp);
-#endif
}
@@ -2135,19 +2106,9 @@ static int ControlAddStringUtf(HWND ctrl, DWORD msg, const char *szString)
char str[MAX_PATH];
char *szItem = ICQTranslateUtfStatic(szString, str, MAX_PATH);
int item = -1;
-
-#if defined( _UNICODE )
WCHAR *wItem = make_unicode_string(szItem);
item = SendMessage(ctrl, msg, 0, (LPARAM)wItem);
SAFE_FREE((void**)&wItem);
-#else
- int size = strlennull(szItem) + 2;
- char *aItem = (char*)_alloca(size);
-
- if (utf8_decode_static(szItem, aItem, size))
- item = SendMessage(ctrl, msg, 0, (LPARAM)aItem);
-#endif
-
return item;
}
@@ -2169,23 +2130,11 @@ int MessageBoxUtf(HWND hWnd, const char *szText, const char *szCaption, UINT uTy
int res;
char str[1024];
char cap[MAX_PATH];
-
-#if defined( _UNICODE )
WCHAR *text = make_unicode_string(ICQTranslateUtfStatic(szText, str, 1024));
WCHAR *caption = make_unicode_string(ICQTranslateUtfStatic(szCaption, cap, MAX_PATH));
res = MessageBoxW(hWnd, text, caption, uType);
SAFE_FREE((void**)&caption);
SAFE_FREE((void**)&text);
-#else
- int size = strlennull(szText) + 2, size2 = strlennull(szCaption) + 2;
- char *text = (char*)_alloca(size);
- char *caption = (char*)_alloca(size2);
-
- utf8_decode_static(ICQTranslateUtfStatic(szText, str, 1024), text, size);
- utf8_decode_static(ICQTranslateUtfStatic(szCaption, cap, MAX_PATH), caption, size2);
- res = MessageBoxA(hWnd, text, caption, uType);
-#endif
-
return res;
}
diff --git a/protocols/JabberG/jabber.h b/protocols/JabberG/jabber.h
index fd4e8a77b1..d3b13bf447 100644
--- a/protocols/JabberG/jabber.h
+++ b/protocols/JabberG/jabber.h
@@ -656,9 +656,7 @@ void __stdcall replaceStr( char*& dest, const char* src );
void __stdcall replaceStr( WCHAR*& dest, const WCHAR* src );
int lstrcmp_null(const TCHAR *s1, const TCHAR *s2);
char* __stdcall rtrim( char *string );
-#if defined( _UNICODE )
- TCHAR* __stdcall rtrim( TCHAR *string );
-#endif
+TCHAR* __stdcall rtrim( TCHAR *string );
//---- jabber_menu.c ------------------------------------------------
@@ -762,13 +760,8 @@ TCHAR* __stdcall JabberStripJid( const TCHAR* jid, TCHAR* dest, size_t de
int __stdcall JabberGetPictureType( const char* buf );
int __stdcall JabberGetPacketID( HXML n );
-#if defined( _UNICODE )
- #define JabberUnixToDosT JabberUnixToDosW
- #define JabberBase64DecodeT JabberBase64DecodeW
-#else
- #define JabberUnixToDosT JabberUnixToDos
- #define JabberBase64DecodeT JabberBase64Decode
-#endif
+#define JabberUnixToDosT JabberUnixToDosW
+#define JabberBase64DecodeT JabberBase64DecodeW
const TCHAR *JabberStrIStr( const TCHAR *str, const TCHAR *substr);
void JabberCopyText(HWND hwnd, TCHAR *text);
diff --git a/protocols/JabberG/jabber_caps.cpp b/protocols/JabberG/jabber_caps.cpp
index 6dfb279ba5..9c3f69b31f 100644
--- a/protocols/JabberG/jabber_caps.cpp
+++ b/protocols/JabberG/jabber_caps.cpp
@@ -697,11 +697,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest( HXML, CJabberIqInfo* pInfo, co
form << XCHILD( _T("field")) << XATTR( _T("var"), _T("os")) << XCHILD( _T("value"), _T("Microsoft Windows"));
form << XCHILD( _T("field")) << XATTR( _T("var"), _T("os_version")) << XCHILD( _T("value"), os );
}
- #ifdef _UNICODE
- form << XCHILD( _T("field")) << XATTR( _T("var"), _T("software")) << XCHILD( _T("value"), _T("Miranda IM Jabber Protocol (Unicode)"));
- #else
- form << XCHILD( _T("field")) << XATTR( _T("var"), _T("software")) << XCHILD( _T("value"), _T("Miranda IM Jabber Protocol"));
- #endif
+ form << XCHILD( _T("field")) << XATTR( _T("var"), _T("software")) << XCHILD( _T("value"), _T("Miranda IM Jabber Protocol (Unicode)"));
form << XCHILD( _T("field")) << XATTR( _T("var"), _T("software_version")) << XCHILD( _T("value"), _T(__VERSION_STRING));
form << XCHILD( _T("field")) << XATTR( _T("var"), _T("x-miranda-core-version")) << XCHILD( _T("value"), szCoreVersion );
diff --git a/protocols/JabberG/jabber_console.cpp b/protocols/JabberG/jabber_console.cpp
index 9d750f6425..0f728b25ec 100644
--- a/protocols/JabberG/jabber_console.cpp
+++ b/protocols/JabberG/jabber_console.cpp
@@ -53,13 +53,8 @@ struct StringBuf
};
static void sttAppendBufRaw(StringBuf *buf, const char *str);
-
-#ifdef UNICODE
- static void sttAppendBufW(StringBuf *buf, const WCHAR *str);
- #define sttAppendBufT(a,b) (sttAppendBufW((a),(b)))
-#else
- #define sttAppendBufT(a,b) (sttAppendBufA((a),(b)))
-#endif
+static void sttAppendBufW(StringBuf *buf, const WCHAR *str);
+#define sttAppendBufT(a,b) (sttAppendBufW((a),(b)))
static void sttEmptyBuf(StringBuf *buf);
#define RTF_HEADER \
@@ -186,7 +181,6 @@ static void sttAppendBufRaw(StringBuf *buf, const char *str)
buf->offset += length;
}
-#ifdef UNICODE
static void sttAppendBufW(StringBuf *buf, const WCHAR *str)
{
char tmp[32];
@@ -214,38 +208,6 @@ static void sttAppendBufW(StringBuf *buf, const WCHAR *str)
}
sttAppendBufRaw(buf, "}");
}
-#else
- static void sttAppendBufA(StringBuf *buf, const char *str)
-
- {
- char tmp[32];
-
- if (!str) return;
-
- for (const char *p = str; *p; ++p)
-
- {
- if ((*p == '\\') || (*p == '{') || (*p == '}'))
- {
- tmp[0] = '\\';
- tmp[1] = (char)*p;
- tmp[2] = 0;
- } else
-
- {
- tmp[0] = (char)*p;
- tmp[1] = 0;
-
-
-
- }
- sttAppendBufRaw(buf, tmp);
- }
-
- }
-
- #define sttAppendBufW sttAppendBufA
-#endif
static void sttEmptyBuf(StringBuf *buf)
{
diff --git a/protocols/JabberG/jabber_disco.h b/protocols/JabberG/jabber_disco.h
index 9daca0ffb7..372a9b1379 100644
--- a/protocols/JabberG/jabber_disco.h
+++ b/protocols/JabberG/jabber_disco.h
@@ -28,12 +28,8 @@ Last change by : $Author: george.hazan $
#ifndef _JABBER_DISCO_H_
#define _JABBER_DISCO_H_
-#ifdef _UNICODE
- #define CHR_BULLET ((WCHAR)0x2022)
+#define CHR_BULLET ((WCHAR)0x2022)
// #define STR_BULLET L" \u2022 "
-#else
- #define CHR_BULLET '-'
-#endif
#define JABBER_DISCO_RESULT_NOT_REQUESTED 0
#define JABBER_DISCO_RESULT_ERROR -1
diff --git a/protocols/JabberG/jabber_groupchat.cpp b/protocols/JabberG/jabber_groupchat.cpp
index 4f6dde53df..6a60c59113 100644
--- a/protocols/JabberG/jabber_groupchat.cpp
+++ b/protocols/JabberG/jabber_groupchat.cpp
@@ -500,11 +500,8 @@ void CJabberDlgGcJoin::OnInitDialog()
else
{
OpenClipboard(m_hwnd);
-#ifdef UNICODE
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
-#else
- HANDLE hData = GetClipboardData(CF_TEXT);
-#endif
+
if (hData)
{
TCHAR *buf = (TCHAR *)GlobalLock(hData);
diff --git a/protocols/JabberG/jabber_iq_handlers.cpp b/protocols/JabberG/jabber_iq_handlers.cpp
index bcb7192c5b..ca1a69ad44 100644
--- a/protocols/JabberG/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/jabber_iq_handlers.cpp
@@ -296,11 +296,7 @@ BOOL CJabberProto::OnIqRequestVersion( HXML, CJabberIqInfo* pInfo )
XmlNodeIq iq( _T("result"), pInfo );
HXML query = iq << XQUERY( _T(JABBER_FEAT_VERSION));
- #if defined( _UNICODE )
- query << XCHILD( _T("name"), _T("Miranda IM Jabber (Unicode)") );
- #else
- query << XCHILD( _T("name"), _T("Miranda IM Jabber") );
- #endif
+ query << XCHILD( _T("name"), _T("Miranda IM Jabber (Unicode)") );
query << XCHILD( _T("version"), _T(__VERSION_STRING) );
if ( m_options.ShowOSVersion )
diff --git a/protocols/JabberG/jabber_libstr.cpp b/protocols/JabberG/jabber_libstr.cpp
index 128528a266..78565bfa1a 100644
--- a/protocols/JabberG/jabber_libstr.cpp
+++ b/protocols/JabberG/jabber_libstr.cpp
@@ -63,7 +63,6 @@ int lstrcmp_null(const TCHAR *s1, const TCHAR *s2)
return lstrcmp(s1, s2);
}
-#if defined( _UNICODE )
TCHAR* __stdcall rtrim( TCHAR *string )
{
TCHAR* p = string + _tcslen( string ) - 1;
@@ -76,4 +75,3 @@ TCHAR* __stdcall rtrim( TCHAR *string )
}
return string;
}
-#endif
diff --git a/protocols/JabberG/jabber_opt.cpp b/protocols/JabberG/jabber_opt.cpp
index 5baae257e7..46665e7a63 100644
--- a/protocols/JabberG/jabber_opt.cpp
+++ b/protocols/JabberG/jabber_opt.cpp
@@ -38,11 +38,7 @@ static BOOL (WINAPI *pfnEnableThemeDialogTexture)(HANDLE, DWORD) = 0;
/////////////////////////////////////////////////////////////////////////////////////////
// JabberRegisterDlgProc - the dialog proc for registering new account
-#if defined( _UNICODE )
- #define STR_FORMAT _T("%s %s@%S:%d?")
-#else
- #define STR_FORMAT _T("%s %s@%s:%d?")
-#endif
+#define STR_FORMAT _T("%s %s@%S:%d?")
struct { TCHAR *szCode; TCHAR *szDescription; } g_LanguageCodes[] = {
{ _T("aa"), _T("Afar") },
@@ -968,11 +964,7 @@ public:
#include <io.h>
#define JM_STATUSCHANGED WM_USER+0x0001
-#ifdef UNICODE
#define fopent(name, mode) _wfopen(name, mode)
-#else
-#define fopent(name, mode) fopen(name, mode)
-#endif
enum {
RRA_FILLLIST = 0,
diff --git a/protocols/JabberG/jabber_secur.cpp b/protocols/JabberG/jabber_secur.cpp
index 12577bb9e2..2dc9c29e68 100644
--- a/protocols/JabberG/jabber_secur.cpp
+++ b/protocols/JabberG/jabber_secur.cpp
@@ -70,13 +70,9 @@ TNtlmAuth::~TNtlmAuth()
bool TNtlmAuth::getSpn( TCHAR* szSpn, size_t dwSpnLen )
{
-#ifdef UNICODE
GetUserNameExType myGetUserNameEx =
( GetUserNameExType )GetProcAddress( GetModuleHandleA( "secur32.dll" ), "GetUserNameExW" );
-#else
- GetUserNameExType myGetUserNameEx =
- ( GetUserNameExType )GetProcAddress( GetModuleHandleA( "secur32.dll" ), "GetUserNameExA" );
-#endif
+
if ( !myGetUserNameEx ) return false;
TCHAR szFullUserName[128] = _T( "" );
diff --git a/protocols/JabberG/jabber_std.cpp b/protocols/JabberG/jabber_std.cpp
index abf40979a9..a480b82924 100644
--- a/protocols/JabberG/jabber_std.cpp
+++ b/protocols/JabberG/jabber_std.cpp
@@ -240,13 +240,8 @@ TCHAR* CJabberProto::JGetStringCrypt( HANDLE hContact, char* valueName )
return NULL;
sttCryptString(dbv.pszVal);
-
-#ifdef UNICODE
WCHAR *res = mir_utf8decodeW(dbv.pszVal);
-#else
- mir_utf8decode(dbv.pszVal, NULL);
- char *res = mir_strdup(dbv.pszVal);
-#endif
+
DBFreeVariant(&dbv);
return res;
diff --git a/protocols/JabberG/jabber_svc.cpp b/protocols/JabberG/jabber_svc.cpp
index ed5bfd7b78..37cc368549 100644
--- a/protocols/JabberG/jabber_svc.cpp
+++ b/protocols/JabberG/jabber_svc.cpp
@@ -521,12 +521,9 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI( WPARAM wParam, LPARAM l
szDelim = 0;
JabberHttpUrlDecode( szMsgBody );
} }
- #if defined(_UNICODE)
- CallService(MS_MSG_SENDMESSAGE "W",(WPARAM)hContact, (LPARAM)szMsgBody);
- #else
- CallService( MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)szMsgBody );
- #endif
-
+
+ CallService(MS_MSG_SENDMESSAGE "W",(WPARAM)hContact, (LPARAM)szMsgBody);
+
return 0;
}
return 1;
@@ -759,11 +756,7 @@ INT_PTR __cdecl CJabberProto::JabberGetApi( WPARAM wParam, LPARAM lParam )
DWORD CJabberInterface::GetFlags() const
{
-#ifdef _UNICODE
return JIF_UNICODE;
-#else
- return 0;
-#endif
}
int CJabberInterface::GetVersion() const
diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp
index bfb3ba0129..116328250f 100644
--- a/protocols/JabberG/jabber_thread.cpp
+++ b/protocols/JabberG/jabber_thread.cpp
@@ -498,12 +498,8 @@ recvRest:
buffer[datalen] = '\0';
TCHAR* str;
- #if defined( _UNICODE )
- str = mir_utf8decodeW( buffer );
- #else
- str = buffer;
- #endif
-
+ str = mir_utf8decodeW( buffer );
+
int bytesParsed = 0;
XmlNode root( str, &bytesParsed, tag );
if ( root && tag )
@@ -516,18 +512,14 @@ recvRest:
root = XmlNode();
bytesParsed = 0;
}
- #if defined( _UNICODE )
- mir_free(str);
- #endif
+
+ mir_free(str);
+
}
else {
- #if defined( _UNICODE )
if ( root ) str[ bytesParsed ] = 0;
bytesParsed = ( root ) ? mir_utf8lenW( str ) : 0;
mir_free(str);
- #else
- bytesParsed = ( root ) ? bytesParsed : 0;
- #endif
}
Log( "bytesParsed = %d", bytesParsed );
@@ -1480,12 +1472,8 @@ void CJabberProto::OnProcessMessage( HXML node, ThreadData* info )
if (( szMessage = JabberUnixToDosT( szMessage )) == NULL )
szMessage = mir_tstrdup( _T(""));
- #if defined( _UNICODE )
char* buf = mir_utf8encodeW( szMessage );
- #else
- char* buf = mir_utf8encode( szMessage );
- #endif
-
+
if ( item != NULL ) {
if ( resourceStatus ) resourceStatus->bMessageSessionActive = TRUE;
if ( hContact != NULL )
@@ -2134,11 +2122,9 @@ int ThreadData::send( HXML node )
// strip forbidden control characters from outgoing XML stream
TCHAR *q = str;
for (TCHAR *p = str; *p; ++p) {
- #if defined( _UNICODE )
+
WCHAR c = *p;
- #else
- WCHAR c = *( BYTE* )p;
- #endif
+
if (c < 0x9 || c > 0x9 && c < 0xA || c > 0xA && c < 0xD || c > 0xD && c < 0x20 || c > 0xD7FF && c < 0xE000 || c > 0xFFFD)
continue;
@@ -2146,13 +2132,11 @@ int ThreadData::send( HXML node )
}
*q = 0;
- #if defined( _UNICODE )
+
char* utfStr = mir_utf8encodeT( str );
int result = send( utfStr, (int)strlen( utfStr ));
mir_free( utfStr );
- #else
- int result = send( str, (int)strlen( str ));
- #endif
+
xi.freeMem( str );
return result;
}
diff --git a/protocols/JabberG/jabber_util.cpp b/protocols/JabberG/jabber_util.cpp
index c6fee74296..7c9867a377 100644
--- a/protocols/JabberG/jabber_util.cpp
+++ b/protocols/JabberG/jabber_util.cpp
@@ -354,12 +354,9 @@ void __stdcall JabberUtfToTchar( const char* pszValue, size_t cbLen, LPTSTR& des
JabberUrlDecode( pszCopy );
- #if defined( _UNICODE )
- mir_utf8decode( pszCopy, &dest );
- #else
- mir_utf8decode( pszCopy, NULL );
- dest = mir_strdup( pszCopy );
- #endif
+
+ mir_utf8decode( pszCopy, &dest );
+
if ( bNeedsFree )
free( pszCopy );
@@ -678,7 +675,6 @@ char* __stdcall JabberBase64Encode( const char* buffer, int bufferLen )
static unsigned char b64rtable[256];
-#ifdef _UNICODE
char* __stdcall JabberBase64DecodeW( const WCHAR* str, int *resultLen )
{
char *stra = mir_u2a(str);
@@ -686,7 +682,6 @@ char* __stdcall JabberBase64DecodeW( const WCHAR* str, int *resultLen )
mir_free(stra);
return res;
}
-#endif
char* __stdcall JabberBase64Decode( const char* str, int *resultLen )
{
@@ -1291,11 +1286,7 @@ void JabberCopyText(HWND hwnd, TCHAR *text)
TCHAR *s = (TCHAR *)GlobalLock(hMem);
lstrcpy(s, text);
GlobalUnlock(hMem);
-#ifdef UNICODE
SetClipboardData(CF_UNICODETEXT, hMem);
-#else
- SetClipboardData(CF_TEXT, hMem);
-#endif
CloseClipboard();
}
diff --git a/protocols/JabberG/jabber_xml.cpp b/protocols/JabberG/jabber_xml.cpp
index 33a5ddad21..70898199c9 100644
--- a/protocols/JabberG/jabber_xml.cpp
+++ b/protocols/JabberG/jabber_xml.cpp
@@ -30,29 +30,7 @@ Last change by : $Author: george.hazan $
#define TAG_MAX_LEN 128
#define ATTR_MAX_LEN 8192
-#if defined( _UNICODE )
- #define T2UTF(A) A
-#else
-
-struct T2UTF
-{
- T2UTF( const TCHAR* str ) :
- m_text( mir_utf8encodeT( str ))
- {}
-
- ~T2UTF()
- { mir_free( m_text );
- }
-
- __inline operator TCHAR*() const
- { return m_text;
- }
-
-private:
- TCHAR* m_text;
-};
-
-#endif
+#define T2UTF(A) A
/////////////////////////////////////////////////////////////////////////////////////////
// XmlNodeIq class members
@@ -240,7 +218,6 @@ HXML __fastcall xmlGetChild( HXML hXml, LPCTSTR key )
return xi.getNthChild( hXml, key, 0 );
}
-#if defined( _UNICODE )
HXML __fastcall xmlGetChild( HXML hXml, LPCSTR key )
{
LPTSTR wszKey = mir_a2t( key );
@@ -253,7 +230,6 @@ HXML __fastcall xmlGetChildByTag( HXML hXml, LPCTSTR key, LPCTSTR attrName, LPCT
{
return xi.getChildByAttrValue( hXml, key, attrName, attrValue );
}
-#endif
HXML __fastcall xmlGetChildByTag( HXML hXml, LPCSTR key, LPCSTR attrName, LPCTSTR attrValue )
{
diff --git a/protocols/JabberG/jabber_xml.h b/protocols/JabberG/jabber_xml.h
index 6a8ce23a3f..96cdbed413 100644
--- a/protocols/JabberG/jabber_xml.h
+++ b/protocols/JabberG/jabber_xml.h
@@ -366,7 +366,6 @@ public:
va_end(args);
}
-#ifdef _UNICODE
XPathFmt(HXML hXml, char *path, ...): XPath(hXml, m_buf)
{
*m_buf = 0;
@@ -379,7 +378,6 @@ public:
MultiByteToWideChar(CP_ACP, 0, buf, -1, m_buf, BUFSIZE);
va_end(args);
}
-#endif
private:
TCHAR m_buf[BUFSIZE];
diff --git a/protocols/JabberG/jabber_xstatus.cpp b/protocols/JabberG/jabber_xstatus.cpp
index fdd7a44e2e..efdb377edc 100644
--- a/protocols/JabberG/jabber_xstatus.cpp
+++ b/protocols/JabberG/jabber_xstatus.cpp
@@ -1382,11 +1382,7 @@ TCHAR* a2tf( const TCHAR* str, BOOL unicode )
if ( str == NULL )
return NULL;
- #if defined( _UNICODE )
- return ( unicode ) ? mir_tstrdup( str ) : mir_a2t(( char* )str );
- #else
- return mir_strdup( str );
- #endif
+ return ( unicode ) ? mir_tstrdup( str ) : mir_a2t(( char* )str );
}
void overrideStr( TCHAR*& dest, const TCHAR* src, BOOL unicode, const TCHAR* def = NULL )
diff --git a/protocols/JabberG/ui_utils.cpp b/protocols/JabberG/ui_utils.cpp
index 0e1fad9a44..b12e413c81 100644
--- a/protocols/JabberG/ui_utils.cpp
+++ b/protocols/JabberG/ui_utils.cpp
@@ -889,7 +889,6 @@ void CCtrlListView::AddColumn(int iSubItem, TCHAR *name, int cx)
void CCtrlListView::AddGroup(int iGroupId, TCHAR *name)
{
-#ifdef UNICODE
if (IsWinVerXPPlus())
{
LVGROUP lvg = {0};
@@ -900,7 +899,6 @@ void CCtrlListView::AddGroup(int iGroupId, TCHAR *name)
lvg.iGroupId = iGroupId;
InsertGroup(-1, &lvg);
}
-#endif
}
int CCtrlListView::AddItem(TCHAR *text, int iIcon, LPARAM lParam, int iGroupId)
@@ -912,13 +910,13 @@ int CCtrlListView::AddItem(TCHAR *text, int iIcon, LPARAM lParam, int iGroupId)
lvi.iImage = iIcon;
lvi.lParam = lParam;
-#ifdef UNICODE
+
if ((iGroupId >= 0) && IsWinVerXPPlus())
{
lvi.mask |= LVIF_GROUPID;
lvi.iGroupId = iGroupId;
}
-#endif
+
return InsertItem(&lvi);
}
@@ -2334,14 +2332,10 @@ TCHAR* CCtrlBase::GetText()
char* CCtrlBase::GetTextA()
{
- #ifdef UNICODE
- int length = GetWindowTextLength(m_hwnd) + 1;
- char *result = (char *)mir_alloc(length * sizeof(char));
- GetWindowTextA(m_hwnd, result, length);
- return result;
- #else
- return GetText();
- #endif
+ int length = GetWindowTextLength(m_hwnd) + 1;
+ char *result = (char *)mir_alloc(length * sizeof(char));
+ GetWindowTextA(m_hwnd, result, length);
+ return result;
}
TCHAR* CCtrlBase::GetText(TCHAR *buf, int size)
@@ -2353,13 +2347,9 @@ TCHAR* CCtrlBase::GetText(TCHAR *buf, int size)
char* CCtrlBase::GetTextA(char *buf, int size)
{
- #ifdef UNICODE
- GetWindowTextA(m_hwnd, buf, size);
- buf[size-1] = 0;
- return buf;
- #else
- return GetText(buf, size);
- #endif
+ GetWindowTextA(m_hwnd, buf, size);
+ buf[size-1] = 0;
+ return buf;
}
int CCtrlBase::GetInt()
@@ -2495,11 +2485,8 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
}
case WM_SETTEXT:
-#ifdef UNICODE
- if (m_show_label && IsWindowUnicode(m_hwnd))
-#else
- if (m_show_label && !IsWindowUnicode(m_hwnd))
-#endif
+ if (m_show_label && IsWindowUnicode(m_hwnd))
+
{
TCHAR *szTitle = (TCHAR *)lParam;
if (!_tcsstr(szTitle, m_proto_interface->m_tszUserName))
diff --git a/protocols/JabberG/ui_utils.h b/protocols/JabberG/ui_utils.h
index f9e7816d9e..4be15802db 100644
--- a/protocols/JabberG/ui_utils.h
+++ b/protocols/JabberG/ui_utils.h
@@ -104,13 +104,8 @@ typedef struct tagLVSETINFOTIP
int iItem;
int iSubItem;
} LVSETINFOTIP, *PLVSETINFOTIP;
-#ifndef _UNICODE
- #define LPLVCOLUMN LPLVCOLUMNA
- #define LPLVITEM LPLVITEMA
-#else
- #define LPLVCOLUMN LPLVCOLUMNW
- #define LPLVITEM LPLVITEMW
-#endif
+#define LPLVCOLUMN LPLVCOLUMNA
+#define LPLVITEM LPLVITEMA
#define LVN_BEGINSCROLL (LVN_FIRST-80)
#define LVN_ENDSCROLL (LVN_FIRST-81)
#define LVN_HOTTRACK (LVN_FIRST-21)
diff --git a/protocols/Yahoo/avatar.cpp b/protocols/Yahoo/avatar.cpp
index 3c8a9471e7..1ee1a64dd8 100644
--- a/protocols/Yahoo/avatar.cpp
+++ b/protocols/Yahoo/avatar.cpp
@@ -132,16 +132,12 @@ void CYahooProto::SendAvatar(const TCHAR *szFile)
yahoo_file_info *sf = y_new(struct yahoo_file_info, 1);
sf->filesize = statbuf.st_size;
-#ifdef _UNICODE
wchar_t tszFilename[MAX_PATH];
wcscpy(tszFilename, szFile);
GetShortPathNameW(szFile, tszFilename, SIZEOF(tszFilename));
char szFilename[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, tszFilename, -1, szFilename, MAX_PATH, 0, 0);
sf->filename = strdup(szFilename);
-#else
- sf->filename = strdup(szFile);
-#endif
DebugLog("[Uploading avatar] filename: %s size: %ld", sf->filename, sf->filesize);
@@ -253,12 +249,8 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt)
AI.cbSize = sizeof AI;
AI.format = PA_FORMAT_PNG;
AI.hContact = hContact;
- #if defined( _UNICODE )
- WideCharToMultiByte( CP_ACP, 0, buf, -1, AI.filename, sizeof AI.filename, 0, 0 );
- #else
- lstrcpyA( AI.filename, buf );
- #endif
-
+ WideCharToMultiByte( CP_ACP, 0, buf, -1, AI.filename, sizeof AI.filename, 0, 0 );
+
if (error)
SetDword(hContact, "PictCK", 0);
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp
index 2403b5aaf8..5bcf10285f 100644
--- a/src/core/miranda.cpp
+++ b/src/core/miranda.cpp
@@ -578,11 +578,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int )
MyMonitorFromPoint = (pfnMyMonitorFromPoint)GetProcAddress(hUser32, "MonitorFromPoint");
MyMonitorFromRect = (pfnMyMonitorFromRect)GetProcAddress(hUser32, "MonitorFromRect");
MyMonitorFromWindow = (pfnMyMonitorFromWindow)GetProcAddress(hUser32, "MonitorFromWindow");
-#ifdef _UNICODE
MyGetMonitorInfo = (pfnMyGetMonitorInfo)GetProcAddress(hUser32, "GetMonitorInfoW");
-#else
- MyGetMonitorInfo = (pfnMyGetMonitorInfo)GetProcAddress(hUser32, "GetMonitorInfoA");
-#endif
hShFolder = GetModuleHandleA("shell32");
shGetSpecialFolderPathA = (pfnSHGetSpecialFolderPathA)GetProcAddress(hShFolder, "SHGetSpecialFolderPathA");
@@ -769,8 +765,6 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam)
mir_snprintf(( char* )lParam, wParam, "%S x64 Unicode", productVersion );
#elif defined( _UNICODE )
mir_snprintf(( char* )lParam, wParam, "%S Unicode", productVersion );
-#else
- lstrcpyn((char*)lParam, productVersion, wParam);
#endif
mir_free(pVerInfo);
return 0;
diff --git a/src/core/miranda.h b/src/core/miranda.h
index f9d6340fb4..044b807fa7 100644
--- a/src/core/miranda.h
+++ b/src/core/miranda.h
@@ -44,11 +44,7 @@ typedef HRESULT (STDAPICALLTYPE *pfnSHGetSpecialFolderPathW)(HWND, LPWSTR, int,
extern pfnSHGetSpecialFolderPathA shGetSpecialFolderPathA;
extern pfnSHGetSpecialFolderPathW shGetSpecialFolderPathW;
-#ifdef _UNICODE
#define shGetSpecialFolderPath shGetSpecialFolderPathW
-#else
-#define shGetSpecialFolderPath shGetSpecialFolderPathA
-#endif
typedef HDESK (WINAPI* pfnOpenInputDesktop)(DWORD, BOOL, DWORD);
extern pfnOpenInputDesktop openInputDesktop;
@@ -177,13 +173,8 @@ char* Utf8EncodeUcs2( const wchar_t* str );
int Ucs2toUtf8Len(const wchar_t *src);
-#if defined( _UNICODE )
- #define Utf8DecodeT Utf8DecodeUcs2
- #define Utf8EncodeT Utf8EncodeUcs2
-#else
- #define Utf8DecodeT Utf8DecodeA
- #define Utf8EncodeT Utf8Encode
-#endif
+#define Utf8DecodeT Utf8DecodeUcs2
+#define Utf8EncodeT Utf8EncodeUcs2
/**** langpack.c ***********************************************************************/
@@ -215,18 +206,12 @@ __inline unsigned int hashstr(const wchar_t * key)
int pathToAbsolute(const char *pSrc, char *pOut, char* base);
void CreatePathToFile( char* wszFilePath );
int CreateDirectoryTree(const char *szDir);
-#if defined( _UNICODE )
- void CreatePathToFileW( WCHAR* wszFilePath );
- int CreateDirectoryTreeW(const WCHAR *szDir);
- int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base);
- #define pathToAbsoluteT pathToAbsoluteW
- #define CreatePathToFileT CreatePathToFileW
- #define CreateDirectoryTreeT CreateDirectoryTreeW
-#else
- #define pathToAbsoluteT pathToAbsolute
- #define CreatePathToFileT CreatePathToFile
- #define CreateDirectoryTreeT CreateDirectoryTree
-#endif
+void CreatePathToFileW( WCHAR* wszFilePath );
+int CreateDirectoryTreeW(const WCHAR *szDir);
+int pathToAbsoluteW(const TCHAR *pSrc, TCHAR *pOut, TCHAR* base);
+#define pathToAbsoluteT pathToAbsoluteW
+#define CreatePathToFileT CreatePathToFileW
+#define CreateDirectoryTreeT CreateDirectoryTreeW
/**** skin2icons.c *********************************************************************/
@@ -309,9 +294,7 @@ __inline static INT_PTR CallProtoService( const char* szModule, const char* szSe
/**** utils.c **************************************************************************/
-#if defined( _UNICODE )
- char* __fastcall rtrim(char* str);
-#endif
+char* __fastcall rtrim(char* str);
TCHAR* __fastcall rtrim(TCHAR* str);
char* __fastcall ltrim(char* str);
char* __fastcall ltrimp(char* str);
@@ -353,19 +336,9 @@ public:
operator const LPARAM () const { return ( LPARAM )m_body; }
};
-#ifdef _UNICODE
-
#define StrConvT( x ) StrConvUT( x )
#define StrConvTu( x ) x
#define StrConvA( x ) StrConvAT( x )
#define StrConvU( x ) x
-#else
-
-#define StrConvT( x ) x
-#define StrConvTu( x ) StrConvAT( x )
-#define StrConvA( x ) x
-#define StrConvU( x ) StrConvUT( x )
-
-#endif
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp
index 86282fe47f..7395f2122a 100644
--- a/src/modules/button/button.cpp
+++ b/src/modules/button/button.cpp
@@ -489,14 +489,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
SendMessage(bct->hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;
ti.uId = (UINT_PTR)bct->hwnd;
- #if defined( _UNICODE )
- if ( lParam & BATF_UNICODE )
- ti.lpszText = mir_wstrdup( TranslateW(( WCHAR* )wParam ));
- else
- ti.lpszText = LangPackPcharToTchar(( char* )wParam );
- #else
- ti.lpszText = Translate(( char* )wParam );
- #endif
+ if ( lParam & BATF_UNICODE )
+ ti.lpszText = mir_wstrdup( TranslateW(( WCHAR* )wParam ));
+ else
+ ti.lpszText = LangPackPcharToTchar(( char* )wParam );
if (bct->pAccPropServices) {
wchar_t *tmpstr = mir_t2u(ti.lpszText);
bct->pAccPropServices->SetHwndPropStr(bct->hwnd, OBJID_CLIENT,
@@ -504,9 +500,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
mir_free(tmpstr);
}
SendMessage( bct->hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
- #if defined( _UNICODE )
- mir_free( ti.lpszText );
- #endif
+ mir_free( ti.lpszText );
}
break;
case WM_SETFOCUS: // set keybord focus and redraw
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 1a9e32617f..982ede3406 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -422,25 +422,16 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if ( dbcws->value.type == DBVT_ASCIIZ ) {
- #if defined( UNICODE )
- WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal+1);
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
- #else
- eq = !lstrcmp( szFullName, dbcws->value.pszVal+1 );
- #endif
+ WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal+1);
+ eq = !lstrcmp( szFullName, wszGrpName );
+ mir_free( wszGrpName );
}
else {
char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal+1);
- #if defined( UNICODE )
- WCHAR* wszGrpName;
- Utf8Decode(szGrpName, &wszGrpName );
- eq = !lstrcmp( szFullName, wszGrpName );
- mir_free( wszGrpName );
- #else
- Utf8Decode(szGrpName, NULL);
- eq = !lstrcmp( szFullName, szGrpName );
- #endif
+ WCHAR* wszGrpName;
+ Utf8Decode(szGrpName, &wszGrpName );
+ eq = !lstrcmp( szFullName, wszGrpName );
+ mir_free( wszGrpName );
}
if ( eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
break; //only expanded has changed: no action reqd