summaryrefslogtreecommitdiff
path: root/plugins/Variables/src/parse_str.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
commit2f261839b60692e33d0e160344d0d636d49c90ba (patch)
tree187921722698b681d29df3f6e60fb18394a5e9d5 /plugins/Variables/src/parse_str.cpp
parent2e931a0b2780587d85f3902468c935f5adba70c8 (diff)
less TCHARs
git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src/parse_str.cpp')
-rw-r--r--plugins/Variables/src/parse_str.cpp192
1 files changed, 96 insertions, 96 deletions
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;
}