diff options
Diffstat (limited to 'plugins/Variables/src/parse_alias.cpp')
-rw-r--r-- | plugins/Variables/src/parse_alias.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
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()
|