summaryrefslogtreecommitdiff
path: root/plugins/Variables
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-16 14:33:30 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-16 14:33:30 +0000
commit05c989e58aeffcfb59cebaca6797cb69dd25cb1e (patch)
tree460bde28df51ea7b01109b56818b5880ac47ba66 /plugins/Variables
parentac7bf920f219a7aed7eb163c8b3195e66c12e4da (diff)
another portion of "#ifdef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@446 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables')
-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
13 files changed, 127 insertions, 282 deletions
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