From e521b812384a0e93f48e078c6cb248913dcc893a Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Fri, 15 Jun 2012 20:04:13 +0000 Subject: another portion of "#ifsef Unicode" removal git-svn-id: http://svn.miranda-ng.org/main/trunk@437 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/QuickMessages/Utils.c | 18 ++++------ plugins/QuickMessages/main.c | 36 +++++++------------ plugins/QuickMessages/quickmessages.h | 8 ++--- plugins/QuickReplies/common.h | 6 +--- plugins/Sessions/Src/Sessions.h | 8 ++--- plugins/SmileyAdd/general.cpp | 24 +++---------- plugins/SmileyAdd/general.h | 21 ----------- plugins/SmileyAdd/imagecache.cpp | 6 ++-- plugins/SmileyAdd/main.cpp | 18 +++------- plugins/SmileyAdd/services.cpp | 19 ++++------ plugins/SmileyAdd/smileyroutines.cpp | 48 ++----------------------- plugins/SmileyAdd/smileys.cpp | 10 +++--- plugins/SplashScreen/src/headers.h | 6 +--- plugins/StatusPlugins/StartupStatus/options.cpp | 23 +++--------- plugins/StatusPlugins/commonstatus.h | 4 --- plugins/StopSpamPlus/res/version.h | 9 +---- plugins/StopSpamPlus/src/events.cpp | 43 ++++++++-------------- plugins/StopSpamPlus/src/settings.cpp | 8 ++--- plugins/StopSpamPlus/src/settings.h | 4 --- plugins/Svc_dbepp/headers.h | 4 --- plugins/helpers/gen_helpers.cpp | 41 +++++---------------- 21 files changed, 82 insertions(+), 282 deletions(-) (limited to 'plugins') diff --git a/plugins/QuickMessages/Utils.c b/plugins/QuickMessages/Utils.c index 8adf1a13bd..41b3710664 100644 --- a/plugins/QuickMessages/Utils.c +++ b/plugins/QuickMessages/Utils.c @@ -474,11 +474,9 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz TCHAR* p=NULL; int NameLenght=0; TCHAR* ptszName=NULL; -#ifdef _UNICODE + ptszName=mir_a2u((char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); -#else - ptszName=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); -#endif + NameLenght=(int)_tcslen(ptszName); p=realloc(tempQValue, (QVSize+NameLenght+1)*sizeof(TCHAR)); @@ -538,11 +536,9 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ZeroMemory(&ci,sizeof(CONTACTINFO)); ci.cbSize = sizeof(CONTACTINFO); ci.hContact = hContact; -#ifdef UNICODE + ci.dwFlag =CNF_FIRSTNAME|CNF_UNICODE; -#else - ci.dwFlag =CNF_FIRSTNAME; -#endif + ci.szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); if (!CallService(MS_CONTACT_GETCONTACTINFO,(WPARAM)0,(LPARAM)&ci)&&ci.pszVal){ NameLenght=(int)_tcslen(ci.pszVal); @@ -578,11 +574,9 @@ TCHAR* ParseString(HANDLE hContact,TCHAR* ptszQValIn,TCHAR* ptszText,TCHAR* ptsz ci.cbSize = sizeof(CONTACTINFO); ci.hContact = hContact; ci.szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); -#ifdef UNICODE + ci.dwFlag =CNF_LASTNAME|CNF_UNICODE; -#else - ci.dwFlag =CNF_LASTNAME; -#endif + if (!CallService(MS_CONTACT_GETCONTACTINFO,(WPARAM)0,(LPARAM)&ci)&&ci.pszVal){ NameLenght=(int)_tcslen(ci.pszVal); ptszName=ci.pszVal; diff --git a/plugins/QuickMessages/main.c b/plugins/QuickMessages/main.c index b1957c89eb..ea51b49eda 100644 --- a/plugins/QuickMessages/main.c +++ b/plugins/QuickMessages/main.c @@ -111,11 +111,9 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) HANDLE hData=NULL; TCHAR* chBuffer=NULL; int textLength=0; -#ifdef _UNICODE + hData= GetClipboardData(CF_UNICODETEXT); -#else - hData = GetClipboardData(CF_TEXT); -#endif + chBuffer= (TCHAR*)GlobalLock(hData); textLength=(int)_tcslen(chBuffer); pszCBText=mir_tstrdup(chBuffer); @@ -136,11 +134,9 @@ static int InputMenuPopup(WPARAM wParam,LPARAM lParam) if(qd->ptszValue){ ptszQValue=ParseString(mwpd->hContact,qd->ptszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(qd->ptszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); if ((bIsService=qd->bIsService)&&ptszQValue) -#ifdef _UNICODE + CallService(mir_u2a(ptszQValue),(WPARAM)mwpd->hContact,0); -#else - CallService(ptszQValue,(WPARAM)mwpd->hContact,0); -#endif + } if(ptszQValue) @@ -190,11 +186,9 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) HANDLE hData=NULL; TCHAR* chBuffer=NULL; int textLength=0; -#ifdef _UNICODE + hData= GetClipboardData(CF_UNICODETEXT); -#else - hData = GetClipboardData(CF_TEXT); -#endif + chBuffer= (TCHAR*)GlobalLock(hData); textLength=(int)_tcslen(chBuffer); pszCBText=mir_tstrdup(chBuffer); @@ -236,11 +230,9 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(ButtonsList[cbcd->dwButtonId]->ptszQValue) ptszQValue=ParseString(cbcd->hContact,ButtonsList[cbcd->dwButtonId]->ptszQValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(ButtonsList[cbcd->dwButtonId]->ptszQValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); if ((bIsService=ButtonsList[cbcd->dwButtonId]->bIsServName)&&ptszQValue) -#ifdef _UNICODE + CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); -#else - CallService(ptszQValue,(WPARAM)cbcd->hContact,0); -#endif + break; case 2: { @@ -249,11 +241,9 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(bd&&bd->pszValue){ ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); if ((bIsService=bd->bIsServName)&&ptszQValue) -#ifdef _UNICODE + CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); -#else - CallService(ptszQValue,(WPARAM)cbcd->hContact,0); -#endif + } } break; @@ -300,11 +290,9 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) if(bd->pszValue){ ptszQValue=ParseString(cbcd->hContact,bd->pszValue,pszText?pszText:_T(""),pszCBText?pszCBText:_T(""),(int)_tcslen(bd->pszValue),textlenght,pszCBText?(int)_tcslen(pszCBText):0); if ((bIsService=bd->bIsServName)&&ptszQValue) -#ifdef _UNICODE + CallService(mir_u2a(ptszQValue),(WPARAM)cbcd->hContact,0); -#else - CallService(ptszQValue,(WPARAM)cbcd->hContact,0); -#endif + } }break; } diff --git a/plugins/QuickMessages/quickmessages.h b/plugins/QuickMessages/quickmessages.h index 4931697b2b..c5e9d851a3 100644 --- a/plugins/QuickMessages/quickmessages.h +++ b/plugins/QuickMessages/quickmessages.h @@ -72,11 +72,9 @@ int OptionsInit(WPARAM,LPARAM); #define SIZEOF(X)(sizeof(X)/sizeof(X[0])) -#ifdef _UNICODE -#define QMESSAGES_NAME "quickmessages_u" -#else -#define QMESSAGES_NAME "quickmessages_a" -#endif + +#define QMESSAGES_NAME "quickmessages" + #define QMESSAGES_VERSION_URL "http://miranda.radicaled.ru/public/updater/quickmessages.txt" diff --git a/plugins/QuickReplies/common.h b/plugins/QuickReplies/common.h index 1955edfded..e65994372c 100644 --- a/plugins/QuickReplies/common.h +++ b/plugins/QuickReplies/common.h @@ -59,11 +59,7 @@ extern HANDLE hQuickRepliesService; extern HANDLE hOnModulesLoaded; extern HANDLE hOnPreShutdown; -#ifdef _UNICODE - typedef std::wstring tString; -#else - typedef std::string tString; -#endif //_UNICODE +typedef std::wstring tString; INT_PTR QuickRepliesService(WPARAM wParam, LPARAM lParam); diff --git a/plugins/Sessions/Src/Sessions.h b/plugins/Sessions/Src/Sessions.h index 703fdeb636..345c31bc54 100644 --- a/plugins/Sessions/Src/Sessions.h +++ b/plugins/Sessions/Src/Sessions.h @@ -76,11 +76,9 @@ extern BOOL g_bIncompletedSave; #define TIMERID_SHOW 11 #define TIMERID_REBUILDAFTER 14 -#ifdef _UNICODE -#define SESSIONS_NAME "sessions_u" -#else -#define SESSIONS_NAME "sessions_a" -#endif + +#define SESSIONS_NAME "sessions" + #define SESSIONS_VERSION_URL "http://miranda.radicaled.ru/public/updater/sessions.txt" diff --git a/plugins/SmileyAdd/general.cpp b/plugins/SmileyAdd/general.cpp index 03164e5c44..9e97737f8c 100644 --- a/plugins/SmileyAdd/general.cpp +++ b/plugins/SmileyAdd/general.cpp @@ -26,9 +26,6 @@ along with this program. If not, see . /* #include "m_popup.h" -#if defined _UNICODE || defined UNICODE -#include "m_popupw.h" -#endif */ static ULONG_PTR g_gdiplusToken = 0; static bool gdiPlusFail = false; @@ -278,22 +275,18 @@ void ReportError(const TCHAR* errmsg) { static const TCHAR title[] = _T("Miranda SmileyAdd"); /* -#if defined _UNICODE || defined UNICODE + POPUPDATAW pd = {0}; -#else - POPUPDATAEX pd = {0}; -#endif + _tcscpy(pd.lpwzContactName, title); _tcscpy(pd.lpwzText, errmsg); pd.iSeconds = -1; -#if defined _UNICODE || defined UNICODE + bool popupFail = PUAddPopUpW(&pd) != CALLSERVICE_NOTFOUND; -#else - bool popupFail = PUAddPopUpEx(&pd) != CALLSERVICE_NOTFOUND; -#endif + if (popupFail) */ MessageBox(NULL, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST); @@ -302,14 +295,5 @@ void ReportError(const TCHAR* errmsg) #pragma warning( disable : 4786 ) #undef _MT -#if defined _UNICODE || defined UNICODE - #include #include - -#else - -#include -#include - -#endif diff --git a/plugins/SmileyAdd/general.h b/plugins/SmileyAdd/general.h index 72bdc217ba..8cc13c5619 100644 --- a/plugins/SmileyAdd/general.h +++ b/plugins/SmileyAdd/general.h @@ -51,8 +51,6 @@ along with this program. If not, see . #pragma warning( disable : 4275 ) #pragma warning( disable : 4390 ) -#if defined _UNICODE || defined UNICODE - #include #include @@ -60,17 +58,6 @@ typedef WCPattern _TPattern; typedef WCMatcher _TMatcher; #define createTMatcher createWCMatcher -#else - -#include -#include - -typedef Pattern _TPattern; -typedef Matcher _TMatcher; -#define createTMatcher createMatcher - -#endif - #pragma warning( pop ) #define _MT @@ -164,18 +151,10 @@ public: operator char*() const { return m_psz; } }; -#if defined _UNICODE || defined UNICODE #define T2A_SM (char*)W2A_SM #define T2W_SM(p1) (wchar_t*)p1 #define A2T_SM (wchar_t*)A2W_SM #define W2T_SM(p1) (TCHAR*)p1 -#else -#define T2A_SM(p1) (char*)p1 -#define T2W_SM A2W_SM -#define A2T_SM(p1) (TCHAR*)p1 -#define W2T_SM W2A_SM -#endif - template struct SMOBJLIST : public OBJLIST { diff --git a/plugins/SmileyAdd/imagecache.cpp b/plugins/SmileyAdd/imagecache.cpp index b771c4941b..8fdcea9003 100644 --- a/plugins/SmileyAdd/imagecache.cpp +++ b/plugins/SmileyAdd/imagecache.cpp @@ -75,11 +75,9 @@ static HMODULE LoadDll(const bkstring& file) { FreeLibrary(lastmodule); lastdllname = file; -#if (defined _UNICODE || defined UNICODE) + lastmodule = LoadLibraryEx(file.c_str(), NULL, LOAD_LIBRARY_AS_DATAFILE); -#else - lastmodule = LoadLibraryEx(file.c_str(), NULL, DONT_RESOLVE_DLL_REFERENCES); -#endif + } laststamp = time(NULL); diff --git a/plugins/SmileyAdd/main.cpp b/plugins/SmileyAdd/main.cpp index e0965d8655..92a7285a45 100644 --- a/plugins/SmileyAdd/main.cpp +++ b/plugins/SmileyAdd/main.cpp @@ -56,11 +56,7 @@ static const PLUGININFOEX pluginInfoEx = "Copyright© 2004 - 2012 Boris Krasnovskiy, portions by Rein-Peter de Boer", "http://code.google.com/p/mirandaimplugins/downloads/list", // "http://addons.miranda-im.org/index.php?action=display&id=2152", -#if defined(UNICODE) | defined(_UNICODE) UNICODE_AWARE, //not transient -#else - 0, -#endif 0, //doesn't replace anything built-in // {BD542BB4-5AE4-4d0e-A435-BA8DBE39607F} { 0xbd542bb4, 0x5ae4, 0x4d0e, { 0xa4, 0x35, 0xba, 0x8d, 0xbe, 0x39, 0x60, 0x7f } } @@ -145,19 +141,13 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) char temp[80]; CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(temp), (LPARAM)temp); -#ifdef _UNICODE + if (strstr(temp, "Unicode") == NULL) { ReportError(TranslateT("Please update SmileyAdd to ANSI Version")); return 1; } -#else - if (strstr(temp, "Unicode") != NULL) - { - ReportError(Translate("Please update SmileyAdd to Unicode Version")); - return 1; - } -#endif + InitImageCache(); @@ -190,9 +180,9 @@ extern "C" __declspec(dllexport) int Load(PLUGINLINK *link) hService[10] = CreateServiceFunction(MS_SMILEYADD_RELOAD, ReloadPack); hService[11] = CreateServiceFunction(MS_SMILEYADD_LOADCONTACTSMILEYS, LoadContactSmileys); -#if defined(UNICODE) | defined(_UNICODE) + hService[12] = CreateServiceFunction(MS_SMILEYADD_PARSEW, ParseTextW); -#endif + return 0; } diff --git a/plugins/SmileyAdd/services.cpp b/plugins/SmileyAdd/services.cpp index 1993e7e733..fed1b4c7ad 100644 --- a/plugins/SmileyAdd/services.cpp +++ b/plugins/SmileyAdd/services.cpp @@ -253,7 +253,7 @@ INT_PTR ParseText(WPARAM, LPARAM lParam) return TRUE; } -#if defined(UNICODE) | defined(_UNICODE) + INT_PTR ParseTextW(WPARAM, LPARAM lParam) { SMADD_PARSEW* smre = (SMADD_PARSEW*) lParam; @@ -294,7 +294,7 @@ INT_PTR ParseTextW(WPARAM, LPARAM lParam) return TRUE; } -#endif + INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) { @@ -341,11 +341,8 @@ INT_PTR ParseTextBatch(WPARAM, LPARAM lParam) } smre->numSmileys = smllist.getCount(); -#if defined(UNICODE) | defined(_UNICODE) + smre->oflag = smre->flag | SAFL_UNICODE; -#else - smre->oflag = smre->flag & ~SAFL_UNICODE; -#endif return (INT_PTR)res; } @@ -363,16 +360,14 @@ INT_PTR RegisterPack(WPARAM, LPARAM lParam) if (smre == NULL || smre->cbSize < sizeof(SMADD_REGCAT)) return FALSE; if (IsBadStringPtrA(smre->name, 50) || IsBadStringPtrA(smre->dispname, 50)) return FALSE; -#if (defined _UNICODE || defined UNICODE) + unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP; -#endif -#if (defined _UNICODE || defined UNICODE) + + bkstring nmd(A2W_SM(smre->dispname, lpcp)); -#else - bkstring nmd(smre->dispname); -#endif + bkstring nm(A2T_SM(smre->name)); g_SmileyCategories.AddAndLoad(nm, nmd); diff --git a/plugins/SmileyAdd/smileyroutines.cpp b/plugins/SmileyAdd/smileyroutines.cpp index c5e6e46d8a..ba136d7ed5 100644 --- a/plugins/SmileyAdd/smileyroutines.cpp +++ b/plugins/SmileyAdd/smileyroutines.cpp @@ -29,12 +29,9 @@ ISmileyBase* CreateSmileyObject(SmileyType* sml); ISmileyBase* CreateAniSmileyObject(SmileyType* sml, COLORREF clr, bool ishpp); -#ifdef _UNICODE + bool g_HiddenTextSupported = true; -#else -int RichEditVersion(void); -bool g_HiddenTextSupported = (RichEditVersion() == 3); -#endif + // {8CC497C0-A1DF-11CE-8098-00AA0047BE5D} const GUID IID_ITextDocument = @@ -272,11 +269,6 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const SmileysQueueType smllist; -#if !defined(_UNICODE) && !defined(UNICODE) - size_t len = SysStringLen(btxt); - for (unsigned i=0; iRelease(); RichEditOle->Release(); } - - -#if !defined(_UNICODE) && !defined(UNICODE) -int RichEditVersion(void) -{ - int ret = -1; - - HMODULE hLib = GetModuleHandle(_T("riched20.dll")); - HRSRC hVersion = FindResource(hLib, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); - if (hVersion != NULL) - { - HGLOBAL hGlobal = LoadResource(hLib, hVersion); - if (hGlobal != NULL) - { - LPVOID versionInfo = LockResource(hGlobal); - if (versionInfo != NULL) - { - int vl = *(unsigned short*)versionInfo; - unsigned *res = (unsigned*)versionInfo; - while (*res != 0xfeef04bd && ((char*)res - (char*)versionInfo) < vl) ++res; - - if (((char*)res - (char*)versionInfo) < vl) - { - VS_FIXEDFILEINFO *vsInfo = (VS_FIXEDFILEINFO*)res; - ret = LOWORD(vsInfo->dwFileVersionMS) ? 3 : 2; - } - } - UnlockResource(hGlobal); - FreeResource(hGlobal); - } - } - return ret; -} -#endif - - diff --git a/plugins/SmileyAdd/smileys.cpp b/plugins/SmileyAdd/smileys.cpp index c23467812d..84dc16b6a9 100644 --- a/plugins/SmileyAdd/smileys.cpp +++ b/plugins/SmileyAdd/smileys.cpp @@ -993,10 +993,10 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) const bkstring& defaultFile = GetSmileyCategory(tname)->GetFilename(); -#if (defined _UNICODE || defined UNICODE) + unsigned lpcp = (unsigned)CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); if (lpcp == CALLSERVICE_NOTFOUND) lpcp = CP_ACP; -#endif + PROTOCOLDESCRIPTOR **protoList; PROTOACCOUNT **accList; @@ -1029,11 +1029,9 @@ void SmileyCategoryListType::AddAllProtocolsAsCategory(void) char protoName[128]; CallProtoService(protoList[i]->szName, PS_GETNAME, sizeof(protoName), (LPARAM)protoName); -#if (defined _UNICODE || defined UNICODE) + displayName = A2W_SM(protoName, lpcp); -#else - displayName = protoName; -#endif + tname = A2T_SM(protoList[i]->szName); AddCategory(tname, displayName, smcProto, paths); } diff --git a/plugins/SplashScreen/src/headers.h b/plugins/SplashScreen/src/headers.h index f5f27d970a..d94b597fd5 100644 --- a/plugins/SplashScreen/src/headers.h +++ b/plugins/SplashScreen/src/headers.h @@ -68,11 +68,7 @@ #define MODNAME "SplashScreen" #define WM_LOADED (WM_USER + 10) -#ifdef _UNICODE - #define tmemcpy wmemcpy -#else - #define tmemcpy memcpy -#endif +#define tmemcpy wmemcpy struct SPLASHOPTS { diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 3aef57390c..992fe13701 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -185,33 +185,23 @@ HRESULT CreateLink(TSettingsList& protoSettings) TCHAR path[MAX_PATH]; GetModuleFileName(NULL, path, SIZEOF(path)); psl->SetPath(path); - #if defined( _UNICODE ) + TCHAR* p = mir_a2t( desc ); psl->SetDescription( p ); mir_free( p ); p = mir_a2t( args ); psl->SetArguments( p ); mir_free( p ); - #else - psl->SetDescription(desc); - psl->SetArguments(args); - #endif - + // Query IShellLink for the IPersistFile interface for saving the // shortcut in persistent storage. IPersistFile* ppf; hres = psl->QueryInterface(IID_IPersistFile, ( void** )&ppf); if (SUCCEEDED(hres)) { - #if defined( _UNICODE ) - WCHAR* wsz = savePath; - #else - WCHAR wsz[MAX_PATH]; - - // Ensure that the string is ANSI. - MultiByteToWideChar(CP_ACP, 0, savePath, -1, wsz, MAX_PATH); - #endif + WCHAR* wsz = savePath; + // Save the link by calling IPersistFile::Save. hres = ppf->Save(wsz, TRUE); ppf->Release(); @@ -959,11 +949,8 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) } // from: http://www.codeproject.com/winhelp/msdnintegrator/ -#ifdef _UNICODE + static const CHAR _szSpecialFolderPath[] = "SHGetSpecialFolderPathW"; -#else - static const CHAR _szSpecialFolderPath[] = "SHGetSpecialFolderPathA"; -#endif BOOL MyGetSpecialFolderPath(HWND hwndOwner, LPTSTR lpszPath, int nFolder, BOOL fCreate) { diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h index a0a46c2476..5c0a531d0c 100644 --- a/plugins/StatusPlugins/commonstatus.h +++ b/plugins/StatusPlugins/commonstatus.h @@ -21,10 +21,6 @@ #ifndef COMMONSTATUSHEADER #define COMMONSTATUSHEADER -#if defined( UNICODE ) && !defined( _UNICODE ) - #define _UNICODE -#endif - #define MIRANDA_VER 0x0A00 #define _CRT_SECURE_NO_WARNINGS diff --git a/plugins/StopSpamPlus/res/version.h b/plugins/StopSpamPlus/res/version.h index 469a330f6f..12fc10b6df 100644 --- a/plugins/StopSpamPlus/res/version.h +++ b/plugins/StopSpamPlus/res/version.h @@ -35,19 +35,12 @@ #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM #define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -#ifdef _UNICODE -#ifdef __REV_NUM -#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM Unicode) -#else -#define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS Unicode) -#endif -#else + #ifdef __REV_NUM #define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS rev. __REV_NUM) #else #define __VERSION_STRING __STRINGIFY(__FILEVERSION_STRING_DOTS) #endif -#endif #define __PRODVERSION_STRING __PROD_MAJOR_VERSION,__PROD_MINOR_VERSION,__PROD_RELEASE_NUM,__PROD_BUILD_NUM #define __PRODVERSION_STRING_DOTS __PROD_MAJOR_VERSION.__PROD_MINOR_VERSION.__PROD_RELEASE_NUM.__PROD_BUILD_NUM diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index bbded01fea..f857560c8c 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -34,27 +34,23 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, wParam, lParam) { if (!plSets->HandleAuthReq.Get()) { - #ifdef _UNICODE + char * buf=mir_utf8encodeW(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()); CallContactService(hcntct, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); - #else - CallContactService(hcntct, PSS_MESSAGE, 0, (LPARAM)(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str())); - #endif + } char *AuthRepl; - #ifdef _UNICODE + AuthRepl=mir_u2a(variables_parse(plSets->AuthRepl.Get(), hcntct).c_str()); - #else - AuthRepl=variables_parse(plSets->AuthRepl.Get(), hcntct).c_str(); - #endif + // ...send message std::string allowService = dbei.szModule; allowService += PS_AUTHDENY; CallService(allowService.c_str(), (WPARAM)hDbEvent, (LPARAM)AuthRepl); - #ifdef _UNICODE + mir_free(AuthRepl); - #endif + DBWriteContactSettingByte(hcntct, "CList", "NotOnList", 1); DBWriteContactSettingByte(hcntct, "CList", "Hidden", 1); if (!plSets->HistLog.Get()) @@ -108,23 +104,17 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) if(dbei->flags & DBEF_UTF){ WCHAR* msg_u=mir_utf8decodeW((char*)dbei->pBlob); -#ifdef _UNICODE + message = msg_u; -#else - char* msg_a = mir_u2a(msg_u); - message = msg_a; - mir_free(msg_a); -#endif + mir_free(msg_u); } else{ -#ifdef _UNICODE + WCHAR* msg_u = mir_a2u((char*)(dbei->pBlob)); message = msg_u; mir_free(msg_u); -#else - message = (char*)(dbei->pBlob); -#endif + } // if message equal right answer... @@ -156,14 +146,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) DBDeleteContactSetting(hContact, "CList", "NotOnList"); // send congratulation - #ifdef _UNICODE + char * buf=mir_utf8encodeW(variables_parse(plSets->Congratulation.Get(), hContact).c_str()); CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); - #else - CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)(variables_parse(plSets->Congratulation.Get(), hContact).c_str())); - #endif - + // process the event return 1; } @@ -179,13 +166,11 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) // send question tstring q = infTalkProtPrefix + variables_parse((tstring)(plSets->Question), hContact); -#ifdef _UNICODE + char * buf=mir_utf8encodeW(q.c_str()); CallContactService(hContact, PSS_MESSAGE, PREF_UTF, (LPARAM)buf); mir_free(buf); -#else - CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)q.c_str()); -#endif + // increment question count DWORD questCount = DBGetContactSettingDword(hContact, pluginName, questCountSetting, 0); diff --git a/plugins/StopSpamPlus/src/settings.cpp b/plugins/StopSpamPlus/src/settings.cpp index 39ce0c96df..7d74b63919 100644 --- a/plugins/StopSpamPlus/src/settings.cpp +++ b/plugins/StopSpamPlus/src/settings.cpp @@ -11,7 +11,7 @@ tstring db_usage::DBGetPluginSetting(std::string const &name, tstring const &def return value; } -#ifdef _UNICODE + std::string db_usage::DBGetPluginSetting(std::string const &name, std::string const &defValue) { DBVARIANT dbv; @@ -21,7 +21,7 @@ std::string db_usage::DBGetPluginSetting(std::string const &name, std::string co DBFreeVariant(&dbv); return value; } -#endif + bool db_usage::DBGetPluginSetting(std::string const &name, bool const &defValue) { @@ -39,12 +39,12 @@ void db_usage::DBSetPluginSetting(std::string const &name, tstring const &value) DBWriteContactSettingTString(NULL, pluginName, name.c_str(), value.c_str()); } -#ifdef _UNICODE + void db_usage::DBSetPluginSetting(std::string const &name, std::string const &value) { DBWriteContactSettingString(NULL, pluginName, name.c_str(), value.c_str()); } -#endif + void db_usage::DBSetPluginSetting(std::string const &name, bool const &value) { diff --git a/plugins/StopSpamPlus/src/settings.h b/plugins/StopSpamPlus/src/settings.h index 5fe2b43a39..99aa9322e8 100644 --- a/plugins/StopSpamPlus/src/settings.h +++ b/plugins/StopSpamPlus/src/settings.h @@ -7,16 +7,12 @@ class db_usage public: //reading from database static tstring DBGetPluginSetting(std::string const &name, tstring const &defValue); -#ifdef _UNICODE static std::string DBGetPluginSetting(std::string const &name, std::string const &defValue); -#endif static bool DBGetPluginSetting(std::string const &name, bool const &defValue); static DWORD DBGetPluginSetting(std::string const &name, DWORD const &defValue); //writting to database static void DBSetPluginSetting(std::string const &name, tstring const &value); -#ifdef _UNICODE static void DBSetPluginSetting(std::string const &name, std::string const &value); -#endif static void DBSetPluginSetting(std::string const &name, bool const &value); static void DBSetPluginSetting(std::string const &name, DWORD const &value); diff --git a/plugins/Svc_dbepp/headers.h b/plugins/Svc_dbepp/headers.h index 4fdb328c58..97a530291c 100644 --- a/plugins/Svc_dbepp/headers.h +++ b/plugins/Svc_dbepp/headers.h @@ -7,10 +7,6 @@ #define _WIN32_WINNT 0x0501 #define MIRANDA_VER 0x0A00 -#if defined( UNICODE ) && !defined( _UNICODE ) - #define _UNICODE -#endif - #include #include diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index b2e8ff3380..817f1d9f48 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -45,11 +45,9 @@ TCHAR *Hlp_GetProtocolName(const char *proto) { if ( (!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname)) ) { return NULL; } -#ifdef UNICODE + return a2u(protoname); -#else - return _strdup(protoname); -#endif + } char *Hlp_GetDlgItemTextA(HWND hwndDlg, int nIDDlgItem) { @@ -195,11 +193,9 @@ int AddDebugLogMessage(const TCHAR* fmt, ...) { _tcsncpy(tszFinal, tszText, sizeof(tszFinal)); #endif -#ifdef UNICODE + szFinal = u2a(tszFinal); -#else - szFinal = _strdup(tszFinal); -#endif + res = WriteToDebugLogA(szFinal); free(szFinal); @@ -242,11 +238,9 @@ int AddErrorLogMessage(const TCHAR* fmt, ...) { _tcsncpy(tszFinal, tszText, sizeof(tszFinal)); #endif -#ifdef UNICODE + szFinal = u2a(tszFinal); -#else - szFinal = _strdup(tszFinal); -#endif + res = WriteToDebugLogA(szFinal); MessageBoxA(NULL, szFinal, "Error", MB_OK|MB_ICONERROR); free(szFinal); @@ -268,11 +262,9 @@ TCHAR *itot(int num) { // check this _itoa(num, tRes, 10); -#ifdef UNICODE + return a2u(tRes); -#else - return _strdup(tRes); -#endif + } ///////////////////////////////////////////////////////////////////////////////////////// @@ -427,7 +419,7 @@ int Hlp_UnicodeCheck(char *szPluginName, BOOL bForce, const char *szModule) { if (!CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVersionText), (LPARAM)szVersionText)) { ptr = strstr(szVersionText, "Unicode"); -#ifdef UNICODE + if ( (ptr == NULL) && (!DBGetContactSettingByte(NULL, szModule, SETTING_NOENCODINGCHECK, 0)) ) { if (bForce) { MessageBoxA(NULL, "You are running the ANSI version Miranda. Please use the ANSI build of this plugin.", szPluginName, MB_OK); @@ -441,21 +433,6 @@ int Hlp_UnicodeCheck(char *szPluginName, BOOL bForce, const char *szModule) { return 0; } } -#else - if ( (ptr != NULL) && (!DBGetContactSettingByte(NULL, szModule, SETTING_NOENCODINGCHECK, 0)) ) { - if (bForce) { - MessageBoxA(NULL, "You are running the UNICODE version Miranda. Please use the UNICODE build of this plugin.", szPluginName, MB_OK); - - return -1; - } - else { - MessageBoxA(NULL, "You are running the UNICODE version Miranda. It's recommened to use the UNICODE build of this plugin.", szPluginName, MB_OK); - DBWriteContactSettingByte(NULL, szModule, SETTING_NOENCODINGCHECK, 1); - - return 0; - } - } -#endif } #endif -- cgit v1.2.3