diff options
Diffstat (limited to 'protocols')
39 files changed, 97 insertions, 442 deletions
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.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);
|