diff options
Diffstat (limited to 'plugins/Variables')
-rw-r--r-- | plugins/Variables/src/contact.cpp | 14 | ||||
-rw-r--r-- | plugins/Variables/src/help.cpp | 4 | ||||
-rw-r--r-- | plugins/Variables/src/parse_alias.cpp | 18 | ||||
-rw-r--r-- | plugins/Variables/src/parse_external.cpp | 6 | ||||
-rw-r--r-- | plugins/Variables/src/parse_logic.cpp | 8 | ||||
-rw-r--r-- | plugins/Variables/src/parse_math.cpp | 12 | ||||
-rw-r--r-- | plugins/Variables/src/parse_miranda.cpp | 42 | ||||
-rw-r--r-- | plugins/Variables/src/parse_str.cpp | 114 | ||||
-rw-r--r-- | plugins/Variables/src/parse_system.cpp | 46 | ||||
-rw-r--r-- | plugins/Variables/src/parse_variables.cpp | 4 | ||||
-rw-r--r-- | plugins/Variables/src/tokenregister.cpp | 2 | ||||
-rw-r--r-- | plugins/Variables/src/variables.cpp | 32 |
12 files changed, 151 insertions, 151 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 5ccc20cea5..cbb70481bc 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -91,7 +91,7 @@ static HANDLE hContactSettingChangedHook; */
BYTE getContactInfoType(TCHAR* type)
{
- if (type == NULL || _tcslen(type) == 0 )
+ if (type == NULL || mir_tstrlen(type) == 0 )
return 0;
for (int i=0; i < SIZEOF(builtinCnfs); i++ )
@@ -206,7 +206,7 @@ int getContactFromString(CONTACTSINFO *ci) tszContact = NEWTSTR_ALLOCA(tmp);
mir_free(tmp);
}
- if ((tszContact == NULL) || (_tcslen(tszContact) == 0))
+ if ((tszContact == NULL) || (mir_tstrlen(tszContact) == 0))
return -1;
ci->hContacts = NULL;
@@ -234,12 +234,12 @@ int getContactFromString(CONTACTSINFO *ci) BOOL bMatch = FALSE;
// <_HANDLE_:hContact>
- size_t size = _tcslen(_T(PROTOID_HANDLE)) + 36;
+ size_t size = mir_tstrlen(_T(PROTOID_HANDLE)) + 36;
szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
if (szFind != NULL)
{
mir_sntprintf(szFind, size, _T("<%s:%p>"), _T(PROTOID_HANDLE), hContact);
- if (!_tcsncmp(tszContact, szFind, _tcslen(tszContact)))
+ if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact)))
bMatch = TRUE;
mir_free(szFind);
@@ -255,12 +255,12 @@ int getContactFromString(CONTACTSINFO *ci) TCHAR *cInfo = getContactInfoT(CNF_UNIQUEID, hContact);
if (cInfo)
{
- size_t size = _tcslen(cInfo) + mir_strlen(szProto) + 4;
+ size_t size = mir_tstrlen(cInfo) + mir_strlen(szProto) + 4;
szFind = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
if (szFind != NULL) {
mir_sntprintf(szFind, size, _T("<%S:%s>"), szProto, cInfo);
mir_free(cInfo);
- if (!_tcsncmp(tszContact, szFind, _tcslen(tszContact)))
+ if (!_tcsncmp(tszContact, szFind, mir_tstrlen(tszContact)))
bMatch = TRUE;
mir_free(szFind);
}
@@ -416,7 +416,7 @@ TCHAR* encodeContactToString(MCONTACT hContact) if (szProto == NULL || tszUniqueId == NULL)
return NULL;
- size_t size = _tcslen(tszUniqueId) + mir_strlen(szProto) + 4;
+ size_t size = mir_tstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
TCHAR *tszResult = (TCHAR *)mir_calloc(size * sizeof(TCHAR));
if (tszResult)
mir_sntprintf(tszResult, size, _T("<%S:%s>"), szProto, tszUniqueId);
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index a76a3a15e9..49f3de4fa7 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -314,7 +314,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) } else args = NULL; - size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; + size_t len = mir_tstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR)); if (desc == NULL) { mir_free(helpText); @@ -484,7 +484,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar if (tr == NULL) break; - size_t len = _tcslen(tr->tszTokenString) + 2; + size_t len = mir_tstrlen(tr->tszTokenString) + 2; TCHAR *tokenString = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); if (tokenString == NULL) break; diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index 557f5be2eb..87256051f5 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -45,7 +45,7 @@ static ALIASREGISTER *searchAliasRegister(TCHAR *szAlias) static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg)
{
- if (_tcslen(tArg) == 0)
+ if (mir_tstrlen(tArg) == 0)
return res;
unsigned int cur = 0, ecur = 0;
@@ -55,14 +55,14 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg) while ((*(res + ecur) != ')') && (*(res + ecur) != ','))
ecur++;
- if (((signed int)_tcslen(tArg) == (ecur - cur)) && (!_tcsncmp(tArg, res + cur, _tcslen(tArg)))) {
- if (_tcslen(rArg) > _tcslen(tArg)) {
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + (_tcslen(rArg) - _tcslen(tArg)) + 1)*sizeof(TCHAR));
+ if (((signed int)mir_tstrlen(tArg) == (ecur - cur)) && (!_tcsncmp(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));
if (res == NULL)
return NULL;
}
- memmove(res + ecur + (_tcslen(rArg) - _tcslen(tArg)), res + ecur, (_tcslen(res + ecur) + 1)*sizeof(TCHAR));
- _tcsncpy(res + cur, rArg, _tcslen(rArg));
+ 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));
}
}
cur++;
@@ -89,7 +89,7 @@ static TCHAR *parseTranslateAlias(ARGUMENTSINFO *ai) static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, TCHAR *szTranslation)
{
- if (szAlias == NULL || szTranslation == NULL || _tcslen(szAlias) == 0)
+ if (szAlias == NULL || szTranslation == NULL || mir_tstrlen(szAlias) == 0)
return -1;
mir_cslock lck(csAliasRegister);
@@ -156,9 +156,9 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) TCHAR *szArgs = NULL;
for (int i = 0; i < argc; i++) {
if (i == 0)
- szArgs = (TCHAR*)mir_calloc((_tcslen(argv[i]) + 2)*sizeof(TCHAR));
+ szArgs = (TCHAR*)mir_calloc((mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR));
else
- szArgs = (TCHAR*)mir_realloc(szArgs, (_tcslen(szArgs) + _tcslen(argv[i]) + 2)*sizeof(TCHAR));
+ szArgs = (TCHAR*)mir_realloc(szArgs, (mir_tstrlen(szArgs) + mir_tstrlen(argv[i]) + 2)*sizeof(TCHAR));
_tcscat(szArgs, argv[i]);
if (i != argc - 1)
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 47aefa0410..4aec50a9ee 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -37,13 +37,13 @@ static TCHAR *getFullWinampTitleText() mir_free(szWinText);
return NULL;
}
- TCHAR *szTitle = (TCHAR*)mir_alloc((2 * _tcslen(szWinText) + 1)*sizeof(TCHAR));
+ TCHAR *szTitle = (TCHAR*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(TCHAR));
if (szTitle == NULL) {
mir_free(szWinText);
return NULL;
}
_tcscpy(szTitle, szWinText);
- _tcscpy(szTitle + _tcslen(szTitle), szWinText);
+ _tcscpy(szTitle + mir_tstrlen(szTitle), szWinText);
mir_free(szWinText);
return szTitle;
@@ -61,7 +61,7 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) TCHAR *scur = _tcschr(szTitle, '.');
TCHAR *cur;
- if ((scur == NULL) || ((cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) || (scur >= cur) || (scur > (szTitle + _tcslen(szTitle) - 2)) || (cur > (szTitle + _tcslen(szTitle)))) {
+ if ((scur == NULL) || ((cur = _tcsstr(scur, _T(" - Winamp"))) == NULL) || (scur >= cur) || (scur > (szTitle + mir_tstrlen(szTitle) - 2)) || (cur > (szTitle + mir_tstrlen(szTitle)))) {
mir_free(szTitle);
return NULL;
}
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index 9ce10a3a92..ec1c70e2a3 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -150,7 +150,7 @@ static TCHAR *parseIflonger(ARGUMENTSINFO *ai) if (tszFirst == NULL || tszSecond == NULL)
return NULL;
- if (_tcslen(tszFirst) > _tcslen(tszSecond))
+ if (mir_tstrlen(tszFirst) > mir_tstrlen(tszSecond))
return mir_tstrdup(ai->targv[3]);
return mir_tstrdup(ai->targv[4]);
@@ -180,13 +180,13 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) TCHAR *parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
- res = (TCHAR*)mir_alloc(_tcslen(parsed) + 1 * sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(TCHAR));
if (res == NULL) {
mir_free(parsed);
return NULL;
}
}
- else res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(parsed) + 1)*sizeof(TCHAR));
+ else res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(TCHAR));
_tcscat(res, parsed);
mir_free(parsed);
@@ -228,7 +228,7 @@ static TCHAR *parseLonger(ARGUMENTSINFO *ai) if (ai->argc != 3)
return NULL;
- if (_tcslen(ai->targv[1]) <= _tcslen(ai->targv[2]))
+ if (mir_tstrlen(ai->targv[1]) <= mir_tstrlen(ai->targv[2]))
ai->flags |= AIF_FALSE;
return mir_tstrdup(_T(""));
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 54820e48f1..2581828c28 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -55,12 +55,12 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val);
- unsigned int zeros = max(padding - (signed int)_tcslen(szVal), 0);
- TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
+ unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((zeros + _tcslen(szVal) + 3) * sizeof(TCHAR)));
+ memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(TCHAR)));
_tcscpy(res, _T("0x"));
for (i = 0; i < zeros; i++)
*(res + 2 + i) = '0';
@@ -140,14 +140,14 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) if (szVal == NULL)
return NULL;
- unsigned zeros = max(padding - (signed int)_tcslen(szVal), 0);
- TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
+ unsigned zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szVal);
return NULL;
}
- memset(res, 0, ((zeros + _tcslen(szVal) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
for (unsigned i = 0; i < zeros; i++)
*cur++ = '0';
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index a60aa9871a..e0efa6e192 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -35,34 +35,34 @@ static TCHAR* parseCodeToStatus(ARGUMENTSINFO *ai) static int getContactInfoFlags(TCHAR *tszDesc)
{
int flags = 0;
- for (TCHAR *cur = tszDesc; (cur < (tszDesc + _tcslen(tszDesc))); cur++) {
- if (!_tcsnicmp(cur, STR_PROTOID, _tcslen(STR_PROTOID))) {
+ for (TCHAR *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) {
+ if (!_tcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) {
flags |= CI_PROTOID;
- cur += _tcslen(STR_PROTOID) - 1;
+ cur += mir_tstrlen(STR_PROTOID) - 1;
}
- else if (!_tcsnicmp(cur, STR_NICK, _tcslen(STR_NICK))) {
+ else if (!_tcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) {
flags |= CI_NICK;
- cur += _tcslen(STR_NICK) - 1;
+ cur += mir_tstrlen(STR_NICK) - 1;
}
- else if (!_tcsnicmp(cur, STR_FIRSTNAME, _tcslen(STR_FIRSTNAME))) {
+ else if (!_tcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) {
flags |= CI_FIRSTNAME;
- cur += _tcslen(STR_FIRSTNAME) - 1;
+ cur += mir_tstrlen(STR_FIRSTNAME) - 1;
}
- else if (!_tcsnicmp(cur, STR_LASTNAME, _tcslen(STR_LASTNAME))) {
+ else if (!_tcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) {
flags |= CI_LASTNAME;
- cur += _tcslen(STR_LASTNAME) - 1;
+ cur += mir_tstrlen(STR_LASTNAME) - 1;
}
- else if (!_tcsnicmp(cur, STR_DISPLAY, _tcslen(STR_DISPLAY))) {
+ else if (!_tcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) {
flags |= CI_LISTNAME;
- cur += _tcslen(STR_DISPLAY) - 1;
+ cur += mir_tstrlen(STR_DISPLAY) - 1;
}
- else if (!_tcsnicmp(cur, STR_EMAIL, _tcslen(STR_EMAIL))) {
+ else if (!_tcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) {
flags |= CI_EMAIL;
- cur += _tcslen(STR_EMAIL) - 1;
+ cur += mir_tstrlen(STR_EMAIL) - 1;
}
- else if (!_tcsnicmp(cur, STR_UNIQUEID, _tcslen(STR_UNIQUEID))) {
+ else if (!_tcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) {
flags |= CI_UNIQUEID;
- cur += _tcslen(STR_UNIQUEID) - 1;
+ cur += mir_tstrlen(STR_UNIQUEID) - 1;
}
}
if (flags == 0) {
@@ -210,7 +210,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return NULL;
MCONTACT hContact = NULL;
- if (_tcslen(ai->targv[1]) > 0) {
+ if (mir_tstrlen(ai->targv[1]) > 0) {
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
ci.tszContact = ai->targv[1];
@@ -236,7 +236,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return NULL;
}
- TCHAR *szDefaultValue = ((ai->argc > 4 && _tcslen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
+ TCHAR *szDefaultValue = ((ai->argc > 4 && mir_tstrlen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
TCHAR *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
@@ -265,7 +265,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) }
TCHAR *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -319,7 +319,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) }
TCHAR *szFormat;
- if (ai->argc == 2 || (ai->argc > 2 && _tcslen(ai->targv[2]) == 0))
+ if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -402,7 +402,7 @@ static TCHAR* parseMyStatus(ARGUMENTSINFO *ai) return NULL;
int status;
- if (ai->argc == 1 || _tcslen(ai->targv[1]) == 0)
+ if (ai->argc == 1 || mir_tstrlen(ai->targv[1]) == 0)
status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0);
else
status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
@@ -475,7 +475,7 @@ static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL)
return NULL;
- size_t size = mir_strlen(szProto) + _tcslen(szUniqueID) + 4;
+ size_t size = mir_strlen(szProto) + mir_tstrlen(szUniqueID) + 4;
TCHAR *res = (TCHAR*)mir_alloc(size * sizeof(TCHAR));
if (res == NULL)
return NULL;
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 0f6cb00b0d..cd61ae483d 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -84,9 +84,9 @@ static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) log_debug(cur);
int loc = cur - res;
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 2)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(TCHAR));
cur = res + loc;
- memmove(cur + 2, cur + 1, (_tcslen(cur + 1) + 1)*sizeof(TCHAR));
+ memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(TCHAR));
memcpy(cur, _T("\r\n"), 2 * sizeof(TCHAR));
cur += 2;
}
@@ -113,7 +113,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]);
cur--;
- TCHAR *res = (TCHAR*)mir_alloc((cur - ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(TCHAR));
if (res == NULL)
return res;
@@ -133,26 +133,26 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) }
TCHAR *res = mir_tstrdup(ai->targv[1]);
- for (size_t pos = 0; pos < _tcslen(res); pos++) {
+ for (size_t pos = 0; pos < mir_tstrlen(res); pos++) {
TCHAR *cur = res + pos;
TCHAR *szEol = NULL;
- if (!_tcsncmp(cur, _T("\r\n"), _tcslen(_T("\r\n"))))
+ if (!_tcsncmp(cur, _T("\r\n"), mir_tstrlen(_T("\r\n"))))
szEol = _T("\r\n");
if (*cur == '\n')
szEol = _T("\n");
if (szEol != NULL) {
- if (_tcslen(szReplacement) > _tcslen(szEol)) {
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szReplacement) - _tcslen(szEol) + 1)*sizeof(TCHAR));
+ if (mir_tstrlen(szReplacement) > mir_tstrlen(szEol)) {
+ res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(szEol) + 1)*sizeof(TCHAR));
cur = res + pos;
}
- memmove(cur + _tcslen(szReplacement), cur + _tcslen(szEol), (_tcslen(cur + _tcslen(szEol)) + 1)*sizeof(TCHAR));
- memcpy(cur, szReplacement, _tcslen(szReplacement)*sizeof(TCHAR));
- pos += _tcslen(szReplacement) - 1;
+ memmove(cur + mir_tstrlen(szReplacement), cur + mir_tstrlen(szEol), (mir_tstrlen(cur + mir_tstrlen(szEol)) + 1)*sizeof(TCHAR));
+ memcpy(cur, szReplacement, mir_tstrlen(szReplacement)*sizeof(TCHAR));
+ pos += mir_tstrlen(szReplacement) - 1;
}
}
- return (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR));
+ return (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
}
static TCHAR *parseInsert(ARGUMENTSINFO *ai)
@@ -161,17 +161,17 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) return NULL;
unsigned int pos = ttoi(ai->targv[3]);
- if (pos > _tcslen(ai->targv[1]))
+ if (pos > mir_tstrlen(ai->targv[1]))
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1) * sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1], pos);
_tcscpy(res + pos, ai->targv[2]);
- _tcscpy(res + pos + _tcslen(ai->targv[2]), ai->targv[1] + pos);
+ _tcscpy(res + pos + mir_tstrlen(ai->targv[2]), ai->targv[1] + pos);
return res;
}
@@ -184,7 +184,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) if (len < 0)
return NULL;
- len = min(len, (signed int)_tcslen(ai->targv[1]));
+ len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -199,7 +199,7 @@ static TCHAR *parseLen(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- return itot((int)_tcslen(ai->targv[1]));
+ return itot((int)mir_tstrlen(ai->targv[1]));
}
static TCHAR *parseLineCount(ARGUMENTSINFO *ai)
@@ -209,7 +209,7 @@ static TCHAR *parseLineCount(ARGUMENTSINFO *ai) int count = 1;
TCHAR *cur = ai->targv[1];
- while (cur < (ai->targv[1] + _tcslen(ai->targv[1]))) {
+ while (cur < (ai->targv[1] + mir_tstrlen(ai->targv[1]))) {
if (!_tcsncmp(cur, _T("\r\n"), 2)) {
count++;
cur++;
@@ -242,7 +242,7 @@ static TCHAR *parseLongest(ARGUMENTSINFO *ai) unsigned int iLong = 1;
for (unsigned int i = 2; i < ai->argc; i++)
- if (_tcslen(ai->targv[i]) > _tcslen(ai->targv[iLong]))
+ if (mir_tstrlen(ai->targv[i]) > mir_tstrlen(ai->targv[iLong]))
iLong = i;
return mir_tstrdup(ai->targv[iLong]);
@@ -269,12 +269,12 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -296,14 +296,14 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- unsigned int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- TCHAR *res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ unsigned int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
+ TCHAR *res = (TCHAR*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
_tcscpy(res, ai->targv[1]);
- TCHAR *cur = res + _tcslen(ai->targv[1]);
+ TCHAR *cur = res + mir_tstrlen(ai->targv[1]);
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -323,7 +323,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -352,7 +352,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) if (padding < 0)
return NULL;
- int addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
+ int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -377,11 +377,11 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) if (count < 0)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((count * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
for (int i = 0; i < count; i++)
_tcscat(res, ai->targv[1]);
@@ -398,22 +398,22 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) size_t pos = 0;
TCHAR *res = mir_tstrdup(ai->targv[1]);
for (size_t i = 2; i < ai->argc; i += 2) {
- if (_tcslen(ai->targv[i]) == 0)
+ if (mir_tstrlen(ai->targv[i]) == 0)
continue;
- for (pos = 0; pos<_tcslen(res); pos++) {
+ for (pos = 0; pos<mir_tstrlen(res); pos++) {
cur = res + pos;
- if (!_tcsncmp(cur, ai->targv[i], _tcslen(ai->targv[i]))) {
- if (_tcslen(ai->targv[i + 1]) > _tcslen(ai->targv[i])) {
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(ai->targv[i + 1]) - _tcslen(ai->targv[i]) + 1)*sizeof(TCHAR));
+ if (!_tcsncmp(cur, ai->targv[i], mir_tstrlen(ai->targv[i]))) {
+ if (mir_tstrlen(ai->targv[i + 1]) > mir_tstrlen(ai->targv[i])) {
+ res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(ai->targv[i + 1]) - mir_tstrlen(ai->targv[i]) + 1)*sizeof(TCHAR));
cur = res + pos;
}
- memmove(cur + _tcslen(ai->targv[i + 1]), cur + _tcslen(ai->targv[i]), (_tcslen(cur + _tcslen(ai->targv[i])) + 1)*sizeof(TCHAR));
- memcpy(cur, ai->targv[i + 1], _tcslen(ai->targv[i + 1])*sizeof(TCHAR));
- pos += _tcslen(ai->targv[i + 1]) - 1;
+ memmove(cur + mir_tstrlen(ai->targv[i + 1]), cur + mir_tstrlen(ai->targv[i]), (mir_tstrlen(cur + mir_tstrlen(ai->targv[i])) + 1)*sizeof(TCHAR));
+ memcpy(cur, ai->targv[i + 1], mir_tstrlen(ai->targv[i + 1])*sizeof(TCHAR));
+ pos += mir_tstrlen(ai->targv[i + 1]) - 1;
}
}
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
}
return res;
@@ -428,13 +428,13 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) if (len < 0)
return NULL;
- len = min(len, (signed int)_tcslen(ai->targv[1]));
+ len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
memset(res, 0, ((len + 1)*sizeof(TCHAR)));
- _tcsncpy(res, ai->targv[1] + _tcslen(ai->targv[1]) - len, len);
+ _tcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len);
return res;
}
@@ -446,24 +446,24 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) if (ai->argc != 4)
return NULL;
- if (_tcslen(ai->targv[1]) == 0)
+ if (mir_tstrlen(ai->targv[1]) == 0)
return mir_tstrdup(ai->targv[1]);
- size_t move = ttoi(ai->targv[3]) % _tcslen(ai->targv[1]);
+ size_t move = ttoi(ai->targv[3]) % mir_tstrlen(ai->targv[1]);
size_t display = ttoi(ai->targv[2]);
- if (display > _tcslen(ai->targv[1]))
- display = (unsigned)_tcslen(ai->targv[1]);
+ if (display > mir_tstrlen(ai->targv[1]))
+ display = (unsigned)mir_tstrlen(ai->targv[1]);
- TCHAR *res = (TCHAR*)mir_alloc((2 * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
- memset(res, 0, ((2 * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((2 * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
_tcscpy(res, ai->targv[1]);
_tcscat(res, ai->targv[1]);
- memmove(res, res + move, (_tcslen(res + move) + 1)*sizeof(TCHAR));
+ memmove(res, res + move, (mir_tstrlen(res + move) + 1)*sizeof(TCHAR));
*(res + display) = 0;
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
return res;
}
@@ -475,7 +475,7 @@ static TCHAR *parseShortest(ARGUMENTSINFO *ai) int iShort = 1;
for (unsigned i = 2; i < ai->argc; i++)
- if (_tcslen(ai->targv[i]) < _tcslen(ai->targv[iShort]))
+ if (mir_tstrlen(ai->targv[i]) < mir_tstrlen(ai->targv[iShort]))
iShort = i;
return mir_tstrdup(ai->targv[iShort]);
@@ -594,9 +594,9 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) int to, from = max(ttoi(ai->targv[2]) - 1, 0);
if (ai->argc > 3)
- to = min(ttoi(ai->targv[3]), (int)_tcslen(ai->targv[1]));
+ to = min(ttoi(ai->targv[3]), (int)mir_tstrlen(ai->targv[1]));
else
- to = (int)_tcslen(ai->targv[1]);
+ to = (int)mir_tstrlen(ai->targv[1]);
if (to < from)
return NULL;
@@ -640,7 +640,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) while (*scur == ' ')
scur++;
- TCHAR *ecur = ai->targv[1] + _tcslen(ai->targv[1]) - 1;
+ TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1;
while ((*ecur == ' ') && (ecur > ai->targv[1]))
ecur--;
@@ -660,7 +660,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) static TCHAR *parseTab(ARGUMENTSINFO *ai)
{
int count = 1;
- if ((ai->argc == 2) && (_tcslen(ai->targv[1]) > 0))
+ if ((ai->argc == 2) && (mir_tstrlen(ai->targv[1]) > 0))
count = ttoi(ai->targv[1]);
if (count < 0)
@@ -701,7 +701,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w) scur++;
count++;
- while ((count < w) && (scur < szString + _tcslen(szString))) {
+ while ((count < w) && (scur < szString + mir_tstrlen(szString))) {
if (*scur == ' ') {
while (*scur == ' ')
scur++;
@@ -735,7 +735,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) TCHAR *res = NULL;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
- if (_tcslen(ai->targv[3]) > 0)
+ if (mir_tstrlen(ai->targv[3]) > 0)
to = ttoi(ai->targv[3]);
else
to = 100000; // rework
@@ -751,7 +751,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) return res;
if (res != NULL) {
- TCHAR *pres = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR));
+ TCHAR *pres = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(TCHAR));
if (pres != NULL) {
res = pres;
_tcscat(res, _T(" "));
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 7551ecab15..35ba4e21df 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -51,10 +51,10 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) if (ai->argc != 2)
return NULL;
- if (_tcslen(ai->targv[1]) == 0)
+ if (mir_tstrlen(ai->targv[1]) == 0)
szCounter = mir_tstrdup(_T("\\Processor(_Total)\\% Processor Time"));
else {
- int size = (int)_tcslen(ai->targv[1]) + 32;
+ int size = (int)mir_tstrlen(ai->targv[1]) + 32;
szCounter = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
if (szCounter == NULL)
return NULL;
@@ -116,7 +116,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai)
{
TCHAR *szFormat;
- if (ai->argc == 1 || (ai->argc > 1 && _tcslen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1 && mir_tstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -137,7 +137,7 @@ static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai) static TCHAR *parseCurrentTime(ARGUMENTSINFO *ai)
{
TCHAR *szFormat;
- if (ai->argc == 1 || (ai->argc > 1) && (_tcslen(ai->targv[1]) == 0))
+ if (ai->argc == 1 || (ai->argc > 1) && (mir_tstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
@@ -168,13 +168,13 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]);
size_t bi, ei;
- for (ei = 0; ei < _tcslen(ai->targv[1]); ei++) {
+ for (ei = 0; ei < mir_tstrlen(ai->targv[1]); ei++) {
if (ai->targv[1][ei] == '\\')
depth--;
if (!depth)
break;
}
- if (ei >= _tcslen(ai->targv[1]))
+ if (ei >= mir_tstrlen(ai->targv[1]))
return ai->targv[1];
for (bi = ei - 1; bi > 0; bi--)
@@ -203,7 +203,7 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) if (depth <= 0)
return NULL;
- TCHAR *ecur = ai->targv[1] + _tcslen(ai->targv[1]);
+ TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]);
while (depth > 0) {
while ((*ecur != '\\') && (ecur > ai->targv[1]))
ecur--;
@@ -226,17 +226,17 @@ static int getTime(TCHAR *szTime, struct tm *date) {
// do some extra checks here
TCHAR *cur = szTime;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_mon = _tcstoul(cur, &cur, 10) - 1;
cur++;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_mday = _tcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_year = _tcstoul(cur, &cur, 10);
@@ -247,17 +247,17 @@ static int getTime(TCHAR *szTime, struct tm *date) date->tm_year = date->tm_year < 38 ? date->tm_year + 100 : date->tm_year;
cur++;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_hour = _tcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_min = _tcstoul(cur, &cur, 10);
cur++;
- if (cur >= szTime + _tcslen(szTime))
+ if (cur >= szTime + mir_tstrlen(szTime))
return -1;
date->tm_sec = _tcstoul(cur, &cur, 10);
@@ -386,11 +386,11 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) if (*ai->targv[4] == 'd')
bFiles = FALSE;
}
- if (tszFirst[_tcslen(tszFirst) - 1] == '\\')
- _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - _tcslen(tszFirst) - 1);
+ if (tszFirst[mir_tstrlen(tszFirst) - 1] == '\\')
+ _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
else {
- _tcsncat(tszFirst, _T("\\"), SIZEOF(tszFirst) - _tcslen(tszFirst) - 1);
- _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - _tcslen(tszFirst) - 1);
+ _tcsncat(tszFirst, _T("\\"), SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
+ _tcsncat(tszFirst, tszFilter, SIZEOF(tszFirst) - mir_tstrlen(tszFirst) - 1);
}
WIN32_FIND_DATA ffd;
@@ -399,17 +399,17 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) return NULL;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
_tcscpy(tszRes, ffd.cFileName);
}
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
if (tszRes != NULL) {
_tcscat(tszRes, tszSeperator);
- tszRes = (TCHAR*)mir_realloc(tszRes, (_tcslen(tszRes) + _tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
}
else {
- tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
_tcscpy(tszRes, _T(""));
}
_tcscat(tszRes, ffd.cFileName);
@@ -530,7 +530,7 @@ static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai) if (timestamp == 0)
return NULL;
- if ((ai->argc == 2) || ((ai->argc > 2) && (_tcslen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -562,7 +562,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) return NULL;
TCHAR *szFormat;
- if ((ai->argc == 2) || ((ai->argc > 2) && (_tcslen(ai->targv[2]) == 0)))
+ if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
szFormat = ai->targv[2];
@@ -859,7 +859,7 @@ static TCHAR *parseClipboard(ARGUMENTSINFO *ai) HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData != NULL) {
TCHAR *tszText = (TCHAR*)GlobalLock(hData);
- size_t len = _tcslen(tszText);
+ size_t len = mir_tstrlen(tszText);
res = (TCHAR*)mir_alloc((len + 1) * sizeof(TCHAR));
_tcscpy(res, tszText);
res[len] = 0;
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index 8a711a1524..ea5a833786 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -26,7 +26,7 @@ static int vrCount = 0; static int addToVariablesRegister(TCHAR *szName, TCHAR *szText)
{
- if ((szName == NULL) || (szText == NULL) || (_tcslen(szName) <= 0))
+ if ((szName == NULL) || (szText == NULL) || (mir_tstrlen(szName) <= 0))
return -1;
mir_cslock lck(csVarRegister);
@@ -50,7 +50,7 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) static TCHAR *searchVariableRegister(TCHAR *szName)
{
- if ((szName == NULL) || (_tcslen(szName) <= 0))
+ if ((szName == NULL) || (mir_tstrlen(szName) <= 0))
return NULL;
mir_cslock lck(csVarRegister);
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index a4722f82d2..6bfb84ad4a 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(TCHAR *tszStr)
{
- return (DWORD)hashlittle(tszStr, _tcslen(tszStr)*sizeof(TCHAR), 0);
+ return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(TCHAR), 0);
}
static TokenRegisterEntry* FindTokenRegisterByName(TCHAR *name)
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index fc92c323bc..3c5652f6f1 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -161,7 +161,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) pargv = argv = NULL; //fi->pCount = 0; memcpy(&afi, fi, sizeof(afi)); - for (pos = 0; pos < _tcslen(string); pos++) { + for (pos = 0; pos < mir_tstrlen(string); pos++) { // string may move in memory, iterate by remembering the position in the string cur = string+pos; // mir_free memory from last iteration, this way we can bail out at any time in the loop @@ -175,46 +175,46 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) pargv = argv = NULL; // new round if (*cur == DONTPARSE_CHAR) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); if (*cur == DONTPARSE_CHAR) continue; while ( (*cur != DONTPARSE_CHAR) && (*cur != 0)) cur++; - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur-string-1; continue; } // remove end of lines else if ((!_tcsncmp(cur, _T("\r\n"), 2)) && (gParseOpts.bStripEOL)) { - memmove(cur, cur+2, (_tcslen(cur+2)+1)*sizeof(TCHAR)); + memmove(cur, cur+2, (mir_tstrlen(cur+2)+1)*sizeof(TCHAR)); pos = cur-string-1; continue; } else if ((*cur == '\n' && gParseOpts.bStripEOL) || (*cur == ' ' && gParseOpts.bStripWS)) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur - string - 1; continue; } // remove comments - else if (!_tcsncmp(cur, _T(COMMENT_STRING), _tcslen(_T(COMMENT_STRING)))) { + else if (!_tcsncmp(cur, _T(COMMENT_STRING), mir_tstrlen(_T(COMMENT_STRING)))) { scur = cur; while ( _tcsncmp(cur, _T("\r\n"), 2) && *cur != '\n' && *cur != 0) cur++; if (*cur == 0) { *scur = 0; - string = (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR)); + string = (TCHAR*)mir_realloc(string, (mir_tstrlen(string)+1)*sizeof(TCHAR)); continue; } - memmove(scur, cur, (_tcslen(cur)+1)*sizeof(TCHAR)); + memmove(scur, cur, (mir_tstrlen(cur)+1)*sizeof(TCHAR)); pos = scur-string-1; continue; } else if ((*cur != FIELD_CHAR) && (*cur != FUNC_CHAR) && (*cur != FUNC_ONCE_CHAR)) { if (gParseOpts.bStripAll) { - memmove(cur, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR)); + memmove(cur, cur+1, (mir_tstrlen(cur+1)+1)*sizeof(TCHAR)); pos = cur - string - 1; } continue; @@ -255,7 +255,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } scur = cur; // store this pointer for later use if (*cur == FIELD_CHAR) { - size_t len = _tcslen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); + size_t len = mir_tstrlen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]); cur++; if (*(cur + len) != FIELD_CHAR) { // the next char after the token should be % fi->eCount++; @@ -266,7 +266,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) { TCHAR *argcur; - cur += _tcslen(tr->tszTokenString)+1; + cur += mir_tstrlen(tr->tszTokenString)+1; argcur = getArguments(cur, &argv, &argc); if ((argcur == cur) || (argcur == NULL)) { fi->eCount++; @@ -339,8 +339,8 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } }*/ - size_t parsedTokenLen = _tcslen(parsedToken); - size_t initStrLen = _tcslen(string); + size_t parsedTokenLen = mir_tstrlen(parsedToken); + size_t initStrLen = mir_tstrlen(string); size_t tokenLen = cur-scur; scurPos = scur-string; curPos = cur-string; @@ -354,10 +354,10 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) } scur = string+scurPos; cur = string+curPos; - memmove(scur + parsedTokenLen, cur, (_tcslen(cur)+1)*sizeof(TCHAR)); + memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur)+1)*sizeof(TCHAR)); memcpy(scur, parsedToken, parsedTokenLen*sizeof(TCHAR)); { - size_t len = _tcslen(string); + size_t len = mir_tstrlen(string); string = (TCHAR*)mir_realloc(string, (len+1)*sizeof(TCHAR)); } if (( ai.flags & AIF_DONTPARSE ) || tmpVarPos >= 0) @@ -375,7 +375,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) mir_free(argv[i]); mir_free(argv); - return (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR)); + return (TCHAR*)mir_realloc(string, (mir_tstrlen(string)+1)*sizeof(TCHAR)); } /* |