summaryrefslogtreecommitdiff
path: root/plugins/Variables/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r--plugins/Variables/src/contact.cpp50
-rw-r--r--plugins/Variables/src/help.cpp50
-rw-r--r--plugins/Variables/src/parse_alias.cpp44
-rw-r--r--plugins/Variables/src/parse_external.cpp18
-rw-r--r--plugins/Variables/src/parse_inet.cpp12
-rw-r--r--plugins/Variables/src/parse_logic.cpp60
-rw-r--r--plugins/Variables/src/parse_math.cpp20
-rw-r--r--plugins/Variables/src/parse_metacontacts.cpp18
-rw-r--r--plugins/Variables/src/parse_miranda.cpp86
-rw-r--r--plugins/Variables/src/parse_regexp.cpp12
-rw-r--r--plugins/Variables/src/parse_str.cpp192
-rw-r--r--plugins/Variables/src/parse_system.cpp96
-rw-r--r--plugins/Variables/src/parse_variables.cpp18
-rw-r--r--plugins/Variables/src/tokenregister.cpp16
-rw-r--r--plugins/Variables/src/variables.cpp54
15 files changed, 373 insertions, 373 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 160b78a1ad..b0a46021ee 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -96,11 +96,11 @@ static mir_cs csContactCache;
// converts a string into a CNF_ type
BYTE getContactInfoType(wchar_t* type)
{
- if (type == NULL || mir_tstrlen(type) == 0)
+ if (type == NULL || mir_wstrlen(type) == 0)
return 0;
for (int i = 0; i < _countof(builtinCnfs); i++)
- if (!mir_tstrcmp(builtinCnfs[i].str, type))
+ if (!mir_wstrcmp(builtinCnfs[i].str, type))
return builtinCnfs[i].cnfCode;
return 0;
@@ -120,22 +120,22 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
wchar_t *res = NULL;
switch (type) {
case CCNF_PROTOID:
- return mir_a2t(szProto);
+ return mir_a2u(szProto);
case CCNF_ACCOUNT:
{
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
+ return pa ? mir_wstrdup(pa->tszAccountName) : NULL;
}
case CCNF_PROTOCOL:
char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
return NULL;
- return mir_a2t(protoname);
+ return mir_a2u(protoname);
case CCNF_STATUS:
- return mir_tstrdup(pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0));
+ return mir_wstrdup(pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0));
case CCNF_INTERNALIP:
case CCNF_EXTERNALIP:
@@ -144,7 +144,7 @@ wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
if (ip != 0) {
struct in_addr in;
in.s_addr = htonl(ip);
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
}
return NULL;
@@ -208,7 +208,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
// <proto:id> (exact)
if ((dwFlags & CI_PROTOID) && !bMatch) {
- ptrT cInfo(getContactInfoT(CNF_UNIQUEID, hContact));
+ ptrW cInfo(getContactInfoT(CNF_UNIQUEID, hContact));
if (cInfo) {
tmp.Format(L"<%S:%s>", szProto, cInfo);
if (tmp == tszContact)
@@ -218,50 +218,50 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
// id (exact)
if ((dwFlags & CI_UNIQUEID) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_UNIQUEID, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_UNIQUEID, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// nick (not exact)
if ((dwFlags & CI_NICK) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_NICK, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_NICK, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// list name (not exact)
if ((dwFlags & CI_LISTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_DISPLAY, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_DISPLAY, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// firstname (exact)
if ((dwFlags & CI_FIRSTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_FIRSTNAME, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_FIRSTNAME, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// lastname (exact)
if ((dwFlags & CI_LASTNAME) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_LASTNAME, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_LASTNAME, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// email (exact)
if ((dwFlags & CI_EMAIL) && !bMatch) {
- ptrT szFind(getContactInfoT(CNF_EMAIL, hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT(CNF_EMAIL, hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
// CNF_ (exact)
if ((dwFlags & CI_CNFINFO) && !bMatch) {
- ptrT szFind(getContactInfoT((BYTE)(dwFlags & ~CI_CNFINFO), hContact));
- if (!mir_tstrcmp(tszContact, szFind))
+ ptrW szFind(getContactInfoT((BYTE)(dwFlags & ~CI_CNFINFO), hContact));
+ if (!mir_wstrcmp(tszContact, szFind))
bMatch = true;
}
@@ -291,7 +291,7 @@ MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMat
CONTACTCE *cce = new CONTACTCE();
cce->hContact = hContact;
cce->flags = dwFlags;
- cce->tszContact = mir_tstrdup(tszContact);
+ cce->tszContact = mir_wstrdup(tszContact);
arContactCache.insert(cce);
}
@@ -365,9 +365,9 @@ wchar_t* encodeContactToString(MCONTACT hContact)
if (tszUniqueId == NULL)
return NULL;
- size_t size = mir_tstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
+ size_t size = mir_wstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
wchar_t *tszResult = (wchar_t *)mir_calloc(size * sizeof(wchar_t));
if (tszResult)
- mir_sntprintf(tszResult, size, L"<%S:%s>", szProto, tszUniqueId);
+ mir_snwprintf(tszResult, size, L"<%S:%s>", szProto, tszUniqueId);
return tszResult;
}
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index 57d5ad1e0c..7d663d4aae 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -228,14 +228,14 @@ static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) {
*cur = 0;
helpText = ( char* )mir_realloc(helpText, mir_strlen(helpText)+1);
- wchar_t *res = mir_a2t(helpText);
+ wchar_t *res = mir_a2u(helpText);
mir_free(helpText);
return res;
}
cur++;
}
- wchar_t *res = mir_a2t(helpText);
+ wchar_t *res = mir_a2u(helpText);
mir_free(helpText);
return res;
@@ -251,7 +251,7 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr)
if (*cur == '\t') {
cur = mir_strdup(cur+1);
- wchar_t *res = mir_a2t(cur);
+ wchar_t *res = mir_a2u(cur);
mir_free(cur);
return res;
@@ -259,7 +259,7 @@ static wchar_t *getHelpDescription(TOKENREGISTEREX *tr)
cur--;
}
- return mir_a2t(tr->szHelpText);
+ return mir_a2u(tr->szHelpText);
}
@@ -269,7 +269,7 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr)
return NULL;
if (tr->szHelpText == NULL)
- return mir_tstrdup(tr->tszTokenString);
+ return mir_wstrdup(tr->tszTokenString);
char *helpText = mir_strdup(tr->szHelpText);
if (helpText == NULL)
@@ -294,7 +294,7 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr)
}
else args = NULL;
- size_t len = mir_tstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3;
+ size_t len = mir_wstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3;
wchar_t *desc = (wchar_t*)mir_calloc(len * sizeof(wchar_t));
if (desc == NULL) {
mir_free(helpText);
@@ -302,12 +302,12 @@ static wchar_t *getTokenDescription(TOKENREGISTEREX *tr)
}
if (tr->flags&TRF_FIELD)
- mir_sntprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
+ mir_snwprintf(desc, len, L"%c%s%c", FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
else {
if (args != NULL)
- tArgs = mir_a2t(args);
+ tArgs = mir_a2u(args);
- mir_sntprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L""));
+ mir_snwprintf(desc, len, L"%c%s%s", FUNC_CHAR, tr->tszTokenString, (tArgs!=NULL?tArgs:L""));
}
mir_free(tArgs);
@@ -322,19 +322,19 @@ static int CALLBACK compareTokenHelp(LPARAM lParam1, LPARAM lParam2, LPARAM)
if (tr1 == NULL || tr2 == NULL)
return 0;
- ptrT cat1(getTokenCategory(tr1));
- ptrT cat2(getTokenCategory(tr2));
+ ptrW cat1(getTokenCategory(tr1));
+ ptrW cat2(getTokenCategory(tr2));
if (cat1 == NULL || cat2 == NULL)
return 0;
- int res = mir_tstrcmp(cat1, cat2);
+ int res = mir_wstrcmp(cat1, cat2);
if (res != 0)
return res;
if (tr1->tszTokenString == NULL || tr2->tszTokenString == NULL)
return 0;
- return mir_tstrcmp(tr1->tszTokenString, tr2->tszTokenString);
+ return mir_wstrcmp(tr1->tszTokenString, tr2->tszTokenString);
}
static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
@@ -367,19 +367,19 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
continue;
else if (hdd != NULL) {
- if (!mir_tstrcmp(tr->tszTokenString, SUBJECT)) {
+ if (!mir_wstrcmp(tr->tszTokenString, SUBJECT)) {
if (hdd->vhs->flags&VHF_HIDESUBJECTTOKEN)
continue;
if (hdd->vhs->szSubjectDesc != NULL)
- tszHelpDesc = mir_a2t(hdd->vhs->szSubjectDesc);
+ tszHelpDesc = mir_a2u(hdd->vhs->szSubjectDesc);
}
- if (!mir_tstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) {
+ if (!mir_wstrcmp(tr->tszTokenString, MIR_EXTRATEXT)) {
if (hdd->vhs->flags & VHF_HIDEEXTRATEXTTOKEN)
continue;
if (hdd->vhs->szExtraTextDesc != NULL)
- tszHelpDesc = mir_a2t(hdd->vhs->szExtraTextDesc);
+ tszHelpDesc = mir_a2u(hdd->vhs->szExtraTextDesc);
}
}
@@ -400,7 +400,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
tszHelpDesc = getHelpDescription(tr);
if (tszHelpDesc == NULL)
- tszHelpDesc = mir_tstrdup(L"unknown");
+ tszHelpDesc = mir_wstrdup(L"unknown");
lvItem.iSubItem = 1;
lvItem.pszText = TranslateTS(tszHelpDesc);
@@ -422,12 +422,12 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
cat = getTokenCategory((TOKENREGISTEREX *)lvItem.lParam);
if (cat != NULL) {
- text = mir_tstrdup(TranslateTS(cat));
+ text = mir_wstrdup(TranslateTS(cat));
mir_free(cat);
}
else text = NULL;
- if (text != NULL && (last == NULL || mir_tstrcmpi(last, text))) {
+ if (text != NULL && (last == NULL || mir_wstrcmpi(last, text))) {
lvItem.mask = LVIF_TEXT;
lvItem.pszText = text;
ListView_InsertItem(hList, &lvItem);
@@ -464,13 +464,13 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA
if (tr == NULL)
break;
- size_t len = mir_tstrlen(tr->tszTokenString) + 2;
+ size_t len = mir_wstrlen(tr->tszTokenString) + 2;
wchar_t *tokenString = (wchar_t*)mir_alloc((len+1)*sizeof(wchar_t));
if (tokenString == NULL)
break;
memset(tokenString, 0, ((len + 1) * sizeof(wchar_t)));
- mir_sntprintf(tokenString, len + 1, L"%c%s%c", (tr->flags & TRF_FIELD) ? FIELD_CHAR : FUNC_CHAR, tr->tszTokenString, (tr->flags & TRF_FIELD) ? FIELD_CHAR : '(');
+ mir_snwprintf(tokenString, len + 1, L"%c%s%c", (tr->flags & TRF_FIELD) ? FIELD_CHAR : FUNC_CHAR, tr->tszTokenString, (tr->flags & TRF_FIELD) ? FIELD_CHAR : '(');
SendDlgItemMessage(hwndInputDlg, IDC_TESTSTRING, EM_REPLACESEL, TRUE, (LPARAM)tokenString);
mir_free(tokenString);
SetFocus(GetDlgItem(hwndInputDlg, IDC_TESTSTRING));
@@ -685,7 +685,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
wchar_t *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0));
if (newString != NULL) {
wchar_t *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT);
- if (oldString == NULL || mir_tstrcmp(oldString, newString))
+ if (oldString == NULL || mir_wstrcmp(oldString, newString))
SetDlgItemText(hwndDlg, IDC_RESULT, newString);
mir_free(newString);
@@ -812,7 +812,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)dat->vhs->fi->tszFormat);
else {
- WCHAR *wszFormatString = mir_a2t(dat->vhs->fi->szFormat);
+ WCHAR *wszFormatString = mir_a2u(dat->vhs->fi->szFormat);
SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)wszFormatString);
mir_free(wszFormatString);
@@ -866,7 +866,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)dat->vhs->fi->tszExtraText);
else {
- WCHAR *wszSource = mir_a2t(dat->vhs->fi->szExtraText);
+ WCHAR *wszSource = mir_a2u(dat->vhs->fi->szExtraText);
SendMessage(hwndDlg, VARM_SETEXTRATEXT, 0, (LPARAM)wszSource);
mir_free(wszSource);
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp
index 8f7ccd9f2e..0c3f1a8060 100644
--- a/plugins/Variables/src/parse_alias.cpp
+++ b/plugins/Variables/src/parse_alias.cpp
@@ -37,7 +37,7 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++)
- if (!mir_tstrcmp(arAliases[i]->szAlias, szAlias))
+ if (!mir_wstrcmp(arAliases[i]->szAlias, szAlias))
return arAliases[i];
return NULL;
@@ -45,7 +45,7 @@ static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
{
- if (mir_tstrlen(tArg) == 0)
+ if (mir_wstrlen(tArg) == 0)
return res;
unsigned int cur = 0, ecur = 0;
@@ -55,14 +55,14 @@ static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
while ((*(res + ecur) != ')') && (*(res + ecur) != ','))
ecur++;
- if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_tstrlen(tArg)))) {
- if (mir_tstrlen(rArg) > mir_tstrlen(tArg)) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + (mir_tstrlen(rArg) - mir_tstrlen(tArg)) + 1)*sizeof(wchar_t));
+ if (((signed int)mir_wstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_wstrlen(tArg)))) {
+ if (mir_wstrlen(rArg) > mir_wstrlen(tArg)) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + (mir_wstrlen(rArg) - mir_wstrlen(tArg)) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
}
- memmove(res + ecur + (mir_tstrlen(rArg) - mir_tstrlen(tArg)), res + ecur, (mir_tstrlen(res + ecur) + 1)*sizeof(wchar_t));
- wcsncpy(res + cur, rArg, mir_tstrlen(rArg));
+ memmove(res + ecur + (mir_wstrlen(rArg) - mir_wstrlen(tArg)), res + ecur, (mir_wstrlen(res + ecur) + 1)*sizeof(wchar_t));
+ wcsncpy(res + cur, rArg, mir_wstrlen(rArg));
}
}
cur++;
@@ -77,7 +77,7 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
if (areg == NULL || areg->argc != ai->argc - 1)
return NULL;
- wchar_t *res = mir_tstrdup(areg->szTranslation);
+ wchar_t *res = mir_wstrdup(areg->szTranslation);
for (unsigned i = 0; i < areg->argc; i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i + 1]);
if (res == NULL)
@@ -89,17 +89,17 @@ static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
{
- if (szAlias == NULL || szTranslation == NULL || mir_tstrlen(szAlias) == 0)
+ if (szAlias == NULL || szTranslation == NULL || mir_wstrlen(szAlias) == 0)
return -1;
mir_cslock lck(csAliasRegister);
for (int i = 0; i < arAliases.getCount(); i++) {
ALIASREGISTER *p = arAliases[i];
- if (mir_tstrcmp(p->szAlias, szAlias))
+ if (mir_wstrcmp(p->szAlias, szAlias))
continue;
mir_free(p->szTranslation);
- p->szTranslation = mir_tstrdup(szTranslation);
+ p->szTranslation = mir_wstrdup(szTranslation);
for (unsigned j = 0; j < p->argc; j++)
mir_free(p->argv[j]);
@@ -110,7 +110,7 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
for (unsigned j = 0; j < argc; j++) {
if (argv[j] != NULL)
- p->argv[j] = mir_tstrdup(argv[j]);
+ p->argv[j] = mir_wstrdup(argv[j]);
else
p->argv[j] = NULL;
}
@@ -121,14 +121,14 @@ static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** arg
return -1;
ALIASREGISTER *p = new ALIASREGISTER;
- p->szAlias = mir_tstrdup(szAlias);
- p->szTranslation = mir_tstrdup(szTranslation);
+ p->szAlias = mir_wstrdup(szAlias);
+ p->szTranslation = mir_wstrdup(szTranslation);
p->argc = argc;
p->argv = pargv;
for (unsigned j = 0; j < p->argc; j++) {
if (argv[j] != NULL)
- p->argv[j] = mir_tstrdup(argv[j]);
+ p->argv[j] = mir_wstrdup(argv[j]);
else
p->argv[j] = NULL;
}
@@ -146,7 +146,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
while (isValidTokenChar(*cur))
cur++;
- ptrT alias(mir_tstrndup(ai->targv[1], cur - ai->targv[1]));
+ ptrW alias(mir_wstrndup(ai->targv[1], cur - ai->targv[1]));
TArgList argv;
getArguments(cur, argv);
@@ -156,17 +156,17 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
wchar_t *szArgs = NULL;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
- szArgs = (wchar_t*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_calloc((mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
else
- szArgs = (wchar_t*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
+ szArgs = (wchar_t*)mir_realloc(szArgs, (mir_wstrlen(szArgs) + mir_wstrlen(argv[i]) + 2)*sizeof(wchar_t));
- mir_tstrcat(szArgs, argv[i]);
+ mir_wstrcat(szArgs, argv[i]);
if (i != argv.getCount() - 1)
- mir_tstrcat(szArgs, L",");
+ mir_wstrcat(szArgs, L",");
}
int res;
if (szArgs != NULL && argv.getCount() > 0) {
- szArgsA = mir_t2a(szArgs);
+ szArgsA = mir_u2a(szArgs);
size_t size = 32 + mir_strlen(szArgsA);
szHelp = (char *)mir_alloc(size);
@@ -184,7 +184,7 @@ static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
mir_free(szArgs);
mir_free(szHelp);
argv.destroy();
- return (res == 0) ? mir_tstrdup(L"") : NULL;
+ return (res == 0) ? mir_wstrdup(L"") : NULL;
}
void registerAliasTokens()
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp
index 873be4f90b..820b4a01ee 100644
--- a/plugins/Variables/src/parse_external.cpp
+++ b/plugins/Variables/src/parse_external.cpp
@@ -37,13 +37,13 @@ static wchar_t *getFullWinampTitleText()
mir_free(szWinText);
return NULL;
}
- wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(wchar_t));
+ wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_wstrlen(szWinText) + 1)*sizeof(wchar_t));
if (szTitle == NULL) {
mir_free(szWinText);
return NULL;
}
- mir_tstrcpy(szTitle, szWinText);
- mir_tstrcpy(szTitle + mir_tstrlen(szTitle), szWinText);
+ mir_wstrcpy(szTitle, szWinText);
+ mir_wstrcpy(szTitle + mir_wstrlen(szTitle), szWinText);
mir_free(szWinText);
return szTitle;
@@ -61,14 +61,14 @@ static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
- if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_tstrlen(szTitle) - 2)) || (cur > (szTitle + mir_tstrlen(szTitle)))) {
+ if ((scur == NULL) || ((cur = wcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_wstrlen(szTitle) - 2)) || (cur > (szTitle + mir_wstrlen(szTitle)))) {
mir_free(szTitle);
return NULL;
}
scur++;
scur++;
*cur = '\0';
- res = mir_tstrdup(scur);
+ res = mir_wstrdup(scur);
mir_free(szTitle);
ai->flags |= AIF_DONTPARSE;
@@ -88,13 +88,13 @@ static wchar_t *parseWinampState(ARGUMENTSINFO *ai)
wchar_t *scur = wcschr(szTitle, '.');
wchar_t *cur;
if (scur == NULL || (cur = wcsstr(scur, L" - Winamp")) == NULL)
- res = mir_tstrdup(TranslateT("Stopped"));
+ res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Stopped]", 9)))
- res = mir_tstrdup(TranslateT("Stopped"));
+ res = mir_wstrdup(TranslateT("Stopped"));
else if ((!wcsncmp(cur + 10, L"[Paused]", 8)))
- res = mir_tstrdup(TranslateT("Paused"));
+ res = mir_wstrdup(TranslateT("Paused"));
else
- res = mir_tstrdup(L"Playing");
+ res = mir_wstrdup(L"Playing");
mir_free(szTitle);
return res;
}
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp
index 58c96df015..cd927fb98b 100644
--- a/plugins/Variables/src/parse_inet.cpp
+++ b/plugins/Variables/src/parse_inet.cpp
@@ -24,7 +24,7 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- char *res = mir_t2a(ai->targv[1]);
+ char *res = mir_u2a(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -45,7 +45,7 @@ static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
cur += mir_strlen(hex);
}
- wchar_t *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2u(res);
mir_free(res);
return tres;
}
@@ -55,7 +55,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- char *res = mir_t2a(ai->targv[1]);
+ char *res = mir_u2a(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -72,7 +72,7 @@ static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
}
res = (char*)mir_realloc(res, mir_strlen(res) + 1);
- wchar_t *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2u(res);
mir_free(res);
return tres;
}
@@ -84,7 +84,7 @@ static wchar_t *parseNToA(ARGUMENTSINFO *ai)
struct in_addr in;
in.s_addr = ttoi(ai->targv[1]);
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
static wchar_t *parseHToA(ARGUMENTSINFO *ai)
@@ -94,7 +94,7 @@ static wchar_t *parseHToA(ARGUMENTSINFO *ai)
struct in_addr in;
in.s_addr = htonl(ttoi(ai->targv[1]));
- return mir_a2t(inet_ntoa(in));
+ return mir_a2u(inet_ntoa(in));
}
void registerInetTokens()
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp
index 763136f821..0737a17d11 100644
--- a/plugins/Variables/src/parse_logic.cpp
+++ b/plugins/Variables/src/parse_logic.cpp
@@ -32,11 +32,11 @@ static wchar_t *parseAnd(ARGUMENTSINFO *ai)
if (fi.eCount > 0) {
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseFalse(ARGUMENTSINFO *ai)
@@ -45,7 +45,7 @@ static wchar_t *parseFalse(ARGUMENTSINFO *ai)
return NULL;
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseIf(ARGUMENTSINFO *ai)
@@ -59,7 +59,7 @@ static wchar_t *parseIf(ARGUMENTSINFO *ai)
fi.tszFormat = ai->targv[1];
mir_free(formatString(&fi));
- return mir_tstrdup((fi.eCount == 0) ? ai->targv[2] : ai->targv[3]);
+ return mir_wstrdup((fi.eCount == 0) ? ai->targv[2] : ai->targv[3]);
}
static wchar_t *parseIf2(ARGUMENTSINFO *ai)
@@ -76,7 +76,7 @@ static wchar_t *parseIf2(ARGUMENTSINFO *ai)
return szCondition;
mir_free(szCondition);
- return mir_tstrdup(ai->targv[2]);
+ return mir_wstrdup(ai->targv[2]);
}
static wchar_t *parseIf3(ARGUMENTSINFO *ai)
@@ -104,16 +104,16 @@ static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
if (ttoi(tszFirst) == ttoi(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
@@ -124,16 +124,16 @@ static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
if (ttoi(tszFirst) > ttoi(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
@@ -144,16 +144,16 @@ static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.szFormat = ai->argv[1];
- ptrT tszFirst(formatString(&fi));
+ ptrW tszFirst(formatString(&fi));
fi.szFormat = ai->argv[2];
- ptrT tszSecond(formatString(&fi));
+ ptrW tszSecond(formatString(&fi));
if (tszFirst == NULL || tszSecond == NULL)
return NULL;
- if (mir_tstrlen(tszFirst) > mir_tstrlen(tszSecond))
- return mir_tstrdup(ai->targv[3]);
+ if (mir_wstrlen(tszFirst) > mir_wstrlen(tszSecond))
+ return mir_wstrdup(ai->targv[3]);
- return mir_tstrdup(ai->targv[4]);
+ return mir_wstrdup(ai->targv[4]);
}
/*
@@ -166,7 +166,7 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai)
if (ai->argc != 5)
return NULL;
- wchar_t *res = mir_tstrdup(L"");
+ wchar_t *res = mir_wstrdup(L"");
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -180,15 +180,15 @@ static wchar_t *parseFor(ARGUMENTSINFO *ai)
wchar_t *parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
- res = (wchar_t*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(wchar_t));
+ res = (wchar_t*)mir_alloc(mir_wstrlen(parsed) + 1 * sizeof(wchar_t));
if (res == NULL) {
mir_free(parsed);
return NULL;
}
}
- else res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(wchar_t));
+ else res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(parsed) + 1)*sizeof(wchar_t));
- mir_tstrcat(res, parsed);
+ mir_wstrcat(res, parsed);
mir_free(parsed);
}
fi.tszFormat = ai->targv[3];
@@ -209,7 +209,7 @@ static wchar_t *parseEqual(ARGUMENTSINFO *ai)
if (ttoi(ai->targv[1]) != ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseGreater(ARGUMENTSINFO *ai)
@@ -220,7 +220,7 @@ static wchar_t *parseGreater(ARGUMENTSINFO *ai)
if (ttoi(ai->targv[1]) <= ttoi(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseLonger(ARGUMENTSINFO *ai)
@@ -228,10 +228,10 @@ static wchar_t *parseLonger(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- if (mir_tstrlen(ai->targv[1]) <= mir_tstrlen(ai->targv[2]))
+ if (mir_wstrlen(ai->targv[1]) <= mir_wstrlen(ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseNot(ARGUMENTSINFO *ai)
@@ -248,7 +248,7 @@ static wchar_t *parseNot(ARGUMENTSINFO *ai)
if (fi.eCount == 0)
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseOr(ARGUMENTSINFO *ai)
@@ -268,12 +268,12 @@ static wchar_t *parseOr(ARGUMENTSINFO *ai)
ai->flags &= ~AIF_FALSE;
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseTrue(ARGUMENTSINFO *ai)
{
- return (ai->argc != 1) ? NULL : mir_tstrdup(L"");
+ return (ai->argc != 1) ? NULL : mir_wstrdup(L"");
}
static wchar_t *parseXor(ARGUMENTSINFO *ai)
@@ -293,7 +293,7 @@ static wchar_t *parseXor(ARGUMENTSINFO *ai)
int val2 = fi.eCount == 0;
ai->flags |= ((val1 & AIF_FALSE) == !(val2 & AIF_FALSE)) ? 0 : AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerLogicTokens()
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index a9946d8a7a..cd028d3651 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -54,18 +54,18 @@ static wchar_t *parseHex(ARGUMENTSINFO *ai)
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
- mir_sntprintf(szVal, L"%x", val);
- unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(wchar_t));
+ mir_snwprintf(szVal, L"%x", val);
+ unsigned int zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 3)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(wchar_t)));
- mir_tstrcpy(res, L"0x");
+ memset(res, 0, ((zeros + mir_wstrlen(szVal) + 3) * sizeof(wchar_t)));
+ mir_wstrcpy(res, L"0x");
for (i = 0; i < zeros; i++)
*(res + 2 + i) = '0';
- mir_tstrcat(res, szVal);
+ mir_wstrcat(res, szVal);
return res;
}
@@ -140,19 +140,19 @@ static wchar_t *parseNum(ARGUMENTSINFO *ai)
if (szVal == NULL)
return NULL;
- unsigned zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(wchar_t));
+ unsigned zeros = max(padding - (signed int)mir_wstrlen(szVal), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_wstrlen(szVal) + 1)*sizeof(wchar_t));
if (res == NULL) {
mir_free(szVal);
return NULL;
}
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((zeros + mir_wstrlen(szVal) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
for (unsigned i = 0; i < zeros; i++)
*cur++ = '0';
- mir_tstrcat(res, szVal);
+ mir_wstrcat(res, szVal);
mir_free(szVal);
return res;
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp
index ac1185edb3..b8d2e9e324 100644
--- a/plugins/Variables/src/parse_metacontacts.cpp
+++ b/plugins/Variables/src/parse_metacontacts.cpp
@@ -32,7 +32,7 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -40,8 +40,8 @@ static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
@@ -60,7 +60,7 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char* szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -68,8 +68,8 @@ static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
@@ -88,7 +88,7 @@ static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
if (hContact == NULL)
return NULL;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char *szProto = GetContactProto(hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, hContact);
@@ -96,8 +96,8 @@ static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
wchar_t tszID[40];
- mir_sntprintf(tszID, L"%p", hContact);
- szUniqueID = mir_tstrdup(tszID);
+ mir_snwprintf(tszID, L"%p", hContact);
+ szUniqueID = mir_wstrdup(tszID);
}
return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 71722f7e45..11eb8d0181 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -27,7 +27,7 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
unsigned int status = ttoi(ai->targv[1]);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
- return mir_tstrdup(szStatus);
+ return mir_wstrdup(szStatus);
return NULL;
}
@@ -35,34 +35,34 @@ static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
static int getContactInfoFlags(wchar_t *tszDesc)
{
int flags = 0;
- for (wchar_t *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) {
- if (!wcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) {
+ for (wchar_t *cur = tszDesc; (cur < (tszDesc + mir_wstrlen(tszDesc))); cur++) {
+ if (!wcsnicmp(cur, STR_PROTOID, mir_wstrlen(STR_PROTOID))) {
flags |= CI_PROTOID;
- cur += mir_tstrlen(STR_PROTOID) - 1;
+ cur += mir_wstrlen(STR_PROTOID) - 1;
}
- else if (!wcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) {
+ else if (!wcsnicmp(cur, STR_NICK, mir_wstrlen(STR_NICK))) {
flags |= CI_NICK;
- cur += mir_tstrlen(STR_NICK) - 1;
+ cur += mir_wstrlen(STR_NICK) - 1;
}
- else if (!wcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) {
+ else if (!wcsnicmp(cur, STR_FIRSTNAME, mir_wstrlen(STR_FIRSTNAME))) {
flags |= CI_FIRSTNAME;
- cur += mir_tstrlen(STR_FIRSTNAME) - 1;
+ cur += mir_wstrlen(STR_FIRSTNAME) - 1;
}
- else if (!wcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) {
+ else if (!wcsnicmp(cur, STR_LASTNAME, mir_wstrlen(STR_LASTNAME))) {
flags |= CI_LASTNAME;
- cur += mir_tstrlen(STR_LASTNAME) - 1;
+ cur += mir_wstrlen(STR_LASTNAME) - 1;
}
- else if (!wcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) {
+ else if (!wcsnicmp(cur, STR_DISPLAY, mir_wstrlen(STR_DISPLAY))) {
flags |= CI_LISTNAME;
- cur += mir_tstrlen(STR_DISPLAY) - 1;
+ cur += mir_wstrlen(STR_DISPLAY) - 1;
}
- else if (!wcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) {
+ else if (!wcsnicmp(cur, STR_EMAIL, mir_wstrlen(STR_EMAIL))) {
flags |= CI_EMAIL;
- cur += mir_tstrlen(STR_EMAIL) - 1;
+ cur += mir_wstrlen(STR_EMAIL) - 1;
}
- else if (!wcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) {
+ else if (!wcsnicmp(cur, STR_UNIQUEID, mir_wstrlen(STR_UNIQUEID))) {
flags |= CI_UNIQUEID;
- cur += mir_tstrlen(STR_UNIQUEID) - 1;
+ cur += mir_wstrlen(STR_UNIQUEID) - 1;
}
}
if (flags == 0) {
@@ -129,7 +129,7 @@ static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai)
if (CallService(MS_DB_GETPROFILENAMET, _countof(name), (LPARAM)name))
return NULL;
- return mir_tstrdup(name);
+ return mir_wstrdup(name);
}
static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
@@ -141,7 +141,7 @@ static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
if (CallService(MS_DB_GETPROFILEPATHT, _countof(path), (LPARAM)path))
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wchar_t* defaultValue)
@@ -162,7 +162,7 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch
var = itot(dbv.dVal);
break;
case DBVT_ASCIIZ:
- var = mir_a2t(dbv.pszVal);
+ var = mir_a2u(dbv.pszVal);
break;
case DBVT_WCHAR:
var = mir_wstrdup(dbv.pwszVal);
@@ -182,23 +182,23 @@ static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
return NULL;
MCONTACT hContact = NULL;
- if (mir_tstrlen(ai->targv[1]) > 0) {
+ if (mir_wstrlen(ai->targv[1]) > 0) {
hContact = getContactFromString(ai->targv[1], CI_ALLFLAGS);
if (hContact == INVALID_CONTACT_ID)
return NULL;
}
- char *szModule = mir_t2a(ai->targv[2]);
+ char *szModule = mir_u2a(ai->targv[2]);
if (szModule == NULL)
return NULL;
- char *szSetting = mir_t2a(ai->targv[3]);
+ char *szSetting = mir_u2a(ai->targv[3]);
if (szSetting == NULL) {
mir_free(szModule);
return NULL;
}
- wchar_t *szDefaultValue = ((ai->argc > 4 && mir_tstrlen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_wstrlen(ai->targv[4]) > 0) ? mir_wstrdup(ai->targv[4]) : NULL);
wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -216,7 +216,7 @@ static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
return NULL;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -258,7 +258,7 @@ static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
return NULL;
wchar_t *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_wstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -307,7 +307,7 @@ static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai)
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
- return mir_tstrdup(szStatus);
+ return mir_wstrdup(szStatus);
return NULL;
}
@@ -322,7 +322,7 @@ static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai)
if (GetModuleFileName(NULL, path, _countof(path)) == 0)
return NULL;
- return mir_tstrdup(path);
+ return mir_wstrdup(path);
}
static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
@@ -331,13 +331,13 @@ static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
return NULL;
int status;
- if (ai->argc == 1 || mir_tstrlen(ai->targv[1]) == 0)
+ if (ai->argc == 1 || mir_wstrlen(ai->targv[1]) == 0)
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else
status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
- return (szStatus != NULL) ? mir_tstrdup(szStatus) : NULL;
+ return (szStatus != NULL) ? mir_wstrdup(szStatus) : NULL;
}
static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
@@ -347,28 +347,28 @@ static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
char *szRes = NULL;
wchar_t *tszRes = NULL;
- ptrA szProto(mir_t2a(ai->targv[1]));
+ ptrA szProto(mir_u2a(ai->targv[1]));
- if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PINAME)))
+ if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINAME)))
tszRes = Hlp_GetProtocolName(szProto);
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDTEXT))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDTEXT, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
return NULL;
}
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PIUIDSETTING))) {
szRes = (char *)CallProtoService(szProto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0);
if (INT_PTR(szRes) == CALLSERVICE_NOTFOUND)
return NULL;
}
- else if (!mir_tstrcmp(ai->targv[2], _A2W(STR_PINICK)))
+ else if (!mir_wstrcmp(ai->targv[2], _A2W(STR_PINICK)))
tszRes = Contact_GetInfo(CNF_DISPLAY, NULL, szProto);
if (szRes == NULL && tszRes == NULL)
return NULL;
if (szRes != NULL && tszRes == NULL)
- tszRes = mir_a2t(szRes);
+ tszRes = mir_a2u(szRes);
return tszRes;
}
@@ -379,7 +379,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
return NULL;
ai->flags |= AIF_DONTPARSE;
- ptrT szUniqueID;
+ ptrW szUniqueID;
char *szProto = GetContactProto(ai->fi->hContact);
if (szProto != NULL)
szUniqueID = getContactInfoT(CNF_UNIQUEID, ai->fi->hContact);
@@ -389,7 +389,7 @@ static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
return NULL;
- mir_sntprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
+ mir_snwprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
}
if (szUniqueID == NULL)
@@ -590,7 +590,7 @@ static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
return NULL;
wchar_t *res = TranslateTS(ai->targv[1]);
- return (res == NULL) ? NULL : mir_tstrdup(res);
+ return (res == NULL) ? NULL : mir_wstrdup(res);
}
static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
@@ -603,7 +603,7 @@ static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
if (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(versionString), (LPARAM)versionString))
return NULL;
- return mir_a2t(versionString);
+ return mir_a2u(versionString);
}
static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
@@ -613,7 +613,7 @@ static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
wchar_t *ret = (wchar_t*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
- return (ret == NULL) ? NULL : mir_tstrdup(ret);
+ return (ret == NULL) ? NULL : mir_wstrdup(ret);
}
static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
@@ -624,7 +624,7 @@ static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
wchar_t ret[128];
- return mir_tstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
+ return mir_wstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
}
static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
@@ -635,7 +635,7 @@ static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
wchar_t corevar[MAX_PATH];
- mir_sntprintf(corevar, L"%%%s%%", ai->targv[0]);
+ mir_snwprintf(corevar, L"%%%s%%", ai->targv[0]);
return Utils_ReplaceVarsT(corevar);
}
@@ -647,7 +647,7 @@ static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
if (!ServiceExists(_T2A(ai->targv[1])))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerMirandaTokens()
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp
index f5cb3c6ba8..7031fc4cc6 100644
--- a/plugins/Variables/src/parse_regexp.cpp
+++ b/plugins/Variables/src/parse_regexp.cpp
@@ -39,14 +39,14 @@ static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai)
return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
- return mir_a2t(szVal);
+ return mir_a2u(szVal);
}
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
}
/*
@@ -72,19 +72,19 @@ static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai)
return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)mir_wstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat >= 0)
ai->flags &= ~AIF_FALSE;
if (pcre16_get_substring(ai->targv[2], offsets, nmat, number, &substring) < 0)
ai->flags |= AIF_FALSE;
else {
- wchar_t *tres = mir_tstrdup(substring);
+ wchar_t *tres = mir_wstrdup(substring);
pcre16_free_substring(substring);
return tres;
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
void registerRegExpTokens()
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp
index 5ee00fb0f7..5779f13dc1 100644
--- a/plugins/Variables/src/parse_str.cpp
+++ b/plugins/Variables/src/parse_str.cpp
@@ -24,7 +24,7 @@ static wchar_t *parseCaps(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
CharLower(res);
*cur = (wchar_t)CharUpper((LPTSTR)*cur);
@@ -49,7 +49,7 @@ static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
*cur = (wchar_t)CharUpper((LPTSTR)*cur);
cur++;
@@ -67,7 +67,7 @@ static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
static wchar_t *parseCrlf(ARGUMENTSINFO *ai)
{
ai->flags |= AIF_DONTPARSE;
- return mir_tstrdup(L"\r\n");
+ return mir_wstrdup(L"\r\n");
}
static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
@@ -75,7 +75,7 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
wchar_t *cur = res;
do {
cur = wcschr(cur, '\n');
@@ -84,9 +84,9 @@ static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
log_debug(cur);
int loc = cur - res;
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 2)*sizeof(wchar_t));
cur = res + loc;
- memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur + 2, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
memcpy(cur, L"\r\n", 2 * sizeof(wchar_t));
cur += 2;
}
@@ -106,20 +106,20 @@ static wchar_t *parseFixeol(ARGUMENTSINFO *ai)
return NULL;
wchar_t *cur = ai->targv[1];
- while (mir_tstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
+ while (mir_wstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
cur++;
if (*cur == '\0')
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
cur--;
- wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_wstrlen(szReplacement) + 1)*sizeof(wchar_t));
if (res == NULL)
return res;
memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], cur - ai->targv[1]);
- mir_tstrcat(res, szReplacement);
+ mir_wstrcat(res, szReplacement);
return res;
}
@@ -132,27 +132,27 @@ static wchar_t *parseFixeol2(ARGUMENTSINFO *ai)
default: return NULL;
}
- wchar_t *res = mir_tstrdup(ai->targv[1]);
- for (size_t pos = 0; pos < mir_tstrlen(res); pos++) {
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
+ for (size_t pos = 0; pos < mir_wstrlen(res); pos++) {
wchar_t *cur = res + pos;
wchar_t *szEol = NULL;
- if (!wcsncmp(cur, L"\r\n", mir_tstrlen(L"\r\n")))
+ if (!wcsncmp(cur, L"\r\n", mir_wstrlen(L"\r\n")))
szEol = L"\r\n";
if (*cur == '\n')
szEol = L"\n";
if (szEol != NULL) {
- if (mir_tstrlen(szReplacement) > mir_tstrlen(szEol)) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(szEol) + 1)*sizeof(wchar_t));
+ if (mir_wstrlen(szReplacement) > mir_wstrlen(szEol)) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szReplacement) - mir_wstrlen(szEol) + 1)*sizeof(wchar_t));
cur = res + pos;
}
- memmove(cur + mir_tstrlen(szReplacement), cur + mir_tstrlen(szEol), (mir_tstrlen(cur + mir_tstrlen(szEol)) + 1)*sizeof(wchar_t));
- memcpy(cur, szReplacement, mir_tstrlen(szReplacement)*sizeof(wchar_t));
- pos += mir_tstrlen(szReplacement) - 1;
+ memmove(cur + mir_wstrlen(szReplacement), cur + mir_wstrlen(szEol), (mir_wstrlen(cur + mir_wstrlen(szEol)) + 1)*sizeof(wchar_t));
+ memcpy(cur, szReplacement, mir_wstrlen(szReplacement)*sizeof(wchar_t));
+ pos += mir_wstrlen(szReplacement) - 1;
}
}
- return (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ return (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
}
static wchar_t *parseInsert(ARGUMENTSINFO *ai)
@@ -161,17 +161,17 @@ static wchar_t *parseInsert(ARGUMENTSINFO *ai)
return NULL;
unsigned int pos = ttoi(ai->targv[3]);
- if (pos > mir_tstrlen(ai->targv[1]))
+ if (pos > mir_wstrlen(ai->targv[1]))
return NULL;
- wchar_t *res = (wchar_t*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((mir_wstrlen(ai->targv[1]) + mir_wstrlen(ai->targv[2]) + 1) * sizeof(wchar_t)));
wcsncpy(res, ai->targv[1], pos);
- mir_tstrcpy(res + pos, ai->targv[2]);
- mir_tstrcpy(res + pos + mir_tstrlen(ai->targv[2]), ai->targv[1] + pos);
+ mir_wstrcpy(res + pos, ai->targv[2]);
+ mir_wstrcpy(res + pos + mir_wstrlen(ai->targv[2]), ai->targv[1] + pos);
return res;
}
@@ -184,7 +184,7 @@ static wchar_t *parseLeft(ARGUMENTSINFO *ai)
if (len < 0)
return NULL;
- len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
+ len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -199,7 +199,7 @@ static wchar_t *parseLen(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- return itot((int)mir_tstrlen(ai->targv[1]));
+ return itot((int)mir_wstrlen(ai->targv[1]));
}
static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
@@ -209,7 +209,7 @@ static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
int count = 1;
wchar_t *cur = ai->targv[1];
- while (cur < (ai->targv[1] + mir_tstrlen(ai->targv[1]))) {
+ while (cur < (ai->targv[1] + mir_wstrlen(ai->targv[1]))) {
if (!wcsncmp(cur, L"\r\n", 2)) {
count++;
cur++;
@@ -228,7 +228,7 @@ static wchar_t *parseLower(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -242,10 +242,10 @@ static wchar_t *parseLongest(ARGUMENTSINFO *ai)
unsigned int iLong = 1;
for (unsigned int i = 2; i < ai->argc; i++)
- if (mir_tstrlen(ai->targv[i]) > mir_tstrlen(ai->targv[iLong]))
+ if (mir_wstrlen(ai->targv[i]) > mir_wstrlen(ai->targv[iLong]))
iLong = i;
- return mir_tstrdup(ai->targv[iLong]);
+ return mir_wstrdup(ai->targv[iLong]);
}
static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
@@ -253,7 +253,7 @@ static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
}
static wchar_t *parsePad(ARGUMENTSINFO *ai)
@@ -269,17 +269,17 @@ static wchar_t *parsePad(ARGUMENTSINFO *ai)
if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
wchar_t *cur = res;
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
- mir_tstrcat(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
return res;
}
@@ -296,14 +296,14 @@ static wchar_t *parsePadright(ARGUMENTSINFO *ai)
if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ unsigned int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
- mir_tstrcpy(res, ai->targv[1]);
- wchar_t *cur = res + mir_tstrlen(ai->targv[1]);
+ memset(res, 0, ((addcount + mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ mir_wstrcpy(res, ai->targv[1]);
+ wchar_t *cur = res + mir_wstrlen(ai->targv[1]);
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -323,7 +323,7 @@ static wchar_t *parsePadcut(ARGUMENTSINFO *ai)
if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -352,7 +352,7 @@ static wchar_t *parsePadcutright(ARGUMENTSINFO *ai)
if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_wstrlen(ai->targv[1]), 0);
wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -377,13 +377,13 @@ static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
if (count < 0)
return NULL;
- wchar_t *res = (wchar_t*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((count * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ memset(res, 0, ((count * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
for (int i = 0; i < count; i++)
- mir_tstrcat(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
return res;
}
@@ -396,24 +396,24 @@ static wchar_t *parseReplace(ARGUMENTSINFO *ai)
wchar_t *cur;
size_t pos = 0;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
for (size_t i = 2; i < ai->argc; i += 2) {
- if (mir_tstrlen(ai->targv[i]) == 0)
+ if (mir_wstrlen(ai->targv[i]) == 0)
continue;
- for (pos = 0; pos<mir_tstrlen(res); pos++) {
+ for (pos = 0; pos<mir_wstrlen(res); pos++) {
cur = res + pos;
- if (!wcsncmp(cur, ai->targv[i], mir_tstrlen(ai->targv[i]))) {
- if (mir_tstrlen(ai->targv[i + 1]) > mir_tstrlen(ai->targv[i])) {
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(ai->targv[i + 1]) - mir_tstrlen(ai->targv[i]) + 1)*sizeof(wchar_t));
+ if (!wcsncmp(cur, ai->targv[i], mir_wstrlen(ai->targv[i]))) {
+ if (mir_wstrlen(ai->targv[i + 1]) > mir_wstrlen(ai->targv[i])) {
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(ai->targv[i + 1]) - mir_wstrlen(ai->targv[i]) + 1)*sizeof(wchar_t));
cur = res + pos;
}
- memmove(cur + mir_tstrlen(ai->targv[i + 1]), cur + mir_tstrlen(ai->targv[i]), (mir_tstrlen(cur + mir_tstrlen(ai->targv[i])) + 1)*sizeof(wchar_t));
- memcpy(cur, ai->targv[i + 1], mir_tstrlen(ai->targv[i + 1])*sizeof(wchar_t));
- pos += mir_tstrlen(ai->targv[i + 1]) - 1;
+ memmove(cur + mir_wstrlen(ai->targv[i + 1]), cur + mir_wstrlen(ai->targv[i]), (mir_wstrlen(cur + mir_wstrlen(ai->targv[i])) + 1)*sizeof(wchar_t));
+ memcpy(cur, ai->targv[i + 1], mir_wstrlen(ai->targv[i + 1])*sizeof(wchar_t));
+ pos += mir_wstrlen(ai->targv[i + 1]) - 1;
}
}
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
}
return res;
@@ -428,13 +428,13 @@ static wchar_t *parseRight(ARGUMENTSINFO *ai)
if (len < 0)
return NULL;
- len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
+ len = min(len, (signed int)mir_wstrlen(ai->targv[1]));
wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
memset(res, 0, ((len + 1)*sizeof(wchar_t)));
- wcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len);
+ wcsncpy(res, ai->targv[1] + mir_wstrlen(ai->targv[1]) - len, len);
return res;
}
@@ -446,24 +446,24 @@ static wchar_t *parseScroll(ARGUMENTSINFO *ai)
if (ai->argc != 4)
return NULL;
- if (mir_tstrlen(ai->targv[1]) == 0)
- return mir_tstrdup(ai->targv[1]);
+ if (mir_wstrlen(ai->targv[1]) == 0)
+ return mir_wstrdup(ai->targv[1]);
- size_t move = ttoi(ai->targv[3]) % mir_tstrlen(ai->targv[1]);
+ size_t move = ttoi(ai->targv[3]) % mir_wstrlen(ai->targv[1]);
size_t display = ttoi(ai->targv[2]);
- if (display > mir_tstrlen(ai->targv[1]))
- display = (unsigned)mir_tstrlen(ai->targv[1]);
+ if (display > mir_wstrlen(ai->targv[1]))
+ display = (unsigned)mir_wstrlen(ai->targv[1]);
- wchar_t *res = (wchar_t*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
+ wchar_t *res = (wchar_t*)mir_alloc((2 * mir_wstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((2 * mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
- mir_tstrcpy(res, ai->targv[1]);
- mir_tstrcat(res, ai->targv[1]);
- memmove(res, res + move, (mir_tstrlen(res + move) + 1)*sizeof(wchar_t));
+ memset(res, 0, ((2 * mir_wstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ mir_wstrcpy(res, ai->targv[1]);
+ mir_wstrcat(res, ai->targv[1]);
+ memmove(res, res + move, (mir_wstrlen(res + move) + 1)*sizeof(wchar_t));
*(res + display) = 0;
- res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
+ res = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + 1)*sizeof(wchar_t));
return res;
}
@@ -475,10 +475,10 @@ static wchar_t *parseShortest(ARGUMENTSINFO *ai)
int iShort = 1;
for (unsigned i = 2; i < ai->argc; i++)
- if (mir_tstrlen(ai->targv[i]) < mir_tstrlen(ai->targv[iShort]))
+ if (mir_wstrlen(ai->targv[i]) < mir_wstrlen(ai->targv[iShort]))
iShort = i;
- return mir_tstrdup(ai->targv[iShort]);
+ return mir_wstrdup(ai->targv[iShort]);
}
static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
@@ -490,7 +490,7 @@ static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
memset(szVal, 0, sizeof(szVal));
wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]);
if (c == NULL || *c == 0)
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -500,10 +500,10 @@ static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- if (mir_tstrcmp(ai->targv[1], ai->targv[2]))
+ if (mir_wstrcmp(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
@@ -513,13 +513,13 @@ static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
ai->flags |= AIF_FALSE;
for (unsigned i = 2; i < ai->argc; i++) {
- if (!mir_tstrcmp(ai->targv[1], ai->targv[i])) {
+ if (!mir_wstrcmp(ai->targv[1], ai->targv[i])) {
ai->flags &= ~AIF_FALSE;
break;
}
}
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
@@ -534,7 +534,7 @@ static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
if (wcsncmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
@@ -542,10 +542,10 @@ static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- if (mir_tstrcmpi(ai->targv[1], ai->targv[2]))
+ if (mir_wstrcmpi(ai->targv[1], ai->targv[2]))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
@@ -560,7 +560,7 @@ static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
if (wcsnicmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
@@ -570,7 +570,7 @@ static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
wchar_t *c = wcsrchr(ai->targv[1], *ai->targv[2]);
if ((c == NULL) || (*c == 0))
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -582,7 +582,7 @@ static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
wchar_t *c = wcsstr(ai->targv[1], ai->targv[2]);
if ((c == NULL) || (*c == 0))
- return mir_tstrdup(L"0");
+ return mir_wstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
@@ -594,9 +594,9 @@ static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
int to, from = max(ttoi(ai->targv[2]) - 1, 0);
if (ai->argc > 3)
- to = min(ttoi(ai->targv[3]), (int)mir_tstrlen(ai->targv[1]));
+ to = min(ttoi(ai->targv[3]), (int)mir_wstrlen(ai->targv[1]));
else
- to = (int)mir_tstrlen(ai->targv[1]);
+ to = (int)mir_wstrlen(ai->targv[1]);
if (to < from)
return NULL;
@@ -616,7 +616,7 @@ static wchar_t *parseSelect(ARGUMENTSINFO *ai)
if ((n > (signed int)ai->argc - 2) || n <= 0)
return NULL;
- return mir_tstrdup(ai->targv[n + 1]);
+ return mir_wstrdup(ai->targv[n + 1]);
}
static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
@@ -625,8 +625,8 @@ static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
return NULL;
for (unsigned i = 2; i < ai->argc; i += 2)
- if (!mir_tstrcmp(ai->targv[1], ai->targv[i]))
- return mir_tstrdup(ai->targv[i + 1]);
+ if (!mir_wstrcmp(ai->targv[1], ai->targv[i]))
+ return mir_wstrdup(ai->targv[i + 1]);
return NULL;
}
@@ -640,12 +640,12 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai)
while (*scur == ' ')
scur++;
- wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1;
+ wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]) - 1;
while ((*ecur == ' ') && (ecur > ai->targv[1]))
ecur--;
if (scur >= ecur)
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 2)*sizeof(wchar_t));
if (res == NULL)
@@ -660,7 +660,7 @@ static wchar_t *parseTrim(ARGUMENTSINFO *ai)
static wchar_t *parseTab(ARGUMENTSINFO *ai)
{
int count = 1;
- if ((ai->argc == 2) && (mir_tstrlen(ai->targv[1]) > 0))
+ if ((ai->argc == 2) && (mir_wstrlen(ai->targv[1]) > 0))
count = ttoi(ai->targv[1]);
if (count < 0)
@@ -683,7 +683,7 @@ static wchar_t *parseUpper(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_wstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
@@ -701,7 +701,7 @@ static wchar_t *getNthWord(wchar_t *szString, int w)
scur++;
count++;
- while ((count < w) && (scur < szString + mir_tstrlen(szString))) {
+ while ((count < w) && (scur < szString + mir_wstrlen(szString))) {
if (*scur == ' ') {
while (*scur == ' ')
scur++;
@@ -735,7 +735,7 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai)
wchar_t *res = NULL;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
- if (mir_tstrlen(ai->targv[3]) > 0)
+ if (mir_wstrlen(ai->targv[3]) > 0)
to = ttoi(ai->targv[3]);
else
to = 100000; // rework
@@ -751,11 +751,11 @@ static wchar_t *parseWord(ARGUMENTSINFO *ai)
return res;
if (res != NULL) {
- wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(wchar_t));
+ wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_wstrlen(res) + mir_wstrlen(szWord) + 2)*sizeof(wchar_t));
if (pres != NULL) {
res = pres;
- mir_tstrcat(res, L" ");
- mir_tstrcat(res, szWord);
+ mir_wstrcat(res, L" ");
+ mir_wstrcat(res, szWord);
}
mir_free(szWord);
}
@@ -772,7 +772,7 @@ static wchar_t *parseExtratext(ARGUMENTSINFO *ai)
ai->flags |= AIF_DONTPARSE;
if (ai->fi->szExtraText != NULL)
- return mir_tstrdup(ai->fi->tszExtraText);
+ return mir_wstrdup(ai->fi->tszExtraText);
return NULL;
}
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 370c84881e..947a6b33e4 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -51,15 +51,15 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
if (ai->argc != 2)
return NULL;
- if (mir_tstrlen(ai->targv[1]) == 0)
- szCounter = mir_tstrdup(L"\\Processor(_Total)\\% Processor Time");
+ if (mir_wstrlen(ai->targv[1]) == 0)
+ szCounter = mir_wstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
- int size = (int)mir_tstrlen(ai->targv[1]) + 32;
+ int size = (int)mir_wstrlen(ai->targv[1]) + 32;
szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
if (szCounter == NULL)
return NULL;
- mir_sntprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
+ mir_snwprintf(szCounter, size, L"\\Process(%s)\\%% Processor Time", ai->targv[1]);
}
PDH_STATUS pdhStatus = PdhValidatePath(szCounter);
if (pdhStatus != ERROR_SUCCESS) {
@@ -105,18 +105,18 @@ static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
pdhStatus = PdhCloseQuery(hQuery);
return NULL;
}
- mir_sntprintf(szVal, L"%.0f", cValue.doubleValue);
+ mir_snwprintf(szVal, L"%.0f", cValue.doubleValue);
//PdhRemoveCounter(*hCounter);
PdhCloseQuery(hQuery);
mir_free(szCounter);
- return mir_tstrdup(szVal);
+ return mir_wstrdup(szVal);
}
static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
- if (ai->argc == 1 || (ai->argc > 1 && mir_tstrlen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1 && mir_wstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -137,7 +137,7 @@ static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
{
wchar_t *szFormat;
- if (ai->argc == 1 || (ai->argc > 1) && (mir_tstrlen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1) && (mir_wstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -165,16 +165,16 @@ static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
depth = ttoi(ai->targv[2]);
if (depth <= 0)
- return mir_tstrdup(ai->targv[1]);
+ return mir_wstrdup(ai->targv[1]);
size_t bi, ei;
- for (ei = 0; ei < mir_tstrlen(ai->targv[1]); ei++) {
+ for (ei = 0; ei < mir_wstrlen(ai->targv[1]); ei++) {
if (ai->targv[1][ei] == '\\')
depth--;
if (!depth)
break;
}
- if (ei >= mir_tstrlen(ai->targv[1]))
+ if (ei >= mir_wstrlen(ai->targv[1]))
return ai->targv[1];
for (bi = ei - 1; bi > 0; bi--)
@@ -203,7 +203,7 @@ static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
if (depth <= 0)
return NULL;
- wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]);
+ wchar_t *ecur = ai->targv[1] + mir_wstrlen(ai->targv[1]);
while (depth > 0) {
while ((*ecur != '\\') && (ecur > ai->targv[1]))
ecur--;
@@ -226,17 +226,17 @@ static int getTime(wchar_t *szTime, struct tm *date)
{
// do some extra checks here
wchar_t *cur = szTime;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_mon = wcstoul(cur, &cur, 10) - 1;
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_mday = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_year = wcstoul(cur, &cur, 10);
@@ -247,17 +247,17 @@ static int getTime(wchar_t *szTime, struct tm *date)
date->tm_year = date->tm_year < 38 ? date->tm_year + 100 : date->tm_year;
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_hour = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_min = wcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + mir_tstrlen(szTime))
+ if (cur >= szTime + mir_wstrlen(szTime))
return -1;
date->tm_sec = wcstoul(cur, &cur, 10);
@@ -282,9 +282,9 @@ static wchar_t *parseDiffTime(ARGUMENTSINFO *ai)
return NULL;
diff = difftime(mktime(&t1), mktime(&t0));
- mir_sntprintf(szTime, L"%.0f", diff);
+ mir_snwprintf(szTime, L"%.0f", diff);
- return mir_tstrdup(szTime);
+ return mir_wstrdup(szTime);
}
static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
@@ -298,7 +298,7 @@ static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
else
CloseHandle(hFile);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
@@ -333,7 +333,7 @@ static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
else
CloseHandle(hFile);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
@@ -386,11 +386,11 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai)
if (*ai->targv[4] == 'd')
bFiles = FALSE;
}
- if (tszFirst[mir_tstrlen(tszFirst) - 1] == '\\')
- mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ if (tszFirst[mir_wstrlen(tszFirst) - 1] == '\\')
+ mir_wstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
else {
- mir_tstrncat(tszFirst, L"\\", _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
- mir_tstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ mir_wstrncat(tszFirst, L"\\", _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
+ mir_wstrncat(tszFirst, tszFilter, _countof(tszFirst) - mir_wstrlen(tszFirst) - 1);
}
WIN32_FIND_DATA ffd;
@@ -399,20 +399,20 @@ static wchar_t *parseListDir(ARGUMENTSINFO *ai)
return NULL;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
- mir_tstrcpy(tszRes, ffd.cFileName);
+ tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcpy(tszRes, ffd.cFileName);
}
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
if (tszRes != NULL) {
- mir_tstrcat(tszRes, tszSeperator);
- tszRes = (wchar_t*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcat(tszRes, tszSeperator);
+ tszRes = (wchar_t*)mir_realloc(tszRes, (mir_wstrlen(tszRes) + mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
}
else {
- tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
- mir_tstrcpy(tszRes, L"");
+ tszRes = (wchar_t*)mir_alloc((mir_wstrlen(ffd.cFileName) + mir_wstrlen(tszSeperator) + 1)*sizeof(wchar_t));
+ mir_wstrcpy(tszRes, L"");
}
- mir_tstrcat(tszRes, ffd.cFileName);
+ mir_wstrcat(tszRes, ffd.cFileName);
}
}
FindClose(hFind);
@@ -443,7 +443,7 @@ static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
ai->flags |= AIF_FALSE;
mir_free(ref);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
#endif
@@ -454,7 +454,7 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
DWORD len, type;
- wchar_t *key = mir_tstrdup(ai->targv[1]);
+ wchar_t *key = mir_wstrdup(ai->targv[1]);
if (key == NULL)
return NULL;
@@ -466,13 +466,13 @@ static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
*cur = 0;
HKEY hKey;
- if (!mir_tstrcmp(key, L"HKEY_CLASSES_ROOT"))
+ if (!mir_wstrcmp(key, L"HKEY_CLASSES_ROOT"))
hKey = HKEY_CLASSES_ROOT;
- else if (!mir_tstrcmp(key, L"HKEY_CURRENT_USER"))
+ else if (!mir_wstrcmp(key, L"HKEY_CURRENT_USER"))
hKey = HKEY_CURRENT_USER;
- else if (!mir_tstrcmp(key, L"HKEY_LOCAL_MACHINE"))
+ else if (!mir_wstrcmp(key, L"HKEY_LOCAL_MACHINE"))
hKey = HKEY_LOCAL_MACHINE;
- else if (!mir_tstrcmp(key, L"HKEY_USERS"))
+ else if (!mir_wstrcmp(key, L"HKEY_USERS"))
hKey = HKEY_USERS;
else {
mir_free(key);
@@ -530,7 +530,7 @@ static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
if (timestamp == 0)
return NULL;
- if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -562,7 +562,7 @@ static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
return NULL;
wchar_t *szFormat;
- if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_wstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -634,7 +634,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
if (tUC)
res = (wchar_t*)pBuf;
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -749,7 +749,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
if (tUC)
res = (wchar_t*)pBuf;
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -763,7 +763,7 @@ static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
res = (wchar_t*)pBuf;
}
else {
- res = mir_a2t((char *)pBuf);
+ res = mir_a2u((char *)pBuf);
mir_free(pBuf);
}
@@ -819,10 +819,10 @@ static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
}
wchar_t szVal[32];
- mir_sntprintf(szVal, L"%u", cValue.largeValue);
+ mir_snwprintf(szVal, L"%u", cValue.largeValue);
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
- return mir_tstrdup(szVal);
+ return mir_wstrdup(szVal);
}
static wchar_t *parseUserName(ARGUMENTSINFO *ai)
@@ -859,9 +859,9 @@ static wchar_t *parseClipboard(ARGUMENTSINFO *ai)
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData != NULL) {
wchar_t *tszText = (wchar_t*)GlobalLock(hData);
- size_t len = mir_tstrlen(tszText);
+ size_t len = mir_wstrlen(tszText);
res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
- mir_tstrcpy(res, tszText);
+ mir_wstrcpy(res, tszText);
res[len] = 0;
GlobalUnlock(hData);
}
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp
index c54bbf6dce..11d168e678 100644
--- a/plugins/Variables/src/parse_variables.cpp
+++ b/plugins/Variables/src/parse_variables.cpp
@@ -26,14 +26,14 @@ static int vrCount = 0;
static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
{
- if ((szName == NULL) || (szText == NULL) || (mir_tstrlen(szName) <= 0))
+ if ((szName == NULL) || (szText == NULL) || (mir_wstrlen(szName) <= 0))
return -1;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++) {
- if ((!mir_tstrcmp(vr[i].szName, szName))) {
+ if ((!mir_wstrcmp(vr[i].szName, szName))) {
mir_free(vr[i].szText);
- vr[i].szText = mir_tstrdup(szText);
+ vr[i].szText = mir_wstrdup(szText);
return 0;
}
}
@@ -42,21 +42,21 @@ static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
return -1;
vr = pvr;
- vr[vrCount].szName = mir_tstrdup(szName);
- vr[vrCount].szText = mir_tstrdup(szText);
+ vr[vrCount].szName = mir_wstrdup(szName);
+ vr[vrCount].szText = mir_wstrdup(szText);
vr[vrCount++].dwOwnerThread = GetCurrentThreadId();
return 0;
}
static wchar_t *searchVariableRegister(wchar_t *szName)
{
- if ((szName == NULL) || (mir_tstrlen(szName) <= 0))
+ if ((szName == NULL) || (mir_wstrlen(szName) <= 0))
return NULL;
mir_cslock lck(csVarRegister);
for (int i = 0; i < vrCount; i++)
- if ((!mir_tstrcmp(vr[i].szName, szName)))
- return mir_tstrdup(vr[i].szText);
+ if ((!mir_wstrcmp(vr[i].szName, szName)))
+ return mir_wstrdup(vr[i].szText);
return NULL;
}
@@ -85,7 +85,7 @@ static wchar_t *parsePuts(ARGUMENTSINFO *ai)
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
return NULL;
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
static wchar_t *parseGet(ARGUMENTSINFO *ai)
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp
index 101d8024f1..158a429582 100644
--- a/plugins/Variables/src/tokenregister.cpp
+++ b/plugins/Variables/src/tokenregister.cpp
@@ -41,7 +41,7 @@ unsigned long int hashlittle(void *key, size_t length, unsigned long int initval
static DWORD NameHashFunction(wchar_t *tszStr)
{
- return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(wchar_t), 0);
+ return (DWORD)hashlittle(tszStr, mir_wstrlen(tszStr)*sizeof(wchar_t), 0);
}
static TokenRegisterEntry* FindTokenRegisterByName(wchar_t *name)
@@ -109,7 +109,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
hash = NameHashFunction(newVr->tszTokenString);
}
else {
- WCHAR *wtoken = mir_a2t(newVr->szTokenString);
+ WCHAR *wtoken = mir_a2u(newVr->szTokenString);
deRegisterToken(wtoken);
hash = NameHashFunction(wtoken);
mir_free(wtoken);
@@ -121,16 +121,16 @@ INT_PTR registerToken(WPARAM, LPARAM lParam)
memcpy(&tre->tr, newVr, newVr->cbSize);
tre->nameHash = hash;
- if (!mir_tstrcmp(newVr->tszTokenString, L"alias"))
+ if (!mir_wstrcmp(newVr->tszTokenString, L"alias"))
log_debugA("alias");
if (!(newVr->flags & TRF_PARSEFUNC) && newVr->szService != NULL)
tre->tr.szService = mir_strdup(newVr->szService);
if (newVr->flags & TRF_TCHAR)
- tre->tr.tszTokenString = mir_tstrdup(newVr->tszTokenString);
+ tre->tr.tszTokenString = mir_wstrdup(newVr->tszTokenString);
else
- tre->tr.tszTokenString = mir_a2t(newVr->szTokenString);
+ tre->tr.tszTokenString = mir_a2u(newVr->szTokenString);
if (newVr->szHelpText != NULL)
tre->tr.szHelpText = mir_strdup(newVr->szHelpText);
@@ -180,7 +180,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
memcpy(&cAi, ai, sizeof(ARGUMENTSINFO));
cAi.argv = (char**)mir_alloc(ai->argc*sizeof(char *));
for (unsigned j = 0; j < ai->argc; j++)
- cAi.argv[j] = mir_t2a(ai->targv[j]);
+ cAi.argv[j] = mir_u2a(ai->targv[j]);
if (thisVr->flags & TRF_PARSEFUNC)
callRes = (INT_PTR)thisVr->parseFunction(&cAi);
@@ -191,7 +191,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
mir_free(cAi.argv[j]);
if ((char *)callRes != NULL)
- res = mir_a2t((char*)callRes);
+ res = mir_a2u((char*)callRes);
}
else {
// unicode variables calls unicode plugin
@@ -201,7 +201,7 @@ wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
callRes = CallService(thisVr->szService, 0, (LPARAM)ai);
if ((wchar_t*)callRes != NULL)
- res = mir_tstrdup((wchar_t*)callRes);
+ res = mir_wstrdup((wchar_t*)callRes);
}
if (callRes != NULL) {
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index 2b2e13af0f..ace282aac9 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -76,9 +76,9 @@ wchar_t* getArguments(wchar_t *string, TArgList &argv)
if (bNewArg) {
wchar_t *tszArg = NULL;
if (cur > scur)
- tszArg = mir_tstrndup(scur + 1, cur - (scur + 1));
+ tszArg = mir_wstrndup(scur + 1, cur - (scur + 1));
if (tszArg == NULL)
- tszArg = mir_tstrdup(L"");
+ tszArg = mir_wstrdup(L"");
argv.insert(tszArg);
bNewArg = false;
@@ -118,7 +118,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
int i, scurPos, curPos, tmpVarPos;
- wchar_t *string = mir_tstrdup(fi->tszFormat);
+ wchar_t *string = mir_wstrdup(fi->tszFormat);
if (string == NULL)
return NULL;
@@ -127,31 +127,31 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
FORMATINFO afi;
memcpy(&afi, fi, sizeof(afi));
- for (size_t pos = 0; pos < mir_tstrlen(string); pos++) {
+ for (size_t pos = 0; pos < mir_wstrlen(string); pos++) {
// string may move in memory, iterate by remembering the position in the string
wchar_t *cur = string + pos;
// new round
if (*cur == DONTPARSE_CHAR) {
- memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
if (*cur == DONTPARSE_CHAR)
continue;
while ((*cur != DONTPARSE_CHAR) && (*cur != 0))
cur++;
- memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
pos = cur - string - 1;
continue;
}
// remove end of lines
else if ((!wcsncmp(cur, L"\r\n", 2)) && (gParseOpts.bStripEOL)) {
- memmove(cur, cur + 2, (mir_tstrlen(cur + 2) + 1)*sizeof(wchar_t));
+ memmove(cur, cur + 2, (mir_wstrlen(cur + 2) + 1)*sizeof(wchar_t));
pos = cur - string - 1;
continue;
}
else if ((*cur == '\n' && gParseOpts.bStripEOL) || (*cur == ' ' && gParseOpts.bStripWS)) {
- memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
pos = cur - string - 1;
continue;
}
@@ -163,16 +163,16 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
if (*cur == 0) {
*scur = 0;
- string = (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t));
+ string = (wchar_t*)mir_realloc(string, (mir_wstrlen(string) + 1)*sizeof(wchar_t));
continue;
}
- memmove(scur, cur, (mir_tstrlen(cur) + 1)*sizeof(wchar_t));
+ memmove(scur, cur, (mir_wstrlen(cur) + 1)*sizeof(wchar_t));
pos = scur - string - 1;
continue;
}
else if ((*cur != FIELD_CHAR) && (*cur != FUNC_CHAR) && (*cur != FUNC_ONCE_CHAR)) {
if (gParseOpts.bStripAll) {
- memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memmove(cur, cur + 1, (mir_wstrlen(cur + 1) + 1)*sizeof(wchar_t));
pos = cur - string - 1;
}
continue;
@@ -189,13 +189,13 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
TOKENREGISTEREX *tr = NULL;
{
- ptrT token(mir_tstrndup(cur + 1, tcur - scur));
+ ptrW token(mir_wstrndup(cur + 1, tcur - scur));
// cur points to FIELD_CHAR or FUNC_CHAR
tmpVarPos = -1;
if (*cur == FIELD_CHAR) {
for (i = 0; i < fi->cbTemporaryVarsSize; i += 2) {
- if (!mir_tstrcmp(fi->tszaTemporaryVars[i], token)) {
+ if (!mir_wstrcmp(fi->tszaTemporaryVars[i], token)) {
tmpVarPos = i;
break;
}
@@ -214,7 +214,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
scur = cur; // store this pointer for later use
if (*cur == FIELD_CHAR) {
- size_t len = mir_tstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]);
+ size_t len = mir_wstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]);
cur++;
if (cur[len] != FIELD_CHAR) { // the next char after the token should be %
fi->eCount++;
@@ -223,7 +223,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
cur += len + 1;
}
else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) {
- cur += mir_tstrlen(tr->tszTokenString) + 1;
+ cur += mir_wstrlen(tr->tszTokenString) + 1;
wchar_t *argcur = getArguments(cur, argv);
if (argcur == cur || argcur == NULL) {
fi->eCount++;
@@ -247,9 +247,9 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
// cur should now point at the character after FIELD_CHAR or after the last ')'
ARGUMENTSINFO ai = { 0 };
- ptrT parsedToken;
+ ptrW parsedToken;
if (tr != NULL) {
- argv.insert(mir_tstrdup(tr->tszTokenString), 0);
+ argv.insert(mir_wstrdup(tr->tszTokenString), 0);
ai.cbSize = sizeof(ai);
ai.argc = argv.getCount();
@@ -260,7 +260,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
parsedToken = parseFromRegister(&ai);
}
- else parsedToken = mir_tstrdup(fi->tszaTemporaryVars[tmpVarPos + 1]);
+ else parsedToken = mir_wstrdup(fi->tszaTemporaryVars[tmpVarPos + 1]);
argv.destroy();
@@ -275,8 +275,8 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
else
fi->pCount++;
- size_t parsedTokenLen = mir_tstrlen(parsedToken);
- size_t initStrLen = mir_tstrlen(string);
+ size_t parsedTokenLen = mir_wstrlen(parsedToken);
+ size_t initStrLen = mir_wstrlen(string);
size_t tokenLen = cur - scur;
scurPos = scur - string;
curPos = cur - string;
@@ -290,10 +290,10 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
}
scur = string + scurPos;
cur = string + curPos;
- memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur) + 1)*sizeof(wchar_t));
+ memmove(scur + parsedTokenLen, cur, (mir_wstrlen(cur) + 1)*sizeof(wchar_t));
memcpy(scur, parsedToken, parsedTokenLen*sizeof(wchar_t));
{
- size_t len = mir_tstrlen(string);
+ size_t len = mir_wstrlen(string);
string = (wchar_t*)mir_realloc(string, (len + 1)*sizeof(wchar_t));
}
if ((ai.flags & AIF_DONTPARSE) || tmpVarPos >= 0)
@@ -302,7 +302,7 @@ static wchar_t* replaceDynVars(FORMATINFO *fi)
pos--; // parse the same pos again, it changed
}
- return (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t));
+ return (wchar_t*)mir_realloc(string, (mir_wstrlen(string) + 1)*sizeof(wchar_t));
}
/*
@@ -341,11 +341,11 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM)
if (!(fi->flags & FIF_TCHAR)) {
copied = TRUE;
- log_debugA("mir_a2t (%s)", fi->szExtraText);
- tszFormat = fi->szFormat != NULL ? mir_a2t(fi->szFormat) : NULL;
- tszSource = fi->szExtraText != NULL ? mir_a2t(fi->szExtraText) : NULL;
+ log_debugA("mir_a2u (%s)", fi->szExtraText);
+ tszFormat = fi->szFormat != NULL ? mir_a2u(fi->szFormat) : NULL;
+ tszSource = fi->szExtraText != NULL ? mir_a2u(fi->szExtraText) : NULL;
for (i = 0; i < fi->cbTemporaryVarsSize; i++) {
- fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2t(fi->szaTemporaryVars[i]) : NULL;
+ fi->tszaTemporaryVars[i] = fi->szaTemporaryVars[i] != NULL ? mir_a2u(fi->szaTemporaryVars[i]) : NULL;
}
}
else {