summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/TipperYM/message_pump.cpp5
-rw-r--r--plugins/TipperYM/popwin.cpp10
-rw-r--r--plugins/TipperYM/str_utils.cpp78
-rw-r--r--plugins/TipperYM/subst.cpp8
-rw-r--r--plugins/TipperYM/tipper.cpp10
-rw-r--r--plugins/TooltipNotify/src/TooltipNotify.cpp24
-rw-r--r--plugins/TooltipNotify/src/main.cpp12
-rw-r--r--plugins/UserInfoEx/ctrl_contact.cpp16
-rw-r--r--plugins/UserInfoEx/ex_import/dlg_ExImOpenSaveFile.cpp14
-rw-r--r--plugins/UserInfoEx/init.cpp16
-rw-r--r--plugins/UserInfoEx/mir_db.h9
-rw-r--r--plugins/UserInfoEx/mir_string.h18
-rw-r--r--plugins/UserInfoEx/svc_avatar.cpp6
-rw-r--r--plugins/Variables/contact.cpp32
-rw-r--r--plugins/Variables/help.cpp72
-rw-r--r--plugins/Variables/parse_alias.cpp6
-rw-r--r--plugins/Variables/parse_external.cpp18
-rw-r--r--plugins/Variables/parse_inet.cpp30
-rw-r--r--plugins/Variables/parse_metacontacts.cpp18
-rw-r--r--plugins/Variables/parse_miranda.cpp85
-rw-r--r--plugins/Variables/parse_regexp.cpp34
-rw-r--r--plugins/Variables/parse_system.cpp36
-rw-r--r--plugins/Variables/parse_xml.cpp26
-rw-r--r--plugins/Variables/tokenregister.cpp27
-rw-r--r--plugins/Variables/variables.cpp21
-rw-r--r--plugins/Variables/variables.h4
26 files changed, 194 insertions, 441 deletions
diff --git a/plugins/TipperYM/message_pump.cpp b/plugins/TipperYM/message_pump.cpp
index 0122d18cb8..4aab0f10b3 100644
--- a/plugins/TipperYM/message_pump.cpp
+++ b/plugins/TipperYM/message_pump.cpp
@@ -260,11 +260,8 @@ void InitMessagePump()
MyUpdateLayeredWindow = (BOOL (WINAPI *)(HWND hwnd, HDC hdcDST, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags))GetProcAddress(hUserDll, "UpdateLayeredWindow");
MyAnimateWindow =(BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(hUserDll, "AnimateWindow");
MyMonitorFromPoint = (HMONITOR (WINAPI*)(POINT, DWORD))GetProcAddress(hUserDll, "MonitorFromPoint");
-#ifdef _UNICODE
MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoW");
-#else
- MyGetMonitorInfo = (BOOL (WINAPI*)(HMONITOR, LPMONITORINFO))GetProcAddress(hUserDll, "GetMonitorInfoA");
-#endif
+
}
HMODULE hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
diff --git a/plugins/TipperYM/popwin.cpp b/plugins/TipperYM/popwin.cpp
index c9f6d82464..964069ce2d 100644
--- a/plugins/TipperYM/popwin.cpp
+++ b/plugins/TipperYM/popwin.cpp
@@ -469,7 +469,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
// fingerprint icon
if (pwd->bIsIconVisible[5])
{
-#ifdef _UNICODE
+
if (ServiceExists(MS_FP_GETCLIENTICONT))
{
for (i = 0; opt.exIconsOrder[i] != 5; i++);
@@ -481,7 +481,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
}
else
-#endif
+
if (ServiceExists(MS_FP_GETCLIENTICON))
{
for (i = 0; opt.exIconsOrder[i] != 5; i++);
@@ -1017,11 +1017,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
GlobalUnlock(hClipboardData);
-#ifdef _UNICODE
+
SetClipboardData(CF_UNICODETEXT, hClipboardData);
-#else
- SetClipboardData(CF_TEXT, hClipboardData);
-#endif
+
}
CloseClipboard();
diff --git a/plugins/TipperYM/str_utils.cpp b/plugins/TipperYM/str_utils.cpp
index 0e9b67f73f..112cc2678b 100644
--- a/plugins/TipperYM/str_utils.cpp
+++ b/plugins/TipperYM/str_utils.cpp
@@ -70,60 +70,46 @@ bool utf2a(const char *us, char *buff, int bufflen)
bool t2w(const TCHAR *ts, wchar_t *buff, int bufflen)
{
-#ifdef _UNICODE
+
wcsncpy(buff, ts, bufflen);
return true;
-#else
- return a2w(ts, buff, bufflen);
-#endif
+
}
bool w2t(const wchar_t *ws, TCHAR *buff, int bufflen)
{
-#ifdef _UNICODE
+
wcsncpy(buff, ws, bufflen);
return true;
-#else
- return w2a(ws, buff, bufflen);
-#endif
+
}
bool t2a(const TCHAR *ts, char *buff, int bufflen)
{
-#ifdef _UNICODE
+
return w2a(ts, buff, bufflen);
-#else
- strncpy(buff, ts, bufflen);
- return true;
-#endif
+
}
bool a2t(const char *as, TCHAR *buff, int bufflen)
{
-#ifdef _UNICODE
+
return a2w(as, buff, bufflen);
-#else
- strncpy(buff, as, bufflen);
- return true;
-#endif
+
}
bool t2utf(const TCHAR *ts, char *buff, int bufflen)
{
-#ifdef _UNICODE
+
return w2utf(ts, buff, bufflen);
-#else
- return a2utf(ts, buff, bufflen);
-#endif
+
}
bool utf2t(const char *us, TCHAR *buff, int bufflen)
{
-#ifdef _UNICODE
+
return utf2w(us, buff, bufflen);
-#else
- return utf2a(us, buff, bufflen);
-#endif
+
}
wchar_t *utf2w(const char *us)
@@ -190,63 +176,43 @@ char *a2utf(const char *as)
TCHAR *w2t(const wchar_t *ws)
{
-#ifdef _UNICODE
+
return mir_wstrdup(ws);
-#else
- return w2a(ws);
-#endif
+
}
wchar_t *t2w(const TCHAR *ts)
{
-#ifdef _UNICODE
+
return mir_tstrdup(ts);
-#else
- return a2w(ts);
-#endif
+
}
char *t2a(const TCHAR *ts)
{
-#ifdef _UNICODE
+
return w2a(ts);
-#else
- return mir_strdup(ts);
-#endif
+
}
TCHAR *a2t(const char *as)
{
-#ifdef _UNICODE
+
return a2w(as);
-#else
- return mir_strdup(as);
-#endif
+
}
TCHAR *utf2t(const char *utfs)
{
-#ifdef _UNICODE
+
return utf2w(utfs);
-#else
- wchar_t *ws = utf2w(utfs);
- char *ret = w2a(ws);
- mir_free(ws);
- return ret;
-#endif
}
char *t2utf(const TCHAR *ts)
{
-#ifdef _UNICODE
+
return w2utf(ts);
-#else
- wchar_t *ws = a2w(ts);
- char *ret = w2utf(ws);
- mir_free(ws);
- return ret;
-#endif
}
TCHAR *myfgets(TCHAR *Buf, int MaxCount, FILE *File)
diff --git a/plugins/TipperYM/subst.cpp b/plugins/TipperYM/subst.cpp
index bc99aee44b..531af67200 100644
--- a/plugins/TipperYM/subst.cpp
+++ b/plugins/TipperYM/subst.cpp
@@ -61,12 +61,12 @@ bool DBGetContactSettingAsString(HANDLE hContact, const char *szModuleName, cons
if (dbv.pszVal) utf2t(dbv.pszVal, buff, bufflen);
buff[bufflen - 1] = 0;
break;
-#ifdef _UNICODE
+
case DBVT_WCHAR:
if (dbv.pwszVal) wcsncpy(buff, dbv.pwszVal, bufflen);
buff[bufflen - 1] = 0;
break;
-#endif
+
}
DBFreeVariant(&dbv);
@@ -847,7 +847,7 @@ TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus)
{
swzText = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, wStatus, 0);
}
-#ifdef _UNICODE
+
else if (swzText == NULL)
{
// try to use service without SGMA_TCHAR
@@ -858,7 +858,7 @@ TCHAR *GetProtoStatusMessage(char *szProto, WORD wStatus)
mir_free(tmpMsg);
}
}
-#endif
+
if (swzText && !swzText[0])
{
diff --git a/plugins/TipperYM/tipper.cpp b/plugins/TipperYM/tipper.cpp
index 3844e66758..fde1fd7a39 100644
--- a/plugins/TipperYM/tipper.cpp
+++ b/plugins/TipperYM/tipper.cpp
@@ -274,11 +274,9 @@ void InitUpdaterSupport()
update.szComponentName = pluginInfoEx.shortName;
update.pbVersion = (BYTE *)CreateVersionString(pluginInfoEx.version, szVersion);
update.cpbVersion = (int)strlen((char *)update.pbVersion);
-#ifdef _UNICODE
+
update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym.zip";
-#else
- update.szUpdateURL = "http://miranda-easy.net/addons/updater/tipper-ym_ansi.zip";
-#endif
+
update.szVersionURL = "http://miranda-easy.net/addons/updater/tipper_version.txt";
update.pbVersionPrefix = (BYTE *)"Tipper YM ";
update.cpbVersionPrefix = (int)strlen((char *)update.pbVersionPrefix);
@@ -369,9 +367,9 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
// for compatibility with mToolTip status tooltips
hShowTipService = CreateServiceFunction("mToolTip/ShowTip", ShowTip);
-#ifdef _UNICODE
+
hShowTipWService = CreateServiceFunction("mToolTip/ShowTipW", ShowTipW);
-#endif
+
hHideTipService = CreateServiceFunction("mToolTip/HideTip", HideTip);
hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp
index d21cae65d2..d4864c96d5 100644
--- a/plugins/TooltipNotify/src/TooltipNotify.cpp
+++ b/plugins/TooltipNotify/src/TooltipNotify.cpp
@@ -725,16 +725,14 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
lvi.iSubItem = 0;
lvi.iItem = i;
lvi.lParam = i;
-#ifdef _UNICODE
+
WCHAR wszProto[128];
long lLen = MultiByteToWideChar(CP_ACP, 0, ppProtos[i]->szName,
(int)strlen(ppProtos[i]->szName), wszProto, ARRAY_SIZE(wszProto));
wszProto[lLen] = L'\0';
lvi.pszText = wszProto;
-#else
- lvi.pszText = ppProtos[lvi.iItem]->szName;
-#endif
+
int new_item = ListView_InsertItem(GetDlgItem(hDlg,IDC_PROTOS),&lvi);
BYTE bProtoState = ReadSettingByte(ppProtos[i]->szName, ProtoUserBit|ProtoIntBit);
@@ -762,24 +760,20 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP
TCHAR szProto[64];
ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, ARRAY_SIZE(szProto));
-#ifdef _UNICODE
+
char szMultiByteProto[128];
long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, lstrlen(szProto),
szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL);
szMultiByteProto[lLen] = '\0';
BYTE bProtoState = ReadSettingByte(szMultiByteProto, ProtoUserBit|ProtoIntBit);
-#else
- BYTE bProtoState = ReadSettingByte(szProto, ProtoUserBit|ProtoIntBit);
-#endif
+
BOOL bProtoEnabled = ListView_GetCheckState(GetDlgItem(hDlg,IDC_PROTOS), i);
bProtoState = bProtoEnabled ? bProtoState|ProtoUserBit : bProtoState&~ProtoUserBit;
-#ifdef _UNICODE
+
WriteSettingByte(szMultiByteProto, bProtoState);
-#else
- WriteSettingByte(szProto, bProtoState);
-#endif
+
}
EndDialog(hDlg, LOWORD(wParam));
@@ -1007,15 +1001,13 @@ TCHAR *CTooltipNotify::MakeTooltipString(HANDLE hContact, int iStatus, TCHAR *sz
memset(szString, 0, iBufSize*sizeof(TCHAR));
-#ifdef _UNICODE
+
WCHAR wszProto[32];
long lLen = MultiByteToWideChar(CP_ACP, 0, szProto, (int)strlen(szProto), wszProto, ARRAY_SIZE(wszProto));
wszProto[lLen] = _T('\0');
_sntprintf(szString, iBufSize-1, szFormatString, wszProto, _T(": "), szContactName);
-#else
- _sntprintf(szString, iBufSize-1, szFormatString, szProto, _T(": "), szContactName);
-#endif
+
TruncateWithDots(szString, iBufSize-1-_tcslen(szStatus)-_tcslen(szIs)-2); // 2 spaces around szIs
_sntprintf(szString+_tcslen(szString), iBufSize-1-_tcslen(szString), _T(" %s %s"), szIs, szStatus);
diff --git a/plugins/TooltipNotify/src/main.cpp b/plugins/TooltipNotify/src/main.cpp
index 85e73351a6..a634a012ae 100644
--- a/plugins/TooltipNotify/src/main.cpp
+++ b/plugins/TooltipNotify/src/main.cpp
@@ -54,11 +54,9 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo);
GetVersionEx(&OsVersionInfo);
-#ifdef _UNICODE
+
g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
-#else
- g_bRightModule = (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
-#endif
+
break;
}
@@ -98,11 +96,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
extern "C" int __declspec(dllexport) Load(PLUGINLINK *pLink)
{
-#ifdef _UNICODE
+
if (!g_bRightModule) return 0;
-#else
- // ansi version can work ok on winnt platform
-#endif
+
pluginLink = pLink;
mir_getLP(&sPluginInfo);
diff --git a/plugins/UserInfoEx/ctrl_contact.cpp b/plugins/UserInfoEx/ctrl_contact.cpp
index 5c54693736..8b13ad9256 100644
--- a/plugins/UserInfoEx/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/ctrl_contact.cpp
@@ -319,22 +319,10 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
EDITBALLOONTIP btt;
btt.cbStruct = SIZEOF(btt);
-#ifdef _UNICODE
+
btt.pszTitle = TranslateW(L"Syntax Error");
btt.pszText = TranslateW(L"The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.");
-#else
- WCHAR wszTitle[MAX_PATH];
- WCHAR wszText[MAX_PATH];
- LPSTR pszTitle = Translate("Syntax Error");
- LPSTR pszText = Translate("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.");
- INT cbTitle = mir_strlen(pszTitle) + 1;
- INT cbText = mir_strlen(pszText) + 1;
-
- MultiByteToWideChar(myGlobals.CodePage, 0, pszTitle, -1, wszTitle, cbTitle);
- MultiByteToWideChar(myGlobals.CodePage, 0, pszText, -1, wszText, cbText);
- btt.pszTitle = wszTitle;
- btt.pszText = wszText;
-#endif
+
SendDlgItemMessage(hDlg, EDIT_PHONE, EM_SHOWBALLOONTIP, NULL, (LPARAM)&btt);
SetDlgItemText(hDlg, EDIT_PHONE, cbi->pszVal);
SendDlgItemMessage(hDlg, EDIT_PHONE, EM_SETSEL, errorPos, errorPos);
diff --git a/plugins/UserInfoEx/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/ex_import/dlg_ExImOpenSaveFile.cpp
index ae11ed0a5f..6e1bb7ad54 100644
--- a/plugins/UserInfoEx/ex_import/dlg_ExImOpenSaveFile.cpp
+++ b/plugins/UserInfoEx/ex_import/dlg_ExImOpenSaveFile.cpp
@@ -30,14 +30,14 @@ Last change by : $Author: ing.u.horn $
#include "commonheaders.h"
-#ifdef _UNICODE
+
#include <dlgs.h>
-#endif
+
#include "m_db3xSA.h"
#include "dlg_ExImOpenSaveFile.h"
-#ifdef _UNICODE
+
#define HKEY_MIRANDA_PLACESBAR _T("Software\\Miranda IM\\PlacesBar")
#define HKEY_WINPOL_PLACESBAR _T("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ComDlg32\\PlacesBar")
@@ -227,7 +227,7 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM wPa
return FALSE;
}
-#endif
+
/**
* name: GetInitialDir
@@ -305,7 +305,7 @@ static VOID InitOpenFileNameStruct(OPENFILENAMEA *pofn, HWND hWndParent, LPCSTR
GetInitialDir(pszInitialDir);
pofn->lpstrInitialDir = pszInitialDir;
-#ifdef _UNICODE
+
if (IsWinVer2000Plus()) {
pofn->lStructSize = sizeof (OPENFILENAME);
pofn->Flags |= OFN_ENABLEHOOK|OFN_EXPLORER;
@@ -314,9 +314,7 @@ static VOID InitOpenFileNameStruct(OPENFILENAMEA *pofn, HWND hWndParent, LPCSTR
else {
pofn->lStructSize = OPENFILENAME_SIZE_VERSION_400;
}
-#else
- pofn->lStructSize = sizeof (OPENFILENAME);
-#endif
+
}
diff --git a/plugins/UserInfoEx/init.cpp b/plugins/UserInfoEx/init.cpp
index 886f3edb6c..0054755e33 100644
--- a/plugins/UserInfoEx/init.cpp
+++ b/plugins/UserInfoEx/init.cpp
@@ -183,15 +183,13 @@ static INT OnModulesLoaded(WPARAM wParam, LPARAM lParam)
update.cpbBetaVersionPrefix = (INT)strlen((LPSTR)update.pbBetaVersionPrefix);
#ifdef _WIN64
- #ifdef _UNICODE
+
update.szBetaUpdateURL = "http://userinfoex.googlecode.com/files/uinfoex64.zip";
- #endif
+
#else
- #ifdef _UNICODE
+
update.szBetaUpdateURL = "http://userinfoex.googlecode.com/files/uinfoexW.zip";
- #else
- update.szBetaUpdateURL = "http://userinfoex.googlecode.com/files/uinfoex.zip";
- #endif
+
#endif
// url for displaying changelog for beta versions
@@ -240,12 +238,10 @@ static BOOL CoreCheck()
strlwr(szVer);
_tcslwr(tszExePath);
-#ifdef _UNICODE
+
bOk *= (GetVersion() & 0x80000000) == 0;
bOk *= strstr(szVer, "unicode") != 0;
-#else
- bOk *= strstr(szVer, "unicode") == 0;
-#endif
+
bOk *= _tcsstr(_tcsrchr(tszExePath, '\\'), _T("miranda")) != 0;
bOk *= !strstr(szVer, "coffee") && strncmp(szVer, "1.", 2) && !strstr(szVer, " 1.");
diff --git a/plugins/UserInfoEx/mir_db.h b/plugins/UserInfoEx/mir_db.h
index 708882a26c..e06a8788a6 100644
--- a/plugins/UserInfoEx/mir_db.h
+++ b/plugins/UserInfoEx/mir_db.h
@@ -170,17 +170,12 @@ namespace Setting {
static FORCEINLINE
BYTE WriteUString (LPCSTR pszSetting, LPSTR value) { return WriteUString(MODNAME, pszSetting, value); }
-#ifdef _UNICODE
+
#define GetTString GetWString
#define GetTStringEx GetWStringEx
#define GetTStringCtrl GetWStringCtrl
#define WriteTString WriteWString
-#else
- #define GetTString GetAString
- #define GetTStringEx GetAStringEx
- #define GetTStringCtrl GetAStringCtrl
- #define WriteTString WriteAString
-#endif
+
/**
* misc operations
diff --git a/plugins/UserInfoEx/mir_string.h b/plugins/UserInfoEx/mir_string.h
index 558e86e508..6e2dad0425 100644
--- a/plugins/UserInfoEx/mir_string.h
+++ b/plugins/UserInfoEx/mir_string.h
@@ -33,7 +33,7 @@ Last change by : $Author: ing.u.horn $
#define mir_wcsdup mir_wstrdup
-#ifdef _UNICODE
+
#define mir_tcslen mir_wcslen
#define mir_tcscpy mir_wcscpy
#define mir_tcsncpy mir_wcsncpy
@@ -47,21 +47,7 @@ Last change by : $Author: ing.u.horn $
#define mir_tcsrchr mir_wcsrchr
#define mir_tcsncat_c mir_wcsncat_c
#define mir_IsEmpty mir_IsEmptyW
-#else
- #define mir_tcslen mir_strlen
- #define mir_tcscpy mir_strcpy
- #define mir_tcsncpy mir_strncpy
- #define mir_tcsncat mir_strncat
- #define mir_tcsdup mir_strdup
- #define mir_tcscmp mir_strcmp
- #define mir_tcsncmp mir_strncmp
- #define mir_tcsicmp mir_stricmp
- #define mir_tcsnicmp mir_strnicmp
- #define mir_tcschr mir_strchr
- #define mir_tcsrchr mir_strrchr
- #define mir_tcsncat_c mir_strncat_c
- #define mir_IsEmpty mir_IsEmptyA
-#endif
+
#define mir_strlen(s) (((s)!=0)?strlen(s):0)
diff --git a/plugins/UserInfoEx/svc_avatar.cpp b/plugins/UserInfoEx/svc_avatar.cpp
index 45dd78e6c9..0010ec54b1 100644
--- a/plugins/UserInfoEx/svc_avatar.cpp
+++ b/plugins/UserInfoEx/svc_avatar.cpp
@@ -116,16 +116,14 @@ namespace NServices
if (!CallService(MS_DB_GETPROFILEPATH, (WPARAM)cchFileName, (LPARAM)szFileName))
{
size_t len = mir_strlen(szFileName);
- #ifdef _UNICODE
+
CHAR tmp[64];
if (WideCharToMultiByte(CP_ACP, 0, zodiac, 64, tmp, SIZEOF(tmp),0,0) > 0)
{
mir_snprintf(szFileName + len, cchFileName - len, "\\avatars\\%s.png", tmp);
}
- #else
- mir_snprintf(szFileName + len, cchFileName - len, "\\avatars\\%s.png", zodiac);
- #endif
+
return !PathFileExistsA(szFileName);
}
return 1;
diff --git a/plugins/Variables/contact.cpp b/plugins/Variables/contact.cpp
index 93c48052ec..c6b7b8f566 100644
--- a/plugins/Variables/contact.cpp
+++ b/plugins/Variables/contact.cpp
@@ -303,11 +303,9 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
TCHAR *getContactInfoT(BYTE type, HANDLE hContact, int tchar)
{
if (tchar) {
- #ifdef UNICODE
+
return getContactInfo((BYTE)(type|CNF_UNICODE), hContact);
- #else
- return getContactInfo(type, hContact);
- #endif
+
}
return getContactInfo(type, hContact);
@@ -330,22 +328,16 @@ int getContactFromString( CONTACTSINFO* ci )
return -1;
if (ci->flags&CI_UNICODE) {
- #ifdef UNICODE
+
tszContact = NEWTSTR_ALLOCA(ci->tszContact);
- #else
- char* tmp = u2a(ci->wszContact);
- tszContact = NEWTSTR_ALLOCA(tmp);
- free( tmp );
- #endif
+
}
else {
- #ifdef UNICODE
+
WCHAR* tmp = a2u(ci->szContact);
tszContact = NEWTSTR_ALLOCA(tmp);
free(tmp);
- #else
- tszContact = NEWTSTR_ALLOCA(ci->szContact);
- #endif
+
}
if ( (tszContact == NULL) || (_tcslen(tszContact) == 0) )
return -1;
@@ -399,11 +391,9 @@ int getContactFromString( CONTACTSINFO* ci )
else {
szFind = ( TCHAR* )malloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR));
if (szFind != NULL) {
-#ifdef UNICODE
+
tszProto = a2u(szProto);
-#else
- tszProto = _strdup(szProto);
-#endif
+
if ( (tszProto != NULL) && (szFind != NULL) ) {
wsprintf(szFind, _T("<%s:%s>"), tszProto, cInfo);
free(cInfo);
@@ -603,11 +593,9 @@ TCHAR *encodeContactToString(HANDLE hContact)
if (tszResult == NULL)
return NULL;
- #ifdef UNICODE
+
tszProto = a2u(szProto);
- #else
- tszProto = _strdup(szProto);
- #endif
+
if (tszProto == NULL)
return NULL;
diff --git a/plugins/Variables/help.cpp b/plugins/Variables/help.cpp
index 7faa156ea6..9d6746d7d3 100644
--- a/plugins/Variables/help.cpp
+++ b/plugins/Variables/help.cpp
@@ -251,9 +251,9 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
// dialog box for the tokens
static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) {
-#ifdef UNICODE
+
TCHAR *res;
-#endif
+
char *cat, *cur, *helpText;
if (tr == NULL) {
@@ -269,24 +269,20 @@ static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) {
if (*cur == _T('\t')) {
*cur = _T('\0');
helpText = ( char* )realloc(helpText, strlen(helpText)+1);
-#ifdef UNICODE
+
res = a2u(helpText);
free(helpText);
return res;
-#else
- return helpText;
-#endif
+
}
cur++;
}
-#ifdef UNICODE
+
res = a2u(helpText);
free(helpText);
return res;
-#else
- return helpText;
-#endif
+
}
static TCHAR *getHelpDescription(TOKENREGISTEREX *tr)
@@ -297,23 +293,19 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr)
char *cur = tr->szHelpText + strlen(tr->szHelpText);
while (cur > tr->szHelpText) {
if (*cur == _T('\t')) {
-#ifdef UNICODE
+
cur = _strdup(cur+1);
TCHAR *res = a2u(cur);
free(cur);
return res;
-#else
- return _strdup(cur+1);
-#endif
+
}
cur--;
}
-#ifdef UNICODE
+
return a2u(tr->szHelpText);
-#else
- return _strdup(tr->szHelpText);
-#endif
+
}
static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
@@ -361,11 +353,9 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
mir_sntprintf(desc, len, _T("%c%s%c"), _T(FIELD_CHAR), tr->szTokenString, _T(FIELD_CHAR));
else {
if (args != NULL)
-#ifdef UNICODE
+
tArgs = a2u(args);
-#else
- tArgs = _strdup(args);
-#endif
+
mir_sntprintf(desc, len, _T("%c%s%s"), _T(FUNC_CHAR), tr->tszTokenString, (tArgs!=NULL?tArgs:_T("")));
}
if (tArgs != NULL)
@@ -451,11 +441,9 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
continue;
}
else if (hdd->vhs->szSubjectDesc != NULL) {
-#ifdef UNICODE
+
tszHelpDesc = a2u(hdd->vhs->szSubjectDesc);
-#else
- tszHelpDesc = _strdup(hdd->vhs->szSubjectDesc);
-#endif
+
}
}
if (!_tcscmp(tr->tszTokenString, _T(EXTRATEXT))) {
@@ -463,11 +451,9 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
continue;
}
else if (hdd->vhs->szExtraTextDesc != NULL) {
-#ifdef UNICODE
+
tszHelpDesc = a2u(hdd->vhs->szExtraTextDesc);
-#else
- tszHelpDesc = _strdup(hdd->vhs->szExtraTextDesc);
-#endif
+
}
}
}
@@ -961,13 +947,11 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if (dat->vhs->fi->flags & FIF_UNICODE)
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat);
else {
-#ifdef UNICODE
+
WCHAR *wszFormatString = a2u(dat->vhs->fi->szFormat);
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)wszFormatString);
free(wszFormatString);
-#else
- SendMessageA(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->szFormat);
-#endif
+
}
}
else if (dat->vhs->hwndCtrl != NULL) {
@@ -1022,13 +1006,11 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if (dat->vhs->fi->flags & FIF_UNICODE)
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText);
else {
-#ifdef UNICODE
+
WCHAR *wszSource = a2u(dat->vhs->fi->szExtraText);
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)wszSource);
free(wszSource);
-#else
- SendMessageA(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->szExtraText);
-#endif
+
}
}
if (dat->vhs->flags&VHF_EXTRATEXT) {
@@ -1066,7 +1048,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if ( (dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT)) ) {
int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
if (len > 0) {
-#ifdef UNICODE
+
if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
if (dat->vhs->fi->flags&FIF_UNICODE) {
dat->vhs->fi->tszFormat = ( TCHAR* )calloc((len+1), sizeof(WCHAR));
@@ -1077,10 +1059,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
SendMessageA(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szFormat);
}
}
-#else
- dat->vhs->fi->szFormat = (char*)calloc(len+1, 1);
- SendMessageA(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szFormat);
-#endif
+
}
}
@@ -1110,7 +1089,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
len = SendMessage(hwndDlg, VARM_GETEXTRATEXTLENGTH, 0, 0);
if (len > 0) {
-#ifdef UNICODE
+
if (dat->vhs->fi->flags&FIF_UNICODE) {
dat->vhs->fi->tszExtraText = ( TCHAR* )calloc((len+1), sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->tszExtraText);
@@ -1119,10 +1098,7 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
dat->vhs->fi->szExtraText = ( char* )calloc(len+1, 1);
SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szExtraText);
}
-#else
- dat->vhs->fi->szExtraText = (char*)calloc(len+1, 1);
- SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szExtraText);
-#endif
+
}
dat->vhs->fi->hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
}
diff --git a/plugins/Variables/parse_alias.cpp b/plugins/Variables/parse_alias.cpp
index 49d7df3310..7f90e0eb04 100644
--- a/plugins/Variables/parse_alias.cpp
+++ b/plugins/Variables/parse_alias.cpp
@@ -189,11 +189,9 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
_tcscat(szArgs, _T(","));
}
if ( (szArgs != NULL) && (argc > 0) ) {
-#ifdef UNICODE
+
szArgsA = u2a(szArgs);
-#else
- szArgsA = _strdup(szArgs);
-#endif
+
szHelp = ( char* )malloc(32 + strlen(szArgsA));
memset(szHelp, '\0', 32 + strlen(szArgsA));
sprintf(szHelp, "Alias\t(%s)\tuser defined", szArgsA);
diff --git a/plugins/Variables/parse_external.cpp b/plugins/Variables/parse_external.cpp
index 76170971e7..32f42ea1d3 100644
--- a/plugins/Variables/parse_external.cpp
+++ b/plugins/Variables/parse_external.cpp
@@ -165,11 +165,9 @@ static TCHAR *parseAMIPEval(ARGUMENTSINFO *ai) {
}
ZeroMemory(&szRes, sizeof(szRes));
if (AC_ERR_NOERROR == acEval(cmd, szRes)) {
-#ifdef UNICODE
+
tszRes = a2u(szRes);
-#else
- tszRes = _strdup(szRes);
-#endif
+
}
else {
lastAMIPFailure = GetTickCount();
@@ -189,21 +187,17 @@ static TCHAR *parseAMIPFormat(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
-#ifdef UNICODE
+
cmd = u2a(ai->targv[1]);
-#else
- cmd = _strdup(ai->targv[1]);
-#endif
+
if (checkAMIP() != 0) {
return NULL;
}
if (AC_ERR_NOERROR == acFormat(cmd, szRes)) {
-#ifdef UNICODE
+
tszRes = a2u(szRes);
-#else
- tszRes = _strdup(szRes);
-#endif
+
}
else {
lastAMIPFailure = GetTickCount();
diff --git a/plugins/Variables/parse_inet.cpp b/plugins/Variables/parse_inet.cpp
index cf8f24524f..9d97b5d1f7 100644
--- a/plugins/Variables/parse_inet.cpp
+++ b/plugins/Variables/parse_inet.cpp
@@ -52,11 +52,9 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) {
strncpy(res+cur, hex, strlen(hex));
cur+=strlen(hex);
}
-#ifdef UNICODE
+
tres = a2u(res);
-#else
- tres = _strdup(res);
-#endif
+
free(res);
return tres;
@@ -71,11 +69,9 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
-#ifdef UNICODE
+
res = u2a(ai->targv[1]);
-#else
- res = _strdup(ai->argv[1]);
-#endif
+
if (res == NULL) {
return NULL;
}
@@ -90,11 +86,9 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) {
cur++;
}
res = ( char* )realloc(res, strlen(res)+1);
-#ifdef UNICODE
+
tres = a2u(res);
-#else
- tres = _strdup(res);
-#endif
+
free(res);
return tres;
@@ -112,11 +106,9 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) {
in.s_addr = ttoi(ai->targv[1]);
res = inet_ntoa(in);
if (res != NULL) {
-#ifdef UNICODE
+
return a2u(res);
-#else
- return _strdup(res);
-#endif
+
}
return NULL;
@@ -134,11 +126,9 @@ static TCHAR *parseHToA(ARGUMENTSINFO *ai) {
in.s_addr = htonl(ttoi(ai->targv[1]));
res = inet_ntoa(in);
if (res != NULL) {
-#ifdef UNICODE
+
return a2u(res);
-#else
- return _strdup(res);
-#endif
+
}
return NULL;
diff --git a/plugins/Variables/parse_metacontacts.cpp b/plugins/Variables/parse_metacontacts.cpp
index 5940569bad..71a9da283b 100644
--- a/plugins/Variables/parse_metacontacts.cpp
+++ b/plugins/Variables/parse_metacontacts.cpp
@@ -69,11 +69,9 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
}
TCHAR* tszProto;
- #ifdef UNICODE
+
tszProto = a2u(szProto);
- #else
- tszProto = _strdup(szProto);
- #endif
+
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
@@ -130,11 +128,9 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
}
TCHAR* tszProto;
- #ifdef UNICODE
+
tszProto = a2u(szProto);
- #else
- tszProto = _strdup(szProto);
- #endif
+
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
@@ -191,11 +187,9 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
}
TCHAR* tszProto;
- #ifdef UNICODE
+
tszProto = a2u(szProto);
- #else
- tszProto = _strdup(szProto);
- #endif
+
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
diff --git a/plugins/Variables/parse_miranda.cpp b/plugins/Variables/parse_miranda.cpp
index 0b8e0a5139..e941a91e89 100644
--- a/plugins/Variables/parse_miranda.cpp
+++ b/plugins/Variables/parse_miranda.cpp
@@ -180,11 +180,9 @@ static TCHAR *parseDBProfileName(ARGUMENTSINFO *ai)
if (CallService(MS_DB_GETPROFILENAME, SIZEOF(name), (LPARAM)name))
return NULL;
- #ifdef UNICODE
+
return a2u(name);
- #else
- return _strdup(name);
- #endif
+
}
static TCHAR *parseDBProfilePath(ARGUMENTSINFO *ai) {
@@ -197,11 +195,9 @@ static TCHAR *parseDBProfilePath(ARGUMENTSINFO *ai) {
if (CallService(MS_DB_GETPROFILEPATH, SIZEOF(path), (LPARAM)path))
return NULL;
- #ifdef UNICODE
+
return a2u(path);
- #else
- return _strdup(path);
- #endif
+
}
static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR* defaultValue) {
@@ -223,26 +219,19 @@ static TCHAR* getDBSetting(HANDLE hContact, char* module, char* setting, TCHAR*
var = itot(dbv.dVal);
break;
case DBVT_ASCIIZ:
- #ifdef UNICODE
+
var = a2u(dbv.pszVal);
- #else
- var = _strdup(dbv.pszVal);
- #endif
+
break;
case DBVT_WCHAR:
- #ifdef UNICODE
+
var = _wcsdup(dbv.pwszVal);
- #else
- var = u2a(dbv.pwszVal);
- #endif
+
break;
case DBVT_UTF8:
- #ifdef UNICODE
+
Utf8Decode(dbv.pszVal, &var);
- #else
- var = _strdup(dbv.pszVal);
- Utf8Decode(var, NULL);
- #endif
+
break;
}
@@ -281,13 +270,10 @@ static TCHAR *parseDBSetting(ARGUMENTSINFO *ai)
}
}
- #ifdef UNICODE
+
szModule = u2a(ai->targv[2]);
szSetting = u2a(ai->targv[3]);
- #else
- szModule = _strdup(ai->argv[2]);
- szSetting = _strdup(ai->argv[3]);
- #endif
+
if ( ai->argc > 4 && _tcslen(ai->targv[4]) > 0 )
szDefaultValue = _tcsdup(ai->targv[4]);
@@ -495,11 +481,9 @@ static TCHAR *parseMyStatus(ARGUMENTSINFO *ai) {
if ( ai->argc == 1 || _tcslen(ai->targv[1]) == 0 )
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else {
-#ifdef UNICODE
+
szProto = u2a(ai->targv[1]);
-#else
- szProto = _strdup(ai->targv[1]);
-#endif
+
status = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
free(szProto);
}
@@ -520,11 +504,9 @@ static TCHAR *parseProtoInfo(ARGUMENTSINFO *ai)
szRes = NULL;
tszRes = NULL;
-#ifdef UNICODE
+
szProto = u2a(ai->targv[1]);
-#else
- szProto = _strdup(ai->targv[1]);
-#endif
+
if (!_tcscmp(ai->targv[2], _T(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
else if (!_tcscmp(ai->targv[2], _T(STR_PIUIDTEXT))) {
@@ -551,12 +533,10 @@ static TCHAR *parseProtoInfo(ARGUMENTSINFO *ai)
return NULL;
if ( szRes != NULL && tszRes == NULL ) {
- #ifdef UNICODE
+
tszRes = a2u(szRes);
free(szRes);
- #else
- tszRes = szRes;
- #endif
+
}
else if ( szRes != NULL && tszRes != NULL )
free(szRes);
@@ -592,11 +572,9 @@ static TCHAR *parseSpecialContact(ARGUMENTSINFO *ai)
return NULL;
}
- #ifdef UNICODE
+
tszProto = a2u(szProto);
- #else
- tszProto = _strdup(szProto);
- #endif
+
if ( tszProto != NULL && szUniqueID != NULL ) {
wsprintf(res, _T("<%s:%s>"), tszProto, szUniqueID);
@@ -758,7 +736,7 @@ static TCHAR *GetMessageDescription(DBEVENTINFO *dbei)
else {
char *pszSrc = ( char* )dbei->pBlob;
size_t len = strlen(( char* )dbei->pBlob )+1;
- #if defined( _UNICODE )
+
if ( dbei->cbBlob > len ) {
int len2 = dbei->cbBlob - len;
@@ -771,10 +749,7 @@ static TCHAR *GetMessageDescription(DBEVENTINFO *dbei)
tszRes = a2u(szRes);
free(szRes);
}
- #else
- tszRes = ( char* )calloc(len, sizeof(char));
- strncpy( tszRes, ( const char* )pszSrc, len );
- #endif
+
}
return tszRes;
@@ -876,11 +851,9 @@ static TCHAR *parseVersionString(ARGUMENTSINFO *ai) {
if (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(versionString), (LPARAM)versionString))
return NULL;
- #ifdef UNICODE
+
return a2u(versionString);
- #else
- return _strdup(versionString);
- #endif
+
}
static TCHAR *parseContactNameString(ARGUMENTSINFO *ai)
@@ -940,18 +913,16 @@ static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai)
return NULL;
char* serviceName;
- #ifdef _UNICODE
+
serviceName = u2a( ai->targv[1] );
- #else
- serviceName = ai->targv[1];
- #endif
+
if ( !ServiceExists( serviceName ))
ai->flags |= AIF_FALSE;
- #ifdef _UNICODE
+
free( serviceName );
- #endif
+
return _tcsdup(_T(""));
}
diff --git a/plugins/Variables/parse_regexp.cpp b/plugins/Variables/parse_regexp.cpp
index 52eaf8430e..7642275eee 100644
--- a/plugins/Variables/parse_regexp.cpp
+++ b/plugins/Variables/parse_regexp.cpp
@@ -45,13 +45,10 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) {
return NULL;
}
ai->flags = AIF_FALSE;
-#ifdef UNICODE
+
arg1 = u2a(ai->targv[1]);
arg2 = u2a(ai->targv[2]);
-#else
- arg1 = _strdup(ai->argv[1]);
- arg2 = _strdup(ai->argv[2]);
-#endif
+
ppat = pcreCompile(arg1, 0, &err, &erroffset, NULL);
if (ppat == NULL) {
free(arg1);
@@ -65,11 +62,9 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) {
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
-#ifdef UNICODE
+
res = a2u(szVal);
-#else
- res = _strdup(szVal);
-#endif
+
return res;
}
@@ -92,15 +87,11 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) {
if (ai->argc != 4) {
return NULL;
}
-#ifdef UNICODE
+
arg1 = u2a(ai->targv[1]);
arg2 = u2a(ai->targv[2]);
arg3 = u2a(ai->targv[3]);
-#else
- arg1 = _strdup(ai->argv[1]);
- arg2 = _strdup(ai->argv[2]);
- arg3 = _strdup(ai->argv[3]);
-#endif
+
number = atoi(arg3);
if (number < 0) {
free(arg1);
@@ -128,11 +119,9 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) {
res = _strdup(substring);
pcreFreeSubstring(substring);
-#ifdef UNICODE
+
tres = a2u(res);
-#else
- tres = _strdup(res);
-#endif
+
free(res);
free(arg1);
free(arg2);
@@ -192,13 +181,10 @@ int registerRegExpTokens() {
return -1;
}
-#ifdef UNICODE
+
registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, "Regular Expressions\t(x,y)\t(ANSI input only) the number of substring matches found in y with pattern x");
registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, "Regular Expressions\t(x,y,z)\t(ANSI input only) substring match number z found in subject y with pattern x");
-#else
- registerIntToken(_T(REGEXPCHECK), parseRegExpCheck, TRF_FUNCTION, "Regular Expressions\t(x,y)\tthe number of substring matches found in y with pattern x");
- registerIntToken(_T(REGEXPSUBSTR), parseRegExpSubstr, TRF_FUNCTION, "Regular Expressions\t(x,y,z)\tsubstring match number z found in subject y with pattern x");
-#endif
+
return 0;
}
diff --git a/plugins/Variables/parse_system.cpp b/plugins/Variables/parse_system.cpp
index 5bc927bd93..65e75ffc9a 100644
--- a/plugins/Variables/parse_system.cpp
+++ b/plugins/Variables/parse_system.cpp
@@ -498,11 +498,9 @@ static TCHAR *parseProcessRunning(ARGUMENTSINFO *ai) {
if (ai->argc != 2) {
return NULL;
}
-#ifdef UNICODE
+
szProc = ref = u2a(ai->targv[1]);
-#else
- szProc = ref = _strdup(ai->argv[1]);
-#endif
+
EnumProcs((PROCENUMPROC) MyProcessEnumerator, (LPARAM)&szProc);
if (szProc != NULL) {
ai->flags |= AIF_FALSE;
@@ -692,11 +690,9 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
}
else {
-#ifndef UNICODE
- return NULL;
-#else
+
csz = sizeof(TCHAR);
-#endif
+
}
totalReadSz = 0;
lineCount = 1;
@@ -713,7 +709,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
return NULL;
}
CloseHandle(hFile);
-#ifdef UNICODE
+
if (tUC) {
res = (TCHAR *)pBuf;
}
@@ -721,9 +717,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = a2u((char *)pBuf);
free(pBuf);
}
-#else
- res = (char*)pBuf;
-#endif
+
return res;
}
@@ -837,7 +831,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
else {
*(char *)pCur = '\0';
}
-#ifdef UNICODE
+
if (tUC) {
res = (TCHAR *)pBuf;
}
@@ -845,15 +839,13 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = a2u((char *)pBuf);
free(pBuf);
}
-#else
- res = (char *)pBuf;
-#endif
+
return res;
}
}
if ( ((DWORD)(linePos+(pCur-pBuf)) == fileSz) ) { // eof
CloseHandle(hFile);
-#ifdef UNICODE
+
if (tUC) {
res = (TCHAR *)pBuf;
}
@@ -861,9 +853,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
res = a2u((char *)pBuf);
free(pBuf);
}
-#else
- res = (char *)pBuf;
-#endif
+
return res;
}
if (readSz == bufSz-csz) {
@@ -964,11 +954,9 @@ static TCHAR *parseClipboard(ARGUMENTSINFO *ai) {
HANDLE hData = NULL;
TCHAR* tszText = NULL;
int len = 0;
-#ifdef _UNICODE
+
hData = GetClipboardData(CF_UNICODETEXT);
-#else
- hData = GetClipboardData(CF_TEXT);
-#endif
+
if (hData != NULL) {
tszText = (TCHAR*)GlobalLock(hData);
len = _tcslen(tszText);
diff --git a/plugins/Variables/parse_xml.cpp b/plugins/Variables/parse_xml.cpp
index 5d3b5778a0..ae6ad960d1 100644
--- a/plugins/Variables/parse_xml.cpp
+++ b/plugins/Variables/parse_xml.cpp
@@ -63,13 +63,10 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) {
if (ai->argc != 3) {
return NULL;
}
-#ifdef UNICODE
+
szStyleSheet = u2a(ai->targv[1]);
szDoc = u2a(ai->targv[2]);
-#else
- szStyleSheet = _strdup(ai->argv[1]);
- szDoc = _strdup(ai->argv[2]);
-#endif
+
log_debugA("calling xsltParseMemory");
sdoc = pXmlParseMemory(szStyleSheet, strlen(szStyleSheet));
@@ -123,11 +120,9 @@ static TCHAR *parseXslts(ARGUMENTSINFO *ai) {
free(szStyleSheet);
log_debugA("calling free");
free(szDoc);
-#ifdef UNICODE
+
tszRes = a2u((char *)xmlChRes);
-#else
- tszRes = _strdup((const char *)xmlChRes);
-#endif
+
log_debugA("calling xmlFree");
pXmlFree(xmlChRes);
@@ -149,13 +144,10 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) {
if (ai->argc != 3) {
return NULL;
}
-#ifdef UNICODE
+
szStyleSheet = u2a(ai->targv[1]);
szDoc = u2a(ai->targv[2]);
-#else
- szStyleSheet = _strdup(ai->argv[1]);
- szDoc = _strdup(ai->argv[2]);
-#endif
+
log_debugA("xslt with %s and %s", szStyleSheet, szDoc);
@@ -206,11 +198,9 @@ static TCHAR *parseXsltf(ARGUMENTSINFO *ai) {
free(szStyleSheet);
free(szDoc);
-#ifdef UNICODE
+
tszRes = a2u((char *)xmlChRes);
-#else
- tszRes = _strdup((const char *)xmlChRes);
-#endif
+
log_debugA("calling xmlFree");
pXmlFree(xmlChRes);
diff --git a/plugins/Variables/tokenregister.cpp b/plugins/Variables/tokenregister.cpp
index 74da8858a3..c9b13e674f 100644
--- a/plugins/Variables/tokenregister.cpp
+++ b/plugins/Variables/tokenregister.cpp
@@ -115,17 +115,14 @@ INT_PTR registerToken(WPARAM wParam, LPARAM lParam)
hash = NameHashFunction( newVr->tszTokenString );
}
else {
-#ifdef UNICODE
+
WCHAR *wtoken;
wtoken = a2u( newVr->szTokenString );
deRegisterToken( wtoken );
hash = NameHashFunction( wtoken );
free( wtoken );
-#else
- deRegisterToken( newVr->szTokenString );
- hash = NameHashFunction( newVr->szTokenString );
-#endif
+
}
tre = ( TokenRegisterEntry* )malloc( sizeof( TokenRegisterEntry ));
@@ -143,11 +140,9 @@ INT_PTR registerToken(WPARAM wParam, LPARAM lParam)
if ( newVr->flags & TRF_TCHAR )
tre->tr.tszTokenString = _tcsdup( newVr->tszTokenString );
else
-#ifdef UNICODE
+
tre->tr.tszTokenString = a2u( newVr->szTokenString );
-#else
- tre->tr.szTokenString = _strdup( newVr->szTokenString );
-#endif
+
if ( newVr->szHelpText != NULL )
tre->tr.szHelpText = _strdup( newVr->szHelpText );
@@ -205,7 +200,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
trCopy = *thisVr;
-#ifdef UNICODE
+
// ai contains WCHARs, convert to chars because the tr doesn't support WCHARs
if ( !( thisVr->flags & TRF_TCHAR )) {
// unicode variables calls a non-unicode plugin
@@ -239,17 +234,7 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
if (( TCHAR* )callRes != NULL )
res = _tcsdup(( TCHAR* )callRes );
}
-#else
- // non-unicode variables, should call non-unicode plugin (assume)
- // ai contains chars, tr shouldn't use WCHARs
- if ( thisVr->flags & TRF_PARSEFUNC )
- callRes = (int)thisVr->parseFunction(ai);
- else if ( thisVr->szService != NULL )
- callRes = CallService( thisVr->szService, (WPARAM)0, (LPARAM)ai );
-
- if (( char* )callRes != NULL )
- res = _strdup(( char* )callRes );
-#endif
+
if (( void* )callRes != NULL ) {
if ( trCopy.flags & TRF_CLEANUP ) {
diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp
index aa316b9169..69adcd87f0 100644
--- a/plugins/Variables/variables.cpp
+++ b/plugins/Variables/variables.cpp
@@ -436,7 +436,7 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
}
orgFormat = fi->tszFormat;
orgSource = fi->tszExtraText;
-#ifdef UNICODE
+
if (!(fi->flags&FIF_TCHAR)) {
copied = TRUE;
log_debugA("a2u (%s)", fi->szExtraText);
@@ -451,23 +451,12 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
tszFormat = fi->tszFormat;
tszSource = fi->tszExtraText;
}
-#else
- if (fi->flags&FIF_UNICODE) {
- if (!bWarningShown) {
- MessageBoxA(NULL, "A plugin using UNICODE encoding tries to make use of the ANSI version of Variables.\r\nPlease use the UNICODE version of Variables or the ANSI version of the plugin using Variables.", "Variables", MB_OK);
- bWarningShown = TRUE;
- }
- return (int)NULL;
- }
- copied = FALSE;
- tszFormat = fi->szFormat;
- tszSource = fi->szExtraText;
-#endif
+
fi->tszFormat = tszFormat;
fi->tszExtraText = tszSource;
tRes = formatString(fi);
-#ifdef UNICODE
+
if (!(fi->flags&FIF_TCHAR)) {
res = (int)u2a(tRes);
free(tRes);
@@ -475,9 +464,7 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam) {
else {
res = (int)tRes;
}
-#else
- res = (int)tRes;
-#endif
+
if (copied) {
if (tszFormat != NULL) {
free(tszFormat);
diff --git a/plugins/Variables/variables.h b/plugins/Variables/variables.h
index eca0b1acd8..814a4263de 100644
--- a/plugins/Variables/variables.h
+++ b/plugins/Variables/variables.h
@@ -16,9 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#if defined( UNICODE ) && !defined( _UNICODE )
-# define _UNICODE
-#endif
+
#define MIRANDA_VER 0x0A00