summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_alias.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables/src/parse_alias.cpp')
-rw-r--r--plugins/Variables/src/parse_alias.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp
index 9a29840a18..8f7ccd9f2e 100644
--- a/plugins/Variables/src/parse_alias.cpp
+++ b/plugins/Variables/src/parse_alias.cpp
@@ -21,16 +21,16 @@
struct ALIASREGISTER
{
- TCHAR *szAlias;
+ wchar_t *szAlias;
unsigned int argc;
- TCHAR **argv;
- TCHAR *szTranslation;
+ wchar_t **argv;
+ wchar_t *szTranslation;
};
static LIST<ALIASREGISTER> arAliases(5);
static mir_cs csAliasRegister;
-static ALIASREGISTER* searchAliasRegister(TCHAR *szAlias)
+static ALIASREGISTER* searchAliasRegister(wchar_t *szAlias)
{
if (szAlias == NULL || *szAlias == 0)
return NULL;
@@ -43,7 +43,7 @@ static ALIASREGISTER* searchAliasRegister(TCHAR *szAlias)
return NULL;
}
-static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg)
+static wchar_t *replaceArguments(wchar_t *res, wchar_t *tArg, wchar_t *rArg)
{
if (mir_tstrlen(tArg) == 0)
return res;
@@ -55,14 +55,14 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg)
while ((*(res + ecur) != ')') && (*(res + ecur) != ','))
ecur++;
- if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!_tcsncmp(tArg, res + cur, mir_tstrlen(tArg)))) {
+ if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!wcsncmp(tArg, res + cur, mir_tstrlen(tArg)))) {
if (mir_tstrlen(rArg) > mir_tstrlen(tArg)) {
- res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + (mir_tstrlen(rArg) - mir_tstrlen(tArg)) + 1)*sizeof(TCHAR));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + (mir_tstrlen(rArg) - mir_tstrlen(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(TCHAR));
- _tcsncpy(res + cur, rArg, mir_tstrlen(rArg));
+ 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));
}
}
cur++;
@@ -71,13 +71,13 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg)
return res;
}
-static TCHAR *parseTranslateAlias(ARGUMENTSINFO *ai)
+static wchar_t *parseTranslateAlias(ARGUMENTSINFO *ai)
{
ALIASREGISTER *areg = searchAliasRegister(ai->targv[0]);
if (areg == NULL || areg->argc != ai->argc - 1)
return NULL;
- TCHAR *res = mir_tstrdup(areg->szTranslation);
+ wchar_t *res = mir_tstrdup(areg->szTranslation);
for (unsigned i = 0; i < areg->argc; i++) {
res = replaceArguments(res, areg->argv[i], ai->targv[i + 1]);
if (res == NULL)
@@ -87,7 +87,7 @@ static TCHAR *parseTranslateAlias(ARGUMENTSINFO *ai)
return res;
}
-static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, TCHAR *szTranslation)
+static int addToAliasRegister(wchar_t *szAlias, unsigned int argc, wchar_t** argv, wchar_t *szTranslation)
{
if (szAlias == NULL || szTranslation == NULL || mir_tstrlen(szAlias) == 0)
return -1;
@@ -104,7 +104,7 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
mir_free(p->argv[j]);
p->argc = argc;
- p->argv = (TCHAR**)mir_realloc(p->argv, argc * sizeof(TCHAR*));
+ p->argv = (wchar_t**)mir_realloc(p->argv, argc * sizeof(wchar_t*));
if (p->argv == NULL)
return -1;
@@ -116,7 +116,7 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
}
return 0;
}
- TCHAR **pargv = (TCHAR**)mir_alloc(argc * sizeof(TCHAR*));
+ wchar_t **pargv = (wchar_t**)mir_alloc(argc * sizeof(wchar_t*));
if (pargv == NULL)
return -1;
@@ -136,13 +136,13 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
return 0;
}
-static TCHAR *parseAddAlias(ARGUMENTSINFO *ai)
+static wchar_t *parseAddAlias(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
char *szHelp, *szArgsA;
- TCHAR *cur = ai->targv[1];
+ wchar_t *cur = ai->targv[1];
while (isValidTokenChar(*cur))
cur++;
@@ -153,12 +153,12 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai)
deRegisterToken(alias);
addToAliasRegister(alias, argv.getCount(), argv.getArray(), ai->targv[2]);
- TCHAR *szArgs = NULL;
+ wchar_t *szArgs = NULL;
for (int i = 0; i < argv.getCount(); i++) {
if (i == 0)
- szArgs = (TCHAR*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR));
+ szArgs = (wchar_t*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
else
- szArgs = (TCHAR*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR));
+ szArgs = (wchar_t*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(wchar_t));
mir_tstrcat(szArgs, argv[i]);
if (i != argv.getCount() - 1)