diff options
Diffstat (limited to 'plugins')
43 files changed, 192 insertions, 762 deletions
diff --git a/plugins/Chat/chat.h b/plugins/Chat/chat.h index c9dd89463b..27e325fd7b 100644 --- a/plugins/Chat/chat.h +++ b/plugins/Chat/chat.h @@ -258,11 +258,9 @@ typedef struct SESSION_INFO_TYPE TCHAR* ptszTopic;
// I hate m3x, Unicode, IRC, chats etc...
- #if defined( _UNICODE )
- char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
- char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
- #endif
-
+ char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
+ char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
+
int iType;
int iFG;
int iBG;
diff --git a/plugins/Chat/log.c b/plugins/Chat/log.c index a1b94a5108..665ab8939c 100644 --- a/plugins/Chat/log.c +++ b/plugins/Chat/log.c @@ -216,11 +216,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff else if (*line > 0 && *line < 128) {
*d++ = (char) *line;
}
- #if defined( _UNICODE )
- else d += sprintf(d, "\\u%u ?", (WORD)*line);
- #else
- else d += sprintf(d, "\\'%02x", (BYTE)*line);
- #endif
+ else d += sprintf(d, "\\u%u ?", (WORD)*line);
}
*cbBufferEnd = (int) (d - *buffer);
diff --git a/plugins/Chat/manager.c b/plugins/Chat/manager.c index f9b9461dea..9968086245 100644 --- a/plugins/Chat/manager.c +++ b/plugins/Chat/manager.c @@ -145,11 +145,9 @@ int SM_RemoveSession( const TCHAR* pszID, const char* pszModule) mir_free( pTemp->ptszName );
mir_free( pTemp->ptszStatusbarText );
mir_free( pTemp->ptszTopic );
- #if defined( _UNICODE )
- mir_free( pTemp->pszID );
- mir_free( pTemp->pszName );
- #endif
-
+ mir_free( pTemp->pszID );
+ mir_free( pTemp->pszName );
+
// delete commands
pCurComm = pTemp->lpCommands;
while (pCurComm != NULL)
@@ -787,11 +785,9 @@ BOOL SM_RemoveAll (void) mir_free( m_WndList->ptszName );
mir_free( m_WndList->ptszStatusbarText );
mir_free( m_WndList->ptszTopic );
- #if defined( _UNICODE )
- mir_free( m_WndList->pszID );
- mir_free( m_WndList->pszName );
- #endif
-
+ mir_free( m_WndList->pszID );
+ mir_free( m_WndList->pszName );
+
while (m_WndList->lpCommands != NULL) {
COMMAND_INFO *pNext = m_WndList->lpCommands->next;
mir_free(m_WndList->lpCommands->lpCommand);
@@ -941,11 +937,7 @@ char* SM_GetUsers(SESSION_INFO* si) if ( pLen + nameLen + 2 > alloced )
p = mir_realloc( p, alloced += 4096 );
- #if !defined( _UNICODE )
- lstrcpy( p + pLen, utemp->pszUID );
- #else
- WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
- #endif
+ WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
lstrcpyA( p + pLen + nameLen, " " );
utemp = utemp->next;
}
diff --git a/plugins/Chat/message.c b/plugins/Chat/message.c index ddf81d38bf..5d1de9379a 100644 --- a/plugins/Chat/message.c +++ b/plugins/Chat/message.c @@ -153,11 +153,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\xA2");
-#else
- strcpy(InsertThis, "\x95");
-#endif
}
else if ( !memcmp(p1, "\\b", 2 )) { //bold
bTextHasStarted = bJustRemovedRTF = TRUE;
@@ -198,61 +194,37 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x93");
-#else
- strcpy(InsertThis, "\x96");
-#endif
}
else if (!memcmp(p1, "\\emdash", 7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x94");
-#else
- strcpy(InsertThis, "\x97");
-#endif
}
else if (!memcmp(p1, "\\lquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x98");
-#else
- strcpy(InsertThis, "\x91");
-#endif
}
else if (!memcmp(p1, "\\rquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x99");
-#else
- strcpy(InsertThis, "\x92");
-#endif
}
else if (!memcmp(p1, "\\ldblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9c");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if (!memcmp(p1, "\\rdblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9d");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if ( p1[1] == '\\' || p1[1] == '{' || p1[1] == '}' ) { // escaped characters
bTextHasStarted = TRUE;
@@ -264,11 +236,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
iRemoveChars = 2;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xC2\xA0");
-#else
- strcpy(InsertThis, "\xA0");
-#endif
}
else if ( p1[1] == '\'' ) { // special character
char tmp[4], *p3 = tmp;
@@ -340,11 +308,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) mir_free(pIndex);
- #if !defined( _UNICODE )
- return pszText;
- #else
- return mir_utf8decodeW(pszText);
- #endif
+ return mir_utf8decodeW(pszText);
}
static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb)
@@ -386,11 +350,7 @@ char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO* si) stream.pfnCallback = Message_StreamCallback;
stream.dwCookie = (DWORD_PTR) &pszText; // pass pointer to pointer
- #if defined(_UNICODE)
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
- #else
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF;
- #endif
+ dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_STREAMOUT, dwFlags, (LPARAM) & stream);
return pszText; // pszText contains the text
}
diff --git a/plugins/Chat/services.c b/plugins/Chat/services.c index 37f7a2c71c..5687e9cb99 100644 --- a/plugins/Chat/services.c +++ b/plugins/Chat/services.c @@ -291,20 +291,15 @@ static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam) if ( gci->Flags & COUNT ) gci->iCount = si->nUsersInNicklist;
if ( gci->Flags & USERS ) gci->pszUsers = SM_GetUsers(si);
- #if defined( _UNICODE )
- if ( si->dwFlags & GC_UNICODE ) {
- if ( gci->Flags & ID ) gci->pszID = si->ptszID;
- if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- }
- else {
- if ( gci->Flags & ID ) gci->pszID = ( TCHAR* )si->pszID;
- if ( gci->Flags & NAME ) gci->pszName = ( TCHAR* )si->pszName;
- }
- #else
+ if ( si->dwFlags & GC_UNICODE ) {
if ( gci->Flags & ID ) gci->pszID = si->ptszID;
if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- #endif
-
+ }
+ else {
+ if ( gci->Flags & ID ) gci->pszID = ( TCHAR* )si->pszID;
+ if ( gci->Flags & NAME ) gci->pszName = ( TCHAR* )si->pszName;
+ }
+
LeaveCriticalSection(&cs);
return 0;
}
@@ -324,11 +319,6 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
return GC_REGISTER_WRONGVER;
- #ifndef _UNICODE
- if (gcr->dwFlags & GC_UNICODE)
- return GC_REGISTER_NOUNICODE;
- #endif
-
EnterCriticalSection(&cs);
mi = MM_AddModule( gcr->pszModule );
@@ -405,13 +395,11 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
- #if defined( _UNICODE )
- if ( !( gcw->dwFlags & GC_UNICODE )) {
- si->pszID = mir_strdup( gcw->pszID );
- si->pszName = mir_strdup( gcw->pszName );
- }
- #endif
-
+ if ( !( gcw->dwFlags & GC_UNICODE )) {
+ si->pszID = mir_strdup( gcw->pszID );
+ si->pszName = mir_strdup( gcw->pszName );
+ }
+
if ( mi->bColor ) {
si->iFG = 4;
si->bFGSet = TRUE;
@@ -627,7 +615,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) EnterCriticalSection(&cs);
-#ifdef _UNICODE
if ( !( gce->dwFlags & GC_UNICODE )) {
save_gce = *gce;
save_gcd = *gce->pDest;
@@ -638,7 +625,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
}
-#endif
// Do different things according to type of event
switch(gcd->iType) {
@@ -780,7 +766,6 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) LBL_Exit:
LeaveCriticalSection(&cs);
-#ifdef _UNICODE
if ( !( gce->dwFlags & GC_UNICODE )) {
mir_free((void*)gce->ptszText );
mir_free((void*)gce->ptszNick );
@@ -791,7 +776,6 @@ LBL_Exit: *gce = save_gce;
*gce->pDest = save_gcd;
}
-#endif
return iRetVal;
}
diff --git a/plugins/Chat/tools.c b/plugins/Chat/tools.c index 41ac446273..6609a388a0 100644 --- a/plugins/Chat/tools.c +++ b/plugins/Chat/tools.c @@ -786,7 +786,6 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int gcd->pszModule = mir_strdup( pszModule );
-#if defined( _UNICODE )
{
SESSION_INFO* si;
if (( si = SM_FindSession(pszID, pszModule)) == NULL )
@@ -803,11 +802,6 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int gch->ptszText = mir_tstrdup( pszText );
}
}
-#else
- gcd->pszID = mir_strdup( pszID );
- gch->pszUID = mir_strdup( pszUID );
- gch->pszText = mir_strdup( pszText );
-#endif
gcd->iType = iType;
gch->dwData = dwItem;
@@ -823,7 +817,6 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH gcd.pszModule = (char*)pszModule;
-#ifdef _UNICODE
{
SESSION_INFO* si;
if (( si = SM_FindSession(pszID, pszModule)) == NULL )
@@ -840,11 +833,6 @@ BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCH gch.ptszText = mir_tstrdup( pszText );
}
}
-#else
- gcd.pszID = mir_strdup( pszID );
- gch.pszUID = mir_strdup( pszUID );
- gch.pszText = mir_strdup( pszText );
-#endif
gcd.iType = iType;
gch.dwData = dwItem;
@@ -909,14 +897,10 @@ TCHAR* a2tf( const TCHAR* str, int flags ) if ( str == NULL )
return NULL;
- #if defined( _UNICODE )
- if ( flags & GC_UNICODE )
- return mir_tstrdup( str );
- else
- return mir_a2u((char*)str);
- #else
- return mir_strdup( str );
- #endif
+ if ( flags & GC_UNICODE )
+ return mir_tstrdup( str );
+ else
+ return mir_a2u((char*)str);
}
TCHAR* replaceStr( TCHAR** dest, const TCHAR* src )
diff --git a/plugins/Chat/window.c b/plugins/Chat/window.c index d6acde7f53..2021496563 100644 --- a/plugins/Chat/window.c +++ b/plugins/Chat/window.c @@ -401,12 +401,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, gt.cb = iLen+99;
gt.flags = GT_DEFAULT;
- #if defined( _UNICODE )
- gt.codepage = 1200;
- #else
- gt.codepage = CP_ACP;
- #endif
-
+ gt.codepage = 1200;
+
SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)pszText);
while ( start >0 && pszText[start-1] != ' ' && pszText[start-1] != 13 && pszText[start-1] != VK_TAB)
start--;
@@ -2378,11 +2374,7 @@ LABEL_SHOWWINDOW: hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
lstrcpy(( TCHAR* )GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
- #if defined( _UNICODE )
- SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
+ SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
break;
@@ -2490,9 +2482,7 @@ LABEL_SHOWWINDOW: DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, (LPARAM)NULL);
mir_free(pszRtf);
- #if defined( _UNICODE )
- mir_free(ptszText);
- #endif
+ mir_free(ptszText);
SetFocus(GetDlgItem(hwndDlg, IDC_MESSAGE));
}
break;
diff --git a/plugins/Import/progress.c b/plugins/Import/progress.c index 60255f6b61..99412f647a 100644 --- a/plugins/Import/progress.c +++ b/plugins/Import/progress.c @@ -93,12 +93,8 @@ void AddMessage( const char* fmt, ... ) }
#endif
- #if defined( _UNICODE )
{ TCHAR* str = mir_a2t( msgBuf );
SendMessage( hdlgProgress, PROGM_ADDMESSAGE, 0, ( LPARAM )str );
mir_free( str );
}
- #else
- SendMessage( hdlgProgress, PROGM_ADDMESSAGE, 0, ( LPARAM )msgBuf );
- #endif
}
diff --git a/plugins/Modernb/modern_clcitems.cpp b/plugins/Modernb/modern_clcitems.cpp index d938cad4eb..367bbb57de 100644 --- a/plugins/Modernb/modern_clcitems.cpp +++ b/plugins/Modernb/modern_clcitems.cpp @@ -256,11 +256,8 @@ void * AddTempGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flag int f=0;
TCHAR * szGroupName;
DWORD groupFlags;
-#ifdef UNICODE
char *mbuf=mir_u2a((TCHAR *)szName);
-#else
- char *mbuf=mir_strdup((char *)szName);
-#endif
+
if (wildcmp(mbuf,"-@-HIDDEN-GROUP-@-",0))
{
mir_free_and_nill(mbuf);
diff --git a/plugins/Modernb/modern_clcpaint.cpp b/plugins/Modernb/modern_clcpaint.cpp index 177d1b73ec..edc043da0f 100644 --- a/plugins/Modernb/modern_clcpaint.cpp +++ b/plugins/Modernb/modern_clcpaint.cpp @@ -668,16 +668,12 @@ MODERNMASK * CLCPaint::_GetCLCContactRowBackModernMask( struct ClcGroup * group, m = lstrlen( b2 );
for ( i = 0; i<m;i++ )
if ( b2[i] == TEXT( ',' ) ) b2[i] = TEXT( '.' );
-#ifdef UNICODE
- {
+ {
char* b3 = mir_utf8encodeT( b2 );
AddParam( mpModernMask, HASH[hi_Name], b3, 0 );
mir_free( b3 );
}
-#else
- AddParam( mpModernMask, HASH[hi_Name], b2, 0 );
-#endif
mir_free_and_nill( b2 );
}
if ( group->parent )
@@ -687,15 +683,12 @@ MODERNMASK * CLCPaint::_GetCLCContactRowBackModernMask( struct ClcGroup * group, m = lstrlen( b2 );
for ( i = 0; i<m;i++ )
if ( b2[i] == TEXT( ',' ) ) b2[i] = TEXT( '.' );
-#ifdef UNICODE
- {
+ {
char * b3 = mir_utf8encodeT( b2 );
AddParam( mpModernMask, HASH[hi_Group], b3, 0 );
mir_free( b3 );
}
-#else
- AddParam( mpModernMask, HASH[hi_Group], b2, 0 );
-#endif
+
mir_free_and_nill( b2 );
}
return mpModernMask;
diff --git a/plugins/Modernb/modern_clistevents.cpp b/plugins/Modernb/modern_clistevents.cpp index e6cadaa02e..1c938a83aa 100644 --- a/plugins/Modernb/modern_clistevents.cpp +++ b/plugins/Modernb/modern_clistevents.cpp @@ -133,14 +133,10 @@ struct CListEvent* cli_AddEvent(CLISTEVENT *cle) if (nmi) {
TCHAR szBuffer[128];
TCHAR* szStatus = pcli->pfnGetStatusModeDescription(ModernGetSettingWord(p->cle.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
-#if defined(_UNICODE)
TCHAR szwProto[64];
MultiByteToWideChar(CP_ACP, 0, szProto, -1, szwProto, 64);
szwProto[63] = 0;
mir_sntprintf(szBuffer, SIZEOF(szBuffer), _T("%s: %s (%s)"), szwProto, szName, szStatus);
-#else
- mir_snprintf(szBuffer, SIZEOF(szBuffer), "%s: %s (%s)", szProto, szName, szStatus);
-#endif
szBuffer[127] = 0;
AppendMenu(g_CluiData.hMenuNotify, MF_BYCOMMAND | MF_STRING, g_CluiData.wNextMenuID, szBuffer);
mii.hbmpItem = HBMMENU_CALLBACK;
diff --git a/plugins/Modernb/modern_clistmod.cpp b/plugins/Modernb/modern_clistmod.cpp index b23d121a25..baa92d5e95 100644 --- a/plugins/Modernb/modern_clistmod.cpp +++ b/plugins/Modernb/modern_clistmod.cpp @@ -235,11 +235,7 @@ INT_PTR CLUIGetCapsService(WPARAM wParam,LPARAM lParam) case CLUIF2_PLUGININFO:
return (INT_PTR)&pluginInfo;
case CLUIF2_CLISTTYPE:
- #ifdef UNICODE
- return 0x0107;
- #else
- return 0x0007;
- #endif
+ return 0x0107;
case CLUIF2_EXTRACOLUMNCOUNT:
return EXTRA_ICON_COUNT;
case CLUIF2_USEREXTRASTART:
@@ -314,11 +310,7 @@ HRESULT CluiLoadModule() HINSTANCE hUser = GetModuleHandleA("USER32");
MyMonitorFromPoint = ( pfnMyMonitorFromPoint )GetProcAddress( hUser,"MonitorFromPoint" );
MyMonitorFromWindow = ( pfnMyMonitorFromWindow )GetProcAddress( hUser, "MonitorFromWindow" );
- #if defined( _UNICODE )
- MyGetMonitorInfo = ( pfnMyGetMonitorInfo )GetProcAddress( hUser, "GetMonitorInfoW");
- #else
- MyGetMonitorInfo = ( pfnMyGetMonitorInfo )GetProcAddress( hUser, "GetMonitorInfoA");
- #endif
+ MyGetMonitorInfo = ( pfnMyGetMonitorInfo )GetProcAddress( hUser, "GetMonitorInfoW");
}
CLUI::InitClui();
diff --git a/plugins/Modernb/modern_clistopts.cpp b/plugins/Modernb/modern_clistopts.cpp index 482f6a3a5b..07092018a0 100644 --- a/plugins/Modernb/modern_clistopts.cpp +++ b/plugins/Modernb/modern_clistopts.cpp @@ -1231,7 +1231,7 @@ int ReserveExtraSlot(WPARAM wParam,LPARAM lParam) {
OrderTreeData[iLastFree].fReserved=TRUE;
OrderTreeData[iLastFree].KeyName=pESINFO->pszSlotID;
-#ifdef UNICODE
+
if (pESINFO->fUnicode)
OrderTreeData[iLastFree].Name=pESINFO->ptszSlotName;
else
@@ -1239,16 +1239,7 @@ int ReserveExtraSlot(WPARAM wParam,LPARAM lParam) OrderTreeData[iLastFree].Name=mir_a2u(pESINFO->pszSlotName); //potential memory leak but should not be more than once
OrderTreeData[iLastFree].fReserved=(BOOL)2; //need to free KeyName
}
-#else
- if (pESINFO->fUnicode)
- {
- OrderTreeData[iLastFree].Name=mir_u2a(pESINFO->pszSlotName); //potential memory leak but should not be more than once
- OrderTreeData[iLastFree].fReserved=(BOOL)2; //need to free KeyName
- }
- else
- OrderTreeData[iLastFree].Name=pESINFO->pszSlotName;
-#endif
- }
+ }
else return -1; // Already reserved
}
return iLastFree;
diff --git a/plugins/Modernb/modern_clistsettings.cpp b/plugins/Modernb/modern_clistsettings.cpp index f04e0a860e..759b1ed8e3 100644 --- a/plugins/Modernb/modern_clistsettings.cpp +++ b/plugins/Modernb/modern_clistsettings.cpp @@ -121,9 +121,7 @@ void CListSettings_FreeCacheItemDataOption( pdisplayNameCacheEntry pDst, DWORD f if (!pDst->isUnknown && pDst->m_cache_tcsName!=UnknownConctactTranslatedName) mir_free_and_nill(pDst->m_cache_tcsName);
}
- #if defined( _UNICODE )
- if (pDst->m_cache_szName) mir_free_and_nill(pDst->m_cache_szName);
- #endif
+ if (pDst->m_cache_szName) mir_free_and_nill(pDst->m_cache_szName);
}
if ( flag & CCI_GROUP )
@@ -155,9 +153,7 @@ void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCache pDst->m_cache_tcsName = pSrc->m_cache_tcsName;
else
pDst->m_cache_tcsName=mir_tstrdup(pSrc->m_cache_tcsName);
- #if defined( _UNICODE )
- pDst->m_cache_szName=mir_strdup(pSrc->m_cache_szName);
- #endif
+ pDst->m_cache_szName=mir_strdup(pSrc->m_cache_szName);
}
if ( flag & CCI_GROUP ) pDst->m_cache_tcsGroup=mir_tstrdup(pSrc->m_cache_tcsGroup);
if ( flag & CCI_PROTO ) pDst->m_cache_cszProto=pSrc->m_cache_cszProto;
@@ -233,9 +229,7 @@ void cliFreeCacheItem( pdisplayNameCacheEntry p ) TRACEVAR("cliFreeCacheItem hContact=%d",hContact);
if ( !p->isUnknown && p->m_cache_tcsName && p->m_cache_tcsName!=UnknownConctactTranslatedName) mir_free_and_nill(p->m_cache_tcsName);
p->m_cache_tcsName = NULL;
- #if defined( _UNICODE )
- if ( p->m_cache_szName) { mir_free_and_nill(p->m_cache_szName); p->m_cache_szName = NULL; }
- #endif
+ if ( p->m_cache_szName) { mir_free_and_nill(p->m_cache_szName); p->m_cache_szName = NULL; }
if ( p->m_cache_tcsGroup) { mir_free_and_nill(p->m_cache_tcsGroup); p->m_cache_tcsGroup = NULL; }
if ( p->szSecondLineText) mir_free_and_nill(p->szSecondLineText);
if ( p->szThirdLineText) mir_free_and_nill(p->szThirdLineText);
@@ -263,9 +257,7 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) if (pdnce->m_cache_hContact==NULL) //selfcontact
{
if (!pdnce->m_cache_tcsName) pdnce->m_cache_tcsName=GetNameForContact(pdnce->m_cache_hContact,0,&pdnce->isUnknown);
-#ifdef _UNICODE
if (!pdnce->m_cache_szName) pdnce->m_cache_szName=mir_t2a(pdnce->m_cache_tcsName);
-#endif
return;
}
if (pdnce->m_cache_cszProto==NULL&&pdnce->m_cache_bProtoNotExists==FALSE)
@@ -307,9 +299,7 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) // what to return here???
pdnce->m_cache_tcsName = GetNameForContact(pdnce->m_cache_hContact,0,&pdnce->isUnknown); //TODO UNICODE
}
-#if defined( _UNICODE )
if (pdnce->m_cache_szName) mir_free_and_nill(pdnce->m_cache_szName);
-#endif
}
else
{
@@ -380,9 +370,7 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) pdnce->dwLastMsgTime=ModernGetSettingDword(pdnce->m_cache_hContact, "CList", "mf_lastmsg", 0);
if (pdnce->dwLastMsgTime==0) pdnce->dwLastMsgTime=CompareContacts2_getLMTime(pdnce->m_cache_hContact);
}
-#ifdef _UNICODE
if (!pdnce->m_cache_szName) pdnce->m_cache_szName=mir_t2a(pdnce->m_cache_tcsName);
-#endif
}
}
diff --git a/plugins/Modernb/modern_commonheaders.cpp b/plugins/Modernb/modern_commonheaders.cpp index 86c1309884..eb78d351c7 100644 --- a/plugins/Modernb/modern_commonheaders.cpp +++ b/plugins/Modernb/modern_commonheaders.cpp @@ -65,12 +65,11 @@ int __cdecl ModernWriteSettingString(HANDLE hContact,const char *szModule,const {
return DBWriteContactSettingString( hContact, szModule, szSetting, val );
}
-#ifdef _UNICODE
+
int __cdecl ModernWriteSettingWString(HANDLE hContact,const char *szModule,const char *szSetting,const WCHAR *val)
{
return DBWriteContactSettingWString( hContact, szModule, szSetting, val );
}
-#endif
int __cdecl ModernDBFreeVariant(DBVARIANT *dbv)
{
diff --git a/plugins/Modernb/modern_gdiplus.cpp b/plugins/Modernb/modern_gdiplus.cpp index a71561a53d..4ab8604697 100644 --- a/plugins/Modernb/modern_gdiplus.cpp +++ b/plugins/Modernb/modern_gdiplus.cpp @@ -214,13 +214,7 @@ COLORREF __inline _revcolref(COLORREF colref) BOOL GDIPlus_IsAnimatedGIF(TCHAR * szName)
{
int nFrameCount=0;
-#ifndef _UNICODE
- WCHAR * temp=mir_a2u(szName);
- Image image(temp);
- mir_free(temp);
-#else
Image image(szName);
-#endif
UINT count = 0;
count = image.GetFrameDimensionsCount();
@@ -240,13 +234,7 @@ BOOL GDIPlus_IsAnimatedGIF(TCHAR * szName) void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * pBitmap, int ** pframesDelay, int * pframesCount, SIZE * pSizeAvatar)
{
int nFrameCount=0;
-#ifndef _UNICODE
- WCHAR * temp=mir_a2u(szName);
- Bitmap image(temp);
- mir_free(temp);
-#else
Bitmap image(szName);
-#endif
PropertyItem * pPropertyItem;
UINT count = 0;
diff --git a/plugins/Modernb/modern_skinbutton.cpp b/plugins/Modernb/modern_skinbutton.cpp index 1fb23e0ff4..cfbfa23b7e 100644 --- a/plugins/Modernb/modern_skinbutton.cpp +++ b/plugins/Modernb/modern_skinbutton.cpp @@ -693,16 +693,12 @@ static HWND ModernSkinButtonCreateWindow(ModernSkinButtonCtrl * bct, HWND parent HWND hwnd;
if (bct==NULL) return FALSE;
-#ifdef _UNICODE
{
TCHAR *UnicodeID;
UnicodeID=mir_a2u(bct->ID);
hwnd=CreateWindow(_T(MODERNSKINBUTTONCLASS),UnicodeID,WS_VISIBLE|WS_CHILD,bct->Left,bct->Top,bct->Right-bct->Left,bct->Bottom-bct->Top,parent,NULL,g_hInst,NULL);
mir_free(UnicodeID);
}
-#else
- hwnd=CreateWindow(_T(MODERNSKINBUTTONCLASS),bct->ID,WS_VISIBLE|WS_CHILD,bct->Left,bct->Top,bct->Right-bct->Left,bct->Bottom-bct->Top,parent,NULL,g_hInst,NULL);
-#endif
bct->hwnd = hwnd;
bct->focus = 0;
diff --git a/plugins/Modernb/modern_skinengine.cpp b/plugins/Modernb/modern_skinengine.cpp index 0a9e4c806a..487285304e 100644 --- a/plugins/Modernb/modern_skinengine.cpp +++ b/plugins/Modernb/modern_skinengine.cpp @@ -2683,16 +2683,12 @@ static int ske_DeleteAllSettingInSection(char * SectionName) BOOL ske_TextOutA(HDC hdc, int x, int y, char * lpString, int nCount)
{
-#ifdef UNICODE
TCHAR *buf=(TCHAR *)mir_alloc((2+nCount)*sizeof(TCHAR));
BOOL res;
MultiByteToWideChar(CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ), 0, lpString, -1, buf, (2+nCount)*sizeof(TCHAR));
res=ske_TextOut(hdc,x,y,buf,nCount);
mir_free_and_nill(buf);
return res;
-#else
- return ske_TextOut(hdc,x,y,lpString,nCount);
-#endif
}
BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount)
@@ -3266,15 +3262,11 @@ INT_PTR ske_Service_DrawTextWithEffect( WPARAM wParam, LPARAM lParam ) BOOL ske_DrawTextA(HDC hdc, char * lpString, int nCount, RECT * lpRect, UINT format)
{
-#ifdef UNICODE
TCHAR *buf=mir_a2u(lpString);
BOOL res;
res=ske_DrawText(hdc,buf,nCount,lpRect,format);
mir_free(buf);
return res;
-#else
- return ske_DrawText(hdc,lpString,nCount,lpRect,format);
-#endif
}
@@ -4285,11 +4277,7 @@ TCHAR* ske_ReplaceVar(TCHAR *var) buf[i]='\0';
}
mir_free_and_nill(var);
-#ifdef UNICODE
return mir_a2u(buf);
-#else
- return mir_strdup(buf);
-#endif
}
mir_free_and_nill(var);
@@ -4397,13 +4385,8 @@ static void OLDske_AddParseTextGlyphObject(char * szGlyphTextID,char * szDefineS glText->dwColor=ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),7,',',TRUE));
glText->dwShadow=ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),8,',',TRUE));
-#ifdef _UNICODE
glText->stValueText=mir_a2u(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE));
glText->stText=ske_ParseText(glText->stValueText);
-#else
- glText->stValueText=mir_strdup(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE));
- glText->stText=ske_ParseText(glText->stValueText);
-#endif
li.List_Insert(globj->plTextList,(void*)glText,globj->plTextList->realCount);
qsort(globj->plTextList->items,globj->plTextList->realCount,sizeof(void*),(int(*)(const void*, const void*))globj->plTextList->sortFunc);
}
@@ -4441,13 +4424,9 @@ static void ske_AddParseTextGlyphObject(char * szGlyphTextID,char * szDefineStri glText->dwColor=ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),7,',',TRUE));
glText->dwShadow=ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),8,',',TRUE));
-#ifdef _UNICODE
glText->stValueText=mir_a2u(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE));
glText->stText=ske_ParseText(glText->stValueText);
-#else
- glText->stValueText=mir_strdup(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE));
- glText->stText=ske_ParseText(glText->stValueText);
-#endif
+
if (!Skin->pTextList)
Skin->pTextList=li.List_Create(0,1);
li.List_InsertPtr(Skin->pTextList,glText);
diff --git a/plugins/Modernb/modern_skinselector.cpp b/plugins/Modernb/modern_skinselector.cpp index aef06d5fb9..2540790d53 100644 --- a/plugins/Modernb/modern_skinselector.cpp +++ b/plugins/Modernb/modern_skinselector.cpp @@ -86,7 +86,6 @@ BOOL wildcmpi(TCHAR* name, TCHAR* mask) }
}
-#if defined( _UNICODE )
BOOL wildcmpi(char * name, char * mask)
{
char * last='\0';
@@ -107,7 +106,6 @@ BOOL wildcmpi(char * name, char * mask) if (*mask != '?' && _qtoupper(*mask) != _qtoupper(*name) ) name -= (size_t)(mask - last) - 1, mask = last;
}
}
-#endif
BOOL __inline wildcmp(const char * name, const char * mask, BYTE option)
{
@@ -574,15 +572,11 @@ SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue,LISTMODERNMASK * TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
{
-#ifdef UNICODE
char *ansibuf=(char*)mir_alloc(buflen/sizeof(TCHAR));
GetParamN(string, ansibuf, buflen/sizeof(TCHAR), paramN, Delim, SkipSpaces);
MultiByteToWideChar(CP_UTF8,0,ansibuf,-1,buf,buflen);
mir_free_and_nill(ansibuf);
return buf;
-#else
- return GetParamN(string, buf, buflen, paramN, Delim, SkipSpaces);
-#endif
}
char * GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces)
diff --git a/plugins/Modernb/modern_viewmodebar.cpp b/plugins/Modernb/modern_viewmodebar.cpp index 37b1e1b66f..c896e3b852 100644 --- a/plugins/Modernb/modern_viewmodebar.cpp +++ b/plugins/Modernb/modern_viewmodebar.cpp @@ -118,7 +118,6 @@ int FillModes(char *szsetting) if(szsetting[0] == (char)13)
return 1;
-#ifdef _UNICODE
{
TCHAR * temp;
//temp=alloca((strlen(szSetting)+1)*sizeof(TCHAR));
@@ -129,10 +128,7 @@ int FillModes(char *szsetting) mir_free(temp);
}
}
-#else
- SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_INSERTSTRING, -1, (LPARAM)szsetting);
-#endif
- return 1;
+ return 1;
}
static void ShowPage(HWND hwnd, int page)
@@ -489,13 +485,11 @@ void SaveState() //if(vastring)
// GetDlgItemTextA(clvmHwnd, IDC_VARIABLES, vastring, len);
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szTempModeName);
-#ifdef _UNICODE
+
{
szModeName=mir_utf8encodeT(szTempModeName);
}
-#else
- szModeName=szTempModeName;
-#endif
+
dwGlobalMask = GetMaskForItem(hInfoItem);
hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0);
while(hContact)
@@ -574,12 +568,8 @@ static void UpdateFilters() szTempBuf= (TCHAR *)mir_alloc((iLen + 1)*sizeof(TCHAR));
SendDlgItemMessage(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szTempBuf);
-#ifdef _UNICODE
szBuf=mir_utf8encodeT(szTempBuf);
-#else
- szBuf=mir_strdup(szTempBuf);
-#endif
- strncpy(g_szModename, szBuf, SIZEOF(g_szModename));
+ strncpy(g_szModename, szBuf, SIZEOF(g_szModename));
g_szModename[SIZEOF(g_szModename) - 1] = 0;
mir_sntprintf(szTemp, 100, TranslateT("Configuring view mode: %s"), szTempBuf);
SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
@@ -790,12 +780,8 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if ( g_CluiData.current_viewmode[0]!='\0' )
{
TCHAR * temp=
-#ifdef _UNICODE
- mir_utf8decodeW( g_CluiData.current_viewmode );
-#else
- mir_strdup( g_CluiData.current_viewmode );
-#endif
-
+ mir_utf8decodeW( g_CluiData.current_viewmode );
+
if(temp)
{
index = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_FINDSTRING, -1, (LPARAM)temp );
@@ -869,11 +855,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETTEXT, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), (LPARAM)szTempBuf);
-#ifdef _UNICODE
szBuf=mir_utf8encodeT(szTempBuf);
-#else
- szBuf=szTempBuf;
-#endif
DeleteViewMode( szBuf );
SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_DELETESTRING, SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_GETCURSEL, 0, 0), 0);
@@ -907,12 +889,9 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(lstrlen(szBuf) > 0)
{
char *szUTF8Buf=NULL;
-#ifdef UNICODE
szUTF8Buf=mir_utf8encodeT(szBuf);
-#else
- szUTF8Buf=_strdup(szBuf);
-#endif
- if(ModernGetSettingDword(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1)
+
+ if(ModernGetSettingDword(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1)
MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK);
else
{
@@ -1053,7 +1032,7 @@ static int FillMenuCallback(char *szSetting) return 1;
if(szSetting[0] == (char)13)
return 1;
-#ifdef _UNICODE
+
{
TCHAR * temp;
//temp=alloca((strlen(szSetting)+1)*sizeof(TCHAR));
@@ -1064,10 +1043,7 @@ static int FillMenuCallback(char *szSetting) mir_free(temp);
}
}
-#else
- AppendMenuA(hViewModeMenu, MF_STRING, menuCounter++, szSetting);
-#endif
- return 1;
+ return 1;
}
void BuildViewModeMenu()
@@ -1176,7 +1152,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
if(g_CluiData.bFilterEffective)
{
-#ifdef _UNICODE
+
{
TCHAR * temp;
//temp=alloca((strlen(szSetting)+1)*sizeof(TCHAR));
@@ -1187,9 +1163,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mir_free(temp);
}
}
-#else
- SetWindowTextA(GetDlgItem(hwnd, IDC_SELECTMODE), g_CluiData.current_viewmode);
-#endif
+
}
else
SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), TranslateT("All contacts"));
@@ -1337,15 +1311,13 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM mii.dwTypeData = szTemp;
mii.cch = 256;
GetMenuItemInfo(hViewModeMenu, selection, FALSE, &mii);
-#ifdef _UNICODE
+
{
char * temp=mir_utf8encodeT(szTemp);
ApplyViewMode(temp);
if (temp) mir_free(temp);
}
-#else
- ApplyViewMode(szTemp);
-#endif
+
}
break;
}
@@ -1705,15 +1677,13 @@ void ApplyViewMode(const char *Name, bool onlySelector ) }
}
-#ifdef _UNICODE
+
{
TCHAR * temp = mir_utf8decodeW( ( name[0] == (char)13 ) ? name + 1 : name );
SetWindowText(hwndSelector, temp);
mir_free(temp);
}
-#else
- SetWindowText(hwndSelector, ( name[0] == (char)13 ) ? name + 1 : name );
-#endif
+
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
CLUI__cliInvalidateRect( pcli->hwndStatus, NULL, FALSE );
// SetButtonStates(pcli->hwndContactList);
diff --git a/plugins/Modernb/modern_xptheme.cpp b/plugins/Modernb/modern_xptheme.cpp index 14e9614304..599cb55010 100644 --- a/plugins/Modernb/modern_xptheme.cpp +++ b/plugins/Modernb/modern_xptheme.cpp @@ -238,10 +238,6 @@ HRESULT xpt_DrawTheme(XPTHANDLE xptHandle, HWND hwnd, HDC hdc, int type, int sta HRESULT xpt_DrawThemeText(XPTHANDLE xptHandle, HDC hdc, int type, int state, LPCTSTR lpStr, int len, DWORD flag1, DWORD flag2, const RECT * textRect)
{
-#ifndef _UNICODE
- ske_DrawText(hdc,lpStr,len, (RECT*)textRect, flag1);
- return S_OK;
-#else
HRESULT res=S_FALSE;
xptcheck S_FALSE;
xptlock();
@@ -251,7 +247,6 @@ HRESULT xpt_DrawThemeText(XPTHANDLE xptHandle, HDC hdc, int type, int state, LPC ske_DrawText(hdc,lpStr,len, (RECT*)textRect, flag1);
xptunlock();
return S_OK;
-#endif
}
BOOL xpt_EnableThemeDialogTexture(HWND hwnd, DWORD flags)
{
diff --git a/plugins/Mwclist/clist.h b/plugins/Mwclist/clist.h index 9277f7d471..32effbad84 100644 --- a/plugins/Mwclist/clist.h +++ b/plugins/Mwclist/clist.h @@ -34,9 +34,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status typedef struct {
HANDLE hContact;
TCHAR *name;
- #if defined( _UNICODE )
- char *szName;
- #endif
+ char *szName;
TCHAR* szGroup;
int Hidden;
int noHiddenOffline;
diff --git a/plugins/Mwclist/clistsettings.cpp b/plugins/Mwclist/clistsettings.cpp index 6f135387b7..24275f4362 100644 --- a/plugins/Mwclist/clistsettings.cpp +++ b/plugins/Mwclist/clistsettings.cpp @@ -63,9 +63,7 @@ void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p) {
pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)_p;
if ( p->name) { mir_free(p->name); p->name = NULL; }
- #if defined( _UNICODE )
- if ( p->szName) { mir_free(p->szName); p->szName = NULL; }
- #endif
+ if ( p->szName) { mir_free(p->szName); p->szName = NULL; }
if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; }
if ( p->szGroup) { mir_free(p->szGroup); p->szGroup = NULL; }
}
diff --git a/plugins/Scriver/chat/chat.h b/plugins/Scriver/chat/chat.h index 283adcdecd..1c11ad223a 100644 --- a/plugins/Scriver/chat/chat.h +++ b/plugins/Scriver/chat/chat.h @@ -191,10 +191,8 @@ typedef struct SESSION_INFO_TYPE TCHAR* ptszStatusbarText;
TCHAR* ptszTopic;
- #if defined( _UNICODE )
- char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
- char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
- #endif
+ char* pszID; // ugly fix for returning static ANSI strings in GC_INFO
+ char* pszName; // just to fix a bug quickly, should die after porting IRC to Unicode
int iType;
int iFG;
diff --git a/plugins/Scriver/chat/log.c b/plugins/Scriver/chat/log.c index 5887708957..7fcae3f870 100644 --- a/plugins/Scriver/chat/log.c +++ b/plugins/Scriver/chat/log.c @@ -208,11 +208,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff else if (*line > 0 && *line < 128) {
*d++ = (char) *line;
} else {
- #if defined( _UNICODE )
d += sprintf(d, "\\u%u ?", (WORD)*line);
- #else
- d += sprintf(d, "\\'%02x", (BYTE)*line);
- #endif
}
}
@@ -323,13 +319,12 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, if ( streamData->lin->ptszText ) {
TCHAR *ptszTemp = NULL;
TCHAR *ptszText = streamData->lin->ptszText;
- #if defined( _UNICODE )
if (streamData->si->windowData.codePage != CP_ACP) {
char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
- #endif
+
Log_AppendRTF( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
mir_free(ptszTemp);
}
@@ -416,13 +411,12 @@ 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->si->windowData.codePage != CP_ACP) {
char *aText = t2acp(streamData->lin->ptszText, CP_ACP);
ptszText = ptszTemp = a2tcp(aText, streamData->si->windowData.codePage);
mir_free(aText);
}
- #endif
+
Log_AppendIEView( streamData, FALSE, buffer, bufferEnd, bufferAlloced, _T("%s"), ptszText );
mir_free(ptszTemp);
}
@@ -567,9 +561,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;
/*
ied.color = event->color;
@@ -881,15 +873,6 @@ char * Log_CreateRtfHeader(MODULEINFO * mi, SESSION_INFO* si) int charset = 0;
BOOL forceCharset = FALSE;
-#if !defined ( _UNICODE )
- if (si->windowData.codePage != CP_ACP) {
- CHARSETINFO csi;
- if(TranslateCharsetInfo((DWORD*)si->windowData.codePage, &csi, TCI_SRCCODEPAGE)) {
- forceCharset = TRUE;
- charset = csi.ciCharset;
- }
- }
-#endif
// guesstimate amount of memory for the RTF header
bufferEnd = 0;
bufferAlloced = 4096;
diff --git a/plugins/Scriver/chat/manager.c b/plugins/Scriver/chat/manager.c index 62542fd14a..74595f3bc0 100644 --- a/plugins/Scriver/chat/manager.c +++ b/plugins/Scriver/chat/manager.c @@ -136,11 +136,9 @@ int SM_RemoveSession( const TCHAR* pszID, const char* pszModule) mir_free( pTemp->ptszStatusbarText );
mir_free( pTemp->ptszTopic );
mir_free( pTemp->pszHeader );
- #if defined( _UNICODE )
- mir_free( pTemp->pszID );
- mir_free( pTemp->pszName );
- #endif
-
+ mir_free( pTemp->pszID );
+ mir_free( pTemp->pszName );
+
// delete commands
tcmdlist_free(pTemp->windowData.cmdList);
mir_free(pTemp);
@@ -771,11 +769,8 @@ char* SM_GetUsers(SESSION_INFO* si) if ( pLen + nameLen + 2 > alloced )
p = mir_realloc( p, alloced += 4096 );
- #if !defined( _UNICODE )
- lstrcpy( p + pLen, utemp->pszUID );
- #else
- WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
- #endif
+ WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 );
+
lstrcpyA( p + pLen + nameLen, " " );
utemp = utemp->next;
}
diff --git a/plugins/Scriver/chat/message.c b/plugins/Scriver/chat/message.c index 2951cc3856..a6866941d2 100644 --- a/plugins/Scriver/chat/message.c +++ b/plugins/Scriver/chat/message.c @@ -86,9 +86,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) char InsertThis[50];
BOOL bJustRemovedRTF = TRUE;
BOOL bTextHasStarted = FALSE;
- #if defined(_UNICODE)
- TCHAR *ptszResult;
- #endif
+ TCHAR *ptszResult;
int iUcMode = 0;
if ( !pszText )
@@ -157,11 +155,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\xA2");
-#else
- strcpy(InsertThis, "\x95");
-#endif
}
else if ( !memcmp(p1, "\\b", 2 )) { //bold
bTextHasStarted = bJustRemovedRTF = TRUE;
@@ -202,61 +196,37 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x93");
-#else
- strcpy(InsertThis, "\x96");
-#endif
}
else if (!memcmp(p1, "\\emdash", 7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x94");
-#else
- strcpy(InsertThis, "\x97");
-#endif
}
else if (!memcmp(p1, "\\lquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x98");
-#else
- strcpy(InsertThis, "\x91");
-#endif
}
else if (!memcmp(p1, "\\rquote",7)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 7;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xE2\x80\x99");
-#else
- strcpy(InsertThis, "\x92");
-#endif
}
else if (!memcmp(p1, "\\ldblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9c");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if (!memcmp(p1, "\\rdblquote",10)) {
bTextHasStarted = TRUE;
bJustRemovedRTF = TRUE;
iRemoveChars = 10;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xe2\x80\x9d");
-#else
- strcpy(InsertThis, "\"");
-#endif
}
else if ( p1[1] == '\\' || p1[1] == '{' || p1[1] == '}' ) { // escaped characters
bTextHasStarted = TRUE;
@@ -268,11 +238,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) bTextHasStarted = TRUE;
bJustRemovedRTF = FALSE;
iRemoveChars = 2;
-#if defined(_UNICODE)
strcpy(InsertThis, "\xC2\xA0");
-#else
- strcpy(InsertThis, "\xA0");
-#endif
}
else if ( p1[1] == '\'' ) { // special character
char tmp[4], *p3 = tmp;
@@ -340,12 +306,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) }
mir_free(pIndex);
-
- #if !defined( _UNICODE )
- return pszText;
- #else
- mir_utf8decode(pszText, &ptszResult);
- return ptszResult;
- #endif
+ mir_utf8decode(pszText, &ptszResult);
+ return ptszResult;
}
diff --git a/plugins/Scriver/chat/services.c b/plugins/Scriver/chat/services.c index 1104aa262b..22afdfd389 100644 --- a/plugins/Scriver/chat/services.c +++ b/plugins/Scriver/chat/services.c @@ -117,20 +117,11 @@ static INT_PTR Service_GetInfo(WPARAM wParam,LPARAM lParam) if ( gci->Flags & TYPE ) gci->iType = si->iType;
if ( gci->Flags & COUNT ) gci->iCount = si->nUsersInNicklist;
if ( gci->Flags & USERS ) gci->pszUsers = SM_GetUsers(si);
-
- #if defined( _UNICODE )
- if ( si->dwFlags & GC_UNICODE ) {
- if ( gci->Flags & ID ) gci->pszID = si->ptszID;
- if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- }
- else {
- if ( gci->Flags & ID ) gci->pszID = ( TCHAR* )si->pszID;
- if ( gci->Flags & NAME ) gci->pszName = ( TCHAR* )si->pszName;
- }
- #else
+ if ( si->dwFlags & GC_UNICODE ) {
if ( gci->Flags & ID ) gci->pszID = si->ptszID;
if ( gci->Flags & NAME ) gci->pszName = si->ptszName;
- #endif
+ }
+
LeaveCriticalSection(&cs);
return 0;
@@ -171,11 +162,6 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) if (gcr->cbSize != SIZEOF_STRUCT_GCREGISTER_V1)
return GC_REGISTER_WRONGVER;
- #ifndef _UNICODE
- if (gcr->dwFlags & GC_UNICODE)
- return GC_REGISTER_NOUNICODE;
- #endif
-
EnterCriticalSection(&cs);
mi = MM_AddModule( gcr->pszModule );
@@ -243,12 +229,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) si->iLogFilterFlags = (int)DBGetContactSettingDword(NULL, "Chat", "FilterFlags", 0x03E0);
si->bFilterEnabled = DBGetContactSettingByte(NULL, "Chat", "FilterEnabled", 0);
si->bNicklistEnabled = DBGetContactSettingByte(NULL, "Chat", "ShowNicklist", 1);
- #if defined( _UNICODE )
- if ( !( gcw->dwFlags & GC_UNICODE )) {
- si->pszID = mir_strdup( gcw->pszID );
- si->pszName = mir_strdup( gcw->pszName );
- }
- #endif
+
+ if ( !( gcw->dwFlags & GC_UNICODE )) {
+ si->pszID = mir_strdup( gcw->pszID );
+ si->pszName = mir_strdup( gcw->pszName );
+ }
+
if ( mi->bColor ) {
si->iFG = 4;
@@ -480,18 +466,16 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) EnterCriticalSection(&cs);
- #if defined( _UNICODE )
- if ( !( gce->dwFlags & GC_UNICODE )) {
- save_gce = *gce;
- save_gcd = *gce->pDest;
- gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
- gce->ptszUID = a2tf( gce->ptszUID, gce->dwFlags );
- gce->ptszNick = a2tf( gce->ptszNick, gce->dwFlags );
- gce->ptszStatus = a2tf( gce->ptszStatus, gce->dwFlags );
- gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
- gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
- }
- #endif
+ if ( !( gce->dwFlags & GC_UNICODE )) {
+ save_gce = *gce;
+ save_gcd = *gce->pDest;
+ gce->pDest->ptszID = a2tf( gce->pDest->ptszID, gce->dwFlags );
+ gce->ptszUID = a2tf( gce->ptszUID, gce->dwFlags );
+ gce->ptszNick = a2tf( gce->ptszNick, gce->dwFlags );
+ gce->ptszStatus = a2tf( gce->ptszStatus, gce->dwFlags );
+ gce->ptszText = a2tf( gce->ptszText, gce->dwFlags );
+ gce->ptszUserInfo = a2tf( gce->ptszUserInfo, gce->dwFlags );
+ }
// Do different things according to type of event
switch(gcd->iType) {
@@ -627,18 +611,16 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) LBL_Exit:
LeaveCriticalSection(&cs);
- #if defined( _UNICODE )
- if ( !( gce->dwFlags & GC_UNICODE )) {
- mir_free((void*)gce->ptszText );
- mir_free((void*)gce->ptszNick );
- mir_free((void*)gce->ptszUID );
- mir_free((void*)gce->ptszStatus );
- mir_free((void*)gce->ptszUserInfo );
- mir_free((void*)gce->pDest->ptszID );
- *gce = save_gce;
- *gce->pDest = save_gcd;
- }
- #endif
+ if ( !( gce->dwFlags & GC_UNICODE )) {
+ mir_free((void*)gce->ptszText );
+ mir_free((void*)gce->ptszNick );
+ mir_free((void*)gce->ptszUID );
+ mir_free((void*)gce->ptszStatus );
+ mir_free((void*)gce->ptszUserInfo );
+ mir_free((void*)gce->pDest->ptszID );
+ *gce = save_gce;
+ *gce->pDest = save_gcd;
+ }
return iRetVal;
}
diff --git a/plugins/Scriver/chat/tools.c b/plugins/Scriver/chat/tools.c index 882d2b2c0a..d18115dfae 100644 --- a/plugins/Scriver/chat/tools.c +++ b/plugins/Scriver/chat/tools.c @@ -531,10 +531,8 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce) if (hFile) {
TCHAR szTemp[512], szTemp2[512];
TCHAR* pszNick = NULL;
-#ifdef _UNICODE
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
-#endif
if ( gce->ptszNick ) {
if ( g_Settings.LogLimitNames && lstrlen(gce->ptszNick) > 20 ) {
lstrcpyn(szTemp2, gce->ptszNick, 20);
@@ -652,9 +650,7 @@ BOOL LogToFile(SESSION_INFO* si, GCEVENT * gce) if (read > 0) {
hFile = _tfopen(tszFile, _T("wb"));
if (hFile) {
-#ifdef _UNICODE
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
-#endif
fwrite(pBufferTemp, 1, read, hFile);
fclose(hFile);
hFile = NULL;
@@ -766,9 +762,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem)
{
- #if defined( _UNICODE )
- SESSION_INFO* si;
- #endif
+ SESSION_INFO* si;
GCHOOK* gch = (GCHOOK*)mir_alloc( sizeof( GCHOOK ));
GCDEST* gcd = (GCDEST*)mir_alloc( sizeof( GCDEST ));
@@ -776,23 +770,20 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int memset( gcd, 0, sizeof( GCDEST ));
replaceStrA( &gcd->pszModule, pszModule);
- #if defined( _UNICODE )
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd->pszID = t2a( pszID );
- gch->pszUID = t2a( pszUID );
- gch->pszText = t2a( pszText );
- }
- else {
- #endif
- replaceStr( &gcd->ptszID, pszID );
- replaceStr( &gch->ptszUID, pszUID);
- replaceStr( &gch->ptszText, pszText);
- #if defined( _UNICODE )
- }
- #endif
+ if (( si = SM_FindSession(pszID, pszModule)) == NULL )
+ return FALSE;
+
+ if ( !( si->dwFlags & GC_UNICODE )) {
+ gcd->pszID = t2a( pszID );
+ gch->pszUID = t2a( pszUID );
+ gch->pszText = t2a( pszText );
+ }
+ else {
+ replaceStr( &gcd->ptszID, pszID );
+ replaceStr( &gch->ptszUID, pszUID);
+ replaceStr( &gch->ptszText, pszText);
+ }
+
gcd->iType = iType;
gch->dwData = dwItem;
gch->pDest = gcd;
@@ -802,30 +793,24 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR* pszID, const char* pszModule, int BOOL DoEventHook(const TCHAR* pszID, const char* pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, DWORD dwItem)
{
- #if defined( _UNICODE )
- SESSION_INFO* si;
- #endif
+ SESSION_INFO* si;
GCHOOK gch = {0};
GCDEST gcd = {0};
gcd.pszModule = (char*)pszModule;
- #if defined( _UNICODE )
- if (( si = SM_FindSession(pszID, pszModule)) == NULL )
- return FALSE;
-
- if ( !( si->dwFlags & GC_UNICODE )) {
- gcd.pszID = t2a( pszID );
- gch.pszUID = t2a( pszUID );
- gch.pszText = t2a( pszText );
- }
- else {
- #endif
- gcd.ptszID = mir_tstrdup( pszID );
- gch.ptszUID = mir_tstrdup( pszUID );
- gch.ptszText = mir_tstrdup( pszText );
- #if defined( _UNICODE )
- }
- #endif
+ if (( si = SM_FindSession(pszID, pszModule)) == NULL )
+ return FALSE;
+
+ if ( !( si->dwFlags & GC_UNICODE )) {
+ gcd.pszID = t2a( pszID );
+ gch.pszUID = t2a( pszUID );
+ gch.pszText = t2a( pszText );
+ }
+ else {
+ gcd.ptszID = mir_tstrdup( pszID );
+ gch.ptszUID = mir_tstrdup( pszUID );
+ gch.ptszText = mir_tstrdup( pszText );
+ }
gcd.iType = iType;
gch.dwData = dwItem;
@@ -878,24 +863,20 @@ TCHAR* a2tf( const TCHAR* str, int flags ) if ( str == NULL )
return NULL;
- #if defined( _UNICODE )
- if ( flags & GC_UNICODE )
- return mir_tstrdup( str );
- else {
- int codepage = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
+ if ( flags & GC_UNICODE )
+ return mir_tstrdup( str );
+ else {
+ int codepage = CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 );
- int cbLen = MultiByteToWideChar( codepage, 0, (char*)str, -1, 0, 0 );
- TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
- if ( result == NULL )
- return NULL;
+ int cbLen = MultiByteToWideChar( codepage, 0, (char*)str, -1, 0, 0 );
+ TCHAR* result = ( TCHAR* )mir_alloc( sizeof(TCHAR)*( cbLen+1 ));
+ if ( result == NULL )
+ return NULL;
- MultiByteToWideChar( codepage, 0, (char*)str, -1, result, cbLen );
- result[ cbLen ] = 0;
- return result;
- }
- #else
- return mir_strdup( str );
- #endif
+ MultiByteToWideChar( codepage, 0, (char*)str, -1, result, cbLen );
+ result[ cbLen ] = 0;
+ return result;
+ }
}
TCHAR* replaceStr( TCHAR** dest, const TCHAR* src )
diff --git a/plugins/Scriver/chat/window.c b/plugins/Scriver/chat/window.c index 1a11b234f3..cc49d7172c 100644 --- a/plugins/Scriver/chat/window.c +++ b/plugins/Scriver/chat/window.c @@ -339,11 +339,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, end = HIWORD(lResult);
SendMessage(hwnd, EM_SETSEL, end, end);
- #if defined( _UNICODE )
- gt.codepage = 1200;
- #else
- gt.codepage = CP_ACP;
- #endif
+ gt.codepage = 1200;
iLen = GetRichTextLength(hwnd, gt.codepage, TRUE);
if (iLen >0) {
TCHAR *pszName = NULL;
@@ -1318,11 +1314,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam) sid.cbSize = sizeof(sid);
sid.szModule = SRMMMOD;
sid.dwId = 0;
- #if defined( _UNICODE )
sid.flags = 0;
- #else
- sid.flags = MBF_DISABLED;
- #endif
+
ModifyStatusIcon((WPARAM)si->windowData.hContact, (LPARAM) &sid);
// SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)si);
}
@@ -1900,9 +1893,7 @@ LABEL_SHOWWINDOW: DoEventHookAsync(hwndDlg, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, (LPARAM)NULL);
mir_free(pszRtf);
- #if defined( _UNICODE )
- mir_free(ptszText);
- #endif
+ mir_free(ptszText);
SetFocus(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE));
}
break;
diff --git a/plugins/Scriver/globals.c b/plugins/Scriver/globals.c index ce44bda1f0..c1006bd8f7 100644 --- a/plugins/Scriver/globals.c +++ b/plugins/Scriver/globals.c @@ -280,12 +280,7 @@ void InitGlobals() { ZeroMemory(g_dat, sizeof(struct GlobalMessageData));
g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
-#if !defined(_UNICODE)
- g_dat->hMenuANSIEncoding = CreatePopupMenu();
- AppendMenu(g_dat->hMenuANSIEncoding, MF_STRING, 500, TranslateT("Default codepage"));
- AppendMenuA(g_dat->hMenuANSIEncoding, MF_SEPARATOR, 0, 0);
- EnumSystemCodePagesA(LangAddCallback, CP_INSTALLED);
-#endif
+
HookEvent_Ex(ME_PROTO_ACK, ackevent);
ReloadGlobals();
g_dat->lastParent = NULL;
@@ -486,10 +481,8 @@ static int ackevent(WPARAM wParam, LPARAM lParam) { dbei.szModule = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) item->hContact, 0);
dbei.timestamp = time(NULL);
dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
- #if defined( _UNICODE )
if ( !( item->flags & PREF_UTF ))
dbei.cbBlob *= sizeof(TCHAR) + 1;
- #endif
dbei.pBlob = (PBYTE) item->sendBuffer;
hNewEvent = (HANDLE) CallService(MS_DB_EVENT_ADD, (WPARAM) item->hContact, (LPARAM) & dbei);
diff --git a/plugins/Scriver/infobar.c b/plugins/Scriver/infobar.c index c98ef1dfe4..4387c4979a 100644 --- a/plugins/Scriver/infobar.c +++ b/plugins/Scriver/infobar.c @@ -83,12 +83,8 @@ void RefreshInfobar(InfobarWindowData* idat) { else
mir_sntprintf(szText, 2047, _T("%s"), TranslateTS(szXStatusName));
st.flags = ST_DEFAULT;
-#ifdef _UNICODE
- st.codepage = 1200;
-#else
- st.codepage = CP_ACP;
-#endif
- SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
+ st.codepage = 1200;
+ SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactName);
SendDlgItemMessage(hwnd, IDC_INFOBAR_STATUS, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)szContactStatusMsg);
hIcon = (HICON)SendDlgItemMessage(hwnd, IDC_XSTATUSICON, STM_SETICON, (WPARAM)hIcon, 0);
if (hIcon) {
diff --git a/plugins/Scriver/input.c b/plugins/Scriver/input.c index 20378d096a..8f61de3f8d 100644 --- a/plugins/Scriver/input.c +++ b/plugins/Scriver/input.c @@ -426,11 +426,7 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
lstrcpy(GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
- #if defined( _UNICODE )
SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
CloseClipboard();
break;
}
diff --git a/plugins/Scriver/msgdialog.c b/plugins/Scriver/msgdialog.c index 9dcafa4746..8f17470549 100644 --- a/plugins/Scriver/msgdialog.c +++ b/plugins/Scriver/msgdialog.c @@ -68,11 +68,7 @@ static TCHAR *GetIEViewSelection(struct MessageWindowData *dat) { IEVIEWEVENT event;
ZeroMemory(&event, sizeof(event));
event.cbSize = sizeof(event);
-#ifdef _UNICODE
event.dwFlags = 0;
-#else
- event.dwFlags = IEEF_NO_UNICODE;
-#endif
event.codepage = dat->windowData.codePage;
event.hwnd = dat->windowData.hwndLog;
event.hContact = dat->windowData.hContact;
@@ -83,11 +79,7 @@ static TCHAR *GetIEViewSelection(struct MessageWindowData *dat) { static TCHAR *GetQuotedTextW(TCHAR * text) {
int i, j, l, newLine, wasCR;
TCHAR *out;
-#ifdef _UNICODE
l = (int)wcslen(text);
-#else
- l = strlen(text);
-#endif
newLine = 1;
wasCR = 0;
for (i=j=0; i<l; i++) {
@@ -180,7 +172,6 @@ static BOOL IsUtfSendAvailable(HANDLE hContact) return ( CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDUTF ) ? TRUE : FALSE;
}
-#if defined(_UNICODE)
int RTL_Detect(WCHAR *pszwText)
{
WORD *infoTypeC2;
@@ -204,7 +195,6 @@ int RTL_Detect(WCHAR *pszwText) }
return 0;
}
-#endif
static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilename)
{
@@ -838,16 +828,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP WindowList_Add(g_dat->hMessageWindowList, hwndDlg, dat->windowData.hContact);
if (newData->szInitialText) {
- #if defined(_UNICODE)
if(newData->isWchar)
SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText);
else
SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- #else
- SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText);
- #endif
- } else if (g_dat->flags & SMF_SAVEDRAFTS) {
- TCmdList *draft = tcmdlist_get2(g_dat->draftList, dat->windowData.hContact);
+ } else if (g_dat->flags & SMF_SAVEDRAFTS) {
+ TCmdList *draft = tcmdlist_get2(g_dat->draftList, dat->windowData.hContact);
if (draft != NULL) {
len = SetRichTextEncoded(GetDlgItem(hwndDlg, IDC_MESSAGE), draft->szCmd, dat->windowData.codePage);
}
@@ -1174,20 +1160,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
mir_free(szOldStatus);
mir_free(szNewStatus);
- #if defined( _UNICODE )
+
{
int ansiLen = WideCharToMultiByte(CP_ACP, 0, buffer, -1, blob, sizeof(blob), 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
+
//iLen = strlen(buffer) + 1;
//MultiByteToWideChar(CP_ACP, 0, buffer, iLen, (LPWSTR) & buffer[iLen], iLen);
dbei.cbSize = sizeof(dbei);
@@ -1657,12 +1636,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP item->codepage = dat->windowData.codePage;
if ( IsUtfSendAvailable( dat->windowData.hContact )) {
char* szMsgUtf;
- #if defined( _UNICODE )
- szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] );
- item->flags &= ~PREF_UNICODE;
- #else
- szMsgUtf = mir_utf8encodecp(msi->sendBuffer, dat->windowData.codePage);
- #endif
+ szMsgUtf = mir_utf8encodeW( (TCHAR *)&msi->sendBuffer[strlen(msi->sendBuffer) + 1] );
+ item->flags &= ~PREF_UNICODE;
if (!szMsgUtf) {
break;
}
@@ -1820,9 +1795,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
if (pf2.wEffects & PFE_RTLPARA)
msi.flags |= PREF_RTL;
- #if defined( _UNICODE )
bufSize += GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2;
- #endif
+
msi.sendBufferSize = bufSize;
msi.sendBuffer = (char *) mir_alloc(msi.sendBufferSize);
msi.flags |= PREF_TCHAR;
@@ -1831,13 +1805,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP gt.cb = ansiBufSize;
gt.codepage = dat->windowData.codePage;
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM) msi.sendBuffer);
- #if defined( _UNICODE )
- gt.cb = bufSize - ansiBufSize;
- gt.codepage = 1200;
- SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM) &msi.sendBuffer[ansiBufSize]);
- if ( RTL_Detect((wchar_t *)&msi.sendBuffer[ansiBufSize] ))
- msi.flags |= PREF_RTL;
- #endif
+ gt.cb = bufSize - ansiBufSize;
+ gt.codepage = 1200;
+ SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETTEXTEX, (WPARAM) >, (LPARAM) &msi.sendBuffer[ansiBufSize]);
+ if ( RTL_Detect((wchar_t *)&msi.sendBuffer[ansiBufSize] ))
+ msi.flags |= PREF_RTL;
+
if (msi.sendBuffer[0] == 0) {
mir_free (msi.sendBuffer);
break;
@@ -1923,11 +1896,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SETTEXTEX st;
TCHAR *buffer = NULL;
st.flags = ST_SELECTION;
-#ifdef _UNICODE
st.codepage = 1200;
-#else
- st.codepage = CP_ACP;
-#endif
+
if (dat->hDbEventLast==NULL) break;
if (dat->windowData.hwndLog != NULL) {
buffer = GetIEViewSelection(dat);
diff --git a/plugins/Scriver/msglog.c b/plugins/Scriver/msglog.c index 5e5823eee0..ba264a14d4 100644 --- a/plugins/Scriver/msglog.c +++ b/plugins/Scriver/msglog.c @@ -28,9 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define LOGICON_MSG_OUT 1
#define LOGICON_MSG_NOTICE 2
-#if defined ( _UNICODE )
extern int RTL_Detect(WCHAR *pszwText);
-#endif
extern HINSTANCE g_hInst;
static int logPixelSY;
static PBYTE pLogIconBmpBits[3];
@@ -94,15 +92,13 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) { ci.hContact = hContact;
ci.szProto = (char *)szProto;
ci.dwFlag = CNF_DISPLAY;
-#if defined ( _UNICODE )
if(IsUnicodeMIM()) {
ci.dwFlag |= CNF_UNICODE;
}
-#endif
+
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (ci.pszVal) {
-#if defined ( _UNICODE )
if(IsUnicodeMIM()) {
if (!_tcscmp((TCHAR *)ci.pszVal, TranslateW(_T("'(Unknown Contact)'")))) {
ci.dwFlag &= ~CNF_UNICODE;
@@ -115,9 +111,7 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) { } else {
szName = a2t((char *)ci.pszVal);
}
-#else
- szName = mir_tstrdup((TCHAR *)ci.pszVal);
-#endif
+
miranda_sys_free(ci.pszVal);
if (szName != NULL) {
return szName;
@@ -127,16 +121,12 @@ TCHAR *GetNickname(HANDLE hContact, const char* szProto) { }
szBaseNick = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
if (szBaseNick != NULL) {
-#if defined ( _UNICODE )
int len;
len = (int)strlen(szBaseNick) + 1;
szName = (TCHAR *) mir_alloc(len * 2);
MultiByteToWideChar(CP_ACP, 0, szBaseNick, -1, szName, len);
szName[len - 1] = 0;
return szName;
-#else
- return mir_tstrdup(szBaseNick);
-#endif
}
return mir_tstrdup(TranslateT("Unknown Contact"));
}
@@ -203,9 +193,8 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE }
event->eventType = event->custom ? EVENTTYPE_MESSAGE : dbei.eventType;
event->dwFlags = (dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0);
-#if defined( _UNICODE )
event->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
+
if ( dat->flags & SMF_RTL) {
event->dwFlags |= IEEDF_RTL;
}
@@ -218,7 +207,7 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE } else {
event->pszNickT = GetNickname(hContact, dat->szProto);
}
-#if defined( _UNICODE )
+
if (event->eventType == EVENTTYPE_FILE) {
char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
char* descr = filename + lstrlenA( filename ) + 1;
@@ -234,18 +223,7 @@ EventData *getEventFromDB(struct MessageWindowData *dat, HANDLE hContact, HANDLE event->dwFlags |= IEEDF_RTL;
}
}
-#else
- if (event->eventType == EVENTTYPE_FILE) {
- char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
- char* descr = filename + lstrlenA( filename ) + 1;
- event->pszTextT = mir_strdup(filename);
- if ( *descr != 0 ) {
- event->pszText2T = mir_strdup(descr);
- }
- } else {
- event->pszTextT = DbGetEventTextT( &dbei, dat->windowData.codePage );
- }
-#endif
+
mir_free(dbei.pBlob);
return event;
}
@@ -256,9 +234,7 @@ static EventData *GetTestEvent(DWORD flags) memset(event, 0, sizeof(EventData));
event->eventType = EVENTTYPE_MESSAGE;
event->dwFlags = IEEDF_READ | flags;
-#if defined( _UNICODE )
event->dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2;
-#endif
event->time = time(NULL);
event->codePage = CP_ACP;
return event;
@@ -383,11 +359,7 @@ static int AppendUnicodeToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferA static int AppendTToBuffer(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, TCHAR * line)
{
-#if defined ( _UNICODE )
return AppendUnicodeToBuffer(buffer, cbBufferEnd, cbBufferAlloced, line);
-#else
- return AppendAnsiToBuffer(buffer, cbBufferEnd, cbBufferAlloced, line);
-#endif
}
//mir_free() the return value
@@ -401,15 +373,6 @@ static char *CreateRTFHeader(struct MessageWindowData *dat, struct GlobalMessage HDC hdc;
int charset = 0;
BOOL forceCharset = FALSE;
-#if !defined ( _UNICODE )
- if (dat->windowData.codePage != CP_ACP) {
- CHARSETINFO csi;
- if(TranslateCharsetInfo((DWORD*)dat->windowData.codePage, &csi, TCI_SRCCODEPAGE)) {
- forceCharset = TRUE;
- charset = csi.ciCharset;
- }
- }
-#endif
hdc = GetDC(NULL);
logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
@@ -764,15 +727,13 @@ static char *CreateRTFFromEvent(struct MessageWindowData *dat, EventData *event, } else {
AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", SetToStyle(MSGFONTID_NOTICE));
}
-#if defined( _UNICODE )
+
if (event->dwFlags & IEEDF_UNICODE_NICK) {
AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNickW);
} else {
AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNick);
}
-#else
- AppendAnsiToBuffer(&buffer, &bufferEnd, &bufferAlloced, event->pszNick);
-#endif
+
showColon = 1;
if (event->eventType == EVENTTYPE_MESSAGE && gdat->flags & SMF_GROUPMESSAGES) {
if (gdat->flags & SMF_MARKFOLLOWUPS) {
@@ -1101,12 +1062,8 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) if (fAppend) {
GETTEXTLENGTHEX gtxl = {0};
gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS;
-#if defined( _UNICODE )
- gtxl.codepage = 1200;
-#else
- gtxl.codepage = CP_ACP;
-#endif
- gtxl.codepage = 1200;
+ gtxl.codepage = 1200;
+ gtxl.codepage = 1200;
fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0);
sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM) & sel);
diff --git a/plugins/Scriver/msgoptions.c b/plugins/Scriver/msgoptions.c index d1bfb2dd64..80358590f4 100644 --- a/plugins/Scriver/msgoptions.c +++ b/plugins/Scriver/msgoptions.c @@ -135,76 +135,10 @@ int FontServiceFontsChanged(WPARAM wParam, LPARAM lParam) return 0;
}
-#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 RegisterFontServiceFonts() {
int i;
diff --git a/plugins/Scriver/msgs.c b/plugins/Scriver/msgs.c index a3ce62f050..c0f63b6538 100644 --- a/plugins/Scriver/msgs.c +++ b/plugins/Scriver/msgs.c @@ -174,7 +174,6 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) return 0;
}
-#if defined(_UNICODE)
static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam)
{
HWND hwnd;
@@ -217,7 +216,6 @@ static INT_PTR SendMessageCommandW(WPARAM wParam, LPARAM lParam) }
return 0;
}
-#endif
static INT_PTR SendMessageCommand(WPARAM wParam, LPARAM lParam)
{
@@ -291,11 +289,7 @@ static int TypingMessage(WPARAM wParam, LPARAM lParam) tn.cbSize = sizeof(tn);
tn.tszInfoTitle = TranslateT("Typing Notification");
tn.tszInfo = szTip;
-#ifdef UNICODE
tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE;
-#else
- tn.dwInfoFlags = NIIF_INFO;
-#endif
tn.uTimeout = 1000 * 4;
CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) & tn);
}
@@ -461,15 +455,6 @@ static void RegisterStatusIcons() { sid.flags = MBF_HIDDEN;
sid.szTooltip = NULL;
AddStickyStatusIcon((WPARAM) 0, (LPARAM) &sid);
-
-#if !defined( _UNICODE )
- sid.dwId = 0;
- sid.hIcon = CopyIcon(GetCachedIcon("scriver_UNICODEOFF"));
- sid.hIconDisabled = CopyIcon(GetCachedIcon("scriver_UNICODEOFF"));
- sid.flags = 0;
- sid.szTooltip = NULL;
- AddStickyStatusIcon((WPARAM) 0, (LPARAM) &sid);
-#endif
}
void ChangeStatusIcons() {
@@ -626,9 +611,7 @@ int OnLoadModule(void) { HookEvent_Ex(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGE, SendMessageCommand);
- #if defined(_UNICODE)
CreateServiceFunction_Ex(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
- #endif
CreateServiceFunction_Ex(MS_MSG_GETWINDOWAPI, GetWindowAPI);
CreateServiceFunction_Ex(MS_MSG_GETWINDOWCLASS, GetWindowClass);
CreateServiceFunction_Ex(MS_MSG_GETWINDOWDATA, GetWindowData);
diff --git a/plugins/Scriver/msgtimedout.c b/plugins/Scriver/msgtimedout.c index c874068799..4a63acfa3a 100644 --- a/plugins/Scriver/msgtimedout.c +++ b/plugins/Scriver/msgtimedout.c @@ -46,14 +46,8 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (ewd->szText) {
SETTEXTEX st = {0};
st.flags = ST_DEFAULT;
- #ifdef _UNICODE
- st.codepage = 1200;
- #else
- st.codepage = CP_ACP;
- if (ewd->queueItem != NULL) {
- st.codepage = ewd->queueItem->codepage;
- }
- #endif
+ st.codepage = 1200;
+
SendDlgItemMessage(hwndDlg, IDC_MSGTEXT, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)ewd->szText);
}
if (ewd->szName) {
diff --git a/plugins/Scriver/msgwindow.c b/plugins/Scriver/msgwindow.c index c4a40a299a..cbbd0a3037 100644 --- a/plugins/Scriver/msgwindow.c +++ b/plugins/Scriver/msgwindow.c @@ -1264,13 +1264,9 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar rect.bottom -= GetSystemMetrics(SM_CYEDGE) + 2;
}
if (hTheme) {
-#ifdef _UNICODE
+
MyDrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, szLabel, -1, dwFormat, 0, &rect);
-#else
- wchar_t* text = mir_a2u(szLabel);
- MyDrawThemeText(hTheme, lpDIS->hDC, TABP_TABITEM, tstate, text, -1, dwFormat, 0, &rect);
- mir_free(text);
-#endif
+
}
else
DrawText(lpDIS->hDC, szLabel, -1, &rect, dwFormat);
diff --git a/plugins/Scriver/multimon.h b/plugins/Scriver/multimon.h index 95b81bbe2f..1ad717c554 100644 --- a/plugins/Scriver/multimon.h +++ b/plugins/Scriver/multimon.h @@ -143,14 +143,9 @@ typedef struct { (*(FARPROC*)&g_pfnMonitorFromRect = GetProcAddress(hUser32,"MonitorFromRect")) &&
(*(FARPROC*)&g_pfnMonitorFromPoint = GetProcAddress(hUser32,"MonitorFromPoint")) &&
(*(FARPROC*)&g_pfnEnumDisplayMonitors = GetProcAddress(hUser32,"EnumDisplayMonitors")) &&
- #ifdef UNICODE
- (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoW")) &&
+ (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoW")) &&
(*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesW")) &&
- #else
- (*(FARPROC*)&g_pfnGetMonitorInfo = GetProcAddress(hUser32,"GetMonitorInfoA")) &&
- (*(FARPROC*)&g_pfnEnumDisplayDevices = GetProcAddress(hUser32,"EnumDisplayDevicesA")) &&
- #endif
- (GetSystemMetrics(SM_CXVIRTUALSCREEN) >= GetSystemMetrics(SM_CXSCREEN)) &&
+ (GetSystemMetrics(SM_CXVIRTUALSCREEN) >= GetSystemMetrics(SM_CXSCREEN)) &&
(GetSystemMetrics(SM_CYVIRTUALSCREEN) >= GetSystemMetrics(SM_CYSCREEN)) )
{
fInitDone = TRUE;
diff --git a/plugins/Scriver/resource.rc b/plugins/Scriver/resource.rc index 01a6592c36..aecb2e21bd 100644 --- a/plugins/Scriver/resource.rc +++ b/plugins/Scriver/resource.rc @@ -7,11 +7,8 @@ #include <windows.h>
#undef RICHEDIT_CLASS
-#if defined ( UNICODE )
+
#define RICHEDIT_CLASS "RichEdit20W"
-#else
-#define RICHEDIT_CLASS "RichEdit20A"
-#endif
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
diff --git a/plugins/Scriver/sendqueue.c b/plugins/Scriver/sendqueue.c index 515ad64a65..33517507dc 100644 --- a/plugins/Scriver/sendqueue.c +++ b/plugins/Scriver/sendqueue.c @@ -28,7 +28,7 @@ static MessageSendQueueItem *global_sendQueue = NULL; static CRITICAL_SECTION queueMutex;
static char *MsgServiceName(HANDLE hContact)
{
-#ifdef _UNICODE
+
char szServiceName[100];
char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
if (szProto == NULL)
@@ -37,28 +37,21 @@ 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;
}
TCHAR * GetSendBufferMsg(MessageSendQueueItem *item) {
TCHAR *szMsg = NULL;
size_t len = strlen(item->sendBuffer);
-#if defined( _UNICODE )
+
if (item->flags & PREF_UTF) {
szMsg = mir_utf8decodeW(item->sendBuffer);
} else {
szMsg = (TCHAR *)mir_alloc(item->sendBufferSize - len - 1);
memcpy(szMsg, item->sendBuffer + len + 1, item->sendBufferSize - len - 1);
}
-#else
- if (item->flags & PREF_UTF) {
- szMsg = mir_utf8decodecp(mir_strdup(item->sendBuffer), item->codepage, NULL);
- } else {
- szMsg = (char *)mir_alloc(len + 1);
- memcpy(szMsg, item->sendBuffer, len + 1);
- }
-#endif
+
return szMsg;
}
diff --git a/plugins/Scriver/utils.c b/plugins/Scriver/utils.c index c59a90739c..bad1314b40 100644 --- a/plugins/Scriver/utils.c +++ b/plugins/Scriver/utils.c @@ -82,16 +82,12 @@ int safe_wcslen(wchar_t *msg, int maxLen) { 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;
}
@@ -120,28 +116,15 @@ wchar_t* a2u( const char* src, int codepage ) { TCHAR *a2t(const char *text) {
if ( text == NULL )
return NULL;
-
- #if defined ( _UNICODE )
return a2tcp(text, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ));
- #else
- return a2tcp(text, CP_ACP);
- #endif
}
char* t2a( const TCHAR* src ) {
- #if defined( _UNICODE )
- return u2a( src, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ) );
- #else
- return mir_strdup( src );
- #endif
+return u2a( src, CallService( MS_LANGPACK_GETCODEPAGE, 0, 0 ) );
}
char* t2acp( const TCHAR* src, int codepage ) {
- #if defined( _UNICODE )
- return u2a( src, codepage );
- #else
- return mir_strdup( src );
- #endif
+ return u2a( src, codepage );
}
wchar_t *a2w(const char *src, int len) {
@@ -216,9 +199,7 @@ TCHAR *GetRichText(HWND hwnd, int codepage) { GETTEXTEX gt = {0};
TCHAR *textBuffer = NULL;
int textBufferSize;
-#if defined( _UNICODE )
codepage = 1200;
-#endif
textBufferSize = GetRichTextLength(hwnd, codepage, TRUE);
if (textBufferSize > 0) {
textBufferSize += sizeof(TCHAR);
@@ -232,7 +213,6 @@ TCHAR *GetRichText(HWND hwnd, int codepage) { }
char *GetRichTextEncoded(HWND hwnd, int codepage) {
-#if defined( _UNICODE )
TCHAR *textBuffer = GetRichText(hwnd, codepage);
char *textUtf = NULL;
if (textBuffer != NULL) {
@@ -240,26 +220,16 @@ char *GetRichTextEncoded(HWND hwnd, int codepage) { mir_free(textBuffer);
}
return textUtf;
-#else
- return GetRichText(hwnd, codepage);
-#endif
}
int SetRichTextEncoded(HWND hwnd, const char *text, int codepage) {
TCHAR *textToSet;
SETTEXTEX st;
st.flags = ST_DEFAULT;
- #ifdef _UNICODE
- st.codepage = 1200;
- textToSet = mir_utf8decodeW(text);
- #else
- st.codepage = codepage;
- textToSet = (char *)text;
- #endif
+ st.codepage = 1200;
+ textToSet = mir_utf8decodeW(text);
SendMessage(hwnd, EM_SETTEXTEX, (WPARAM) &st, (LPARAM)textToSet);
- #ifdef _UNICODE
- mir_free(textToSet);
- #endif
+ mir_free(textToSet);
return GetRichTextLength(hwnd, st.codepage, FALSE);
}
@@ -309,12 +279,7 @@ char* GetRichTextRTF(HWND hwnd) ZeroMemory(&stream, sizeof(stream));
stream.pfnCallback = RichTextStreamCallback;
stream.dwCookie = (DWORD_PTR) &pszText; // pass pointer to pointer
-
- #if defined( _UNICODE )
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
- #else
- dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF;
- #endif
+ dwFlags = SF_RTFNOOBJS | SFF_PLAINRTF | SF_USECODEPAGE | (CP_UTF8 << 16);
SendMessage(hwnd, EM_STREAMOUT, dwFlags, (LPARAM) & stream);
return pszText; // pszText contains the text
}
@@ -400,11 +365,7 @@ TCHAR *GetRichEditSelection(HWND hwnd) ZeroMemory(&stream, sizeof(stream));
stream.pfnCallback = StreamOutCallback;
stream.dwCookie = (DWORD_PTR) &msi;
-#if defined( _UNICODE )
dwFlags = SF_TEXT|SF_UNICODE|SFF_SELECTION;
-#else
- dwFlags = SF_TEXT|SFF_SELECTION;
-#endif
msi.sendBuffer = NULL;
msi.sendBufferSize = 0;
SendMessage(hwnd, EM_STREAMOUT, (WPARAM)dwFlags, (LPARAM) & stream);
|