diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-26 09:20:25 +0000 |
commit | 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac (patch) | |
tree | 2e8bb660c908b54914abd562af8aafa4a486c846 /plugins/Variables/src | |
parent | a61c8728b379057fe7f0a0d86fe0b037598229dd (diff) |
less TCHARs:
- TCHAR is replaced with wchar_t everywhere;
- LPGENT replaced with either LPGENW or LPGEN;
- fixes for ANSI plugins that improperly used _t functions;
- TCHAR *t removed from MAllStrings;
- ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz*
git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r-- | plugins/Variables/src/contact.cpp | 20 | ||||
-rw-r--r-- | plugins/Variables/src/contact.h | 2 | ||||
-rw-r--r-- | plugins/Variables/src/help.cpp | 44 | ||||
-rw-r--r-- | plugins/Variables/src/options.cpp | 6 | ||||
-rw-r--r-- | plugins/Variables/src/parse_alias.cpp | 38 | ||||
-rw-r--r-- | plugins/Variables/src/parse_alias.h | 8 | ||||
-rw-r--r-- | plugins/Variables/src/parse_external.cpp | 34 | ||||
-rw-r--r-- | plugins/Variables/src/parse_inet.cpp | 12 | ||||
-rw-r--r-- | plugins/Variables/src/parse_logic.cpp | 44 | ||||
-rw-r--r-- | plugins/Variables/src/parse_math.cpp | 36 | ||||
-rw-r--r-- | plugins/Variables/src/parse_metacontacts.cpp | 12 | ||||
-rw-r--r-- | plugins/Variables/src/parse_miranda.cpp | 102 | ||||
-rw-r--r-- | plugins/Variables/src/parse_regexp.cpp | 10 | ||||
-rw-r--r-- | plugins/Variables/src/parse_str.cpp | 272 | ||||
-rw-r--r-- | plugins/Variables/src/parse_system.cpp | 158 | ||||
-rw-r--r-- | plugins/Variables/src/parse_variables.cpp | 10 | ||||
-rw-r--r-- | plugins/Variables/src/parse_variables.h | 4 | ||||
-rw-r--r-- | plugins/Variables/src/stdafx.h | 22 | ||||
-rw-r--r-- | plugins/Variables/src/tokenregister.cpp | 22 | ||||
-rw-r--r-- | plugins/Variables/src/variables.cpp | 56 |
20 files changed, 456 insertions, 456 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 0ab768ffd4..416cc360c8 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -22,7 +22,7 @@ struct _tagType
{
int cnfCode;
- TCHAR* str;
+ wchar_t* str;
}
static builtinCnfs[] =
{
@@ -77,7 +77,7 @@ static builtinCnfs[] = struct CONTACTCE
{
int flags;
- TCHAR* tszContact;
+ wchar_t* tszContact;
MCONTACT hContact;
};
@@ -94,7 +94,7 @@ static OBJLIST<CONTACTCE> arContactCache(20, SortContactCache); static mir_cs csContactCache;
// converts a string into a CNF_ type
-BYTE getContactInfoType(TCHAR* type)
+BYTE getContactInfoType(wchar_t* type)
{
if (type == NULL || mir_tstrlen(type) == 0)
return 0;
@@ -107,7 +107,7 @@ BYTE getContactInfoType(TCHAR* type) }
// returns info about a contact as a string
-TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
+wchar_t* getContactInfoT(BYTE type, MCONTACT hContact)
{
/* returns dynamic allocated buffer with info, or NULL if failed */
if (hContact == NULL)
@@ -117,7 +117,7 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact) if (szProto == NULL)
return NULL;
- TCHAR *res = NULL;
+ wchar_t *res = NULL;
switch (type) {
case CCNF_PROTOID:
return mir_a2t(szProto);
@@ -168,7 +168,7 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact) }
// MS_VARS_GETCONTACTFROMSTRING
-MCONTACT getContactFromString(const TCHAR *tszContact, DWORD dwFlags, int nMatch)
+MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMatch)
{
/* service to retrieve a contact's HANDLE from a given string */
if (tszContact == NULL || *tszContact == 0)
@@ -183,7 +183,7 @@ MCONTACT getContactFromString(const TCHAR *tszContact, DWORD dwFlags, int nMatch // search the cache
{
- CONTACTCE tmp = { dwFlags, (TCHAR*)tszContact, 0 };
+ CONTACTCE tmp = { dwFlags, (wchar_t*)tszContact, 0 };
mir_cslock lck(csContactCache);
CONTACTCE *p = arContactCache.find(&tmp);
@@ -355,18 +355,18 @@ int deinitContactModule() // returns a string in the form <PROTOID:UNIQUEID>, cannot be _HANDLE_!
// result must be freed
-TCHAR* encodeContactToString(MCONTACT hContact)
+wchar_t* encodeContactToString(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return NULL;
- TCHAR *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
+ wchar_t *tszUniqueId = getContactInfoT(CNF_UNIQUEID, hContact);
if (tszUniqueId == NULL)
return NULL;
size_t size = mir_tstrlen(tszUniqueId) + mir_strlen(szProto) + 4;
- TCHAR *tszResult = (TCHAR *)mir_calloc(size * sizeof(TCHAR));
+ wchar_t *tszResult = (wchar_t *)mir_calloc(size * sizeof(wchar_t));
if (tszResult)
mir_sntprintf(tszResult, size, L"<%S:%s>", szProto, tszUniqueId);
return tszResult;
diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h index 55e292677c..b145a48f4f 100644 --- a/plugins/Variables/src/contact.h +++ b/plugins/Variables/src/contact.h @@ -96,4 +96,4 @@ // CNF_ type possible
#define CI_NEEDCOUNT 0x80000000 // returns contacts count
-TCHAR *encodeContactToString(MCONTACT hContact);
+wchar_t *encodeContactToString(MCONTACT hContact);
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp index 842695deb3..57d5ad1e0c 100644 --- a/plugins/Variables/src/help.cpp +++ b/plugins/Variables/src/help.cpp @@ -129,7 +129,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM MCONTACT hItem, hContact = wParam; log_debugA("VARM_SETSUBJECT: %u", hContact); if (hContact == INVALID_CONTACT_ID) { - TCHAR *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT); + wchar_t *tszContact = db_get_tsa(NULL, MODULENAME, SETTING_SUBJECT); log_debugA("VARM_SETSUBJECT: %s", tszContact); if (tszContact != NULL) { hContact = getContactFromString(tszContact, CI_PROTOID); @@ -202,7 +202,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM MCONTACT hContact = (MCONTACT)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0); if (hContact != NULL) { - TCHAR *tszContact = encodeContactToString(hContact); + wchar_t *tszContact = encodeContactToString(hContact); if (tszContact != NULL) { db_set_ts(NULL, MODULENAME, SETTING_SUBJECT, tszContact); mir_free(tszContact); @@ -214,7 +214,7 @@ static INT_PTR CALLBACK clistDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } // dialog box for the tokens -static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) { +static wchar_t *getTokenCategory(TOKENREGISTEREX *tr) { if (tr == NULL) { return NULL; } @@ -228,20 +228,20 @@ static TCHAR *getTokenCategory(TOKENREGISTEREX *tr) { *cur = 0; helpText = ( char* )mir_realloc(helpText, mir_strlen(helpText)+1); - TCHAR *res = mir_a2t(helpText); + wchar_t *res = mir_a2t(helpText); mir_free(helpText); return res; } cur++; } - TCHAR *res = mir_a2t(helpText); + wchar_t *res = mir_a2t(helpText); mir_free(helpText); return res; } -static TCHAR *getHelpDescription(TOKENREGISTEREX *tr) +static wchar_t *getHelpDescription(TOKENREGISTEREX *tr) { if (tr == NULL) return NULL; @@ -251,7 +251,7 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr) if (*cur == '\t') { cur = mir_strdup(cur+1); - TCHAR *res = mir_a2t(cur); + wchar_t *res = mir_a2t(cur); mir_free(cur); return res; @@ -263,7 +263,7 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr) } -static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) +static wchar_t *getTokenDescription(TOKENREGISTEREX *tr) { if (tr == NULL) return NULL; @@ -276,7 +276,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) return NULL; char *cur = helpText; - TCHAR *tArgs = NULL; + wchar_t *tArgs = NULL; char *args = NULL, *first = NULL, *second = NULL; while (*cur != 0) { if (*cur == '\t') { @@ -295,7 +295,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr) else args = NULL; size_t len = mir_tstrlen(tr->tszTokenString) + (args!=NULL?mir_strlen(args):0) + 3; - TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR)); + wchar_t *desc = (wchar_t*)mir_calloc(len * sizeof(wchar_t)); if (desc == NULL) { mir_free(helpText); return NULL; @@ -344,7 +344,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA case WM_INITDIALOG: { TOKENREGISTEREX *tr; - TCHAR *tszTokenDesc, *tszHelpDesc, *last, *cat, *text; + wchar_t *tszTokenDesc, *tszHelpDesc, *last, *cat, *text; // token list things HWND hList = GetDlgItem(hwndDlg, IDC_TOKENLIST); @@ -465,11 +465,11 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM, LPA break; size_t len = mir_tstrlen(tr->tszTokenString) + 2; - TCHAR *tokenString = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR)); + wchar_t *tokenString = (wchar_t*)mir_alloc((len+1)*sizeof(wchar_t)); if (tokenString == NULL) break; - memset(tokenString, 0, ((len + 1) * sizeof(TCHAR))); + 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 : '('); SendDlgItemMessage(hwndInputDlg, IDC_TESTSTRING, EM_REPLACESEL, TRUE, (LPARAM)tokenString); mir_free(tokenString); @@ -673,18 +673,18 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM case VARM_PARSE: { - TCHAR *string = Hlp_GetDlgItemText(hwndDlg, IDC_TESTSTRING), *extraText; + wchar_t *string = Hlp_GetDlgItemText(hwndDlg, IDC_TESTSTRING), *extraText; int len = SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXTLENGTH, 0, 0); if (len > 0) { - extraText = (TCHAR*)mir_calloc((len + 1)* sizeof(TCHAR)); + extraText = (wchar_t*)mir_calloc((len + 1)* sizeof(wchar_t)); SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)extraText); } else extraText = NULL; if (string != NULL) { - TCHAR *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); + wchar_t *newString = variables_parsedup(string, extraText, (MCONTACT)SendMessage(GetParent(hwndDlg), VARM_GETSUBJECT, 0, 0)); if (newString != NULL) { - TCHAR *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT); + wchar_t *oldString = Hlp_GetDlgItemText(hwndDlg, IDC_RESULT); if (oldString == NULL || mir_tstrcmp(oldString, newString)) SetDlgItemText(hwndDlg, IDC_RESULT, newString); @@ -819,7 +819,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l } } else if (dat->vhs->hwndCtrl != NULL) { - TCHAR *tszText = Hlp_GetWindowText(dat->vhs->hwndCtrl); + wchar_t *tszText = Hlp_GetWindowText(dat->vhs->hwndCtrl); if (tszText != NULL) { SendMessage(hwndDlg, VARM_SETINPUTTEXT, 0, (LPARAM)tszText); mir_free(tszText); @@ -908,7 +908,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l if (len > 0) { if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) { if (dat->vhs->fi->flags&FIF_UNICODE) { - dat->vhs->fi->tszFormat = (TCHAR*)mir_calloc((len + 1)*sizeof(WCHAR)); + dat->vhs->fi->tszFormat = (wchar_t*)mir_calloc((len + 1)*sizeof(WCHAR)); SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->tszFormat); } else { @@ -922,9 +922,9 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l if (dat->vhs->hwndCtrl != NULL) { int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0); if (len > 0) { - TCHAR *tszText; + wchar_t *tszText; - tszText = (TCHAR*)mir_calloc((len + 1)*sizeof(TCHAR)); + tszText = (wchar_t*)mir_calloc((len + 1)*sizeof(wchar_t)); if (tszText != NULL) { SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len + 1, (LPARAM)tszText); SetWindowText(dat->vhs->hwndCtrl, tszText); @@ -942,7 +942,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l int len = SendMessage(hwndDlg, VARM_GETEXTRATEXTLENGTH, 0, 0); if (len > 0) { if (dat->vhs->fi->flags&FIF_UNICODE) { - dat->vhs->fi->tszExtraText = (TCHAR*)mir_calloc((len + 1)*sizeof(WCHAR)); + dat->vhs->fi->tszExtraText = (wchar_t*)mir_calloc((len + 1)*sizeof(WCHAR)); SendMessage(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len + 1, (LPARAM)dat->vhs->fi->tszExtraText); } else { diff --git a/plugins/Variables/src/options.cpp b/plugins/Variables/src/options.cpp index bb381ef238..d07ad89999 100644 --- a/plugins/Variables/src/options.cpp +++ b/plugins/Variables/src/options.cpp @@ -85,7 +85,7 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int len = SendDlgItemMessage(hwndDlg, IDC_FORMATTEXT, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
- TCHAR *szFormatText = (TCHAR*)mir_calloc((len+1)* sizeof(TCHAR));
+ wchar_t *szFormatText = (wchar_t*)mir_calloc((len+1)* sizeof(wchar_t));
if (szFormatText == NULL)
break;
@@ -103,9 +103,9 @@ static INT_PTR CALLBACK SetOptsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA case VARM_PARSE:
{
- TCHAR *string = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
+ wchar_t *string = Hlp_GetDlgItemText(hwndDlg, IDC_FORMATTEXT);
if (string != NULL) {
- TCHAR *newString = variables_parsedup(string, NULL, NULL);
+ wchar_t *newString = variables_parsedup(string, NULL, NULL);
if (newString != NULL) {
SetDlgItemText(hwndDlg, IDC_RESULT, newString);
mir_free(newString);
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)
diff --git a/plugins/Variables/src/parse_alias.h b/plugins/Variables/src/parse_alias.h index 5876367aad..8cec5ded4f 100644 --- a/plugins/Variables/src/parse_alias.h +++ b/plugins/Variables/src/parse_alias.h @@ -19,12 +19,12 @@ #define ADDALIAS L"alias"
-int isValidTokenChar(TCHAR tc);
+int isValidTokenChar(wchar_t tc);
-struct TArgList : public LIST<TCHAR>
+struct TArgList : public LIST<wchar_t>
{
TArgList() :
- LIST<TCHAR>(1)
+ LIST<wchar_t>(1)
{}
void destroy()
@@ -35,4 +35,4 @@ struct TArgList : public LIST<TCHAR> }
};
-TCHAR* getArguments(TCHAR *string, TArgList &aargv);
+wchar_t* getArguments(wchar_t *string, TArgList &aargv);
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index 4dca2905f2..873be4f90b 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -19,7 +19,7 @@ #include "stdafx.h"
-static TCHAR *getFullWinampTitleText()
+static wchar_t *getFullWinampTitleText()
{
HWND hwndWinamp = FindWindow(L"STUDIO", NULL);
if (hwndWinamp == NULL)
@@ -29,7 +29,7 @@ static TCHAR *getFullWinampTitleText() return NULL;
SIZE_T dwWinTextLength = (GetWindowTextLength(hwndWinamp) + 1);
- TCHAR *szWinText = (TCHAR*)mir_alloc(dwWinTextLength * sizeof(TCHAR));
+ wchar_t *szWinText = (wchar_t*)mir_alloc(dwWinTextLength * sizeof(wchar_t));
if (szWinText == NULL)
return NULL;
@@ -37,7 +37,7 @@ static TCHAR *getFullWinampTitleText() mir_free(szWinText);
return NULL;
}
- TCHAR *szTitle = (TCHAR*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(TCHAR));
+ wchar_t *szTitle = (wchar_t*)mir_alloc((2 * mir_tstrlen(szWinText) + 1)*sizeof(wchar_t));
if (szTitle == NULL) {
mir_free(szWinText);
return NULL;
@@ -49,19 +49,19 @@ static TCHAR *getFullWinampTitleText() return szTitle;
}
-static TCHAR *parseWinampSong(ARGUMENTSINFO *ai)
+static wchar_t *parseWinampSong(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
- TCHAR *res = NULL;
- TCHAR *szTitle = getFullWinampTitleText();
+ wchar_t *res = NULL;
+ wchar_t *szTitle = getFullWinampTitleText();
if (szTitle == NULL)
return NULL;
- TCHAR *scur = _tcschr(szTitle, '.');
- TCHAR *cur;
- if ((scur == NULL) || ((cur = _tcsstr(scur, L" - Winamp")) == NULL) || (scur >= cur) || (scur > (szTitle + mir_tstrlen(szTitle) - 2)) || (cur > (szTitle + mir_tstrlen(szTitle)))) {
+ 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)))) {
mir_free(szTitle);
return NULL;
}
@@ -75,23 +75,23 @@ static TCHAR *parseWinampSong(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseWinampState(ARGUMENTSINFO *ai)
+static wchar_t *parseWinampState(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
- TCHAR *res = NULL;
- TCHAR *szTitle = getFullWinampTitleText();
+ wchar_t *res = NULL;
+ wchar_t *szTitle = getFullWinampTitleText();
if (szTitle == NULL)
return NULL;
- TCHAR *scur = _tcschr(szTitle, '.');
- TCHAR *cur;
- if (scur == NULL || (cur = _tcsstr(scur, L" - Winamp")) == NULL)
+ wchar_t *scur = wcschr(szTitle, '.');
+ wchar_t *cur;
+ if (scur == NULL || (cur = wcsstr(scur, L" - Winamp")) == NULL)
res = mir_tstrdup(TranslateT("Stopped"));
- else if ((!_tcsncmp(cur + 10, L"[Stopped]", 9)))
+ else if ((!wcsncmp(cur + 10, L"[Stopped]", 9)))
res = mir_tstrdup(TranslateT("Stopped"));
- else if ((!_tcsncmp(cur + 10, L"[Paused]", 8)))
+ else if ((!wcsncmp(cur + 10, L"[Paused]", 8)))
res = mir_tstrdup(TranslateT("Paused"));
else
res = mir_tstrdup(L"Playing");
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index 59d3cc4ce8..58c96df015 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -19,7 +19,7 @@ #include "stdafx.h"
-static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai)
+static wchar_t *parseUrlEnc(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -45,12 +45,12 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) cur += mir_strlen(hex);
}
- TCHAR *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2t(res);
mir_free(res);
return tres;
}
-static TCHAR *parseUrlDec(ARGUMENTSINFO *ai)
+static wchar_t *parseUrlDec(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -72,12 +72,12 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) }
res = (char*)mir_realloc(res, mir_strlen(res) + 1);
- TCHAR *tres = mir_a2t(res);
+ wchar_t *tres = mir_a2t(res);
mir_free(res);
return tres;
}
-static TCHAR *parseNToA(ARGUMENTSINFO *ai)
+static wchar_t *parseNToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -87,7 +87,7 @@ static TCHAR *parseNToA(ARGUMENTSINFO *ai) return mir_a2t(inet_ntoa(in));
}
-static TCHAR *parseHToA(ARGUMENTSINFO *ai)
+static wchar_t *parseHToA(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp index c06d8445a9..763136f821 100644 --- a/plugins/Variables/src/parse_logic.cpp +++ b/plugins/Variables/src/parse_logic.cpp @@ -19,7 +19,7 @@ #include "stdafx.h"
-static TCHAR *parseAnd(ARGUMENTSINFO *ai)
+static wchar_t *parseAnd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
@@ -39,7 +39,7 @@ static TCHAR *parseAnd(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseFalse(ARGUMENTSINFO *ai)
+static wchar_t *parseFalse(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
@@ -48,7 +48,7 @@ static TCHAR *parseFalse(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseIf(ARGUMENTSINFO *ai)
+static wchar_t *parseIf(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -62,7 +62,7 @@ static TCHAR *parseIf(ARGUMENTSINFO *ai) return mir_tstrdup((fi.eCount == 0) ? ai->targv[2] : ai->targv[3]);
}
-static TCHAR *parseIf2(ARGUMENTSINFO *ai)
+static wchar_t *parseIf2(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -71,7 +71,7 @@ static TCHAR *parseIf2(ARGUMENTSINFO *ai) memcpy(&fi, ai->fi, sizeof(fi));
fi.eCount = fi.pCount = 0;
fi.tszFormat = ai->targv[1];
- TCHAR *szCondition = formatString(&fi);
+ wchar_t *szCondition = formatString(&fi);
if (fi.eCount == 0)
return szCondition;
@@ -79,14 +79,14 @@ static TCHAR *parseIf2(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[2]);
}
-static TCHAR *parseIf3(ARGUMENTSINFO *ai)
+static wchar_t *parseIf3(ARGUMENTSINFO *ai)
{
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
for (unsigned i = 1; i < ai->argc; i++) {
fi.eCount = fi.pCount = 0;
fi.tszFormat = ai->targv[i];
- TCHAR *szCondition = formatString(&fi);
+ wchar_t *szCondition = formatString(&fi);
if (fi.eCount == 0)
return szCondition;
@@ -96,7 +96,7 @@ static TCHAR *parseIf3(ARGUMENTSINFO *ai) return NULL;
}
-static TCHAR *parseIfequal(ARGUMENTSINFO *ai)
+static wchar_t *parseIfequal(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return NULL;
@@ -116,7 +116,7 @@ static TCHAR *parseIfequal(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[4]);
}
-static TCHAR *parseIfgreater(ARGUMENTSINFO *ai)
+static wchar_t *parseIfgreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return NULL;
@@ -136,7 +136,7 @@ static TCHAR *parseIfgreater(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[4]);
}
-static TCHAR *parseIflonger(ARGUMENTSINFO *ai)
+static wchar_t *parseIflonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return NULL;
@@ -161,12 +161,12 @@ static TCHAR *parseIflonger(ARGUMENTSINFO *ai) ?for(init, cond, incr, show)
*/
-static TCHAR *parseFor(ARGUMENTSINFO *ai)
+static wchar_t *parseFor(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return NULL;
- TCHAR *res = mir_tstrdup(L"");
+ wchar_t *res = mir_tstrdup(L"");
FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
@@ -177,16 +177,16 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) mir_free(formatString(&fi));
while (fi.eCount == 0) {
fi.tszFormat = ai->targv[4];
- TCHAR *parsed = formatString(&fi);
+ wchar_t *parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
- res = (TCHAR*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(TCHAR));
+ res = (wchar_t*)mir_alloc(mir_tstrlen(parsed) + 1 * sizeof(wchar_t));
if (res == NULL) {
mir_free(parsed);
return NULL;
}
}
- else res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(TCHAR));
+ else res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(parsed) + 1)*sizeof(wchar_t));
mir_tstrcat(res, parsed);
mir_free(parsed);
@@ -201,7 +201,7 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseEqual(ARGUMENTSINFO *ai)
+static wchar_t *parseEqual(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -212,7 +212,7 @@ static TCHAR *parseEqual(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseGreater(ARGUMENTSINFO *ai)
+static wchar_t *parseGreater(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -223,7 +223,7 @@ static TCHAR *parseGreater(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseLonger(ARGUMENTSINFO *ai)
+static wchar_t *parseLonger(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -234,7 +234,7 @@ static TCHAR *parseLonger(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseNot(ARGUMENTSINFO *ai)
+static wchar_t *parseNot(ARGUMENTSINFO *ai)
{
if (ai->argc != 2) {
return NULL;
@@ -251,7 +251,7 @@ static TCHAR *parseNot(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseOr(ARGUMENTSINFO *ai)
+static wchar_t *parseOr(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return NULL;
@@ -271,12 +271,12 @@ static TCHAR *parseOr(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseTrue(ARGUMENTSINFO *ai)
+static wchar_t *parseTrue(ARGUMENTSINFO *ai)
{
return (ai->argc != 1) ? NULL : mir_tstrdup(L"");
}
-static TCHAR *parseXor(ARGUMENTSINFO *ai)
+static wchar_t *parseXor(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp index 0e65e29da2..a9946d8a7a 100644 --- a/plugins/Variables/src/parse_math.cpp +++ b/plugins/Variables/src/parse_math.cpp @@ -19,7 +19,7 @@ #include "stdafx.h"
-static TCHAR *parseAdd(ARGUMENTSINFO *ai)
+static wchar_t *parseAdd(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
@@ -31,7 +31,7 @@ static TCHAR *parseAdd(ARGUMENTSINFO *ai) return itot(result);
}
-static TCHAR *parseDiv(ARGUMENTSINFO *ai)
+static wchar_t *parseDiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -44,10 +44,10 @@ static TCHAR *parseDiv(ARGUMENTSINFO *ai) return itot(val1 / val2);
}
-static TCHAR *parseHex(ARGUMENTSINFO *ai)
+static wchar_t *parseHex(ARGUMENTSINFO *ai)
{
unsigned int i;
- TCHAR szVal[34];
+ wchar_t szVal[34];
if (ai->argc != 3)
return NULL;
@@ -56,11 +56,11 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) int padding = ttoi(ai->targv[2]);
mir_sntprintf(szVal, L"%x", val);
unsigned int zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 3)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(TCHAR)));
+ memset(res, 0, ((zeros + mir_tstrlen(szVal) + 3) * sizeof(wchar_t)));
mir_tstrcpy(res, L"0x");
for (i = 0; i < zeros; i++)
*(res + 2 + i) = '0';
@@ -69,7 +69,7 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseMod(ARGUMENTSINFO *ai)
+static wchar_t *parseMod(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -82,7 +82,7 @@ static TCHAR *parseMod(ARGUMENTSINFO *ai) return itot(val1 % val2);
}
-static TCHAR *parseMul(ARGUMENTSINFO *ai)
+static wchar_t *parseMul(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
@@ -94,7 +94,7 @@ static TCHAR *parseMul(ARGUMENTSINFO *ai) return itot(result);
}
-static TCHAR *parseMuldiv(ARGUMENTSINFO *ai)
+static wchar_t *parseMuldiv(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -105,7 +105,7 @@ static TCHAR *parseMuldiv(ARGUMENTSINFO *ai) return itot((ttoi(ai->targv[1])*ttoi(ai->targv[2])) / ttoi(ai->targv[3]));
}
-static TCHAR *parseMin(ARGUMENTSINFO *ai)
+static wchar_t *parseMin(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return NULL;
@@ -117,7 +117,7 @@ static TCHAR *parseMin(ARGUMENTSINFO *ai) return itot(minVal);
}
-static TCHAR *parseMax(ARGUMENTSINFO *ai)
+static wchar_t *parseMax(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return NULL;
@@ -129,26 +129,26 @@ static TCHAR *parseMax(ARGUMENTSINFO *ai) return itot(maxVal);
}
-static TCHAR *parseNum(ARGUMENTSINFO *ai)
+static wchar_t *parseNum(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
int val = ttoi(ai->targv[1]);
int padding = ttoi(ai->targv[2]);
- TCHAR *szVal = itot(val);
+ wchar_t *szVal = itot(val);
if (szVal == NULL)
return NULL;
unsigned zeros = max(padding - (signed int)mir_tstrlen(szVal), 0);
- TCHAR *res = (TCHAR*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((zeros + mir_tstrlen(szVal) + 1)*sizeof(wchar_t));
if (res == NULL) {
mir_free(szVal);
return NULL;
}
- memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(TCHAR)));
- TCHAR *cur = res;
+ memset(res, 0, ((zeros + mir_tstrlen(szVal) + 1) * sizeof(wchar_t)));
+ wchar_t *cur = res;
for (unsigned i = 0; i < zeros; i++)
*cur++ = '0';
@@ -158,12 +158,12 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseRand(ARGUMENTSINFO *)
+static wchar_t *parseRand(ARGUMENTSINFO *)
{
return itot(rand());
}
-static TCHAR *parseSub(ARGUMENTSINFO *ai)
+static wchar_t *parseSub(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
diff --git a/plugins/Variables/src/parse_metacontacts.cpp b/plugins/Variables/src/parse_metacontacts.cpp index 71ab1c08a6..ac1185edb3 100644 --- a/plugins/Variables/src/parse_metacontacts.cpp +++ b/plugins/Variables/src/parse_metacontacts.cpp @@ -19,7 +19,7 @@ #include "stdafx.h"
-static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
+static wchar_t *parseGetParent(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -39,7 +39,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- TCHAR tszID[40];
+ wchar_t tszID[40];
mir_sntprintf(tszID, L"%p", hContact);
szUniqueID = mir_tstrdup(tszID);
}
@@ -47,7 +47,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai) return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
-static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
+static wchar_t *parseGetDefault(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -67,7 +67,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- TCHAR tszID[40];
+ wchar_t tszID[40];
mir_sntprintf(tszID, L"%p", hContact);
szUniqueID = mir_tstrdup(tszID);
}
@@ -75,7 +75,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai) return CMString(FORMAT, L"<%S:%s>", szProto, szUniqueID).Detach();
}
-static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
+static wchar_t *parseGetMostOnline(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -95,7 +95,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- TCHAR tszID[40];
+ wchar_t tszID[40];
mir_sntprintf(tszID, L"%p", hContact);
szUniqueID = mir_tstrdup(tszID);
}
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 088fb00497..a25e303247 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -19,48 +19,48 @@ #include "stdafx.h"
-static TCHAR* parseCodeToStatus(ARGUMENTSINFO *ai)
+static wchar_t* parseCodeToStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
unsigned int status = ttoi(ai->targv[1]);
- TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
+ wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
return mir_tstrdup(szStatus);
return NULL;
}
-static int getContactInfoFlags(TCHAR *tszDesc)
+static int getContactInfoFlags(wchar_t *tszDesc)
{
int flags = 0;
- for (TCHAR *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) {
- if (!_tcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) {
+ for (wchar_t *cur = tszDesc; (cur < (tszDesc + mir_tstrlen(tszDesc))); cur++) {
+ if (!wcsnicmp(cur, STR_PROTOID, mir_tstrlen(STR_PROTOID))) {
flags |= CI_PROTOID;
cur += mir_tstrlen(STR_PROTOID) - 1;
}
- else if (!_tcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) {
+ else if (!wcsnicmp(cur, STR_NICK, mir_tstrlen(STR_NICK))) {
flags |= CI_NICK;
cur += mir_tstrlen(STR_NICK) - 1;
}
- else if (!_tcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) {
+ else if (!wcsnicmp(cur, STR_FIRSTNAME, mir_tstrlen(STR_FIRSTNAME))) {
flags |= CI_FIRSTNAME;
cur += mir_tstrlen(STR_FIRSTNAME) - 1;
}
- else if (!_tcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) {
+ else if (!wcsnicmp(cur, STR_LASTNAME, mir_tstrlen(STR_LASTNAME))) {
flags |= CI_LASTNAME;
cur += mir_tstrlen(STR_LASTNAME) - 1;
}
- else if (!_tcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) {
+ else if (!wcsnicmp(cur, STR_DISPLAY, mir_tstrlen(STR_DISPLAY))) {
flags |= CI_LISTNAME;
cur += mir_tstrlen(STR_DISPLAY) - 1;
}
- else if (!_tcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) {
+ else if (!wcsnicmp(cur, STR_EMAIL, mir_tstrlen(STR_EMAIL))) {
flags |= CI_EMAIL;
cur += mir_tstrlen(STR_EMAIL) - 1;
}
- else if (!_tcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) {
+ else if (!wcsnicmp(cur, STR_UNIQUEID, mir_tstrlen(STR_UNIQUEID))) {
flags |= CI_UNIQUEID;
cur += mir_tstrlen(STR_UNIQUEID) - 1;
}
@@ -74,7 +74,7 @@ static int getContactInfoFlags(TCHAR *tszDesc) return flags;
}
-static TCHAR* parseContact(ARGUMENTSINFO *ai)
+static wchar_t* parseContact(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
return NULL;
@@ -95,7 +95,7 @@ static TCHAR* parseContact(ARGUMENTSINFO *ai) return encodeContactToString(hContact);
}
-static TCHAR* parseContactCount(ARGUMENTSINFO *ai)
+static wchar_t* parseContactCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -104,7 +104,7 @@ static TCHAR* parseContactCount(ARGUMENTSINFO *ai) return itot(count);
}
-static TCHAR* parseContactInfo(ARGUMENTSINFO *ai)
+static wchar_t* parseContactInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -120,37 +120,37 @@ static TCHAR* parseContactInfo(ARGUMENTSINFO *ai) return getContactInfoT(type, hContact);
}
-static TCHAR* parseDBProfileName(ARGUMENTSINFO *ai)
+static wchar_t* parseDBProfileName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
- TCHAR name[MAX_PATH];
+ wchar_t name[MAX_PATH];
if (CallService(MS_DB_GETPROFILENAMET, _countof(name), (LPARAM)name))
return NULL;
return mir_tstrdup(name);
}
-static TCHAR* parseDBProfilePath(ARGUMENTSINFO *ai)
+static wchar_t* parseDBProfilePath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
if (CallService(MS_DB_GETPROFILEPATHT, _countof(path), (LPARAM)path))
return NULL;
return mir_tstrdup(path);
}
-static TCHAR* getDBSetting(MCONTACT hContact, char* module, char* setting, TCHAR* defaultValue)
+static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wchar_t* defaultValue)
{
DBVARIANT dbv;
if (db_get_s(hContact, module, setting, &dbv, 0))
return defaultValue;
- TCHAR *var = NULL;
+ wchar_t *var = NULL;
switch (dbv.type) {
case DBVT_BYTE:
var = itot(dbv.bVal);
@@ -176,7 +176,7 @@ static TCHAR* getDBSetting(MCONTACT hContact, char* module, char* setting, TCHAR return var;
}
-static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
+static wchar_t* parseDBSetting(ARGUMENTSINFO *ai)
{
if (ai->argc < 4)
return NULL;
@@ -198,15 +198,15 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai) return 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);
+ wchar_t *szDefaultValue = ((ai->argc > 4 && mir_tstrlen(ai->targv[4]) > 0) ? mir_tstrdup(ai->targv[4]) : NULL);
+ wchar_t *res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szDefaultValue);
mir_free(szSetting);
mir_free(szModule);
return res;
}
-static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai)
+static wchar_t* parseLastSeenDate(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
@@ -215,7 +215,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) if (hContact == INVALID_CONTACT_ID)
return NULL;
- TCHAR *szFormat;
+ wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
@@ -236,7 +236,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) lsTime.wMonth = db_get_w(hContact, szModule, "Month", 0);
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -248,7 +248,7 @@ static TCHAR* parseLastSeenDate(ARGUMENTSINFO *ai) return res;
}
-static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai)
+static wchar_t* parseLastSeenTime(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
@@ -257,7 +257,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) if (hContact == INVALID_CONTACT_ID)
return NULL;
- TCHAR *szFormat;
+ wchar_t *szFormat;
if (ai->argc == 2 || (ai->argc > 2 && mir_tstrlen(ai->targv[2]) == 0))
szFormat = NULL;
else
@@ -279,7 +279,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) lsTime.wYear = db_get_w(hContact, szModule, "Year", 0);
int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -291,7 +291,7 @@ static TCHAR* parseLastSeenTime(ARGUMENTSINFO *ai) return res;
}
-static TCHAR* parseLastSeenStatus(ARGUMENTSINFO *ai)
+static wchar_t* parseLastSeenStatus(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -305,27 +305,27 @@ static TCHAR* parseLastSeenStatus(ARGUMENTSINFO *ai) if (status == 0)
return NULL;
- TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
+ wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
if (szStatus != NULL)
return mir_tstrdup(szStatus);
return NULL;
}
-static TCHAR* parseMirandaPath(ARGUMENTSINFO *ai)
+static wchar_t* parseMirandaPath(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
if (GetModuleFileName(NULL, path, _countof(path)) == 0)
return NULL;
return mir_tstrdup(path);
}
-static TCHAR* parseMyStatus(ARGUMENTSINFO *ai)
+static wchar_t* parseMyStatus(ARGUMENTSINFO *ai)
{
if (ai->argc > 2)
return NULL;
@@ -336,17 +336,17 @@ static TCHAR* parseMyStatus(ARGUMENTSINFO *ai) else
status = CallProtoService(_T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
- TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
+ wchar_t *szStatus = pcli->pfnGetStatusModeDescription(status, 0);
return (szStatus != NULL) ? mir_tstrdup(szStatus) : NULL;
}
-static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai)
+static wchar_t* parseProtoInfo(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
char *szRes = NULL;
- TCHAR *tszRes = NULL;
+ wchar_t *tszRes = NULL;
ptrA szProto(mir_t2a(ai->targv[1]));
if (!mir_tstrcmp(ai->targv[2], _T(STR_PINAME)))
@@ -373,7 +373,7 @@ static TCHAR* parseProtoInfo(ARGUMENTSINFO *ai) return tszRes;
}
-static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai)
+static wchar_t* parseSpecialContact(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
return NULL;
@@ -386,7 +386,7 @@ static TCHAR* parseSpecialContact(ARGUMENTSINFO *ai) if (szUniqueID == NULL) {
szProto = PROTOID_HANDLE;
- szUniqueID = (TCHAR*)mir_alloc(40);
+ szUniqueID = (wchar_t*)mir_alloc(40);
if (szUniqueID == NULL)
return NULL;
mir_sntprintf(szUniqueID, 20, L"%p", ai->fi->hContact);
@@ -526,7 +526,7 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) }
// ?message(%subject%,last|first,sent|recv,read|unread)
-static TCHAR* parseDbEvent(ARGUMENTSINFO *ai)
+static wchar_t* parseDbEvent(ARGUMENTSINFO *ai)
{
if (ai->argc != 5)
return NULL;
@@ -579,21 +579,21 @@ static TCHAR* parseDbEvent(ARGUMENTSINFO *ai) return NULL;
}
- TCHAR *res = DbGetEventTextT(&dbe, CP_ACP);
+ wchar_t *res = DbGetEventTextT(&dbe, CP_ACP);
mir_free(dbe.pBlob);
return res;
}
-static TCHAR* parseTranslate(ARGUMENTSINFO *ai)
+static wchar_t* parseTranslate(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = TranslateTS(ai->targv[1]);
+ wchar_t *res = TranslateTS(ai->targv[1]);
return (res == NULL) ? NULL : mir_tstrdup(res);
}
-static TCHAR* parseVersionString(ARGUMENTSINFO *ai)
+static wchar_t* parseVersionString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
@@ -606,40 +606,40 @@ static TCHAR* parseVersionString(ARGUMENTSINFO *ai) return mir_a2t(versionString);
}
-static TCHAR *parseContactNameString(ARGUMENTSINFO *ai)
+static wchar_t *parseContactNameString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1 || ai->fi->hContact == NULL)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR *ret = (TCHAR*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
+ wchar_t *ret = (wchar_t*)pcli->pfnGetContactDisplayName(ai->fi->hContact, 0);
return (ret == NULL) ? NULL : mir_tstrdup(ret);
}
-static TCHAR *parseMirDateString(ARGUMENTSINFO *ai)
+static wchar_t *parseMirDateString(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR ret[128];
+ wchar_t ret[128];
return mir_tstrdup(TimeZone_ToStringT(time(NULL), L"d s", ret, _countof(ret)));
}
-static TCHAR *parseMirandaCoreVar(ARGUMENTSINFO *ai)
+static wchar_t *parseMirandaCoreVar(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR corevar[MAX_PATH];
+ wchar_t corevar[MAX_PATH];
mir_sntprintf(corevar, L"%%%s%%", ai->targv[0]);
return Utils_ReplaceVarsT(corevar);
}
-static TCHAR *parseMirSrvExists(ARGUMENTSINFO *ai)
+static wchar_t *parseMirSrvExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index f3e968ddb2..f5cb3c6ba8 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -22,7 +22,7 @@ /*
pattern, subject
*/
-static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai)
+static wchar_t *parseRegExpCheck(ARGUMENTSINFO *ai)
{
const char *err;
int erroffset;
@@ -52,17 +52,17 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) /*
pattern, subject, substring no (== PCRE string no (starting at 0))
*/
-static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai)
+static wchar_t *parseRegExpSubstr(ARGUMENTSINFO *ai)
{
const char *err;
- const TCHAR *substring;
+ const wchar_t *substring;
int erroffset, number;
int offsets[99];
if (ai->argc != 4)
return NULL;
- number = _ttoi(ai->targv[3]);
+ number = _wtoi(ai->targv[3]);
if (number < 0)
return NULL;
@@ -79,7 +79,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) if (pcre16_get_substring(ai->targv[2], offsets, nmat, number, &substring) < 0)
ai->flags |= AIF_FALSE;
else {
- TCHAR *tres = mir_tstrdup(substring);
+ wchar_t *tres = mir_tstrdup(substring);
pcre16_free_substring(substring);
return tres;
}
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index 23a18acc7e..5ee00fb0f7 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -19,75 +19,75 @@ #include "stdafx.h"
-static TCHAR *parseCaps(ARGUMENTSINFO *ai)
+static wchar_t *parseCaps(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
- TCHAR *cur = res;
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *cur = res;
CharLower(res);
- *cur = (TCHAR)CharUpper((LPTSTR)*cur);
+ *cur = (wchar_t)CharUpper((LPTSTR)*cur);
cur++;
while (*cur != 0) {
if ((*cur == ' ') && (*(cur + 1) != 0)) {
cur++;
if (IsCharLower(*cur))
- *cur = (TCHAR)CharUpper((LPTSTR)*cur);
+ *cur = (wchar_t)CharUpper((LPTSTR)*cur);
}
else {
cur++;
if (IsCharUpper(*cur))
- *cur = (TCHAR)CharLower((LPTSTR)*cur);
+ *cur = (wchar_t)CharLower((LPTSTR)*cur);
}
}
return res;
}
-static TCHAR *parseCaps2(ARGUMENTSINFO *ai)
+static wchar_t *parseCaps2(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
- TCHAR *cur = res;
- *cur = (TCHAR)CharUpper((LPTSTR)*cur);
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *cur = res;
+ *cur = (wchar_t)CharUpper((LPTSTR)*cur);
cur++;
while (*cur != 0) {
if ((*cur == ' ') && (*(cur + 1) != 0)) {
cur++;
if (IsCharLower(*cur))
- *cur = (TCHAR)CharUpper((LPTSTR)*cur);
+ *cur = (wchar_t)CharUpper((LPTSTR)*cur);
}
else cur++;
}
return res;
}
-static TCHAR *parseCrlf(ARGUMENTSINFO *ai)
+static wchar_t *parseCrlf(ARGUMENTSINFO *ai)
{
ai->flags |= AIF_DONTPARSE;
return mir_tstrdup(L"\r\n");
}
-static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai)
+static wchar_t *parseEolToCrlf(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
- TCHAR *cur = res;
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *cur = res;
do {
- cur = _tcschr(cur, '\n');
+ cur = wcschr(cur, '\n');
if ((cur == NULL) || ((cur > res) && (*(cur - 1) == '\r')))
continue;
log_debug(cur);
int loc = cur - res;
- res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(TCHAR));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 2)*sizeof(wchar_t));
cur = res + loc;
- memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(TCHAR));
- memcpy(cur, L"\r\n", 2 * sizeof(TCHAR));
+ memmove(cur + 2, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t));
+ memcpy(cur, L"\r\n", 2 * sizeof(wchar_t));
cur += 2;
}
while (cur != NULL);
@@ -95,9 +95,9 @@ static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseFixeol(ARGUMENTSINFO *ai)
+static wchar_t *parseFixeol(ARGUMENTSINFO *ai)
{
- TCHAR *szReplacement;
+ wchar_t *szReplacement;
if (ai->argc == 2)
szReplacement = L"(...)";
else if (ai->argc == 3)
@@ -105,7 +105,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) else
return NULL;
- TCHAR *cur = ai->targv[1];
+ wchar_t *cur = ai->targv[1];
while (mir_tstrcmp(cur, L"\r\n") && *cur != '\n' && *cur != 0)
cur++;
@@ -113,30 +113,30 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]);
cur--;
- TCHAR *res = (TCHAR*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((cur - ai->targv[1] + mir_tstrlen(szReplacement) + 1)*sizeof(wchar_t));
if (res == NULL)
return res;
- memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(TCHAR)));
- _tcsncpy(res, ai->targv[1], cur - ai->targv[1]);
+ memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(wchar_t)));
+ wcsncpy(res, ai->targv[1], cur - ai->targv[1]);
mir_tstrcat(res, szReplacement);
return res;
}
-static TCHAR *parseFixeol2(ARGUMENTSINFO *ai)
+static wchar_t *parseFixeol2(ARGUMENTSINFO *ai)
{
- TCHAR *szReplacement;
+ wchar_t *szReplacement;
switch (ai->argc) {
case 2: szReplacement = L" "; break;
case 3: szReplacement = ai->targv[2]; break;
default: return NULL;
}
- TCHAR *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
for (size_t pos = 0; pos < mir_tstrlen(res); pos++) {
- TCHAR *cur = res + pos;
- TCHAR *szEol = NULL;
- if (!_tcsncmp(cur, L"\r\n", mir_tstrlen(L"\r\n")))
+ wchar_t *cur = res + pos;
+ wchar_t *szEol = NULL;
+ if (!wcsncmp(cur, L"\r\n", mir_tstrlen(L"\r\n")))
szEol = L"\r\n";
if (*cur == '\n')
@@ -144,18 +144,18 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) if (szEol != NULL) {
if (mir_tstrlen(szReplacement) > mir_tstrlen(szEol)) {
- res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(szEol) + 1)*sizeof(TCHAR));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szReplacement) - mir_tstrlen(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(TCHAR));
- memcpy(cur, szReplacement, mir_tstrlen(szReplacement)*sizeof(TCHAR));
+ 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;
}
}
- return (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
+ return (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
}
-static TCHAR *parseInsert(ARGUMENTSINFO *ai)
+static wchar_t *parseInsert(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -164,18 +164,18 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) if (pos > mir_tstrlen(ai->targv[1]))
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((mir_tstrlen(ai->targv[1]) + mir_tstrlen(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(TCHAR)));
- _tcsncpy(res, ai->targv[1], pos);
+ memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(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);
return res;
}
-static TCHAR *parseLeft(ARGUMENTSINFO *ai)
+static wchar_t *parseLeft(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -185,16 +185,16 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) return NULL;
len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((len + 1) * sizeof(TCHAR)));
- _tcsncpy(res, ai->targv[1], len);
+ memset(res, 0, ((len + 1) * sizeof(wchar_t)));
+ wcsncpy(res, ai->targv[1], len);
return res;
}
-static TCHAR *parseLen(ARGUMENTSINFO *ai)
+static wchar_t *parseLen(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -202,15 +202,15 @@ static TCHAR *parseLen(ARGUMENTSINFO *ai) return itot((int)mir_tstrlen(ai->targv[1]));
}
-static TCHAR *parseLineCount(ARGUMENTSINFO *ai)
+static wchar_t *parseLineCount(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
int count = 1;
- TCHAR *cur = ai->targv[1];
+ wchar_t *cur = ai->targv[1];
while (cur < (ai->targv[1] + mir_tstrlen(ai->targv[1]))) {
- if (!_tcsncmp(cur, L"\r\n", 2)) {
+ if (!wcsncmp(cur, L"\r\n", 2)) {
count++;
cur++;
}
@@ -223,19 +223,19 @@ static TCHAR *parseLineCount(ARGUMENTSINFO *ai) return itot(count);
}
-static TCHAR *parseLower(ARGUMENTSINFO *ai)
+static wchar_t *parseLower(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
return CharLower(res);
}
-static TCHAR *parseLongest(ARGUMENTSINFO *ai)
+static wchar_t *parseLongest(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return NULL;
@@ -248,7 +248,7 @@ static TCHAR *parseLongest(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[iLong]);
}
-static TCHAR *parseNoOp(ARGUMENTSINFO *ai)
+static wchar_t *parseNoOp(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -256,9 +256,9 @@ static TCHAR *parseNoOp(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[1]);
}
-static TCHAR *parsePad(ARGUMENTSINFO *ai)
+static wchar_t *parsePad(ARGUMENTSINFO *ai)
{
- TCHAR padchar;
+ wchar_t padchar;
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
@@ -270,12 +270,12 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) return NULL;
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));
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
- TCHAR *cur = res;
+ memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
+ wchar_t *cur = res;
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -283,9 +283,9 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parsePadright(ARGUMENTSINFO *ai)
+static wchar_t *parsePadright(ARGUMENTSINFO *ai)
{
- TCHAR padchar;
+ wchar_t padchar;
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
@@ -297,22 +297,22 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai) return NULL;
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));
+ wchar_t *res = (wchar_t*)mir_alloc((addcount + mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((addcount + mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
mir_tstrcpy(res, ai->targv[1]);
- TCHAR *cur = res + mir_tstrlen(ai->targv[1]);
+ wchar_t *cur = res + mir_tstrlen(ai->targv[1]);
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
return res;
}
-static TCHAR *parsePadcut(ARGUMENTSINFO *ai)
+static wchar_t *parsePadcut(ARGUMENTSINFO *ai)
{
- TCHAR padchar;
+ wchar_t padchar;
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
@@ -324,24 +324,24 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) return NULL;
int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((padding + 1) * sizeof(TCHAR)));
- TCHAR *cur = res;
+ memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
+ wchar_t *cur = res;
for (int i = 0; i < addcount; i++)
*cur++ = padchar;
if (padding > addcount)
- _tcsncpy(res + addcount, ai->targv[1], padding - addcount);
+ wcsncpy(res + addcount, ai->targv[1], padding - addcount);
return res;
}
-static TCHAR *parsePadcutright(ARGUMENTSINFO *ai)
+static wchar_t *parsePadcutright(ARGUMENTSINFO *ai)
{
- TCHAR padchar;
+ wchar_t padchar;
switch (ai->argc) {
case 3: padchar = ' '; break;
case 4: padchar = *ai->targv[3]; break;
@@ -353,22 +353,22 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) return NULL;
int addcount = max(padding - (signed int)mir_tstrlen(ai->targv[1]), 0);
- TCHAR *res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((padding + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((padding + 1) * sizeof(TCHAR)));
- TCHAR *cur = res + padding - addcount;
+ memset(res, 0, ((padding + 1) * sizeof(wchar_t)));
+ wchar_t *cur = res + padding - addcount;
for (int i = 0; i < addcount; i++)
*cur++ = padchar;
if (padding > addcount)
- _tcsncpy(res, ai->targv[1], padding - addcount);
+ wcsncpy(res, ai->targv[1], padding - addcount);
return res;
}
-static TCHAR *parseRepeat(ARGUMENTSINFO *ai)
+static wchar_t *parseRepeat(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -377,49 +377,49 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) if (count < 0)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((count * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((count * mir_tstrlen(ai->targv[1]) + 1) * sizeof(wchar_t)));
for (int i = 0; i < count; i++)
mir_tstrcat(res, ai->targv[1]);
return res;
}
-static TCHAR *parseReplace(ARGUMENTSINFO *ai)
+static wchar_t *parseReplace(ARGUMENTSINFO *ai)
{
if ((ai->argc < 4) || (ai->argc % 2 != 0))
return NULL;
- TCHAR *cur;
+ wchar_t *cur;
size_t pos = 0;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
for (size_t i = 2; i < ai->argc; i += 2) {
if (mir_tstrlen(ai->targv[i]) == 0)
continue;
for (pos = 0; pos<mir_tstrlen(res); pos++) {
cur = res + pos;
- if (!_tcsncmp(cur, ai->targv[i], mir_tstrlen(ai->targv[i]))) {
+ if (!wcsncmp(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));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(ai->targv[i + 1]) - mir_tstrlen(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(TCHAR));
- memcpy(cur, ai->targv[i + 1], mir_tstrlen(ai->targv[i + 1])*sizeof(TCHAR));
+ 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;
}
}
- res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
}
return res;
}
-static TCHAR *parseRight(ARGUMENTSINFO *ai)
+static wchar_t *parseRight(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -429,19 +429,19 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) return NULL;
len = min(len, (signed int)mir_tstrlen(ai->targv[1]));
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((len + 1)*sizeof(TCHAR)));
- _tcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len);
+ memset(res, 0, ((len + 1)*sizeof(wchar_t)));
+ wcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len);
return res;
}
/*
string, display size, scroll amount
*/
-static TCHAR *parseScroll(ARGUMENTSINFO *ai)
+static wchar_t *parseScroll(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -454,21 +454,21 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) if (display > mir_tstrlen(ai->targv[1]))
display = (unsigned)mir_tstrlen(ai->targv[1]);
- TCHAR *res = (TCHAR*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((2 * mir_tstrlen(ai->targv[1]) + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((2 * mir_tstrlen(ai->targv[1]) + 1) * sizeof(TCHAR)));
+ 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(TCHAR));
+ memmove(res, res + move, (mir_tstrlen(res + move) + 1)*sizeof(wchar_t));
*(res + display) = 0;
- res = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(TCHAR));
+ res = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + 1)*sizeof(wchar_t));
return res;
}
-static TCHAR *parseShortest(ARGUMENTSINFO *ai)
+static wchar_t *parseShortest(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
@@ -481,21 +481,21 @@ static TCHAR *parseShortest(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[iShort]);
}
-static TCHAR *parseStrchr(ARGUMENTSINFO *ai)
+static wchar_t *parseStrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
char *szVal[34];
memset(szVal, 0, sizeof(szVal));
- TCHAR *c = _tcschr(ai->targv[1], *ai->targv[2]);
+ wchar_t *c = wcschr(ai->targv[1], *ai->targv[2]);
if (c == NULL || *c == 0)
return mir_tstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
-static TCHAR *parseStrcmp(ARGUMENTSINFO *ai)
+static wchar_t *parseStrcmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -506,7 +506,7 @@ static TCHAR *parseStrcmp(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseStrmcmp(ARGUMENTSINFO *ai)
+static wchar_t *parseStrmcmp(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
@@ -522,7 +522,7 @@ static TCHAR *parseStrmcmp(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseStrncmp(ARGUMENTSINFO *ai)
+static wchar_t *parseStrncmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -531,13 +531,13 @@ static TCHAR *parseStrncmp(ARGUMENTSINFO *ai) if (n <= 0)
return NULL;
- if (_tcsncmp(ai->targv[1], ai->targv[2], n))
+ if (wcsncmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
return mir_tstrdup(L"");
}
-static TCHAR *parseStricmp(ARGUMENTSINFO *ai)
+static wchar_t *parseStricmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -548,7 +548,7 @@ static TCHAR *parseStricmp(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseStrnicmp(ARGUMENTSINFO *ai)
+static wchar_t *parseStrnicmp(ARGUMENTSINFO *ai)
{
if (ai->argc != 4)
return NULL;
@@ -557,37 +557,37 @@ static TCHAR *parseStrnicmp(ARGUMENTSINFO *ai) if (n <= 0)
return NULL;
- if (_tcsnicmp(ai->targv[1], ai->targv[2], n))
+ if (wcsnicmp(ai->targv[1], ai->targv[2], n))
ai->flags |= AIF_FALSE;
return mir_tstrdup(L"");
}
-static TCHAR *parseStrrchr(ARGUMENTSINFO *ai)
+static wchar_t *parseStrrchr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
- TCHAR *c = _tcsrchr(ai->targv[1], *ai->targv[2]);
+ wchar_t *c = wcsrchr(ai->targv[1], *ai->targv[2]);
if ((c == NULL) || (*c == 0))
return mir_tstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
-static TCHAR *parseStrstr(ARGUMENTSINFO *ai)
+static wchar_t *parseStrstr(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
- TCHAR *c = _tcsstr(ai->targv[1], ai->targv[2]);
+ wchar_t *c = wcsstr(ai->targv[1], ai->targv[2]);
if ((c == NULL) || (*c == 0))
return mir_tstrdup(L"0");
return itot(c - ai->targv[1] + 1);
}
-static TCHAR *parseSubstr(ARGUMENTSINFO *ai)
+static wchar_t *parseSubstr(ARGUMENTSINFO *ai)
{
if (ai->argc < 3)
return NULL;
@@ -601,13 +601,13 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) if (to < from)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((to - from + 1)*sizeof(TCHAR));
- memset(res, 0, ((to - from + 1) * sizeof(TCHAR)));
- _tcsncpy(res, ai->targv[1] + from, to - from);
+ wchar_t *res = (wchar_t*)mir_alloc((to - from + 1)*sizeof(wchar_t));
+ memset(res, 0, ((to - from + 1) * sizeof(wchar_t)));
+ wcsncpy(res, ai->targv[1] + from, to - from);
return res;
}
-static TCHAR *parseSelect(ARGUMENTSINFO *ai)
+static wchar_t *parseSelect(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
@@ -619,7 +619,7 @@ static TCHAR *parseSelect(ARGUMENTSINFO *ai) return mir_tstrdup(ai->targv[n + 1]);
}
-static TCHAR *parseSwitch(ARGUMENTSINFO *ai)
+static wchar_t *parseSwitch(ARGUMENTSINFO *ai)
{
if (ai->argc % 2 != 0)
return NULL;
@@ -631,33 +631,33 @@ static TCHAR *parseSwitch(ARGUMENTSINFO *ai) return NULL;
}
-static TCHAR *parseTrim(ARGUMENTSINFO *ai)
+static wchar_t *parseTrim(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *scur = ai->targv[1];
+ wchar_t *scur = ai->targv[1];
while (*scur == ' ')
scur++;
- TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1;
+ wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]) - 1;
while ((*ecur == ' ') && (ecur > ai->targv[1]))
ecur--;
if (scur >= ecur)
return mir_tstrdup(L"");
- TCHAR *res = (TCHAR*)mir_alloc((ecur - scur + 2)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 2)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((ecur - scur + 2) * sizeof(TCHAR)));
- _tcsncpy(res, scur, ecur - scur + 1);
+ memset(res, 0, ((ecur - scur + 2) * sizeof(wchar_t)));
+ wcsncpy(res, scur, ecur - scur + 1);
return res;
}
-static TCHAR *parseTab(ARGUMENTSINFO *ai)
+static wchar_t *parseTab(ARGUMENTSINFO *ai)
{
int count = 1;
if ((ai->argc == 2) && (mir_tstrlen(ai->targv[1]) > 0))
@@ -666,37 +666,37 @@ static TCHAR *parseTab(ARGUMENTSINFO *ai) if (count < 0)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((count + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((count + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, (count + 1)*sizeof(TCHAR));
- TCHAR *cur = res;
+ memset(res, 0, (count + 1)*sizeof(wchar_t));
+ wchar_t *cur = res;
for (int i = 0; i < count; i++)
*cur++ = '\t';
return res;
}
-static TCHAR *parseUpper(ARGUMENTSINFO *ai)
+static wchar_t *parseUpper(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
- TCHAR *res = mir_tstrdup(ai->targv[1]);
+ wchar_t *res = mir_tstrdup(ai->targv[1]);
if (res == NULL)
return NULL;
return CharUpper(res);
}
-static TCHAR *getNthWord(TCHAR *szString, int w)
+static wchar_t *getNthWord(wchar_t *szString, int w)
{
if (szString == NULL)
return NULL;
int count = 0;
- TCHAR *scur = szString;
+ wchar_t *scur = szString;
while (*scur == ' ')
scur++;
@@ -714,25 +714,25 @@ static TCHAR *getNthWord(TCHAR *szString, int w) if (count != w)
return NULL;
- TCHAR *ecur = scur;
+ wchar_t *ecur = scur;
while ((*ecur != ' ') && (*ecur != 0))
ecur++;
- TCHAR *res = (TCHAR*)mir_alloc((ecur - scur + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((ecur - scur + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((ecur - scur + 1) * sizeof(TCHAR)));
- _tcsncpy(res, scur, ecur - scur);
+ memset(res, 0, ((ecur - scur + 1) * sizeof(wchar_t)));
+ wcsncpy(res, scur, ecur - scur);
return res;
}
-static TCHAR *parseWord(ARGUMENTSINFO *ai)
+static wchar_t *parseWord(ARGUMENTSINFO *ai)
{
if (ai->argc < 3 || ai->argc > 4)
return NULL;
- TCHAR *res = NULL;
+ wchar_t *res = NULL;
int to, from = ttoi(ai->targv[2]);
if (ai->argc == 4) {
if (mir_tstrlen(ai->targv[3]) > 0)
@@ -746,12 +746,12 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) return NULL;
for (int i = from; i <= to; i++) {
- TCHAR *szWord = getNthWord(ai->targv[1], i);
+ wchar_t *szWord = getNthWord(ai->targv[1], i);
if (szWord == NULL)
return res;
if (res != NULL) {
- TCHAR *pres = (TCHAR*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(TCHAR));
+ wchar_t *pres = (wchar_t*)mir_realloc(res, (mir_tstrlen(res) + mir_tstrlen(szWord) + 2)*sizeof(wchar_t));
if (pres != NULL) {
res = pres;
mir_tstrcat(res, L" ");
@@ -765,7 +765,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseExtratext(ARGUMENTSINFO *ai)
+static wchar_t *parseExtratext(ARGUMENTSINFO *ai)
{
if (ai->argc > 1)
return NULL;
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 43695c7db0..370c84881e 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -19,14 +19,14 @@ #include "stdafx.h"
-static TCHAR *parseComputerName(ARGUMENTSINFO *ai)
+static wchar_t *parseComputerName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
DWORD len = MAX_COMPUTERNAME_LENGTH;
- TCHAR *res = (TCHAR*)mir_calloc((len + 1) * sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -40,13 +40,13 @@ static TCHAR *parseComputerName(ARGUMENTSINFO *ai) #include <pdh.h>
#include <pdhmsg.h>
-static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai)
+static wchar_t *parseCpuLoad(ARGUMENTSINFO *ai)
{
HQUERY hQuery;
PDH_FMT_COUNTERVALUE cValue;
HCOUNTER hCounter;
- TCHAR *szCounter, szVal[32];
+ wchar_t *szCounter, szVal[32];
if (ai->argc != 2)
return NULL;
@@ -55,7 +55,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) szCounter = mir_tstrdup(L"\\Processor(_Total)\\% Processor Time");
else {
int size = (int)mir_tstrlen(ai->targv[1]) + 32;
- szCounter = (TCHAR *)mir_alloc(size * sizeof(TCHAR));
+ szCounter = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
if (szCounter == NULL)
return NULL;
@@ -113,16 +113,16 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) return mir_tstrdup(szVal);
}
-static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai)
+static wchar_t *parseCurrentDate(ARGUMENTSINFO *ai)
{
- TCHAR *szFormat;
+ wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1 && mir_tstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -134,16 +134,16 @@ static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseCurrentTime(ARGUMENTSINFO *ai)
+static wchar_t *parseCurrentTime(ARGUMENTSINFO *ai)
{
- TCHAR *szFormat;
+ wchar_t *szFormat;
if (ai->argc == 1 || (ai->argc > 1) && (mir_tstrlen(ai->targv[1]) == 0))
szFormat = NULL;
else
szFormat = ai->targv[1];
int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -155,7 +155,7 @@ static TCHAR *parseCurrentTime(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseDirectory(ARGUMENTSINFO *ai)
+static wchar_t *parseDirectory(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
return NULL;
@@ -181,8 +181,8 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) if (ai->targv[1][bi - 1] == '\\')
break;
- TCHAR *res = (TCHAR*)mir_alloc((ei - bi + 1) * sizeof(TCHAR));
- _tcsncpy(res, ai->targv[1] + bi, ei - bi);
+ wchar_t *res = (wchar_t*)mir_alloc((ei - bi + 1) * sizeof(wchar_t));
+ wcsncpy(res, ai->targv[1] + bi, ei - bi);
res[ei - bi] = 0;
return res;
}
@@ -191,7 +191,7 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) path, depth
returns complete path up to "path depth - depth"
*/
-static TCHAR *parseDirectory2(ARGUMENTSINFO *ai)
+static wchar_t *parseDirectory2(ARGUMENTSINFO *ai)
{
if (ai->argc < 2 || ai->argc > 3)
return NULL;
@@ -203,7 +203,7 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) if (depth <= 0)
return NULL;
- TCHAR *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]);
+ wchar_t *ecur = ai->targv[1] + mir_tstrlen(ai->targv[1]);
while (depth > 0) {
while ((*ecur != '\\') && (ecur > ai->targv[1]))
ecur--;
@@ -214,32 +214,32 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) depth -= 1;
ecur--;
}
- TCHAR *res = (TCHAR*)mir_calloc((ecur - ai->targv[1] + 2) * sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_calloc((ecur - ai->targv[1] + 2) * sizeof(wchar_t));
if (res == NULL)
return NULL;
- _tcsncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1);
+ wcsncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1);
return res;
}
-static int getTime(TCHAR *szTime, struct tm *date)
+static int getTime(wchar_t *szTime, struct tm *date)
{
// do some extra checks here
- TCHAR *cur = szTime;
+ wchar_t *cur = szTime;
if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_mon = _tcstoul(cur, &cur, 10) - 1;
+ date->tm_mon = wcstoul(cur, &cur, 10) - 1;
cur++;
if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_mday = _tcstoul(cur, &cur, 10);
+ date->tm_mday = wcstoul(cur, &cur, 10);
cur++;
if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_year = _tcstoul(cur, &cur, 10);
+ date->tm_year = wcstoul(cur, &cur, 10);
if (date->tm_year > 2000)
date->tm_year -= 2000;
else if (date->tm_year > 1900)
@@ -250,24 +250,24 @@ static int getTime(TCHAR *szTime, struct tm *date) if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_hour = _tcstoul(cur, &cur, 10);
+ date->tm_hour = wcstoul(cur, &cur, 10);
cur++;
if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_min = _tcstoul(cur, &cur, 10);
+ date->tm_min = wcstoul(cur, &cur, 10);
cur++;
if (cur >= szTime + mir_tstrlen(szTime))
return -1;
- date->tm_sec = _tcstoul(cur, &cur, 10);
+ date->tm_sec = wcstoul(cur, &cur, 10);
return 0;
}
-static TCHAR *parseDiffTime(ARGUMENTSINFO *ai)
+static wchar_t *parseDiffTime(ARGUMENTSINFO *ai)
{
struct tm t0, t1;
- TCHAR szTime[32];
+ wchar_t szTime[32];
double diff;
if (ai->argc != 3)
@@ -287,7 +287,7 @@ static TCHAR *parseDiffTime(ARGUMENTSINFO *ai) return mir_tstrdup(szTime);
}
-static TCHAR *parseDirExists(ARGUMENTSINFO *ai)
+static wchar_t *parseDirExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -301,7 +301,7 @@ static TCHAR *parseDirExists(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseEnvironmentVariable(ARGUMENTSINFO *ai)
+static wchar_t *parseEnvironmentVariable(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -310,11 +310,11 @@ static TCHAR *parseEnvironmentVariable(ARGUMENTSINFO *ai) if (len <= 0)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, ((len + 1) * sizeof(TCHAR)));
+ memset(res, 0, ((len + 1) * sizeof(wchar_t)));
if (ExpandEnvironmentStrings(ai->targv[1], res, len) == 0) {
mir_free(res);
return NULL;
@@ -322,7 +322,7 @@ static TCHAR *parseEnvironmentVariable(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseFileExists(ARGUMENTSINFO *ai)
+static wchar_t *parseFileExists(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -336,7 +336,7 @@ static TCHAR *parseFileExists(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseFindWindow(ARGUMENTSINFO *ai)
+static wchar_t *parseFindWindow(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -349,8 +349,8 @@ static TCHAR *parseFindWindow(ARGUMENTSINFO *ai) if (len == 0)
return NULL;
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
- memset(res, 0, ((len + 1) * sizeof(TCHAR)));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
+ memset(res, 0, ((len + 1) * sizeof(wchar_t)));
GetWindowText(hWin, res, len + 1);
return res;
}
@@ -359,19 +359,19 @@ static TCHAR *parseFindWindow(ARGUMENTSINFO *ai) // 2 = filter
// 3 = sperator
// 4 = [f]iles, [d]irs
-static TCHAR *parseListDir(ARGUMENTSINFO *ai)
+static wchar_t *parseListDir(ARGUMENTSINFO *ai)
{
if (ai->argc < 2)
return NULL;
- TCHAR tszFirst[MAX_PATH], *tszRes, *tszSeperator, *tszFilter;
+ wchar_t tszFirst[MAX_PATH], *tszRes, *tszSeperator, *tszFilter;
tszFirst[0] = 0;
tszSeperator = L"\r\n";
tszFilter = L"*";
tszRes = NULL;
if (ai->argc > 1)
- _tcsncpy(tszFirst, ai->targv[1], _countof(tszFirst) - 1);
+ wcsncpy(tszFirst, ai->targv[1], _countof(tszFirst) - 1);
if (ai->argc > 2)
tszFilter = ai->targv[2];
@@ -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((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
mir_tstrcpy(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 = (TCHAR*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (wchar_t*)mir_realloc(tszRes, (mir_tstrlen(tszRes) + mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
}
else {
- tszRes = (TCHAR*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (wchar_t*)mir_alloc((mir_tstrlen(ffd.cFileName) + mir_tstrlen(tszSeperator) + 1)*sizeof(wchar_t));
mir_tstrcpy(tszRes, L"");
}
mir_tstrcat(tszRes, ffd.cFileName);
@@ -430,7 +430,7 @@ static BOOL CALLBACK MyProcessEnumerator(DWORD, WORD, char *szProcess, LPARAM lP return TRUE;
}
-static TCHAR *parseProcessRunning(ARGUMENTSINFO *ai)
+static wchar_t *parseProcessRunning(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
@@ -447,18 +447,18 @@ static TCHAR *parseProcessRunning(ARGUMENTSINFO *ai) }
#endif
-static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai)
+static wchar_t *parseRegistryValue(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
DWORD len, type;
- TCHAR *key = mir_tstrdup(ai->targv[1]);
+ wchar_t *key = mir_tstrdup(ai->targv[1]);
if (key == NULL)
return NULL;
- TCHAR *cur = _tcschr(key, '\\');
+ wchar_t *cur = wcschr(key, '\\');
if (cur == NULL) {
mir_free(key);
return NULL;
@@ -478,18 +478,18 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai) mir_free(key);
return NULL;
}
- TCHAR *subKey = cur + 1;
+ wchar_t *subKey = cur + 1;
if (RegOpenKeyEx(hKey, subKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) {
mir_free(key);
return NULL;
}
mir_free(key);
len = MAX_REGVALUE_LENGTH + 1;
- TCHAR *res = (TCHAR*)mir_alloc(len*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
if (res == NULL)
return NULL;
- memset(res, 0, (len * sizeof(TCHAR)));
+ memset(res, 0, (len * sizeof(wchar_t)));
int err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
if ((err != ERROR_SUCCESS) || (type != REG_SZ)) {
RegCloseKey(hKey);
@@ -519,13 +519,13 @@ static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp) return 0;
}
-static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai)
+static wchar_t *parseTimestamp2Date(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
SYSTEMTIME sysTime;
- TCHAR *szFormat;
+ wchar_t *szFormat;
time_t timestamp = ttoi(ai->targv[1]);
if (timestamp == 0)
return NULL;
@@ -539,7 +539,7 @@ static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai) return NULL;
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_calloc((len + 1) * sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_calloc((len + 1) * sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -551,7 +551,7 @@ static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai)
+static wchar_t *parseTimestamp2Time(ARGUMENTSINFO *ai)
{
if (ai->argc <= 1)
return NULL;
@@ -561,7 +561,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) if (timestamp == 0)
return NULL;
- TCHAR *szFormat;
+ wchar_t *szFormat;
if ((ai->argc == 2) || ((ai->argc > 2) && (mir_tstrlen(ai->targv[2]) == 0)))
szFormat = NULL;
else
@@ -571,7 +571,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) return NULL;
int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
- TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
+ wchar_t *res = (wchar_t*)mir_alloc((len + 1)*sizeof(wchar_t));
if (res == NULL)
return NULL;
@@ -583,7 +583,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) return res;
}
-static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
+static wchar_t *parseTextFile(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -603,15 +603,15 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) unsigned int icur, bufSz;
DWORD readSz, totalReadSz;
unsigned long linePos;
- TCHAR tUC, *res;
+ wchar_t tUC, *res;
BYTE *pBuf, *pCur;
- ReadFile(hFile, &tUC, sizeof(TCHAR), &readSz, NULL);
- if (tUC != (TCHAR)0xFEFF) {
+ ReadFile(hFile, &tUC, sizeof(wchar_t), &readSz, NULL);
+ if (tUC != (wchar_t)0xFEFF) {
tUC = 0;
csz = sizeof(char);
SetFilePointer(hFile, 0, NULL, FILE_BEGIN);
}
- else csz = sizeof(TCHAR);
+ else csz = sizeof(wchar_t);
totalReadSz = 0;
lineCount = 1;
@@ -632,7 +632,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) CloseHandle(hFile);
if (tUC)
- res = (TCHAR*)pBuf;
+ res = (wchar_t*)pBuf;
else {
res = mir_a2t((char *)pBuf);
mir_free(pBuf);
@@ -659,11 +659,11 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) totalReadSz += readSz;
for (pCur = pBuf; *pCur != '\0'; pCur += csz) {
if (tUC) {
- if (!_tcsncmp((TCHAR*)pCur, L"\r\n", 2)) {
+ if (!wcsncmp((wchar_t*)pCur, L"\r\n", 2)) {
lineCount++;
pCur += csz;
}
- else if (*(TCHAR*)pCur == '\n')
+ else if (*(wchar_t*)pCur == '\n')
lineCount++;
}
else {
@@ -699,11 +699,11 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) linePos = (tUC ? csz : 0) + totalReadSz - readSz + pCur - pBuf;
if (tUC) {
- if (!_tcsncmp((TCHAR*)pCur, L"\r\n", 2)) {
+ if (!wcsncmp((wchar_t*)pCur, L"\r\n", 2)) {
lineCount++;
pCur += csz;
}
- else if (*(TCHAR*)pCur == '\n')
+ else if (*(wchar_t*)pCur == '\n')
lineCount++;
}
else {
@@ -715,7 +715,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) lineCount++;
}
}
- if (((tUC) && (*(TCHAR*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
+ if (((tUC) && (*(wchar_t*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
// in case the \r was at the end of the buffer, \n could be next
SetFilePointer(hFile, -1 * csz, NULL, FILE_CURRENT);
totalReadSz -= csz;
@@ -738,16 +738,16 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) return NULL;
}
for (pCur = pBuf; (pCur < pBuf + readSz); pCur += csz) {
- if ((tUC) && ((!_tcsncmp((TCHAR*)pCur, L"\r\n", 2)) || (*(TCHAR*)pCur == '\n')) ||
+ if ((tUC) && ((!wcsncmp((wchar_t*)pCur, L"\r\n", 2)) || (*(wchar_t*)pCur == '\n')) ||
((!tUC) && (((!strncmp((char *)pCur, "\r\n", 2)) || (*(char *)pCur == '\n'))))) {
CloseHandle(hFile);
if (tUC)
- *(TCHAR*)pCur = 0;
+ *(wchar_t*)pCur = 0;
else
*(char *)pCur = '\0';
if (tUC)
- res = (TCHAR*)pBuf;
+ res = (wchar_t*)pBuf;
else {
res = mir_a2t((char *)pBuf);
mir_free(pBuf);
@@ -760,7 +760,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) CloseHandle(hFile);
if (tUC) {
- res = (TCHAR*)pBuf;
+ res = (wchar_t*)pBuf;
}
else {
res = mir_a2t((char *)pBuf);
@@ -772,7 +772,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) if (readSz == bufSz - csz) {
// buffer must be increased
bufSz += TXTFILEBUFSZ*csz;
- if (((tUC) && (*(TCHAR*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
+ if (((tUC) && (*(wchar_t*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
pCur -= csz;
}
icur = pCur - pBuf;
@@ -787,7 +787,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) return NULL;
}
-static TCHAR *parseUpTime(ARGUMENTSINFO *ai)
+static wchar_t *parseUpTime(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
@@ -818,21 +818,21 @@ static TCHAR *parseUpTime(ARGUMENTSINFO *ai) return NULL;
}
- TCHAR szVal[32];
+ wchar_t szVal[32];
mir_sntprintf(szVal, L"%u", cValue.largeValue);
PdhRemoveCounter(hCounter);
PdhCloseQuery(hQuery);
return mir_tstrdup(szVal);
}
-static TCHAR *parseUserName(ARGUMENTSINFO *ai)
+static wchar_t *parseUserName(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
DWORD len = UNLEN;
- TCHAR *res = (TCHAR*)mir_alloc(len + 1);
+ wchar_t *res = (wchar_t*)mir_alloc(len + 1);
if (res == NULL)
return NULL;
@@ -845,22 +845,22 @@ static TCHAR *parseUserName(ARGUMENTSINFO *ai) }
// clipboard support
-static TCHAR *parseClipboard(ARGUMENTSINFO *ai)
+static wchar_t *parseClipboard(ARGUMENTSINFO *ai)
{
if (ai->argc != 1)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR *res = NULL;
+ wchar_t *res = NULL;
if (IsClipboardFormatAvailable(CF_TEXT)) {
if (OpenClipboard(NULL)) {
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData != NULL) {
- TCHAR *tszText = (TCHAR*)GlobalLock(hData);
+ wchar_t *tszText = (wchar_t*)GlobalLock(hData);
size_t len = mir_tstrlen(tszText);
- res = (TCHAR*)mir_alloc((len + 1) * sizeof(TCHAR));
+ res = (wchar_t*)mir_alloc((len + 1) * sizeof(wchar_t));
mir_tstrcpy(res, tszText);
res[len] = 0;
GlobalUnlock(hData);
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp index bc19f44cfc..c54bbf6dce 100644 --- a/plugins/Variables/src/parse_variables.cpp +++ b/plugins/Variables/src/parse_variables.cpp @@ -24,7 +24,7 @@ static mir_cs csVarRegister; static VARIABLEREGISTER *vr = NULL;
static int vrCount = 0;
-static int addToVariablesRegister(TCHAR *szName, TCHAR *szText)
+static int addToVariablesRegister(wchar_t *szName, wchar_t *szText)
{
if ((szName == NULL) || (szText == NULL) || (mir_tstrlen(szName) <= 0))
return -1;
@@ -48,7 +48,7 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText) return 0;
}
-static TCHAR *searchVariableRegister(TCHAR *szName)
+static wchar_t *searchVariableRegister(wchar_t *szName)
{
if ((szName == NULL) || (mir_tstrlen(szName) <= 0))
return NULL;
@@ -61,7 +61,7 @@ static TCHAR *searchVariableRegister(TCHAR *szName) return NULL;
}
-static TCHAR *parsePut(ARGUMENTSINFO *ai)
+static wchar_t *parsePut(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -77,7 +77,7 @@ static TCHAR *parsePut(ARGUMENTSINFO *ai) return formatString(&fi);
}
-static TCHAR *parsePuts(ARGUMENTSINFO *ai)
+static wchar_t *parsePuts(ARGUMENTSINFO *ai)
{
if (ai->argc != 3)
return NULL;
@@ -88,7 +88,7 @@ static TCHAR *parsePuts(ARGUMENTSINFO *ai) return mir_tstrdup(L"");
}
-static TCHAR *parseGet(ARGUMENTSINFO *ai)
+static wchar_t *parseGet(ARGUMENTSINFO *ai)
{
if (ai->argc != 2)
return NULL;
diff --git a/plugins/Variables/src/parse_variables.h b/plugins/Variables/src/parse_variables.h index b623f5a4c1..ea83c3b1e0 100644 --- a/plugins/Variables/src/parse_variables.h +++ b/plugins/Variables/src/parse_variables.h @@ -18,8 +18,8 @@ */
typedef struct {
- TCHAR *szName;
- TCHAR *szText;
+ wchar_t *szName;
+ wchar_t *szText;
DWORD dwOwnerThread;
} VARIABLEREGISTER;
diff --git a/plugins/Variables/src/stdafx.h b/plugins/Variables/src/stdafx.h index 66570a7aa6..87b596ae77 100644 --- a/plugins/Variables/src/stdafx.h +++ b/plugins/Variables/src/stdafx.h @@ -88,7 +88,7 @@ #define SUBJECT L"subject"
#define MIR_EXTRATEXT L"extratext"
-#define VAR_HELP_TEXT LPGENT("--- Special characters ---\r\n\r\n\
+#define VAR_HELP_TEXT LPGENW("--- Special characters ---\r\n\r\n\
The following characters have a special meaning in a formatting string:\r\n\r\n\
?<function>(<arguments>)\r\n\
This will parse the function given the arguments, the result will be parsed again. Example: Today is ?cdate(yyyy/MM/dd).\r\n\r\n\
@@ -152,16 +152,16 @@ extern int hLangpack; // variables.c
//int isValidTokenChar(char c);
-TCHAR *formatString(FORMATINFO *fi);
+wchar_t *formatString(FORMATINFO *fi);
int setParseOptions(struct ParseOptions *po);
int LoadVarModule();
int UnloadVarModule();
// tokenregister.c
-int registerIntToken(TCHAR *szToken, TCHAR *(*parseFunction)(ARGUMENTSINFO *ai), int extraFlags, char* szHelpText);
+int registerIntToken(wchar_t *szToken, wchar_t *(*parseFunction)(ARGUMENTSINFO *ai), int extraFlags, char* szHelpText);
INT_PTR registerToken(WPARAM wParam, LPARAM lParam);
-int deRegisterToken(TCHAR *var);
-TOKENREGISTEREX *searchRegister(TCHAR *var, int type);
-TCHAR *parseFromRegister(ARGUMENTSINFO *ai);
+int deRegisterToken(wchar_t *var);
+TOKENREGISTEREX *searchRegister(wchar_t *var, int type);
+wchar_t *parseFromRegister(ARGUMENTSINFO *ai);
TOKENREGISTEREX *getTokenRegister(int i);
int getTokenRegisterCount();
TOKENREGISTER *getTokenRegisterByIndex(int i);
@@ -169,9 +169,9 @@ void deRegisterTemporaryVariables(); int initTokenRegister();
int deinitTokenRegister();
// contact.c
-BYTE getContactInfoType(TCHAR* type);
-TCHAR* getContactInfoT(BYTE type, MCONTACT hContact);
-MCONTACT getContactFromString(const TCHAR *tszContact, DWORD dwFlags, int nMatch = 0);
+BYTE getContactInfoType(wchar_t* type);
+wchar_t* getContactInfoT(BYTE type, MCONTACT hContact);
+MCONTACT getContactFromString(const wchar_t *tszContact, DWORD dwFlags, int nMatch = 0);
int initContactModule();
int deinitContactModule();
// alias
@@ -206,5 +206,5 @@ INT_PTR showHelpExService(WPARAM wParam, LPARAM lParam); INT_PTR getSkinItemService(WPARAM wParam, LPARAM lParam);
int iconsChanged(WPARAM wParam, LPARAM lParam);
-int ttoi(TCHAR *string);
-TCHAR *itot(int num);
+int ttoi(wchar_t *string);
+wchar_t *itot(int num);
diff --git a/plugins/Variables/src/tokenregister.cpp b/plugins/Variables/src/tokenregister.cpp index b74465ce99..101d8024f1 100644 --- a/plugins/Variables/src/tokenregister.cpp +++ b/plugins/Variables/src/tokenregister.cpp @@ -39,19 +39,19 @@ static mir_cs csRegister; unsigned long int hashlittle(void *key, size_t length, unsigned long int initval);
-static DWORD NameHashFunction(TCHAR *tszStr)
+static DWORD NameHashFunction(wchar_t *tszStr)
{
- return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(TCHAR), 0);
+ return (DWORD)hashlittle(tszStr, mir_tstrlen(tszStr)*sizeof(wchar_t), 0);
}
-static TokenRegisterEntry* FindTokenRegisterByName(TCHAR *name)
+static TokenRegisterEntry* FindTokenRegisterByName(wchar_t *name)
{
TokenRegisterEntry temp;
temp.nameHash = NameHashFunction(name);
return tokens.find(&temp);
}
-int registerIntToken(TCHAR *szToken, TCHAR *(*parseFunction)(ARGUMENTSINFO *ai), int extraFlags, char* szHelpText)
+int registerIntToken(wchar_t *szToken, wchar_t *(*parseFunction)(ARGUMENTSINFO *ai), int extraFlags, char* szHelpText)
{
TOKENREGISTEREX tr = { 0 };
tr.cbSize = sizeof(tr);
@@ -65,7 +65,7 @@ int registerIntToken(TCHAR *szToken, TCHAR *(*parseFunction)(ARGUMENTSINFO *ai), return registerToken(0, (LPARAM)&tr);
}
-int deRegisterToken(TCHAR *token)
+int deRegisterToken(wchar_t *token)
{
if (token == NULL)
return -1;
@@ -143,7 +143,7 @@ INT_PTR registerToken(WPARAM, LPARAM lParam) return 0;
}
-TOKENREGISTEREX *searchRegister(TCHAR *tvar, int type)
+TOKENREGISTEREX *searchRegister(wchar_t *tvar, int type)
{
if (tvar == NULL)
return 0;
@@ -156,13 +156,13 @@ TOKENREGISTEREX *searchRegister(TCHAR *tvar, int type) return &tre->tr;
}
-TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
+wchar_t *parseFromRegister(ARGUMENTSINFO *ai)
{
if (ai == NULL || ai->argc == 0 || ai->targv[0] == NULL)
return NULL;
INT_PTR callRes = 0;
- TCHAR *res = NULL;
+ wchar_t *res = NULL;
mir_cslock lck(csRegister);
@@ -200,14 +200,14 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai) else if (thisVr->szService != NULL)
callRes = CallService(thisVr->szService, 0, (LPARAM)ai);
- if ((TCHAR*)callRes != NULL)
- res = mir_tstrdup((TCHAR*)callRes);
+ if ((wchar_t*)callRes != NULL)
+ res = mir_tstrdup((wchar_t*)callRes);
}
if (callRes != NULL) {
if (trCopy.flags & TRF_CLEANUP) {
if (trCopy.flags & TRF_CLEANUPFUNC)
- trCopy.cleanupFunctionT((TCHAR*)callRes);
+ trCopy.cleanupFunctionT((wchar_t*)callRes);
else if (trCopy.szCleanupService != NULL)
CallService(trCopy.szCleanupService, 0, (LPARAM)callRes);
}
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 83c34b279a..44920139f4 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -36,16 +36,16 @@ HCURSOR hCurSplitNS; struct ParseOptions gParseOpts; -TCHAR* getArguments(TCHAR *string, TArgList &argv) +wchar_t* getArguments(wchar_t *string, TArgList &argv) { - TCHAR *cur = string; + wchar_t *cur = string; while (*cur == ' ') cur++; if (*cur != '(') return NULL; - TCHAR *scur = cur; + wchar_t *scur = cur; cur++; int brackets = 0; bool bDontParse = false, bNewArg = false, bDone = false; @@ -74,7 +74,7 @@ TCHAR* getArguments(TCHAR *string, TArgList &argv) } if (bNewArg) { - TCHAR *tszArg = NULL; + wchar_t *tszArg = NULL; if (cur > scur) tszArg = mir_tstrndup(scur + 1, cur - (scur + 1)); if (tszArg == NULL) @@ -96,7 +96,7 @@ TCHAR* getArguments(TCHAR *string, TArgList &argv) return cur; } -int isValidTokenChar(TCHAR tc) +int isValidTokenChar(wchar_t tc) { return @@ -111,14 +111,14 @@ int isValidTokenChar(TCHAR tc) } /* pretty much the main loop */ -static TCHAR* replaceDynVars(FORMATINFO *fi) +static wchar_t* replaceDynVars(FORMATINFO *fi) { if (fi->tszFormat == NULL) return NULL; int i, scurPos, curPos, tmpVarPos; - TCHAR *string = mir_tstrdup(fi->tszFormat); + wchar_t *string = mir_tstrdup(fi->tszFormat); if (string == NULL) return NULL; @@ -129,56 +129,56 @@ static TCHAR* replaceDynVars(FORMATINFO *fi) for (size_t pos = 0; pos < mir_tstrlen(string); pos++) { // string may move in memory, iterate by remembering the position in the string - TCHAR *cur = string + pos; + wchar_t *cur = string + pos; // new round if (*cur == DONTPARSE_CHAR) { - memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(TCHAR)); + memmove(cur, cur + 1, (mir_tstrlen(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(TCHAR)); + memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; continue; } // remove end of lines - else if ((!_tcsncmp(cur, L"\r\n", 2)) && (gParseOpts.bStripEOL)) { - memmove(cur, cur + 2, (mir_tstrlen(cur + 2) + 1)*sizeof(TCHAR)); + else if ((!wcsncmp(cur, L"\r\n", 2)) && (gParseOpts.bStripEOL)) { + memmove(cur, cur + 2, (mir_tstrlen(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(TCHAR)); + memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; continue; } // remove comments - else if (!_tcsncmp(cur, _T(COMMENT_STRING), mir_tstrlen(_T(COMMENT_STRING)))) { - TCHAR *scur = cur; - while (_tcsncmp(cur, L"\r\n", 2) && *cur != '\n' && *cur != 0) + else if (!wcsncmp(cur, _T(COMMENT_STRING), mir_tstrlen(_T(COMMENT_STRING)))) { + wchar_t *scur = cur; + while (wcsncmp(cur, L"\r\n", 2) && *cur != '\n' && *cur != 0) cur++; if (*cur == 0) { *scur = 0; - string = (TCHAR*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(TCHAR)); + string = (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t)); continue; } - memmove(scur, cur, (mir_tstrlen(cur) + 1)*sizeof(TCHAR)); + memmove(scur, cur, (mir_tstrlen(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(TCHAR)); + memmove(cur, cur + 1, (mir_tstrlen(cur + 1) + 1)*sizeof(wchar_t)); pos = cur - string - 1; } continue; } - TCHAR *scur = cur + 1, *tcur = scur; + wchar_t *scur = cur + 1, *tcur = scur; while (isValidTokenChar(*tcur)) tcur++; @@ -224,7 +224,7 @@ static TCHAR* replaceDynVars(FORMATINFO *fi) } else if ((*cur == FUNC_CHAR) || (*cur == FUNC_ONCE_CHAR)) { cur += mir_tstrlen(tr->tszTokenString) + 1; - TCHAR *argcur = getArguments(cur, argv); + wchar_t *argcur = getArguments(cur, argv); if (argcur == cur || argcur == NULL) { fi->eCount++; // error getting arguments @@ -282,7 +282,7 @@ static TCHAR* replaceDynVars(FORMATINFO *fi) curPos = cur - string; if (tokenLen < parsedTokenLen) { // string needs more memory - string = (TCHAR*)mir_realloc(string, (initStrLen - tokenLen + parsedTokenLen + 1)*sizeof(TCHAR)); + string = (wchar_t*)mir_realloc(string, (initStrLen - tokenLen + parsedTokenLen + 1)*sizeof(wchar_t)); if (string == NULL) { fi->eCount++; return NULL; @@ -290,11 +290,11 @@ static TCHAR* replaceDynVars(FORMATINFO *fi) } scur = string + scurPos; cur = string + curPos; - memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur) + 1)*sizeof(TCHAR)); - memcpy(scur, parsedToken, parsedTokenLen*sizeof(TCHAR)); + memmove(scur + parsedTokenLen, cur, (mir_tstrlen(cur) + 1)*sizeof(wchar_t)); + memcpy(scur, parsedToken, parsedTokenLen*sizeof(wchar_t)); { size_t len = mir_tstrlen(string); - string = (TCHAR*)mir_realloc(string, (len + 1)*sizeof(TCHAR)); + string = (wchar_t*)mir_realloc(string, (len + 1)*sizeof(wchar_t)); } if ((ai.flags & AIF_DONTPARSE) || tmpVarPos >= 0) pos += parsedTokenLen; @@ -302,7 +302,7 @@ static TCHAR* replaceDynVars(FORMATINFO *fi) pos--; // parse the same pos again, it changed } - return (TCHAR*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(TCHAR)); + return (wchar_t*)mir_realloc(string, (mir_tstrlen(string) + 1)*sizeof(wchar_t)); } /* @@ -314,7 +314,7 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM) int i; BOOL copied; FORMATINFO *fi, tempFi; - TCHAR *tszFormat, *orgFormat, *tszSource, *orgSource, *tRes; + wchar_t *tszFormat, *orgFormat, *tszSource, *orgSource, *tRes; if (((FORMATINFO *)wParam)->cbSize >= sizeof(FORMATINFO)) { memset(&tempFi, 0, sizeof(FORMATINFO)); @@ -384,7 +384,7 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM) return res; } -TCHAR* formatString(FORMATINFO *fi) +wchar_t* formatString(FORMATINFO *fi) { if (fi == NULL) return NULL; |