diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2012-06-16 17:42:08 +0000 |
commit | 5975b2d0903bd5df128d55e20cd27d7c13b4e46c (patch) | |
tree | 6696492511c591fa8bf3b65a64864245caa3e7c2 | |
parent | 8617d7e00546f892c9084f7c382648b23d8bbb63 (diff) |
another portion of "#ifdef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@448 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
58 files changed, 235 insertions, 570 deletions
diff --git a/plugins/AddContactPlus/main.cpp b/plugins/AddContactPlus/main.cpp index 932105e175..68a210543a 100644 --- a/plugins/AddContactPlus/main.cpp +++ b/plugins/AddContactPlus/main.cpp @@ -146,10 +146,8 @@ static int OnModulesLoaded(WPARAM, LPARAM) if (ServiceExists(MS_UPDATE_REGISTERFL))
#if defined(_WIN64)
CallService(MS_UPDATE_REGISTERFL, 4414, (LPARAM)&pluginInfo);
-#elif defined(_UNICODE)
- CallService(MS_UPDATE_REGISTERFL, 3842, (LPARAM)&pluginInfo);
#else
- CallService(MS_UPDATE_REGISTERFL, 3843, (LPARAM)&pluginInfo);
+ CallService(MS_UPDATE_REGISTERFL, 3842, (LPARAM)&pluginInfo);
#endif
SKINICONDESC sid = {0};
diff --git a/plugins/AssocMgr/assoclist.cpp b/plugins/AssocMgr/assoclist.cpp index 780924968d..4cedcb519c 100644 --- a/plugins/AssocMgr/assoclist.cpp +++ b/plugins/AssocMgr/assoclist.cpp @@ -687,9 +687,9 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara TranslateDialogDefault(hwndDlg);
CoInitialize(NULL);
hwndList = GetDlgItem(hwndDlg, IDC_ASSOCLIST);
-#if defined(_UNICODE)
+
ListView_SetUnicodeFormat(hwndList, TRUE);
-#endif
+
SendDlgItemMessage(hwndDlg, IDC_HEADERTEXT, WM_SETFONT, SendMessage(GetParent(hwndDlg), PSM_GETBOLDFONT, 0, 0), 0);
/* checkboxes won't show up on Win95 without IE3+ or 4.70 (plugin opts uses the same) */
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP);
@@ -838,11 +838,11 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara /* enable apply */
PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
-#if defined(_UNICODE)
+
case WM_NOTIFYFORMAT:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, NFR_UNICODE);
return TRUE;
-#endif
+
case WM_NOTIFY:
{ NMHDR *nmhdr = (NMHDR*)lParam;
switch(nmhdr->idFrom) {
diff --git a/plugins/AssocMgr/dde.cpp b/plugins/AssocMgr/dde.cpp index dc03e7e0cc..a8328b4d34 100644 --- a/plugins/AssocMgr/dde.cpp +++ b/plugins/AssocMgr/dde.cpp @@ -109,10 +109,10 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM DDEACK ack;
ZeroMemory(&ack,sizeof(ack));
if(UnpackDDElParam(msg,lParam,NULL,(PUINT_PTR)&hCommand)) {
- #if defined(_UNICODE)
+
/* ANSI execute command can't happen for shell */
if(IsWindowUnicode((HWND)wParam)) {
- #endif
+
pszCommand = (TCHAR*)GlobalLock(hCommand);
if(pszCommand!=NULL) {
TCHAR *pszAction,*pszArg;
@@ -129,9 +129,9 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM }
GlobalUnlock(hCommand);
}
- #if defined(_UNICODE)
+
}
- #endif
+
lParam=ReuseDDElParam(lParam,msg,WM_DDE_ACK,*(PUINT)&ack,(UINT)hCommand);
if (!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
GlobalFree(hCommand);
diff --git a/plugins/AssocMgr/reg.cpp b/plugins/AssocMgr/reg.cpp index 089d483c70..92451a52d3 100644 --- a/plugins/AssocMgr/reg.cpp +++ b/plugins/AssocMgr/reg.cpp @@ -419,12 +419,9 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe ptszName=a2t(pszName);
if(ptszName!=NULL) {
if (!RegQueryValueEx(hKey,ptszName,NULL,&dwType,pData,&cbData)) {
- #ifdef _UNICODE
+
WriteDbBackupData(*param->ppszDbPrefix,dwType,pData,cbData);
- #else
- if (!(dwType®F_ANSI)) /* sanity check, never happens */
- WriteDbBackupData(*param->ppszDbPrefix,dwType®F_ANSI,pData,cbData);
- #endif
+
}
mir_free(ptszName);
}
diff --git a/plugins/AssocMgr/utils.cpp b/plugins/AssocMgr/utils.cpp index 663484142a..e6414eeb02 100644 --- a/plugins/AssocMgr/utils.cpp +++ b/plugins/AssocMgr/utils.cpp @@ -76,25 +76,19 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp) // mir_free() the return value
TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp)
{
-#if defined(_UNICODE)
+
if(fUnicode) return mir_wstrdup((WCHAR*)pszStr);
return a2u((char*)pszStr,fMirCp);
-#else
- if(fUnicode) return u2a((WCHAR*)pszStr,fMirCp);
- return mir_strdup((char*)pszStr);
-#endif
+
}
// mir_free() the return value
void* t2s(const TCHAR *pszStr,DWORD fUnicode,BOOL fMirCp)
{
-#if defined(_UNICODE)
+
if (!fUnicode) return (void*)u2a(pszStr,fMirCp);
return (void*)mir_wstrdup(pszStr);
-#else
- if(fUnicode) return (void*)a2u(pszStr,fMirCp);
- return (void*)mir_strdup(pszStr);
-#endif
+
}
/************************* Database *******************************/
diff --git a/plugins/AssocMgr/utils.h b/plugins/AssocMgr/utils.h index 0c2682c4a8..f65a29ebec 100644 --- a/plugins/AssocMgr/utils.h +++ b/plugins/AssocMgr/utils.h @@ -26,13 +26,10 @@ WCHAR* a2u(const char *pszAnsi,BOOL fMirCp); char* u2a(const WCHAR *pszUnicode,BOOL fMirCp);
TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp);
void* t2s(const TCHAR *pszStr,DWORD fUnicode,BOOL fMirCp);
-#ifdef _UNICODE
+
#define t2a(s) u2a(s,FALSE)
#define a2t(s) a2u(s,FALSE)
-#else
- #define t2a(s) mir_strdup(s)
- #define a2t(s) mir_strdup(s)
-#endif
+
/* Database */
BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,char ***pSettings,int *pnSettingsCount);
diff --git a/plugins/Bonsai/utils.cpp b/plugins/Bonsai/utils.cpp index 3f30dc44ad..1f62ac32c8 100644 --- a/plugins/Bonsai/utils.cpp +++ b/plugins/Bonsai/utils.cpp @@ -228,9 +228,9 @@ TCHAR *GetContactName(HANDLE hContact, char *szProto) ctInfo.szProto = proto;
}
ctInfo.dwFlag = CNF_DISPLAY;
-#ifdef _UNICODE
+
ctInfo.dwFlag += CNF_UNICODE;
-#endif
+
ctInfo.hContact = hContact;
//_debug_message("retrieving contact name for %d", hContact);
ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
@@ -277,9 +277,9 @@ TCHAR *GetContactID(HANDLE hContact, char *szProto) ctInfo.cbSize = sizeof(ctInfo);
ctInfo.szProto = szProto;
ctInfo.dwFlag = CNF_UNIQUEID;
-#ifdef _UNICODE
+
ctInfo.dwFlag |= CNF_UNICODE;
-#endif
+
ctInfo.hContact = hContact;
ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo);
TCHAR *buffer;
diff --git a/plugins/ChangeKeyboardLayout/hook_events.c b/plugins/ChangeKeyboardLayout/hook_events.c index 6251dc8911..4afad800d1 100644 --- a/plugins/ChangeKeyboardLayout/hook_events.c +++ b/plugins/ChangeKeyboardLayout/hook_events.c @@ -203,11 +203,9 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) //Поддержка Апдейтера
if(ServiceExists(MS_UPDATE_REGISTERFL))
{
- #if defined (_UNICODE)
+
CallService(MS_UPDATE_REGISTERFL, (WPARAM)3632, (LPARAM)&pluginInfo);
- #else
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)3631, (LPARAM)&pluginInfo);
- #endif
+
}
diff --git a/plugins/ChangeKeyboardLayout/text_operations.c b/plugins/ChangeKeyboardLayout/text_operations.c index 8118d76afa..c7652c7776 100644 --- a/plugins/ChangeKeyboardLayout/text_operations.c +++ b/plugins/ChangeKeyboardLayout/text_operations.c @@ -14,9 +14,9 @@ static DWORD CALLBACK EditStreamOutRtf(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG c CopyMemory(esd->pbBuff+esd->iCurrent, pbBuff, cb);
esd->iCurrent += cb;
esd->pbBuff[esd->iCurrent] = 0;
- #if defined (_UNICODE)
+
esd->pbBuff[esd->iCurrent+1] = 0;
- #endif
+
*pcb = cb;
return 0;
}
@@ -56,11 +56,9 @@ BOOL CopyTextToClipboard(LPTSTR ptszText) _tcscpy((TCHAR*)GlobalLock(hCopy), ptszText);
GlobalUnlock(hCopy);
- #if defined (_UNICODE)
+
SetClipboardData(CF_UNICODETEXT, hCopy);
- #else
- SetClipboardData(CF_TEXT, hCopy);
- #endif
+
CloseClipboard();
return TRUE;
@@ -129,15 +127,11 @@ LPTSTR GenerateLayoutString(HKL hklLayout) shVirtualKey = MapVirtualKeyEx(iScanCode, 1, hklLayout);
bState[shVirtualKey&0x00FF] = 0x80;
- #if defined (_UNICODE)
+
iRes = ToUnicodeEx(shVirtualKey, iScanCode, bState, ptszTemp, 3, 0, hklLayout);
// Защита от дэд-кеев
if (iRes<0) ToUnicodeEx(shVirtualKey, iScanCode, bState, ptszTemp, 3, 0, hklLayout);
- #else
- iRes = ToAsciiEx(shVirtualKey, iScanCode, bState, ptszTemp, 0, hklLayout);
- // Защита от дэд-кеев
- if (iRes<0) ToAsciiEx(shVirtualKey, iScanCode, bState, ptszTemp, 0, hklLayout);
- #endif
+
//Если нам вернули нулевой символ, или не вернули ничего, то присвоим "звоночек"
if (ptszTemp[0] == 0) ptszLayStr[i] = 3; else ptszLayStr[i] = ptszTemp[0];
@@ -302,9 +296,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) ieEvent.dwFlags = 0;
ieEvent.iType = IEE_GET_SELECTION;
//event.codepage = 1200;
- #if !defined(_UNICODE)
- ieEvent.dwFlags |= IEEF_NO_UNICODE;
- #endif
+
if (ServiceExists(MS_HPP_EG_EVENT))
{
@@ -361,11 +353,9 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (WindowType == WTYPE_RichEdit)
{
ZeroMemory(&esdData, sizeof(esdData));
- #if defined (_UNICODE)
+
if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SF_UNICODE|SFF_SELECTION, (LPARAM)&esStream)>0)
- #else
- if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SFF_SELECTION, (LPARAM)&esStream)>0)
- #endif
+
ptszInText = GeTStringFromStreamData(&esdData);
else
{
@@ -405,11 +395,9 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) crTemp.cpMin = 0;
crTemp.cpMax = -1;
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crTemp);
- #if defined (_UNICODE)
+
if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SF_UNICODE|SFF_SELECTION, (LPARAM)&esStream) != 0)
- #else
- if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SFF_SELECTION, (LPARAM)&esStream) != 0)
- #endif
+
ptszInText = GeTStringFromStreamData(&esdData);
else
{
@@ -450,11 +438,9 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) {
SendMessage(hTextWnd, EM_EXSETSEL, 0, (LPARAM)&crTemp);
ZeroMemory(&esdData, sizeof(esdData));
- #if defined (_UNICODE)
+
if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SF_UNICODE|SFF_SELECTION, (LPARAM)&esStream) != 0)
- #else
- if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT|SFF_SELECTION, (LPARAM)&esStream) != 0)
- #endif
+
ptszInText = GeTStringFromStreamData(&esdData);
else
{
diff --git a/plugins/ClientChangeNotify/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/ClientChangeNotify.cpp index a19c41e128..8ce9f2080d 100644 --- a/plugins/ClientChangeNotify/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/ClientChangeNotify.cpp @@ -416,15 +416,15 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) update.pbVersion = (BYTE*)CreateVersionString(PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), szVersion);
update.cpbVersion = (int)strlen((char*)update.pbVersion);
update.szUpdateURL = "http://deathdemon.int.ru/projects/ClientChangeNotify"
-#ifdef _UNICODE
+
"W"
-#endif
+
".zip";
update.szVersionURL = "http://deathdemon.int.ru/updaterinfo.php";
update.pbVersionPrefix = (BYTE*)"ClientChangeNotify"
-#ifdef _UNICODE
+
" Unicode"
-#endif
+
" version ";
update.cpbVersionPrefix = (int)strlen((char*)update.pbVersionPrefix);
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
diff --git a/plugins/ClientChangeNotify/Common.h b/plugins/ClientChangeNotify/Common.h index d45b6d007d..483724fdb1 100644 --- a/plugins/ClientChangeNotify/Common.h +++ b/plugins/ClientChangeNotify/Common.h @@ -136,13 +136,10 @@ struct SHOWPOPUP_DATA // additional m_popup.h declarations
-#ifdef _UNICODE
+
#define POPUPDATAT POPUPDATAW
#define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPW
-#else
- #define POPUPDATAT POPUPDATAEX
- #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPEX
-#endif
+
int ContactSettingChanged(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/CommonLibs/CString.cpp b/plugins/CommonLibs/CString.cpp index 87266513d0..2b7441a8e0 100644 --- a/plugins/CommonLibs/CString.cpp +++ b/plugins/CommonLibs/CString.cpp @@ -310,7 +310,7 @@ CString DBGetContactSettingString(HANDLE hContact, const char *szModule, const c }
-#ifdef _UNICODE
+
TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *szDefaultValue)
{
DBVARIANT dbv = {0};
@@ -334,7 +334,7 @@ TCString DBGetContactSettingString(HANDLE hContact, const char *szModule, const }
return Result;
}
-#endif
+
int DBGetContactSettingString(HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv)
@@ -355,12 +355,10 @@ TCString DBGetContactSettingAsString(HANDLE hContact, const char *szModule, cons dbcgs.szModule = szModule;
dbcgs.pValue = &dbv;
dbcgs.szSetting = szSetting;
-#ifdef _UNICODE
+
dbv.type = DBVT_WCHAR;
int iRes = CallService(MS_DB_CONTACT_GETSETTING_STR, (WPARAM)hContact, (LPARAM)&dbcgs);
-#else
- int iRes = CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs);
-#endif
+
TCString Result;
if (!iRes && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR))
{
diff --git a/plugins/CommonLibs/CString.h b/plugins/CommonLibs/CString.h index ed2540c511..fb956f6e4e 100644 --- a/plugins/CommonLibs/CString.h +++ b/plugins/CommonLibs/CString.h @@ -109,7 +109,7 @@ typedef TString<WCHAR> WCString; __inline CString TCHAR2ANSI(TCString Str)
{
-#ifdef _UNICODE
+
if (Str == NULL)
{
return CString();
@@ -123,15 +123,13 @@ __inline CString TCHAR2ANSI(TCString Str) AStr.ReleaseBuffer(Str.GetLen());
}
return AStr;
-#else
- return Str;
-#endif
+
}
__inline TCString ANSI2TCHAR(CString Str)
{
-#ifdef _UNICODE
+
if (Str == NULL)
{
return TCString();
@@ -146,64 +144,30 @@ __inline TCString ANSI2TCHAR(CString Str) TStr.ReleaseBuffer(Len - 1);
}
return TStr;
-#else
- return Str;
-#endif
+
}
__inline WCString TCHAR2WCHAR(TCString Str)
{
-#ifdef _UNICODE
+
return Str;
-#else
- if (Str == NULL)
- {
- return WCString();
- }
- WCString WStr;
- int Len = MultiByteToWideChar(CP_ACP, 0, Str, -1, NULL, 0);
- if (!MultiByteToWideChar(CP_ACP, 0, Str, -1, WStr.GetBuffer(Len), Len))
- {
- WStr.ReleaseBuffer(0);
- } else
- {
- WStr.ReleaseBuffer(Len - 1);
- }
- return WStr;
-#endif
+
}
__inline TCString WCHAR2TCHAR(WCString Str)
{
-#ifdef _UNICODE
+
return Str;
-#else
- if (Str == NULL)
- {
- return TCString();
- }
- CString AStr;
- if (!WideCharToMultiByte(CP_ACP, 0, Str, -1, AStr.GetBuffer(Str.GetLen() + 1), Str.GetLen() + 1, NULL, NULL))
- {
- AStr.ReleaseBuffer(0);
- } else
- {
- AStr.ReleaseBuffer(Str.GetLen());
- }
- return AStr;
-#endif
+
}
-#ifdef _UNICODE
+
#define WCHAR2ANSI TCHAR2ANSI
#define ANSI2WCHAR ANSI2TCHAR
-#else
-#define WCHAR2ANSI WCHAR2TCHAR
-#define ANSI2WCHAR TCHAR2WCHAR
-#endif
+
#ifdef CHARARRAY_CONVERT
@@ -247,7 +211,7 @@ __inline CHARARRAY ANSI2WCHAR_ARRAY(CHARARRAY &c) return Result;
}
-#ifdef _UNICODE // utf8 conversion doesn't work on win95
+
__inline CHARARRAY WCHAR2UTF8(WCString Str)
{
CHARARRAY Result;
@@ -262,7 +226,7 @@ __inline CHARARRAY WCHAR2UTF8(WCString Str) }
return Result;
}
-#endif
+
#endif // CHARARRAY_CONVERT
@@ -308,11 +272,8 @@ private: wchar_t *p;
};
-#ifdef _UNICODE
+
#define UTF8Decode UTF8DecodeW
-#else
-#define UTF8Decode UTF8DecodeA
-#endif
/*class mallocStrA
@@ -339,9 +300,7 @@ private: wchar_t *p;
};
-#ifdef _UNICODE
+
#define mallocStr mallocStrW
-#else
-#define mallocStr mallocStrA
-#endif
+
*/
\ No newline at end of file diff --git a/plugins/CommonLibs/pcre.cpp b/plugins/CommonLibs/pcre.cpp index 5bd85833d9..ae82e43435 100644 --- a/plugins/CommonLibs/pcre.cpp +++ b/plugins/CommonLibs/pcre.cpp @@ -128,11 +128,9 @@ TCString CompileRegexp(TCString Regexp, int bAddAsUsualSubstring, int ID) }
Regexp.ReleaseBuffer();
}
-#ifdef _UNICODE
+
PcreCompileData[NewID].pPcre = pcre_compile(WCHAR2UTF8(Regexp).GetData(), PCRE_UTF8 | PCRE_NO_UTF8_CHECK | Flags, &Err, &ErrOffs, NULL);
-#else
- PcreCompileData[NewID].pPcre = pcre_compile(Regexp, Flags, &Err, &ErrOffs, NULL);
-#endif
+
if (PcreCompileData[NewID].pPcre) {
PcreCompileData[NewID].pExtra = NULL;
if (pcre_study)
@@ -164,7 +162,7 @@ HMODULE LoadPcreLibrary(const char *szPath) *(FARPROC*)&pcre_free = *(FARPROC*)GetProcAddress(hModule, "pcre_free"); // pcre_free is a pointer to a variable containing pointer to the function %)
if (pcre_compile && pcre_exec && pcre_free)
{
-#ifdef _UNICODE
+
int Utf8Supported = 0;
if (pcre_config)
{
@@ -174,9 +172,7 @@ HMODULE LoadPcreLibrary(const char *szPath) {
return hModule;
}
-#else
- return hModule;
-#endif
+
}
FreeLibrary(hModule);
return NULL;
@@ -256,12 +252,10 @@ int PcreCheck(TCString Str, int StartingID) {
if (hPcreDLL && PcreCompileData[I].pPcre)
{
-#ifdef _UNICODE
+
CHARARRAY Utf8Str = WCHAR2UTF8(Str);
int Res = pcre_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Utf8Str.GetData(), Utf8Str.GetSize() - 1, 0, PCRE_NOTEMPTY | PCRE_NO_UTF8_CHECK, NULL, 0);
-#else
- int Res = pcre_exec(PcreCompileData[I].pPcre, PcreCompileData[I].pExtra, Str, Str.GetLen(), 0, PCRE_NOTEMPTY, NULL, 0);
-#endif
+
if (Res >= 0)
{
return PcreCompileData[I].ID;
diff --git a/plugins/LangMan/langpack.cpp b/plugins/LangMan/langpack.cpp index 0f05c61a30..0f783e0bbe 100644 --- a/plugins/LangMan/langpack.cpp +++ b/plugins/LangMan/langpack.cpp @@ -217,11 +217,9 @@ static BOOL LoadPackData(LANGPACK_INFO *pack, BOOL fEnabledPacks, const char *ps if (GetLocaleInfoA(pack->Locale, LOCALE_IDEFAULTANSICODEPAGE, line, 6))
pack->codepage = (WORD)atoi(line); /* CP_ACP on error */
/* language */
-#if defined(_UNICODE)
+
MultiByteToWideChar(pack->codepage, 0, szLanguageA, -1, pack->szLanguage, SIZEOF(pack->szLanguage));
-#else
- lstrcpyA(pack->szLanguage, szLanguageA); /* buffer safe */
-#endif
+
/* ensure the pack always has a language name */
if (!pack->szLanguage[0] && !GetLocaleInfo(pack->Locale, LOCALE_SENGLANGUAGE, pack->szLanguage, SIZEOF(pack->szLanguage))) {
TCHAR *p;
diff --git a/plugins/LangMan/options.cpp b/plugins/LangMan/options.cpp index 740790a8a9..a0c6aa70e0 100644 --- a/plugins/LangMan/options.cpp +++ b/plugins/LangMan/options.cpp @@ -197,15 +197,13 @@ static void DisplayNotIncludedPlugins(HWND hwndListBox, const LANGPACK_INFO *pac lstrcpy(szSearch, wfd.cFileName); /* buffer safe */
p = _tcsrchr(szSearch, _T('.'));
if (p!=NULL) *p = _T('\0');
-#if defined(_UNICODE)
+
{ char cFileNameA[MAX_PATH];
cFileNameA[0] = '\0';
WideCharToMultiByte(CP_ACP, 0, szSearch, -1, cFileNameA, sizeof(cFileNameA), NULL, NULL);
if (IsPluginIncluded(pack, cFileNameA)) continue;
}
-#else
- if (IsPluginIncluded(pack, szSearch)) continue;
-#endif
+
/* friendly name of the plugin */
mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\Plugins\\%s"), szDir, wfd.cFileName);
hModule = GetModuleHandle(szSearch);
@@ -530,11 +528,11 @@ static INT_PTR CALLBACK LangOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE;
}
break;
-#if defined(_UNICODE)
+
case WM_NOTIFYFORMAT:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, NFR_UNICODE);
return TRUE;
-#endif
+
case WM_NOTIFY:
{ NMHDR *nmhdr = (NMHDR*)lParam;
switch(nmhdr->idFrom) {
diff --git a/plugins/LangMan/version.h b/plugins/LangMan/version.h index 296ad97e87..69dae65ae4 100644 --- a/plugins/LangMan/version.h +++ b/plugins/LangMan/version.h @@ -32,8 +32,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define USERAGENT_VERSION "1.0.2.3"
#endif
-#if defined(_UNICODE)
#define PLUGIN_WEBSITE "http://addons.miranda-im.org/details.php?action = viewfile&id = 3003"
-#else
- #define PLUGIN_WEBSITE "http://addons.miranda-im.org/details.php?action = viewfile&id = 3002"
-#endif
diff --git a/plugins/ListeningTo/options.cpp b/plugins/ListeningTo/options.cpp index 27dc7f6fea..3c93cf9855 100644 --- a/plugins/ListeningTo/options.cpp +++ b/plugins/ListeningTo/options.cpp @@ -145,7 +145,7 @@ BOOL IsTypeEnabled(LISTENINGTOINFO *lti) if (lti == NULL)
return TRUE;
-#ifdef UNICODE
+
if (lti->dwFlags & LTI_UNICODE) {
if (lstrcmpi(lti->ptszType, _T("Music")) == 0)
return opts.enable_music;
@@ -156,7 +156,7 @@ BOOL IsTypeEnabled(LISTENINGTOINFO *lti) return opts.enable_others;
}
else
-#endif
+
{
if (strcmpi(lti->pszType, "Music") == 0)
return opts.enable_music;
diff --git a/plugins/ListeningTo/players/generic.cpp b/plugins/ListeningTo/players/generic.cpp index 2300ace336..62582ab7bc 100644 --- a/plugins/ListeningTo/players/generic.cpp +++ b/plugins/ListeningTo/players/generic.cpp @@ -51,10 +51,10 @@ int m_log(const TCHAR *function, const TCHAR *fmt, ...) if (fp != NULL)
{
-#ifdef UNICODE
+
if (writeBOM)
fwprintf(fp, L"\xFEFF");
-#endif
+
_ftprintf(fp, _T("%s\r\n"), text);
fclose(fp);
@@ -157,12 +157,9 @@ void GenericPlayer::ProcessReceived() Player *player = this;
for (int i = FIRST_PLAYER; i < NUM_PLAYERS; i++)
{
-#ifdef UNICODE
+
WCHAR *player_name = players[i]->name;
-#else
- WCHAR player_name[128];
- MultiByteToWideChar(CP_ACP, 0, players[i]->name, -1, player_name, MAX_REGS(player_name));
-#endif
+
if (_wcsicmp(parts[1], player_name) == 0)
{
player = players[i];
@@ -274,11 +271,9 @@ void GenericPlayer::NewData(const WCHAR *data, size_t len) wcsncpy(received, data, len);
received[len] = L'\0';
-//#ifdef UNICODE
+
// m_log(_T("NewData"), _T("Text: %s"), received);
-//#else
-// m_log(_T("NewData"), _T("Text: %S"), received);
-//#endif
+
if (hTimer)
KillTimer(NULL, hTimer);
diff --git a/plugins/ListeningTo/players/watrack.cpp b/plugins/ListeningTo/players/watrack.cpp index bace34d2a4..133c97e57f 100644 --- a/plugins/ListeningTo/players/watrack.cpp +++ b/plugins/ListeningTo/players/watrack.cpp @@ -87,19 +87,13 @@ void WATrack::NewStatus(int event, int value) void WATrack::GetData()
{
-#ifdef UNICODE
+
SONGINFO *si = NULL;
int playing = CallService(MS_WAT_GETMUSICINFO, WAT_INF_UNICODE, (LPARAM) &si);
-#else
-
- SONGINFOA *si = NULL;
-
- int playing = CallService(MS_WAT_GETMUSICINFO, WAT_INF_ANSI, (LPARAM) &si);
-#endif
FreeData();
diff --git a/plugins/ListeningTo/players/wmp.cpp b/plugins/ListeningTo/players/wmp.cpp index a146976508..a636a45119 100644 --- a/plugins/ListeningTo/players/wmp.cpp +++ b/plugins/ListeningTo/players/wmp.cpp @@ -154,11 +154,9 @@ void WindowsMediaPlayer::NewData(const WCHAR *data, size_t len) wcsncpy(received, data, len);
received[len] = L'\0';
-/*#ifdef UNICODE
+/*
m_log(_T("ReceiverWndProc"), _T("WMP : New data: [%d] %s"), len, received);
-#else
- m_log(_T("ReceiverWndProc"), _T("WMP : New data: [%d] %S"), len, received);
-#endif
+
*/
if (hTimer)
KillTimer(NULL, hTimer);
diff --git a/plugins/NewAwaySysMod/AwaySys.cpp b/plugins/NewAwaySysMod/AwaySys.cpp index 0e10dd9eeb..1e968393b9 100644 --- a/plugins/NewAwaySysMod/AwaySys.cpp +++ b/plugins/NewAwaySysMod/AwaySys.cpp @@ -980,15 +980,15 @@ int MirandaLoaded(WPARAM wParam, LPARAM lParam) update.pbVersion = (BYTE*)CreateVersionString(my_make_version(PRODUCTVER), szVersion);
update.cpbVersion = strlen((char*)update.pbVersion);
update.szUpdateURL = "http://myied.org/packs/NAS"
-#ifdef _UNICODE
+
"W"
-#endif
+
".zip";
update.szVersionURL = "http://myied.org/packs/NAS/updaterinfo.php";
update.pbVersionPrefix = (BYTE*)"New Away System Mod"
-#ifdef _UNICODE
+
" Unicode"
-#endif
+
" version ";
update.cpbVersionPrefix = strlen((char*)update.pbVersionPrefix);
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
diff --git a/plugins/NewAwaySysMod/Common.h b/plugins/NewAwaySysMod/Common.h index a76012036f..7801d3f47e 100644 --- a/plugins/NewAwaySysMod/Common.h +++ b/plugins/NewAwaySysMod/Common.h @@ -290,7 +290,7 @@ typedef struct #define MTYPE_AUTOONLINE 0xE7 // required to support ICQ Plus online status messages
/*
// additional m_popup.h declarations
-#ifdef _UNICODE
+
typedef struct
{
HANDLE lchContact;
@@ -306,10 +306,7 @@ typedef struct } POPUPDATAT;
#define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPW
-#else
- #define POPUPDATAT POPUPDATAEX
- #define MS_POPUP_ADDPOPUPT MS_POPUP_ADDPOPUPEX
-#endif
+
*/
// Beware of conflicts between two different windows trying to use the same page at a time!
// Other windows than the owner of the Page must copy the page to their own memory,
diff --git a/plugins/NewAwaySysMod/MsgEventAdded.cpp b/plugins/NewAwaySysMod/MsgEventAdded.cpp index b9bbc80ad2..a8219e7bd7 100644 --- a/plugins/NewAwaySysMod/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/MsgEventAdded.cpp @@ -60,15 +60,13 @@ void __cdecl AutoreplyDelayThread(void *_ad) _ASSERT(0);
return;
}
-#ifdef _UNICODE
+
int ReplyLen = (ad->Reply.GetLen() + 1) * (sizeof(char) + sizeof(WCHAR));
PBYTE pBuf = (PBYTE)malloc(ReplyLen);
memcpy(pBuf, TCHAR2ANSI(ad->Reply), ad->Reply.GetLen() + 1);
memcpy(pBuf + ad->Reply.GetLen() + 1, ad->Reply, (ad->Reply.GetLen() + 1) * sizeof(WCHAR));
CallContactService(ad->hContact, ServiceExists(CString(szProto) + PSS_MESSAGE "W") ? (PSS_MESSAGE "W") : PSS_MESSAGE, PREF_UNICODE, (LPARAM)pBuf);
-#else
- CallContactService(ad->hContact, PSS_MESSAGE, 0, (LPARAM)(char*)ad->Reply);
-#endif
+
if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_LOGREPLY))
{ // store in the history
DBEVENTINFO dbeo = {0};
@@ -77,19 +75,16 @@ void __cdecl AutoreplyDelayThread(void *_ad) dbeo.flags = DBEF_SENT;
dbeo.szModule = szProto;
dbeo.timestamp = time(NULL);
-#ifdef _UNICODE
+
dbeo.cbBlob = ReplyLen;
dbeo.pBlob = pBuf;
-#else
- dbeo.cbBlob = ad->Reply.GetLen() + 1;
- dbeo.pBlob = (PBYTE)(char*)ad->Reply;
-#endif
+
SleepEx(1000, true); // delay before sending the reply, as we need it to be later than the message we're replying to (without this delay, srmm puts the messages in a wrong order)
CallService(MS_DB_EVENT_ADD, (WPARAM)ad->hContact, (LPARAM)&dbeo);
}
-#ifdef _UNICODE
+
free(pBuf);
-#endif
+
/*
char *utf8Reply = mir_utf8encodeT(ad->Reply); // todo: use this instead of the code above, when 0.7 will be released
if (g_AutoreplyOptPage.GetDBValueCopy(IDC_REPLYDLG_LOGREPLY))
diff --git a/plugins/SimpleStatusMsg/awaymsg.cpp b/plugins/SimpleStatusMsg/awaymsg.cpp index 4932f475a1..5aebe1edb1 100644 --- a/plugins/SimpleStatusMsg/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/awaymsg.cpp @@ -54,7 +54,7 @@ static char *StrNormNewlineA(char *szStr) return szNewStr;
}
-#ifdef _UNICODE
+
static TCHAR *StrNormNewline(TCHAR *tszStr)
{
if (tszStr == NULL) return NULL;
@@ -76,7 +76,7 @@ static TCHAR *StrNormNewline(TCHAR *tszStr) return tszNewStr;
}
-#endif
+
struct AwayMsgDlgData
{
@@ -137,7 +137,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP if (ack->result != ACKRESULT_SUCCESS) break;
if (dat->hAwayMsgEvent && ack->hProcess == dat->hSeq) { UnhookEvent(dat->hAwayMsgEvent); dat->hAwayMsgEvent = NULL; }
-#ifdef _UNICODE
+
DBVARIANT dbv;
bool unicode = !DBGetContactSetting(dat->hContact, "CList", "StatusMsg", &dbv) &&
(dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
@@ -151,7 +151,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP DBFreeVariant(&dbv);
}
else
-#endif
+
{
char *szMsg = StrNormNewlineA((char *)ack->lParam);
SetDlgItemTextA(hwndDlg, IDC_MSG, szMsg);
@@ -192,11 +192,9 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP memcpy(lptstrCopy, msg, len * sizeof(TCHAR));
lptstrCopy[len] = (TCHAR)0;
GlobalUnlock(hglbCopy);
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hglbCopy);
-#else
- SetClipboardData(CF_TEXT, hglbCopy);
-#endif
+
}
}
CloseClipboard();
@@ -270,7 +268,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP {
TCHAR msg[1024];
int len;
-#ifdef _UNICODE
+
DBVARIANT dbv;
bool unicode = !DBGetContactSetting(dat->hContact, "CList", "StatusMsg", &dbv) &&
(dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
@@ -284,7 +282,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP DBFreeVariant(&dbv);
}
else
-#endif
+
{
char *szMsg = StrNormNewlineA((char *)ack->lParam);
mir_sntprintf(msg, SIZEOF(msg), _T("%hs"), szMsg);
@@ -306,11 +304,9 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP memcpy(lptstrCopy, msg, len * sizeof(TCHAR));
lptstrCopy[len] = (TCHAR)0;
GlobalUnlock(hglbCopy);
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hglbCopy);
-#else
- SetClipboardData(CF_TEXT, hglbCopy);
-#endif
+
}
}
CloseClipboard();
@@ -375,7 +371,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
char *szMsg;
-#ifdef _UNICODE
+
int unicode = !DBGetContactSetting((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
DBFreeVariant(&dbv);
if (unicode)
@@ -384,7 +380,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) szMsg = mir_u2a(dbv.pwszVal);
}
else
-#endif
+
{
DBGetContactSettingString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_strdup(dbv.pszVal);
@@ -446,7 +442,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) if (!iHidden)
{
DBVARIANT dbv;
-#ifdef _UNICODE
+
int unicode = !DBGetContactSetting((HANDLE)wParam, "CList", "StatusMsg", &dbv) && (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
DBFreeVariant(&dbv);
if (unicode)
@@ -455,7 +451,7 @@ static int AwayMsgPreBuildMenu(WPARAM wParam, LPARAM lParam) szMsg = mir_u2a(dbv.pwszVal);
}
else
-#endif
+
{
DBGetContactSettingString((HANDLE)wParam, "CList", "StatusMsg", &dbv);
szMsg = mir_strdup(dbv.pszVal);
diff --git a/plugins/SimpleStatusMsg/main.cpp b/plugins/SimpleStatusMsg/main.cpp index 4cdaee3023..59f27d9920 100644 --- a/plugins/SimpleStatusMsg/main.cpp +++ b/plugins/SimpleStatusMsg/main.cpp @@ -212,19 +212,16 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else if (!_tcsnicmp(msg+i, _T("%fortunemsg%"), 12))
{
TCHAR *FortuneMsg;
-#ifdef _UNICODE
+
char *FortuneMsgA;
-#endif
+
if (!ServiceExists(MS_FORTUNEMSG_GETMESSAGE))
continue;
-#ifdef _UNICODE
+
FortuneMsgA = (char*)CallService(MS_FORTUNEMSG_GETMESSAGE, 0, 0);
FortuneMsg = mir_a2u(FortuneMsgA);
-#else
- FortuneMsg = (char*)CallService(MS_FORTUNEMSG_GETMESSAGE, 0, 0);
-#endif
if (lstrlen(FortuneMsg) > 12)
msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(FortuneMsg) - 12) * sizeof(TCHAR));
@@ -232,29 +229,25 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-#ifdef _UNICODE
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
-#else
- CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsg);
-#endif
+
}
else if (!_tcsnicmp(msg+i, _T("%protofortunemsg%"), 17))
{
TCHAR *FortuneMsg;
-#ifdef _UNICODE
+
char *FortuneMsgA;
-#endif
+
if (!ServiceExists(MS_FORTUNEMSG_GETPROTOMSG))
continue;
-#ifdef _UNICODE
+
FortuneMsgA = (char*)CallService(MS_FORTUNEMSG_GETPROTOMSG, (WPARAM)szProto, 0);
FortuneMsg = mir_a2u(FortuneMsgA);
-#else
- FortuneMsg = (char*)CallService(MS_FORTUNEMSG_GETPROTOMSG, (WPARAM)szProto, 0);
-#endif
+
if (lstrlen(FortuneMsg) > 17)
msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(FortuneMsg) - 17) * sizeof(TCHAR));
@@ -262,29 +255,25 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 17, (lstrlen(msg) - i - 16) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-#ifdef _UNICODE
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
-#else
- CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsg);
-#endif
+
}
else if (!_tcsnicmp(msg+i, _T("%statusfortunemsg%"), 18))
{
TCHAR *FortuneMsg;
-#ifdef _UNICODE
+
char *FortuneMsgA;
-#endif
+
if (!ServiceExists(MS_FORTUNEMSG_GETSTATUSMSG))
continue;
-#ifdef _UNICODE
+
FortuneMsgA = (char*)CallService(MS_FORTUNEMSG_GETSTATUSMSG, (WPARAM)status, 0);
FortuneMsg = mir_a2u(FortuneMsgA);
-#else
- FortuneMsg = (char*)CallService(MS_FORTUNEMSG_GETSTATUSMSG, (WPARAM)status, 0);
-#endif
+
if (lstrlen(FortuneMsg) > 18)
msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(FortuneMsg) - 18) * sizeof(TCHAR));
@@ -292,12 +281,10 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) MoveMemory(msg + i + lstrlen(FortuneMsg), msg + i + 18, (lstrlen(msg) - i - 17) * sizeof(TCHAR));
CopyMemory(msg + i, FortuneMsg, lstrlen(FortuneMsg) * sizeof(TCHAR));
-#ifdef _UNICODE
+
mir_free(FortuneMsg);
CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsgA);
-#else
- CallService(MS_FORTUNEMSG_FREEMEMORY, 0, (LPARAM)FortuneMsg);
-#endif
+
}
else if (!_tcsnicmp(msg + i, _T("%time%"), 6))
{
@@ -727,16 +714,14 @@ static void Proto_SetAwayMsgT(const char *szProto, int iStatus, TCHAR *tszMsg) {
if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
{
-#ifdef _UNICODE
+
if (CallProtoService(szProto, PS_SETAWAYMSGW, (WPARAM)iStatus, (LPARAM)tszMsg) == CALLSERVICE_NOTFOUND)
{
char *szMsg = mir_u2a(tszMsg);
CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iStatus, (LPARAM)szMsg);
mir_free(szMsg);
}
-#else
- CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iStatus, (LPARAM)tszMsg);
-#endif
+
}
}
@@ -748,16 +733,14 @@ static void Proto_SetStatus(const char *szProto, int iInitialStatus, int iStatus if (!(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_INDIVMODEMSG))
{
int iMsgStatus = CheckProtoSettings(szProto, iInitialStatus);
-#ifdef _UNICODE
+
if (CallProtoService(szProto, PS_SETAWAYMSGW, (WPARAM)iMsgStatus, (LPARAM)tszMsg) == CALLSERVICE_NOTFOUND)
{
char *szMsg = mir_u2a(tszMsg);
CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iMsgStatus, (LPARAM)szMsg);
mir_free(szMsg);
}
-#else
- CallProtoService(szProto, PS_SETAWAYMSG, (WPARAM)iMsgStatus, (LPARAM)tszMsg);
-#endif
+
CallProtoService(szProto, PS_SETSTATUS, (WPARAM)iMsgStatus, 0);
}
if (ServiceExists(MS_KS_ANNOUNCESTATUSCHANGE))
@@ -1376,15 +1359,13 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) if (ack->type == ACKTYPE_AWAYMSG && ack->result == ACKRESULT_SENTREQUEST && !ack->lParam)
{
TCHAR *tszMsg = GetAwayMessage(CallProtoService((char *)ack->szModule, PS_GETSTATUS, 0, 0), (char *)ack->szModule, TRUE, NULL);
-#ifdef _UNICODE
+
{
char *szMsg = mir_u2a(tszMsg);
CallContactService(ack->hContact, PSS_AWAYMSG, (WPARAM)(HANDLE)ack->hProcess, (LPARAM)szMsg);
if (szMsg) mir_free(szMsg);
}
-#else
- CallContactService(ack->hContact, PSS_AWAYMSG, (WPARAM)(HANDLE)ack->hProcess, (LPARAM)tszMsg);
-#endif
+
#ifdef _DEBUG
log2file("ProcessProtoAck(): Send away message \"" TCHAR_STR_PARAM "\" reply.", tszMsg);
#endif
@@ -1843,9 +1824,9 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
char buff[80];
BOOL found = FALSE;
-#ifdef _UNICODE
+
wchar_t *szMsgW = mir_a2u(ps[i]->szMsg);
-#endif
+
#ifdef _DEBUG
log2file("CSStatusChange(): Set \"%s\" status message for %s.", ps[i]->szMsg, ps[i]->szName);
@@ -1856,11 +1837,9 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j);
if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", buff, &dbv))
{
-#ifdef _UNICODE
+
if (!lstrcmp(dbv.ptszVal, szMsgW))
-#else
- if (!lstrcmp(dbv.ptszVal, ps[i]->szMsg))
-#endif
+
{
found = TRUE;
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", ps[i]->szName);
@@ -1879,16 +1858,12 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) }
mir_snprintf(szSetting, SIZEOF(szSetting), "%sMsg", ps[i]->szName);
-#ifdef _UNICODE
+
DBWriteContactSettingWString(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), szMsgW);
msg = InsertVarsIntoMsg(szMsgW, ps[i]->szName, status_mode, NULL);
SaveMessageToDB(ps[i]->szName, szMsgW, TRUE);
mir_free(szMsgW);
-#else
- DBWriteContactSettingString(NULL, "SRAway", StatusModeToDbSetting(status_mode, szSetting), ps[i]->szMsg);
- msg = InsertVarsIntoMsg(ps[i]->szMsg, ps[i]->szName, status_mode, NULL);
- SaveMessageToDB(ps[i]->szName, ps[i]->szMsg, TRUE);
-#endif
+
SaveMessageToDB(ps[i]->szName, msg, FALSE);
mir_free(msg);
}
@@ -2031,10 +2006,8 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (ServiceExists(MS_UPDATE_REGISTERFL))
#if defined(_WIN64)
CallService(MS_UPDATE_REGISTERFL, 4322, (LPARAM)&pluginInfo);
-#elif defined(_UNICODE)
- CallService(MS_UPDATE_REGISTERFL, 4321, (LPARAM)&pluginInfo);
#else
- CallService(MS_UPDATE_REGISTERFL, 4320, (LPARAM)&pluginInfo);
+ CallService(MS_UPDATE_REGISTERFL, 4321, (LPARAM)&pluginInfo);
#endif
IconsInit();
@@ -2179,7 +2152,7 @@ static INT_PTR sttGetAwayMessageT(WPARAM wParam, LPARAM lParam) return (INT_PTR)GetAwayMessage((int)wParam, (char*)lParam, TRUE, NULL);
}
-#ifdef UNICODE
+
static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam)
{
TCHAR* msg = GetAwayMessage((int)wParam, (char*)lParam, TRUE, NULL);
@@ -2187,7 +2160,7 @@ static INT_PTR sttGetAwayMessage(WPARAM wParam, LPARAM lParam) mir_free(msg);
return (INT_PTR)res;
}
-#endif
+
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
@@ -2202,12 +2175,10 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) HookEventEx(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEventEx(ME_PROTO_ACCLISTCHANGED, OnAccListChanged);
-#ifdef UNICODE
+
CreateServiceFunctionEx(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessage);
CreateServiceFunctionEx(MS_AWAYMSG_GETSTATUSMSGW, sttGetAwayMessageT);
-#else
- CreateServiceFunctionEx(MS_AWAYMSG_GETSTATUSMSG, sttGetAwayMessageT);
-#endif
+
CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_SETSTATUS, SetStatusModeFromExtern);
CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_SHOWDIALOG, ShowStatusMessageDialog);
CreateServiceFunctionEx(MS_SIMPLESTATUSMSG_CHANGESTATUSMSG, ChangeStatusMsg);
diff --git a/plugins/SimpleStatusMsg/msgbox.cpp b/plugins/SimpleStatusMsg/msgbox.cpp index b984c03338..c6cec33b6b 100644 --- a/plugins/SimpleStatusMsg/msgbox.cpp +++ b/plugins/SimpleStatusMsg/msgbox.cpp @@ -184,11 +184,9 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) for (int i = 0; i < profileCount; ++i)
{
CallService(MS_SS_GETPROFILENAME, (WPARAM)i, (LPARAM)buff1);
-#ifdef _UNICODE
+
status_desc = mir_a2u(buff1);
-#else
- status_desc = (char*)buff1;
-#endif
+
cbei.iItem = j;
cbei.pszText = (LPTSTR)status_desc;
cbei.cchTextMax = sizeof(status_desc);
@@ -200,9 +198,9 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) cbei.iSelectedImage = statusicon_nr[k];
}
cbei.lParam = (LPARAM)40083+i;
-#ifdef _UNICODE
+
mir_free(status_desc);
-#endif
+
if (SendMessage(handle, CBEM_INSERTITEM, 0, (LPARAM)&cbei) == -1)
break;
j++;
@@ -498,11 +496,9 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) break;
case ID__VARIABLES:
-#ifdef _UNICODE
+
CallService(MS_UTILS_OPENURL,1,(LPARAM)"http://addons.miranda-im.org/details.php?action=viewfile&id=3815");
-#else
- CallService(MS_UTILS_OPENURL,1,(LPARAM)"http://addons.miranda-im.org/details.php?action=viewfile&id=3814");
-#endif
+
break;
case ID__VARIABLES_MOREVARIABLES:
@@ -539,11 +535,9 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) memcpy(lptstrCopy, item_string, len * sizeof(TCHAR));
lptstrCopy[len] = (TCHAR)0;
GlobalUnlock(hglbCopy);
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hglbCopy);
-#else
- SetClipboardData(CF_TEXT, hglbCopy);
-#endif
+
}
}
CloseClipboard();
@@ -878,13 +872,11 @@ void ChangeDlgStatus(HWND hwndDlg, struct MsgBoxData *msgbox_data, int iStatus) else if (iStatus > ID_STATUS_CURRENT)
{
TCHAR buff[128];
-#ifdef _UNICODE
+
char buff1[128];
CallService(MS_SS_GETPROFILENAME, iStatus - 40083, (LPARAM)buff1);
MultiByteToWideChar(CallService(MS_LANGPACK_GETCODEPAGE, 0, 0), 0, buff1, -1, buff, 128);
-#else
- CallService(MS_SS_GETPROFILENAME, iStatus - 40083, (LPARAM)buff);
-#endif
+
mir_sntprintf(szTitle, SIZEOF(szTitle), TranslateT("%s Message (%s)"), (TCHAR*)buff, szProtoName);
}
else
diff --git a/plugins/SpellChecker/dictionary.cpp b/plugins/SpellChecker/dictionary.cpp index 8d65763a8a..ac24af66ea 100644 --- a/plugins/SpellChecker/dictionary.cpp +++ b/plugins/SpellChecker/dictionary.cpp @@ -116,25 +116,19 @@ protected: void toHunspell(char *hunspellWord, const TCHAR *word, size_t hunspellWordLen)
{
-#ifdef UNICODE
+
WideCharToMultiByte(codePage, 0, word, -1, hunspellWord, hunspellWordLen, NULL, NULL);
-#else
- // TODO
- strncpy(hunspellWord, word, hunspellWordLen);
-#endif
+
}
TCHAR * fromHunspell(const char *hunspellWord)
{
-#ifdef UNICODE
+
int len = MultiByteToWideChar(codePage, 0, hunspellWord, -1, NULL, 0);
WCHAR *ret = (WCHAR *) malloc((len + 1) * sizeof(WCHAR));
MultiByteToWideChar(codePage, 0, hunspellWord, -1, ret, len + 1);
return ret;
-#else
- // TODO
- return strdup(hunspellWord);
-#endif
+
}
TCHAR * fromHunspellAndFree(char *hunspellWord)
@@ -235,13 +229,10 @@ public: char dic[1024];
char aff[1024];
-#ifdef UNICODE
+
mir_snprintf(dic, MAX_REGS(dic), "%S.dic", fileWithoutExtension);
mir_snprintf(aff, MAX_REGS(aff), "%S.aff", fileWithoutExtension);
-#else
- mir_snprintf(dic, MAX_REGS(dic), "%s.dic", fileWithoutExtension);
- mir_snprintf(aff, MAX_REGS(aff), "%s.aff", fileWithoutExtension);
-#endif
+
hunspell = new Hunspell(aff, dic);
@@ -253,13 +244,10 @@ public: {
codePage = CP_UTF8;
-#ifdef UNICODE
+
int wcs_len;
hwordchars = fromHunspell((char *) hunspell->get_wordchars_utf16(&wcs_len));
-#else
- // No option
- hwordchars = NULL;
-#endif
+
}
else
{
@@ -525,13 +513,11 @@ void GetDictsInfo(LIST<Dictionary> &dicts) if (dict->full_name[0] == _T('\0'))
{
DBVARIANT dbv;
-#ifdef UNICODE
+
char lang[128];
WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL);
if (!DBGetContactSettingTString(NULL, MODULE_NAME, lang, &dbv))
-#else
- if (!DBGetContactSettingTString(NULL, MODULE_NAME, dict->language, &dbv))
-#endif
+
{
lstrcpyn(dict->localized_name, dbv.ptszVal, MAX_REGS(dict->localized_name));
DBFreeVariant(&dbv);
diff --git a/plugins/SpellChecker/spellchecker.cpp b/plugins/SpellChecker/spellchecker.cpp index fdccd20b49..7207f4a71a 100644 --- a/plugins/SpellChecker/spellchecker.cpp +++ b/plugins/SpellChecker/spellchecker.cpp @@ -129,13 +129,11 @@ DEFINE_GUIDXXX(IID_ITextDocument,0x8CC497C0,0xA1DF,0x11CE,0x80,0x98, HICON IcoLib_LoadIcon(Dictionary *dict, BOOL copy) { -#ifdef UNICODE + char lang[32]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); return IcoLib_LoadIcon(lang, copy); -#else - return IcoLib_LoadIcon(dict->language, copy); -#endif + } @@ -212,14 +210,10 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellchecker64.%VERSION%.zip"; // upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id="; upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (x64) "; -#elif UNICODE +#else upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellcheckerW.%VERSION%.zip"; upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3691"; upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (Unicode) "; -#else - upd.szBetaUpdateURL = "http://pescuma.googlecode.com/files/spellchecker.%VERSION%.zip"; - upd.szVersionURL = "http://addons.miranda-im.org/details.php?action=viewfile&id=3690"; - upd.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Spell Checker (Ansi) "; #endif upd.cpbVersionPrefix = (int)strlen((char *)upd.pbVersionPrefix); @@ -291,13 +285,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) for(int i = 0; i < languages.getCount(); i++) { sid.ptszDescription = languages[i]->full_name; -#ifdef UNICODE + char lang[32]; mir_snprintf(lang, MAX_REGS(lang), "%S", languages[i]->language); sid.pszName = lang; -#else - sid.pszName = languages[i]->language; -#endif + HICON hFlag = IcoLib_LoadIcon(sid.pszName); if (hFlag != NULL) @@ -2273,7 +2265,7 @@ TCHAR *lstrtrim(TCHAR *str) BOOL lstreq(TCHAR *a, TCHAR *b, size_t len) { -#ifdef UNICODE + a = CharLower(_tcsdup(a)); b = CharLower(_tcsdup(b)); BOOL ret; @@ -2284,12 +2276,7 @@ BOOL lstreq(TCHAR *a, TCHAR *b, size_t len) free(a); free(b); return ret; -#else - if (len > 0) - return !_tcsnicmp(a, b, len); - else - return !_tcsicmp(a, b); -#endif + } diff --git a/plugins/Svc_crshdmp/crshdmp.cpp b/plugins/Svc_crshdmp/crshdmp.cpp index 4869ed7182..2bd26df7f0 100644 --- a/plugins/Svc_crshdmp/crshdmp.cpp +++ b/plugins/Svc_crshdmp/crshdmp.cpp @@ -301,10 +301,7 @@ static int ModulesLoaded(WPARAM, LPARAM) FoldersPathChanged(0, 0);
-#ifndef _UNICODE
- if (_tcsstr(vertxt, TEXT("Unicode")) != NULL)
- ShowMessage(2, TEXT("Please update Crash Dumper to Unicode Version"));
-#endif
+
hHooks[2] = HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
if (hHooks[3] == NULL) hHooks[3] = HookEvent(ME_TB_MODULELOADED, ToolbarModulesLoaded);
diff --git a/plugins/Svc_crshdmp/dumper.cpp b/plugins/Svc_crshdmp/dumper.cpp index 21c90cd33e..bce015016b 100644 --- a/plugins/Svc_crshdmp/dumper.cpp +++ b/plugins/Svc_crshdmp/dumper.cpp @@ -116,11 +116,9 @@ void GetLinkedModulesInfo(TCHAR *moduleName, bkstring &buffer) LPVOID dllAddr = MapViewOfFile(hDllMapping, FILE_MAP_READ, 0, 0, 0);
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT(" Plugin statically linked to missing module: %S\r\n");
-#else
- static const TCHAR format[] = TEXT(" Plugin statically linked to missing module: %s\r\n");
-#endif
+
__try
{
@@ -198,11 +196,9 @@ static void GetPluginsString(bkstring& buffer, unsigned& flags) bkstring ubuffer;
ListItem* dlllist = NULL;
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT("%c %s v.%s%d.%d.%d.%d%s [%s] - %S %s\r\n");
-#else
- static const TCHAR format[] = TEXT("%c %s v.%s%d.%d.%d.%d%s [%s] - %s %s\r\n");
-#endif
+
do
{
@@ -435,11 +431,9 @@ static void GetWeatherStrings(bkstring& buffer, unsigned flags) TCHAR timebuf[30] = TEXT("");
GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30);
-#ifdef _UNICODE
+
static const TCHAR format[] = TEXT(" %s v.%s%S%s [%s] - %S\r\n");
-#else
- static const TCHAR format[] = TEXT(" %s v.%s%s%s [%s] - $s\r\n");
-#endif
+
buffer.appendfmt(format, FindFileData.cFileName,
(flags & VI_FLAG_FORMAT) ? TEXT("[b]") : TEXT(""),
ver,
@@ -711,11 +705,9 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA PLUGININFO *pi = GetMirInfo(hModule);
if (pi != NULL)
{
-#ifdef _UNICODE
+
static const TCHAR formatc[] = TEXT("\r\nLikely cause of the crash plugin: %S\r\n\r\n");
-#else
- static const TCHAR formatc[] = TEXT("\r\nLikely cause of the crash plugin: %s\r\n\r\n");
-#endif
+
if (pi->shortName)
{
bkstring crashcause;
@@ -726,11 +718,9 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA }
}
-#ifdef _UNICODE
+
static const TCHAR formatd[] = TEXT("%p (%S %p): %S (%d): %S\r\n");
-#else
- static const TCHAR formatd[] = TEXT("%p (%s %p): %s (%d): %s\r\n");
-#endif
+
buffer.appendfmt(formatd,
(LPVOID)frame.AddrPC.Offset, moduleName, (LPVOID)Module.BaseOfImage,
lineFileName, Line.LineNumber, name);
@@ -740,7 +730,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA PrintVersionInfo(buffer, VI_FLAG_PRNDLL);
-#ifdef _UNICODE
+
int len = WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, NULL, 0, NULL, NULL);
char* dst = (char*)(len > 8192 ? malloc(len) : alloca(len));
WideCharToMultiByte(CP_UTF8, 0, buffer.c_str(), -1, dst, len, NULL, NULL);
@@ -748,10 +738,7 @@ void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHA WriteUtfFile(hDumpFile, dst);
if (len > 8192) free(dst);
-#else
- DWORD bytes;
- WriteFile(hDumpFile, buffer.c_str(), buffer.sizebytes(), &bytes, NULL);
-#endif
+
if (msg && MessageBox(NULL, msg, TEXT("Miranda Crash Dumper"), MB_YESNO | MB_ICONERROR | MB_TASKMODAL | MB_DEFBUTTON2 | MB_TOPMOST) == IDYES)
StoreStringToClip(buffer);
diff --git a/plugins/Svc_crshdmp/sdkstuff.h b/plugins/Svc_crshdmp/sdkstuff.h index fdef4729e5..536a00bc40 100644 --- a/plugins/Svc_crshdmp/sdkstuff.h +++ b/plugins/Svc_crshdmp/sdkstuff.h @@ -18,9 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <windows.h>
-//#ifdef _UNICODE
+
//#define DBGHELP_TRANSLATE_TCHAR
-//#endif
+
#ifndef __in_bcount_opt
#define __in_bcount_opt(x)
diff --git a/plugins/Svc_crshdmp/utils.cpp b/plugins/Svc_crshdmp/utils.cpp index f1448f184b..e60893ecf5 100644 --- a/plugins/Svc_crshdmp/utils.cpp +++ b/plugins/Svc_crshdmp/utils.cpp @@ -29,11 +29,9 @@ tGetSystemDefaultUILanguage pGetSystemDefaultUILanguage = (tGetSystemDefaultUILa tIsWow64Process pIsWow64Process = (tIsWow64Process) GetProcAddress(hKernel, "IsWow64Process");
tIsProcessorFeaturePresent pIsProcessorFeaturePresent = (tIsProcessorFeaturePresent) GetProcAddress(hKernel, "IsProcessorFeaturePresent");
-#ifdef _UNICODE
+
tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExW");
-#else
-tGetDiskFreeSpaceEx pGetDiskFreeSpaceEx = (tGetDiskFreeSpaceEx) GetProcAddress(hKernel, "GetDiskFreeSpaceExA");
-#endif
+
void CheckForOtherCrashReportingPlugins(void)
@@ -824,12 +822,9 @@ void StoreStringToClip(bkstring& buffer) OpenClipboard(NULL);
EmptyClipboard();
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hData);
-#else
- SetClipboardData(CF_TEXT, hData);
-#endif
- CloseClipboard();
+
}
bool IsPluginEnabled(TCHAR* filename)
diff --git a/plugins/Svc_crshdmp/utils.h b/plugins/Svc_crshdmp/utils.h index b63e9f893a..6c03552db7 100644 --- a/plugins/Svc_crshdmp/utils.h +++ b/plugins/Svc_crshdmp/utils.h @@ -77,19 +77,13 @@ int crs_sntprintf(TCHAR *buffer, size_t count, const TCHAR* fmt, ...); MultiByteToWideChar(CP_ACP, 0, src, -1, dst, cbLen); \
}
-#ifdef _UNICODE
+
#define crsi_t2a(d,s) crsi_u2a(d,s)
#define crsi_a2t(d,s) crsi_a2u(d,s,alloca)
#define crs_a2t(d,s) crsi_a2u(d,s,mir_alloc)
-#else
-
-#define crsi_t2a(d,s) (d=s)
-#define crsi_a2t(d,s) (d=s)
-#define crs_a2t(d,s) (d=mir_strdup(s))
-#endif
#define SIZEOF(X) (sizeof(X)/sizeof(X[0]))
diff --git a/plugins/Svc_vi/CPlugin.h b/plugins/Svc_vi/CPlugin.h index 46528b8511..5da1b1dc6b 100644 --- a/plugins/Svc_vi/CPlugin.h +++ b/plugins/Svc_vi/CPlugin.h @@ -41,11 +41,9 @@ extern TCHAR PLUGIN_UUID_MARK[]; //using namespace std;
-#if defined( _UNICODE )
+
#define tstring wstring
-#else
- #define tstring string
-#endif
+
class CPlugin {
private:
diff --git a/plugins/Svc_vi/CVersionInfo.cpp b/plugins/Svc_vi/CVersionInfo.cpp index b3b2825922..d35c0c5c01 100644 --- a/plugins/Svc_vi/CVersionInfo.cpp +++ b/plugins/Svc_vi/CVersionInfo.cpp @@ -344,11 +344,9 @@ bool CVersionInfo::GetHWSettings() { HMODULE hKernel32;
hKernel32 = LoadLibraryA("kernel32.dll");
if (hKernel32) {
- #if defined( _UNICODE )
+
MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExW");
- #else
- MyGetDiskFreeSpaceEx = (BOOL (WINAPI *)(LPCTSTR,PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER))GetProcAddress(hKernel32, "GetDiskFreeSpaceExA");
- #endif
+
MyIsWow64Process = (BOOL (WINAPI *) (HANDLE, PBOOL)) GetProcAddress(hKernel32, "IsWow64Process");
MyGetSystemInfo = (void (WINAPI *) (LPSYSTEM_INFO)) GetProcAddress(hKernel32, "GetNativeSystemInfo");
@@ -1190,11 +1188,9 @@ void CVersionInfo::PrintInformationsToClipboard(bool showLog) lptstrCopy[length] = '\0';
GlobalUnlock(hData);
//Now set the clipboard data.
- #if defined( _UNICODE )
+
SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
+
//Remove the lock on the clipboard.
CloseClipboard();
if (showLog)
diff --git a/plugins/Svc_vi/dlgHandlers.cpp b/plugins/Svc_vi/dlgHandlers.cpp index 73eee44c0a..a1a81e6a51 100644 --- a/plugins/Svc_vi/dlgHandlers.cpp +++ b/plugins/Svc_vi/dlgHandlers.cpp @@ -559,11 +559,9 @@ INT_PTR CALLBACK DialogBoxProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam lptstrCopy[length] = '\0';
GlobalUnlock(hData);
//Now set the clipboard data.
- #if defined( _UNICODE )
+
SetClipboardData(CF_UNICODETEXT, hData);
- #else
- SetClipboardData(CF_TEXT, hData);
- #endif
+
//Remove the lock on the clipboard.
CloseClipboard();
}
diff --git a/plugins/Updater/allocations.h b/plugins/Updater/allocations.h index 719b42383a..25d98c21f7 100644 --- a/plugins/Updater/allocations.h +++ b/plugins/Updater/allocations.h @@ -53,11 +53,9 @@ __inline static wchar_t *safe_wstrdup(const wchar_t *s) { return ret;
}
-#ifdef _UNICODE
+
#define safe_tstrdup(x) safe_wstrdup(x)
-#else
-#define sage_tstrdup(x) safe_strdup(x)
-#endif
+
__inline static BYTE *safe_bytedup(BYTE *bytes, int size) {
if (!bytes || size == 0) return 0;
diff --git a/plugins/Updater/common.h b/plugins/Updater/common.h index d51a1db85b..4b7c930bc2 100644 --- a/plugins/Updater/common.h +++ b/plugins/Updater/common.h @@ -127,9 +127,9 @@ void* memmem (const void *buf1, size_t size1, const void *buf2, size_t size2); void NLog(char *msg);
void NLogF(const char *fmt, ...);
-#ifdef _UNICODE
+
void NLog(wchar_t *msg);
-#endif
+
// clist 'exit' menu item command id
#define ID_ICQ_EXIT 40001
diff --git a/plugins/Updater/extern.cpp b/plugins/Updater/extern.cpp index 500c11c9de..3e97fc1ec4 100644 --- a/plugins/Updater/extern.cpp +++ b/plugins/Updater/extern.cpp @@ -313,17 +313,7 @@ bool ReadTLine(HANDLE hDatFile, TCHAR *line, int bsize, int &offset) { BOOL bResult;
while((bResult = ReadFile(hDatFile, line + offset, sizeof(TCHAR), &bytes_read, 0)) && offset < bsize && bytes_read == sizeof(TCHAR) && line[offset] && (line[offset] != _T('\n') || (offset > 0 && line[offset - 1] != _T('\r')))) offset++;
-#ifndef _UNICODE
- if(offset == 1 && line[1] == 0) {
- wchar_t wline[MAX_PATH];
- wline[0] = *(wchar_t *)line;
- while((bResult = ReadFile(hDatFile, wline + offset, sizeof(wchar_t), &bytes_read, 0)) && offset < bsize && bytes_read == sizeof(wchar_t) && wline[offset] && (wline[offset] != L'\n' || (offset > 0 && wline[offset - 1] != L'\r'))) offset++;
- if(offset > 0) wline[offset - 1] = 0; // cut off /r/n
-
- WideCharToMultiByte(CP_ACP, 0, wline, -1, line, bsize, 0, 0);
- }
-#endif
if(offset > 0) line[offset - 1] = 0; // cut off /r/n
return true;
}
diff --git a/plugins/Updater/options.cpp b/plugins/Updater/options.cpp index 7539ce2047..1c4545d76e 100644 --- a/plugins/Updater/options.cpp +++ b/plugins/Updater/options.cpp @@ -389,13 +389,10 @@ int OptInit(WPARAM wParam,LPARAM lParam) return 0;
}
-#ifdef _UNICODE
+
#define DBGetString DBGetContactSettingTString
#define DBWriteString DBWriteContactSettingTString
-#else
-#define DBGetString DBGetContactSetting
-#define DBWriteString DBWriteContactSettingString
-#endif
+
void InitOptionsMenuItems() {
if(options.restart_menu_item)
@@ -451,9 +448,9 @@ void LoadOptions(void) {
FOLDERSDATA fd = {0};
fd.cbSize = sizeof(fd);
-#ifdef _UNICODE
+
fd.flags = FF_UNICODE;
-#endif
+
strcpy(fd.szSection, "Updates");
strcpy(fd.szName, "Backups");
diff --git a/plugins/Updater/scan.cpp b/plugins/Updater/scan.cpp index ad8fa165e2..ddae89dc43 100644 --- a/plugins/Updater/scan.cpp +++ b/plugins/Updater/scan.cpp @@ -15,11 +15,9 @@ static const AlternateShortName alternate_shortname_map[] = { "Version Informations", "Version Information" },
{ "Jabber Protocol", "JabberG Protocol" },
{ "Jabber Protocol (Unicode)", "JabberG Protocol (Unicode)" },
-#ifdef _UNICODE
+
{ "PopUp Interoperability", "PopUp Plus (Unicode)" },
-#else
- { "PopUp Interoperability", "PopUp Plus" },
-#endif
+
//{ "Messaging Style Conversation", "nConvers++" }, // will this conflict with other nConvers'?
{ "MimQQ-libeva", "MirandaQQ (libeva Version)" },
@@ -35,14 +33,14 @@ char* findAlternateShortName(const char* name) if (strcmp(name, alternate_shortname_map[i].from) == 0)
return mir_strdup(alternate_shortname_map[i].to);
}
-#ifdef _UNICODE
+
if (!strstr(name, "Unicode"))
{
char *buf = (char*)mir_alloc(256);
mir_snprintf(buf, 256, "%s (Unicode)", name);
return buf;
}
-#endif
+
return NULL;
}
diff --git a/plugins/Updater/updater.cpp b/plugins/Updater/updater.cpp index 69abd97330..531689e5d1 100644 --- a/plugins/Updater/updater.cpp +++ b/plugins/Updater/updater.cpp @@ -86,17 +86,11 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { update.pbVersion = (BYTE *)CreateVersionString(&pluginInfo, szVersion);
update.cpbVersion = strlen((char *)update.pbVersion);
-#ifdef _UNICODE
+
update.szUpdateURL = BETA_HOST_URL_PREFIX "/ver_updater_unicode.zip";
update.szVersionURL = BETA_HOST_URL_PREFIX "/updater_unicode.html";
update.pbVersionPrefix = (BYTE *)"Updater (Unicode) version ";
update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
-#else //!_UNICODE
- update.szUpdateURL = BETA_HOST_URL_PREFIX "/updater.zip";
- update.szVersionURL = BETA_HOST_URL_PREFIX "/ver_updater.html";
- update.pbVersionPrefix = (BYTE *)"Updater version ";
- update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
-#endif //_UNICODE
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
@@ -115,7 +109,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { update.szBetaChangelogURL = "https://server.scottellis.com.au/wsvn/mim_plugs/updater/?op=log&rev=0&sc=0&isdir=1";
-#ifdef _UNICODE
+
#ifdef REGISTER_AUTO
update.szUpdateURL = UPDATER_AUTOREGISTER;
@@ -134,35 +128,14 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { update.szBetaVersionURL = BETA_HOST_URL_PREFIX "/ver_updater_unicode.html";
update.pbBetaVersionPrefix = (BYTE *)"Updater (Unicode) version ";
update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
-#else
-
-#ifdef REGISTER_AUTO
- update.szUpdateURL = UPDATER_AUTOREGISTER;
-#else //!REGISTER_AUTO
- update.szUpdateURL = MIM_DOWNLOAD_URL_PREFIX "2254";
- update.szVersionURL = MIM_VIEW_URL_PREFIX "2254";
- update.pbVersionPrefix = (BYTE *)"<span class=\"fileNameHeader\">Updater ";
- update.cpbVersionPrefix = strlen((char *)update.pbVersionPrefix);
-#endif //REGISTER_AUTO
-#ifdef _WIN64
- update.szBetaUpdateURL = BETA_HOST_URL_PREFIX "/updater_x64.zip";
-#else
- update.szBetaUpdateURL = BETA_HOST_URL_PREFIX "/updater.zip";
-#endif
- update.szBetaVersionURL = BETA_HOST_URL_PREFIX "/ver_updater.html";
- update.pbBetaVersionPrefix = (BYTE *)"Updater version ";
- update.cpbBetaVersionPrefix = (int)strlen((char *)update.pbBetaVersionPrefix);
-#endif
CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
#else // !REGISTER_BETA
-#ifdef _UNICODE
+
CallService(MS_UPDATE_REGISTERFL, (WPARAM)2596, (LPARAM)&pluginInfo);
-#else //!_UNICODE
- CallService(MS_UPDATE_REGISTERFL, (WPARAM)2254, (LPARAM)&pluginInfo);
-#endif //_UNICODE
+
#endif // REGISTER_BETA
diff --git a/plugins/Updater/utils.cpp b/plugins/Updater/utils.cpp index 6936a905ae..b2d6b8d982 100644 --- a/plugins/Updater/utils.cpp +++ b/plugins/Updater/utils.cpp @@ -238,11 +238,9 @@ void NLogF(const char *fmt, ...) }
-#ifdef _UNICODE
void NLog(wchar_t *msg)
{
char* a = mir_utf8encodeW(msg);
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)a);
mir_free(a);
}
-#endif
\ No newline at end of file diff --git a/plugins/Utils/mir_memory.h b/plugins/Utils/mir_memory.h index b7ed17b6aa..51b16866ab 100644 --- a/plugins/Utils/mir_memory.h +++ b/plugins/Utils/mir_memory.h @@ -73,7 +73,6 @@ static int strcmpnullW(WCHAR *str1, WCHAR *str2) }
-#ifdef UNICODE
#define CHECK_VERSION(_NAME_) \
if (!mir_is_unicode()) \
@@ -94,27 +93,6 @@ static int strcmpnullW(WCHAR *str1, WCHAR *str2) char _new_var_[_size_]; \
WideCharToMultiByte(CP_ACP, 0, _old_var_, -1, _new_var_, _size_, NULL, NULL);
-#else
-
-#define CHECK_VERSION(_NAME_) \
- if (mir_is_unicode()) \
- { \
- MessageBox(NULL, _T("Your Miranda is unicode. You have to install unicode ") _T(_NAME_), \
- _T(_NAME_), MB_OK | MB_ICONERROR); \
- return -1; \
- }
-
-# define lstrcmpnull strcmpnull
-
-#define INPLACE_CHAR_TO_TCHAR(_new_var_, _size_, _old_var_) \
- TCHAR *_new_var_ = _old_var_
-
-#define INPLACE_TCHAR_TO_CHAR(_new_var_, _size_, _old_var_) \
- char *_new_var_ = _old_var_;
-
-#endif
-
-
// Free memory and set to NULL
//#define MIR_FREE(_x_) if (_x_ != NULL) { mir_free(_x_); _x_ = NULL; }
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 85782488da..2fa58dffbf 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -48,7 +48,7 @@ static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* if (!DBGetContactSettingTString(hContact, module, setting, &dbv))
{
-#ifdef UNICODE
+
if (dbv.type == DBVT_ASCIIZ)
{
MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, out, (int)len);
@@ -61,12 +61,7 @@ static TCHAR* MyDBGetContactSettingTString(HANDLE hContact, char* module, char* {
lstrcpyn(out, dbv.pwszVal, (int)len);
}
-#else
- if (dbv.type == DBVT_ASCIIZ)
- {
- lstrcpyn(out, dbv.pszVal, len);
- }
-#endif
+
else
{
if (def != NULL)
diff --git a/plugins/ZeroNotification/main.c b/plugins/ZeroNotification/main.c index 077b9748a8..946699b18a 100644 --- a/plugins/ZeroNotification/main.c +++ b/plugins/ZeroNotification/main.c @@ -257,19 +257,13 @@ int __declspec(dllexport) Load(PLUGINLINK *link) CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(temp), (LPARAM)temp);
-#ifdef _UNICODE
+
if (strstr(temp, "Unicode") == NULL)
{
//ReportError(TranslateT("Please update "PLUGINNAME" to ANSI Version")); //debug
return 1;
}
-#else
- if (strstr(temp, "Unicode") != NULL)
- {
- //ReportError(Translate("Please update "PLUGINNAME" to Unicode Version"));
- return 1;
- }
-#endif
+
//The menu item - begin
if (!DBGetContactSettingByte(NULL,PLUGINNAME_SHORT,"HideMenu",1))
diff --git a/protocols/FacebookRM/definitions.h b/protocols/FacebookRM/definitions.h index 0679c567cf..5a862438d8 100644 --- a/protocols/FacebookRM/definitions.h +++ b/protocols/FacebookRM/definitions.h @@ -39,10 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define LOG_FAILURE 3
#define LOG_CRITICAL 4
-#if defined( _UNICODE )
+
#define NIIF_INTERN_TCHAR NIIF_INTERN_UNICODE // m_clist.h
#define mir_tstrdup mir_wstrdup // m_system.h
-#else
-#define NIIF_INTERN_TCHAR 0
-#define mir_tstrdup mir_strdup
-#endif
+
diff --git a/protocols/GTalkExt/stdafx.h b/protocols/GTalkExt/stdafx.h index a5e11b980b..d9712d7e9c 100644 --- a/protocols/GTalkExt/stdafx.h +++ b/protocols/GTalkExt/stdafx.h @@ -26,10 +26,6 @@ #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_WARNINGS
-#if defined( UNICODE ) && !defined( _UNICODE )
- #define _UNICODE
-#endif
-
#include <assert.h>
#include <malloc.h>
#include <time.h>
diff --git a/protocols/MRA/Mra.h b/protocols/MRA/Mra.h index 3f5a1f1394..e927d76dbc 100644 --- a/protocols/MRA/Mra.h +++ b/protocols/MRA/Mra.h @@ -8,9 +8,6 @@ #define _CRT_SECURE_NO_WARNINGS
-#if defined( UNICODE ) && !defined( _UNICODE )
- #define _UNICODE
-#endif
//#define CRTDLL
diff --git a/protocols/Quotes/DBUtils.h b/protocols/Quotes/DBUtils.h index d154e99075..27e3de5038 100644 --- a/protocols/Quotes/DBUtils.h +++ b/protocols/Quotes/DBUtils.h @@ -4,11 +4,8 @@ std::string Quotes_DBGetStringA(HANDLE hContact,const char* szModule,const char* szSetting,const char* pszDefValue = NULL);
std::wstring Quotes_DBGetStringW(HANDLE hContact,const char* szModule,const char* szSetting,const wchar_t* pszDefValue = NULL);
-#ifdef _UNICODE
+
#define Quotes_DBGetStringT Quotes_DBGetStringW
-#else
-#define Quotes_DBGetStringT Quotes_DBGetStringA
-#endif
bool Quotes_DBWriteDouble(HANDLE hContact,const char* szModule,const char* szSetting,double dValue);
bool Quotes_DBReadDouble(HANDLE hContact,const char* szModule,const char* szSetting,double& rdValue);
diff --git a/protocols/Quotes/QuotesProviderBase.cpp b/protocols/Quotes/QuotesProviderBase.cpp Binary files differindex c92c748a02..c60909d7fa 100644 --- a/protocols/Quotes/QuotesProviderBase.cpp +++ b/protocols/Quotes/QuotesProviderBase.cpp diff --git a/protocols/Quotes/stdafx.h b/protocols/Quotes/stdafx.h index 19c85a3303..23cd7c3c4a 100644 --- a/protocols/Quotes/stdafx.h +++ b/protocols/Quotes/stdafx.h @@ -74,7 +74,7 @@ #include <fstream>
#include <map>
-#ifdef _UNICODE
+
typedef std::wstring tstring;
typedef std::wostringstream tostringstream;
typedef std::wistringstream tistringstream;
@@ -84,17 +84,6 @@ typedef std::wostream tostream; typedef std::wistream tistream;
typedef boost::posix_time::wtime_input_facet ttime_input_facet;
typedef boost::posix_time::wtime_facet ttime_facet;
-#else
-typedef std::string tstring;
-typedef std::ostringstream tostringstream;
-typedef std::istringstream tistringstream;
-typedef std::ofstream tofstream;
-typedef std::ifstream tifstream;
-typedef std::ostream tostream;
-typedef std::istream tistream;
-typedef boost::posix_time::time_input_facet ttime_input_facet;
-typedef boost::posix_time::time_facet ttime_facet;
-#endif
inline int quotes_stricmp(LPCTSTR p1,LPCTSTR p2)
{
diff --git a/protocols/Twitter/Debug.c b/protocols/Twitter/Debug.c index cfc5c7fd4f..947df7a536 100644 --- a/protocols/Twitter/Debug.c +++ b/protocols/Twitter/Debug.c @@ -97,13 +97,11 @@ void _TRACE(LPCSTR fmt, ...) TCHAR buf[DEBUG_TRACE_BUF_SIZE + 3] = _T("");
va_list va;
-#ifndef UNICODE
- char* tfmt = fmt;
-#else
+
wchar_t tfmt[DEBUG_TRACE_FMT_SIZE];
size_t tmp = 0;
mbstowcs_s(&tmp, tfmt, SIZEOF(tfmt), fmt, _TRUNCATE);
-#endif
+
va_start(va, fmt);
len = _vsntprintf_s(buf, SIZEOF(buf), _TRUNCATE, tfmt, va);
diff --git a/protocols/Twitter/StringConv.h b/protocols/Twitter/StringConv.h index c5266f574d..ec25c15ef7 100644 --- a/protocols/Twitter/StringConv.h +++ b/protocols/Twitter/StringConv.h @@ -39,20 +39,13 @@ inline std::wstring UTF8ToWide(const std::string& str) { return MBToWide(str, C inline std::string ANSIToUTF8(const std::string& str, UINT codePage = CP_ACP) { return WideToUTF8(MBToWide(str, codePage)); }
inline std::string UTF8ToANSI(const std::string& str, UINT codePage = CP_ACP) { return WideToMB(UTF8ToWide(str), codePage); }
-#ifdef _UNICODE
+
#define TCHARToUTF8 WideToUTF8
#define UTF8ToTCHAR UTF8ToWide
#define TCHARToWide
#define WideToTCHAR
#define TCHARToMB WideToMB
#define MBToTCHAR MBToWide
-#else
-#define TCHARToUTF8 ANSIToUTF8
-#define UTF8ToTCHAR UTF8ToANSI
-#define TCHARToWide MBToWide
-#define WideToTCHAR WideToMB
-#define TCHARToMB
-#define MBToTCHAR
-#endif
+
#endif // StringConv_h__
diff --git a/protocols/Twitter/main.cpp b/protocols/Twitter/main.cpp index 077b54a0fa..42ffac5220 100644 --- a/protocols/Twitter/main.cpp +++ b/protocols/Twitter/main.cpp @@ -109,11 +109,9 @@ int OnModulesLoaded(WPARAM,LPARAM) upd.szBetaChangelogURL = "http://twosx.net/mim/twitter/updater/changelog.html";
upd.pbBetaVersionPrefix = reinterpret_cast<BYTE*>("Twitter ");
upd.cpbBetaVersionPrefix = (int)strlen(reinterpret_cast<char*>(upd.pbBetaVersionPrefix));
-#ifdef UNICODE
+
upd.szBetaUpdateURL = "http://twosx.net/mim/twitter/updater/twitter.zip";
-#else
- upd.szBetaUpdateURL = "http://www.teamboxel.com/update/twitter/ansi";
-#endif
+
upd.pbVersion = reinterpret_cast<BYTE*>( CreateVersionStringPlugin(
reinterpret_cast<PLUGININFO*>(&pluginInfo),curr_version) );
diff --git a/protocols/Twitter/twitter.h b/protocols/Twitter/twitter.h index d26c06bdbd..54baa768f7 100644 --- a/protocols/Twitter/twitter.h +++ b/protocols/Twitter/twitter.h @@ -30,11 +30,8 @@ using std::vector; #include "StringConv.h"
#include "stdafx.h"
-#if defined( _UNICODE )
- #define tstring wstring
-#else
- #define tstring string
-#endif
+#define tstring wstring
+
typedef unsigned long long twitter_id;
typedef std::map<std::wstring, std::wstring> OAuthParameters;
diff --git a/protocols/Twitter/utility.h b/protocols/Twitter/utility.h index c827a6d1ec..cc60ee15c4 100644 --- a/protocols/Twitter/utility.h +++ b/protocols/Twitter/utility.h @@ -120,20 +120,16 @@ protected: inline void mbcs_to_tcs(UINT code_page,const char *mbstr,TCHAR *tstr,int tlen)
{
-#ifdef UNICODE
+
MultiByteToWideChar(code_page,0,mbstr,-1,tstr,tlen);
-#else
- strncpy(tstr,mbstr,tlen);
-#endif
+
}
inline void wcs_to_tcs(UINT code_page,const wchar_t *wstr,TCHAR *tstr,int tlen)
{
-#ifdef UNICODE
+
wcsncpy(tstr,wstr,tlen);
-#else
- WideCharToMultiByte(code_page,0,wstr,-1,tstr,tlen,0,0);
-#endif
+
}
class ScopedLock
|