summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-30 19:34:50 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-30 19:34:50 +0000
commit190b98cf90600fc0e98543ee87d772560547acca (patch)
tree8b32108b311515eb63f5292c2ec9efe50ffcfd9f
parentca7197e8812b188a99fc72b524f936e06e08327a (diff)
"Variables are inexhaustible like an atom" (c) V.Lenin
git-svn-id: http://svn.miranda-ng.org/main/trunk@704 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Variables/action_variables.cpp2
-rw-r--r--plugins/Variables/condition_variables.cpp2
-rw-r--r--plugins/Variables/contact.cpp40
-rw-r--r--plugins/Variables/enumprocs.cpp2
-rw-r--r--plugins/Variables/help.cpp69
-rw-r--r--plugins/Variables/options.cpp2
-rw-r--r--plugins/Variables/parse_alias.cpp12
-rw-r--r--plugins/Variables/parse_external.cpp4
-rw-r--r--plugins/Variables/parse_logic.cpp4
-rw-r--r--plugins/Variables/parse_math.cpp4
-rw-r--r--plugins/Variables/parse_metacontacts.cpp6
-rw-r--r--plugins/Variables/parse_miranda.cpp16
-rw-r--r--plugins/Variables/parse_str.cpp46
-rw-r--r--plugins/Variables/parse_system.cpp69
-rw-r--r--plugins/Variables/tokenregister.cpp6
-rw-r--r--plugins/Variables/variables.cpp18
16 files changed, 146 insertions, 156 deletions
diff --git a/plugins/Variables/action_variables.cpp b/plugins/Variables/action_variables.cpp
index 541b592fd4..d767250578 100644
--- a/plugins/Variables/action_variables.cpp
+++ b/plugins/Variables/action_variables.cpp
@@ -31,7 +31,7 @@ static void parseStringThread(void *arg) {
if (arg == NULL) {
return;
}
- tszParsed = (TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)fi, 0);
+ tszParsed = (TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)fi, 0);
log_debugA("parseStringThread: %s > %s", fi->tszFormat, tszParsed);
if (tszParsed != NULL) {
mir_free(tszParsed);
diff --git a/plugins/Variables/condition_variables.cpp b/plugins/Variables/condition_variables.cpp
index b252a78f8f..c58703cc54 100644
--- a/plugins/Variables/condition_variables.cpp
+++ b/plugins/Variables/condition_variables.cpp
@@ -39,7 +39,7 @@ int ParseStringCondition(DWORD conditionID, REPORTINFO *ri) {
fi.tszExtraText = ((ri->td!=NULL)&&(ri->td->dFlags&DF_TEXT))?ri->td->tszText:NULL;
fi.hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL;
fi.flags |= FIF_TCHAR;
- mir_free((TCHAR *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0));
+ mir_free((TCHAR*)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0));
log_debugA("err: %d", fi.eCount);
res = fi.eCount==0?CRV_TRUE:CRV_FALSE;
DBFreeVariant(&dbv);
diff --git a/plugins/Variables/contact.cpp b/plugins/Variables/contact.cpp
index 65c53859fc..16ef88a239 100644
--- a/plugins/Variables/contact.cpp
+++ b/plugins/Variables/contact.cpp
@@ -131,8 +131,8 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if (type & CNF_UNICODE )
- return (TCHAR *)mir_a2t(szProto);
- return (TCHAR *)mir_strdup(szProto);
+ return (TCHAR*)mir_a2t(szProto);
+ return (TCHAR*)mir_strdup(szProto);
case CCNF_ACCOUNT:
if (g_mirandaVersion < PLUGIN_MAKE_VERSION( 0,8,0,0 ))
@@ -155,9 +155,9 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if (type & CNF_UNICODE )
- return (TCHAR *)mir_a2t(protoname);
+ return (TCHAR*)mir_a2t(protoname);
- return (TCHAR *)mir_strdup(protoname);
+ return (TCHAR*)mir_strdup(protoname);
case CCNF_STATUS:
szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
@@ -169,7 +169,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if (type & CNF_UNICODE) {
- szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)GSMDF_UNICODE);
+ szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)GSMDF_UNICODE);
if (szStatus == NULL)
return NULL;
@@ -180,7 +180,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
if (aszStatus == NULL)
return NULL;
- return (TCHAR *)mir_strdup(aszStatus);
+ return (TCHAR*)mir_strdup(aszStatus);
}
case CCNF_INTERNALIP:
@@ -200,25 +200,25 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
return NULL;
if (type & CNF_UNICODE )
- return (TCHAR *)mir_a2t(dotted);
- return (TCHAR *)mir_strdup(dotted);
+ return (TCHAR*)mir_a2t(dotted);
+ return (TCHAR*)mir_strdup(dotted);
}
case CCNF_GROUP:
if (!DBGetContactSetting(hContact, "CList", "Group", &dbv)) {
if (type & CNF_UNICODE )
- res = (TCHAR *)mir_a2t(dbv.pszVal);
+ res = (TCHAR*)mir_a2t(dbv.pszVal);
else
- res = (TCHAR *)mir_strdup(dbv.pszVal);
+ res = (TCHAR*)mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
return res;
}
if (!DBGetContactSettingW(hContact, "CList", "Group", &dbv)) {
if (type & CNF_UNICODE )
- res = (TCHAR *)mir_wstrdup(dbv.pwszVal);
+ res = (TCHAR*)mir_wstrdup(dbv.pwszVal);
else
- res = (TCHAR *)mir_u2a(dbv.pwszVal);
+ res = (TCHAR*)mir_u2a(dbv.pwszVal);
DBFreeVariant(&dbv);
return res;
@@ -258,12 +258,12 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
if (type & CNF_UNICODE) {
TCHAR *ptszVal;
- ptszVal = (TCHAR *)mir_a2t((char *)ci.pszVal);
+ ptszVal = (TCHAR*)mir_a2t((char *)ci.pszVal);
mir_free(ci.pszVal);
return ptszVal;
}
else {
- res = (TCHAR *)mir_strdup((char *)ci.pszVal);
+ res = (TCHAR*)mir_strdup((char *)ci.pszVal);
mir_free(ci.pszVal);
return res;
} } }
@@ -276,8 +276,8 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
szVal[0] = (char)ci.bVal;
if (type & CNF_UNICODE )
- return (TCHAR *)mir_a2t(szVal);
- return (TCHAR *)mir_strdup(szVal);
+ return (TCHAR*)mir_a2t(szVal);
+ return (TCHAR*)mir_strdup(szVal);
case CNFT_WORD:
return itot(ci.wVal);
@@ -290,7 +290,7 @@ static TCHAR* getContactInfo(BYTE type, HANDLE hContact)
if (type&CNF_UNICODE)
res = mir_tstrdup(ci.pszVal);
else
- res = (TCHAR *)mir_strdup((char *)ci.pszVal);
+ res = (TCHAR*)mir_strdup((char *)ci.pszVal);
mir_free(ci.pszVal);
}
@@ -381,7 +381,7 @@ int getContactFromString( CONTACTSINFO* ci )
cInfo = (TCHAR*)mir_alloc(32);
//cInfo = itot((INT_PTR)hContact);
_stprintf(cInfo, _T("%p"), hContact);
- szFind = ( TCHAR* )mir_alloc((_tcslen(cInfo) + _tcslen(_T(PROTOID_HANDLE)) + 4)*sizeof(TCHAR));
+ szFind = (TCHAR*)mir_alloc((_tcslen(cInfo) + _tcslen(_T(PROTOID_HANDLE)) + 4)*sizeof(TCHAR));
if (szFind != NULL)
{
wsprintf(szFind, _T("<%s:%s>"), _T(PROTOID_HANDLE), cInfo);
@@ -395,7 +395,7 @@ int getContactFromString( CONTACTSINFO* ci )
}
else
{
- szFind = ( TCHAR* )mir_alloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR));
+ szFind = (TCHAR*)mir_alloc((_tcslen(cInfo) + strlen(szProto) + 4)*sizeof(TCHAR));
if (szFind != NULL)
{
tszProto = mir_a2t(szProto);
@@ -596,7 +596,7 @@ TCHAR *encodeContactToString(HANDLE hContact)
if (szProto == NULL || tszUniqueId == NULL)
return NULL;
- tszResult = ( TCHAR* )mir_alloc((_tcslen(tszUniqueId) + strlen(szProto) + 4) * sizeof(TCHAR));
+ tszResult = (TCHAR*)mir_calloc((_tcslen(tszUniqueId) + strlen(szProto) + 4) * sizeof(TCHAR));
if (tszResult == NULL)
return NULL;
diff --git a/plugins/Variables/enumprocs.cpp b/plugins/Variables/enumprocs.cpp
index 74462a8661..56df0acfc8 100644
--- a/plugins/Variables/enumprocs.cpp
+++ b/plugins/Variables/enumprocs.cpp
@@ -181,7 +181,7 @@ BOOL WINAPI EnumProcs(PROCENUMPROC lpProc, LPARAM lParam) {
// Get the module name
if (!lpfGetModuleBaseName(hProcess, hMod,
- (TCHAR *)szFileName, sizeof(szFileName)))
+ (TCHAR*)szFileName, sizeof(szFileName)))
szFileName[0] = 0;
}
CloseHandle(hProcess);
diff --git a/plugins/Variables/help.cpp b/plugins/Variables/help.cpp
index 348384297a..66d24ee12f 100644
--- a/plugins/Variables/help.cpp
+++ b/plugins/Variables/help.cpp
@@ -342,7 +342,7 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
else args = NULL;
len = _tcslen(tr->tszTokenString) + (args!=NULL?strlen(args):0) + 3;
- desc = ( TCHAR* )mir_calloc(len * sizeof(TCHAR));
+ desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR));
if (desc == NULL)
return NULL;
@@ -549,7 +549,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg,UINT msg,WPARAM wParam
if (len < 0) {
break;
}
- tokenString = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ tokenString = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (tokenString == NULL) {
break;
}
@@ -775,7 +775,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
TCHAR *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 = (TCHAR*)mir_calloc((len+1)* sizeof(TCHAR));
SendMessage(GetParent(hwndDlg), VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)extraText);
}
else extraText = NULL;
@@ -1045,10 +1045,9 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
if ((dat->vhs->fi != NULL) && (!(dat->vhs->flags&VHF_DONTFILLSTRUCT))) {
int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
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 = (TCHAR*)mir_calloc((len+1)*sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->tszFormat);
}
else {
@@ -1056,18 +1055,15 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
SendMessageA(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szFormat);
}
}
-
}
}
if (dat->vhs->hwndCtrl != NULL) {
- int len;
-
- len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
+ int len = SendMessage(hwndDlg, VARM_GETINPUTTEXTLENGTH, 0, 0);
if (len > 0) {
TCHAR *tszText;
- tszText = ( TCHAR* )mir_calloc((len+1)*sizeof(TCHAR));
+ tszText = (TCHAR*)mir_calloc((len+1)*sizeof(TCHAR));
if (tszText != NULL) {
SendMessage(hwndDlg, VARM_GETINPUTTEXT, (WPARAM)len+1, (LPARAM)tszText);
SetWindowText(dat->vhs->hwndCtrl, tszText);
@@ -1082,20 +1078,16 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
}
if ((dat->vhs->flags&VHF_FULLFILLSTRUCT) && (dat->vhs->fi != NULL)) {
- int len;
-
- len = SendMessage(hwndDlg, VARM_GETEXTRATEXTLENGTH, 0, 0);
+ 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 = (TCHAR*)mir_calloc((len+1)*sizeof(WCHAR));
SendMessage(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->tszExtraText);
}
else {
dat->vhs->fi->szExtraText = ( char* )mir_calloc(len+1);
SendMessageA(hwndDlg, VARM_GETEXTRATEXT, (WPARAM)len+1, (LPARAM)dat->vhs->fi->szExtraText);
}
-
}
dat->vhs->fi->hContact = (HANDLE)SendMessage(hwndDlg, VARM_GETSUBJECT, 0, 0);
}
@@ -1158,30 +1150,31 @@ static BOOL CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
}
break;
- case WM_GETMINMAXINFO: {
- int i, count;
- TCITEM tci;
- RECT rcParent;
- HWND hTab;
- MINMAXINFO pageMinMax;
-
- GetWindowRect(hwndDlg, &rcParent);
- // defaults
- ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 400;
- ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 400;
- hTab = GetDlgItem(hwndDlg, IDC_TABS);
- tci.mask = TCIF_PARAM;
- count = TabCtrl_GetItemCount(hTab);
- // return the largest of all pages
- for (i=0;i<count;i++) {
- TabCtrl_GetItem(hTab, i, &tci);
- ZeroMemory(&pageMinMax, sizeof(pageMinMax));
- SendMessage((HWND)tci.lParam, WM_GETMINMAXINFO, wParam, (LPARAM)&pageMinMax);
- ((MINMAXINFO*)lParam)->ptMinTrackSize.x = max(((MINMAXINFO*)lParam)->ptMinTrackSize.x, pageMinMax.ptMinTrackSize.x);
- ((MINMAXINFO*)lParam)->ptMinTrackSize.y = max(((MINMAXINFO*)lParam)->ptMinTrackSize.y, pageMinMax.ptMinTrackSize.y);
+ case WM_GETMINMAXINFO:
+ {
+ int i, count;
+ TCITEM tci;
+ RECT rcParent;
+ HWND hTab;
+ MINMAXINFO pageMinMax;
+
+ GetWindowRect(hwndDlg, &rcParent);
+ // defaults
+ ((MINMAXINFO*)lParam)->ptMinTrackSize.x = 400;
+ ((MINMAXINFO*)lParam)->ptMinTrackSize.y = 400;
+ hTab = GetDlgItem(hwndDlg, IDC_TABS);
+ tci.mask = TCIF_PARAM;
+ count = TabCtrl_GetItemCount(hTab);
+ // return the largest of all pages
+ for (i=0;i<count;i++) {
+ TabCtrl_GetItem(hTab, i, &tci);
+ ZeroMemory(&pageMinMax, sizeof(pageMinMax));
+ SendMessage((HWND)tci.lParam, WM_GETMINMAXINFO, wParam, (LPARAM)&pageMinMax);
+ ((MINMAXINFO*)lParam)->ptMinTrackSize.x = max(((MINMAXINFO*)lParam)->ptMinTrackSize.x, pageMinMax.ptMinTrackSize.x);
+ ((MINMAXINFO*)lParam)->ptMinTrackSize.y = max(((MINMAXINFO*)lParam)->ptMinTrackSize.y, pageMinMax.ptMinTrackSize.y);
+ }
}
break;
- }
case WM_SIZE: {
TCITEM tci;
diff --git a/plugins/Variables/options.cpp b/plugins/Variables/options.cpp
index 3ccbbd987f..e94e27fcdf 100644
--- a/plugins/Variables/options.cpp
+++ b/plugins/Variables/options.cpp
@@ -88,7 +88,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));
+ TCHAR *szFormatText = (TCHAR*)mir_calloc((len+1)* sizeof(TCHAR));
if (szFormatText == NULL)
break;
diff --git a/plugins/Variables/parse_alias.cpp b/plugins/Variables/parse_alias.cpp
index 1ab708b42d..49c2999595 100644
--- a/plugins/Variables/parse_alias.cpp
+++ b/plugins/Variables/parse_alias.cpp
@@ -62,7 +62,7 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg) {
}
if (((signed int)_tcslen(tArg) == (ecur-cur)) && (!_tcsncmp(tArg, res+cur, _tcslen(tArg)))) {
if ( _tcslen(rArg) > _tcslen(tArg)) {
- res = ( TCHAR* )mir_realloc(res, (_tcslen(res) + (_tcslen(rArg)-_tcslen(tArg)) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res) + (_tcslen(rArg)-_tcslen(tArg)) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
}
@@ -115,7 +115,7 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
}
}
ar[i].argc = argc;
- ar[i].argv = ( TCHAR** )mir_realloc(ar[i].argv, argc * sizeof(TCHAR *));
+ ar[i].argv = ( TCHAR** )mir_realloc(ar[i].argv, argc * sizeof(TCHAR*));
if (ar[i].argv == NULL) {
LeaveCriticalSection(&csAliasRegister);
return -1;
@@ -138,7 +138,7 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
ar[arCount].szAlias = mir_tstrdup(szAlias);
ar[arCount].szTranslation = mir_tstrdup(szTranslation);
ar[arCount].argc = argc;
- ar[arCount].argv = ( TCHAR** )mir_alloc(argc * sizeof(TCHAR *));
+ ar[arCount].argv = ( TCHAR** )mir_alloc(argc * sizeof(TCHAR*));
if (ar[arCount].argv == NULL) {
LeaveCriticalSection(&csAliasRegister);
return -1;
@@ -169,7 +169,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
while (isValidTokenChar(*cur))
cur++;
- alias = ( TCHAR* )mir_calloc(((cur-ai->targv[1])+1)*sizeof(TCHAR));
+ alias = (TCHAR*)mir_calloc(((cur-ai->targv[1])+1)*sizeof(TCHAR));
if (alias == NULL)
return NULL;
@@ -180,9 +180,9 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai) {
szArgs = NULL;
for (i=0;i<argc;i++) {
if (i == 0)
- szArgs = ( TCHAR* )mir_calloc(( _tcslen(argv[i])+2)*sizeof(TCHAR));
+ szArgs = (TCHAR*)mir_calloc(( _tcslen(argv[i])+2)*sizeof(TCHAR));
else
- szArgs = ( TCHAR* )mir_realloc(szArgs, (_tcslen(szArgs) + _tcslen(argv[i]) + 2)*sizeof(TCHAR));
+ szArgs = (TCHAR*)mir_realloc(szArgs, (_tcslen(szArgs) + _tcslen(argv[i]) + 2)*sizeof(TCHAR));
_tcscat(szArgs, argv[i]);
if (i != argc-1)
diff --git a/plugins/Variables/parse_external.cpp b/plugins/Variables/parse_external.cpp
index 6a0d0dd846..42b7a12462 100644
--- a/plugins/Variables/parse_external.cpp
+++ b/plugins/Variables/parse_external.cpp
@@ -39,7 +39,7 @@ static TCHAR *getFullWinampTitleText() {
if (hwndWinamp == NULL)
return NULL;
- szWinText = ( TCHAR* )mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR));
+ szWinText = (TCHAR*)mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR));
if (szWinText == NULL)
return NULL;
@@ -47,7 +47,7 @@ static TCHAR *getFullWinampTitleText() {
mir_free(szWinText);
return NULL;
}
- szTitle = ( TCHAR* )mir_alloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR));
+ szTitle = (TCHAR*)mir_alloc((2*_tcslen(szWinText)+1)*sizeof(TCHAR));
if (szTitle == NULL) {
mir_free(szWinText);
return NULL;
diff --git a/plugins/Variables/parse_logic.cpp b/plugins/Variables/parse_logic.cpp
index a9abcaa227..b375faab14 100644
--- a/plugins/Variables/parse_logic.cpp
+++ b/plugins/Variables/parse_logic.cpp
@@ -257,11 +257,11 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai) {
parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
- res = ( TCHAR* )mir_alloc( _tcslen(parsed)+1 * sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc( _tcslen(parsed)+1 * sizeof(TCHAR));
if (res == NULL)
return NULL;
}
- else res = ( TCHAR* )mir_realloc(res, (_tcslen(res)+_tcslen(parsed)+1)*sizeof(TCHAR));
+ else res = (TCHAR*)mir_realloc(res, (_tcslen(res)+_tcslen(parsed)+1)*sizeof(TCHAR));
_tcscat(res, parsed);
}
diff --git a/plugins/Variables/parse_math.cpp b/plugins/Variables/parse_math.cpp
index 9fefb30ee4..c214898b5d 100644
--- a/plugins/Variables/parse_math.cpp
+++ b/plugins/Variables/parse_math.cpp
@@ -64,7 +64,7 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai) {
padding = ttoi(ai->targv[2]);
mir_sntprintf(szVal, SIZEOF(szVal), _T("%x"), val);
zeros = max(padding - (signed int)_tcslen(szVal), 0);
- res = ( TCHAR* )mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -170,7 +170,7 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai) {
return NULL;
zeros = max(padding - (signed int)_tcslen(szVal), 0);
- res = ( TCHAR* )mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
diff --git a/plugins/Variables/parse_metacontacts.cpp b/plugins/Variables/parse_metacontacts.cpp
index dd41eba2e3..341457f240 100644
--- a/plugins/Variables/parse_metacontacts.cpp
+++ b/plugins/Variables/parse_metacontacts.cpp
@@ -65,7 +65,7 @@ static TCHAR *parseGetParent(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -126,7 +126,7 @@ static TCHAR *parseGetDefault(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -187,7 +187,7 @@ static TCHAR *parseGetMostOnline(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
diff --git a/plugins/Variables/parse_miranda.cpp b/plugins/Variables/parse_miranda.cpp
index ad1a79f514..201f699fbf 100644
--- a/plugins/Variables/parse_miranda.cpp
+++ b/plugins/Variables/parse_miranda.cpp
@@ -26,7 +26,7 @@ static TCHAR *parseCodeToStatus(ARGUMENTSINFO *ai)
return NULL;
unsigned int status = ttoi(ai->targv[1]);
- TCHAR *szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
+ TCHAR *szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
if (szStatus != NULL)
return mir_tstrdup(szStatus);
@@ -290,7 +290,7 @@ static TCHAR *parseLastSeenDate(ARGUMENTSINFO *ai)
lsTime.wMonth = DBGetContactSettingWord(hContact, szModule, "Month", 0);
int len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- TCHAR *res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -349,7 +349,7 @@ static TCHAR *parseLastSeenTime(ARGUMENTSINFO *ai)
lsTime.wYear = DBGetContactSettingWord(hContact, szModule, "Year", 0);
int len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &lsTime, szFormat, NULL, 0);
- TCHAR *res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -389,7 +389,7 @@ static TCHAR *parseLastSeenStatus(ARGUMENTSINFO *ai)
if (status == 0)
return NULL;
- TCHAR *szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
+ TCHAR *szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_TCHAR);
if (szStatus != NULL)
return mir_tstrdup(szStatus);
@@ -420,7 +420,7 @@ static TCHAR *parseMyStatus(ARGUMENTSINFO *ai)
else
status = CallProtoService( _T2A(ai->targv[1]), PS_GETSTATUS, 0, 0);
- TCHAR *szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_UNICODE);
+ TCHAR *szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, GSMDF_UNICODE);
if (szStatus != NULL)
return mir_tstrdup(szStatus);
@@ -489,7 +489,7 @@ static TCHAR *parseSpecialContact(ARGUMENTSINFO *ai)
return NULL;
}
- res = ( TCHAR* )mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((strlen(szProto) + _tcslen(szUniqueID) + 4)*sizeof(TCHAR));
if (res == NULL) {
mir_free(szUniqueID);
return NULL;
@@ -702,7 +702,7 @@ static TCHAR *parseDbEvent(ARGUMENTSINFO *ai)
DBEVENTINFO dbe = { 0 };
dbe.cbSize = sizeof(DBEVENTINFO);
dbe.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)hDbEvent, 0);
- dbe.pBlob = ( PBYTE )mir_calloc(dbe.cbBlob);
+ dbe.pBlob = (PBYTE)mir_calloc(dbe.cbBlob);
if (CallService(MS_DB_EVENT_GET, (WPARAM)hDbEvent, (LPARAM)&dbe)) {
mir_free(dbe.pBlob);
return NULL;
@@ -741,7 +741,7 @@ static TCHAR *parseContactNameString(ARGUMENTSINFO *ai)
return NULL;
ai->flags |= AIF_DONTPARSE;
- TCHAR *ret = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) ai->fi->hContact, GCDNF_TCHAR);
+ TCHAR *ret = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) ai->fi->hContact, GCDNF_TCHAR);
if (ret == NULL)
return NULL;
diff --git a/plugins/Variables/parse_str.cpp b/plugins/Variables/parse_str.cpp
index 81144aea08..4ee815cdae 100644
--- a/plugins/Variables/parse_str.cpp
+++ b/plugins/Variables/parse_str.cpp
@@ -92,7 +92,7 @@ static TCHAR *parseEolToCrlf(ARGUMENTSINFO *ai) {
}
log_debug(cur);
loc = cur - res;
- res = ( TCHAR* )realloc(res, (_tcslen(res)+2)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res)+2)*sizeof(TCHAR));
cur = res + loc;
MoveMemory(cur+2, cur+1, (_tcslen(cur+1)+1)*sizeof(TCHAR));
CopyMemory(cur, _T("\r\n"), 2*sizeof(TCHAR));
@@ -123,7 +123,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) {
return mir_tstrdup(ai->targv[1]);
}
cur--;
- res = ( TCHAR* )mir_alloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((cur-ai->targv[1] + _tcslen(szReplacement) + 1)*sizeof(TCHAR));
if (res == NULL) {
return res;
}
@@ -157,7 +157,7 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) {
}
if (szEol != NULL) {
if ( _tcslen(szReplacement) > _tcslen(szEol)) {
- res = ( TCHAR* )realloc(res, (_tcslen(res) + _tcslen(szReplacement) - _tcslen(szEol) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szReplacement) - _tcslen(szEol) + 1)*sizeof(TCHAR));
cur = res+pos;
}
MoveMemory(cur+_tcslen(szReplacement), cur+_tcslen(szEol), (_tcslen(cur+_tcslen(szEol))+1)*sizeof(TCHAR));
@@ -165,7 +165,7 @@ static TCHAR *parseFixeol2(ARGUMENTSINFO *ai) {
pos += _tcslen(szReplacement) - 1;
}
}
- res = ( TCHAR* )realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
return res;
}
@@ -183,7 +183,7 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) {
if (pos > _tcslen(ai->targv[1])) {
return NULL;
}
- res = ( TCHAR* )mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -208,7 +208,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) {
return NULL;
}
len = min(len, (signed int)_tcslen(ai->targv[1]));
- res = ( TCHAR* )mir_alloc((len + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -311,7 +311,7 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -341,7 +341,7 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -370,7 +370,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )mir_alloc((padding + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -401,7 +401,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) {
return NULL;
addcount = max(padding - (signed int)_tcslen(ai->targv[1]), 0);
- res = ( TCHAR* )mir_alloc((padding + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((padding + 1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -428,7 +428,7 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai) {
if (count < 0) {
return NULL;
}
- res = ( TCHAR* )mir_alloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -458,7 +458,7 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) {
cur = res+pos;
if (!_tcsncmp(cur, ai->targv[i], _tcslen(ai->targv[i]))) {
if ( _tcslen(ai->targv[i+1]) > _tcslen(ai->targv[i])) {
- res = ( TCHAR* )realloc(res, (_tcslen(res) + _tcslen(ai->targv[i+1]) - _tcslen(ai->targv[i]) + 1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(ai->targv[i+1]) - _tcslen(ai->targv[i]) + 1)*sizeof(TCHAR));
cur = res+pos;
}
MoveMemory(cur+_tcslen(ai->targv[i+1]), cur+_tcslen(ai->targv[i]), (_tcslen(cur+_tcslen(ai->targv[i]))+1)*sizeof(TCHAR));
@@ -466,7 +466,7 @@ static TCHAR *parseReplace(ARGUMENTSINFO *ai) {
pos += _tcslen(ai->targv[i+1]) - 1;
}
}
- res = ( TCHAR* )realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
}
return res;
@@ -485,7 +485,7 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) {
return NULL;
}
len = min(len, (signed int)_tcslen(ai->targv[1]));
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -515,7 +515,7 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) {
if (display > _tcslen(ai->targv[1])) {
display = _tcslen(ai->targv[1]);
}
- res = ( TCHAR* )mir_alloc((2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((2*_tcslen(ai->targv[1])+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -524,7 +524,7 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai) {
_tcscat(res, ai->targv[1]);
MoveMemory(res, res+move, (_tcslen(res+move)+1)*sizeof(TCHAR));
*(res + display) = _T('\0');
- res = ( TCHAR* )realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res)+1)*sizeof(TCHAR));
return res;
}
@@ -690,7 +690,7 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) {
if (to < from) {
return NULL;
}
- res = ( TCHAR* )mir_alloc((to-from+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((to-from+1)*sizeof(TCHAR));
ZeroMemory(res, (to-from+1)*sizeof(TCHAR));
_tcsncpy(res, ai->targv[1]+from, to-from);
@@ -745,7 +745,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) {
if (scur >= ecur) {
return mir_tstrdup(_T(""));
}
- res = ( TCHAR* )mir_alloc((ecur-scur+2)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((ecur-scur+2)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -767,7 +767,7 @@ static TCHAR *parseTab(ARGUMENTSINFO *ai) {
if (count < 0) {
return NULL;
}
- res = ( TCHAR* )mir_alloc((count+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((count+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -827,7 +827,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w) {
while ( (*ecur != _T(' ')) && (*ecur != _T('\0'))) {
ecur++;
}
- res = ( TCHAR* )mir_alloc((ecur-scur+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((ecur-scur+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -837,8 +837,8 @@ static TCHAR *getNthWord(TCHAR *szString, int w) {
return res;
}
-static TCHAR *parseWord(ARGUMENTSINFO *ai) {
-
+static TCHAR *parseWord(ARGUMENTSINFO *ai)
+{
int i, from, to;
TCHAR *res, *szWord;
@@ -864,7 +864,7 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai) {
return res;
if (res != NULL) {
- res = ( TCHAR* )realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR));
+ res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR));
if (res != NULL) {
_tcscat(res, _T(" "));
_tcscat(res, szWord);
diff --git a/plugins/Variables/parse_system.cpp b/plugins/Variables/parse_system.cpp
index 761211edeb..28dc3d4224 100644
--- a/plugins/Variables/parse_system.cpp
+++ b/plugins/Variables/parse_system.cpp
@@ -43,7 +43,7 @@ static TCHAR *parseComputerName(ARGUMENTSINFO *ai) {
ai->flags |= AIF_DONTPARSE;
len = MAX_COMPUTERNAME_LENGTH;
- res = ( TCHAR* )mir_alloc((len + 1) * sizeof(TCHAR));
+ res = (TCHAR*)mir_calloc((len + 1) * sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -72,7 +72,7 @@ static TCHAR *parseCpuLoad(ARGUMENTSINFO *ai) {
if ( _tcslen(ai->targv[1]) == 0)
szCounter = mir_tstrdup(_T("\\Processor(_Total)\\% Processor Time"));
else {
- szCounter = ( TCHAR* )mir_alloc((_tcslen(ai->targv[1]) + 32)*sizeof(TCHAR));
+ szCounter = (TCHAR*)mir_alloc((_tcslen(ai->targv[1]) + 32)*sizeof(TCHAR));
if (szCounter == NULL)
return NULL;
@@ -142,7 +142,7 @@ static TCHAR *parseCurrentDate(ARGUMENTSINFO *ai) {
szFormat = ai->targv[1];
len = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -165,7 +165,7 @@ static TCHAR *parseCurrentTime(ARGUMENTSINFO *ai) {
szFormat = ai->targv[1];
len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, szFormat, NULL, 0);
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -210,7 +210,7 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) {
if (*scur == _T('\\'))
scur++;
- res = ( TCHAR* )mir_alloc((ecur-scur)+2 * sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((ecur-scur+2) * sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -222,22 +222,19 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) {
path, depth
returns complete path up to "path depth - depth"
*/
-static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) {
-
- int depth;
- TCHAR *res, *ecur;
-
+static TCHAR *parseDirectory2(ARGUMENTSINFO *ai)
+{
if (ai->argc < 2 || ai->argc > 3 )
return NULL;
- depth = 1;
+ int depth = 1;
if (ai->argc == 3)
depth = ttoi(ai->targv[2]);
if (depth <= 0)
return NULL;
- ecur = ai->targv[1]+_tcslen(ai->targv[1]);
+ TCHAR *ecur = ai->targv[1]+_tcslen(ai->targv[1]);
while (depth > 0) {
while ( (*ecur != _T('\\')) && (ecur > ai->targv[1]))
ecur--;
@@ -248,7 +245,7 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) {
depth -= 1;
ecur--;
}
- res = ( TCHAR* )mir_alloc((ecur-ai->targv[1])+2 * sizeof(TCHAR));
+ TCHAR *res = (TCHAR*)mir_calloc((ecur-ai->targv[1]+2) * sizeof(TCHAR));
if (res == NULL)
return NULL;
@@ -358,7 +355,7 @@ static TCHAR *parseEnvironmentVariable(ARGUMENTSINFO *ai) {
if (len <= 0) {
return NULL;
}
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -401,7 +398,7 @@ static TCHAR *parseFindWindow(ARGUMENTSINFO *ai) {
len = SendMessage(hWin, WM_GETTEXTLENGTH, 0, 0);
if (len >= 0) {
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
ZeroMemory(res, (len+1)*sizeof(TCHAR));
GetWindowText(hWin, res, len+1);
return res;
@@ -457,17 +454,17 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) {
return NULL;
}
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
- tszRes = ( TCHAR* )mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
_tcscpy(tszRes, ffd.cFileName);
}
while (FindNextFile(hFind, &ffd) != 0) {
if (((ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && (bDirs)) || ((!(ffd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) && (bFiles))) {
if (tszRes != NULL) {
_tcscat(tszRes, tszSeperator);
- tszRes = ( TCHAR* )mir_realloc(tszRes, (_tcslen(tszRes) + _tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_realloc(tszRes, (_tcslen(tszRes) + _tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
}
else {
- tszRes = ( TCHAR* )mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
+ tszRes = (TCHAR*)mir_alloc((_tcslen(ffd.cFileName) + _tcslen(tszSeperator) + 1)*sizeof(TCHAR));
_tcscpy(tszRes, _T(""));
}
_tcscat(tszRes, ffd.cFileName);
@@ -552,7 +549,7 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai) {
}
mir_free(key);
len = MAX_REGVALUE_LENGTH+1;
- res = ( TCHAR* )mir_alloc(len*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc(len*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -612,7 +609,7 @@ static TCHAR *parseTimestamp2Date(ARGUMENTSINFO *ai) {
return NULL;
}
len = GetDateFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
- res = ( TCHAR* )mir_alloc((len+1) * sizeof(TCHAR));
+ res = (TCHAR*)mir_calloc((len+1) * sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -648,7 +645,7 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai) {
return NULL;
}
len = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &sysTime, szFormat, NULL, 0);
- res = ( TCHAR* )mir_alloc((len+1)*sizeof(TCHAR));
+ res = (TCHAR*)mir_alloc((len+1)*sizeof(TCHAR));
if (res == NULL) {
return NULL;
}
@@ -699,7 +696,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
if (*ai->targv[2] == _T('0')) {
// complete file
bufSz = fileSz + csz;
- pBuf = ( PBYTE )mir_alloc(1 * bufSz);
+ pBuf = (PBYTE)mir_calloc(bufSz);
if (pBuf == NULL)
return NULL;
@@ -711,7 +708,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
CloseHandle(hFile);
if (tUC) {
- res = (TCHAR *)pBuf;
+ res = (TCHAR*)pBuf;
}
else {
res = mir_a2t((char *)pBuf);
@@ -722,7 +719,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
return res;
}
bufSz = TXTFILEBUFSZ*csz;
- pBuf = ( PBYTE )mir_calloc(bufSz);
+ pBuf = (PBYTE)mir_calloc(bufSz);
if (pBuf == NULL) {
return NULL;
}
@@ -737,11 +734,11 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
totalReadSz += readSz;
for (pCur = pBuf;*pCur != '\0';pCur += csz) {
if (tUC) {
- if (!_tcsncmp((TCHAR *)pCur, _T("\r\n"), 2)) {
+ if (!_tcsncmp((TCHAR*)pCur, _T("\r\n"), 2)) {
lineCount += 1;
pCur += csz;
}
- else if (*(TCHAR *)pCur == _T('\n')) {
+ else if (*(TCHAR*)pCur == _T('\n')) {
lineCount += 1;
}
}
@@ -778,11 +775,11 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
linePos = (tUC?csz:0) + totalReadSz - readSz + pCur - pBuf;
}
if (tUC) {
- if (!_tcsncmp((TCHAR *)pCur, _T("\r\n"), 2)) {
+ if (!_tcsncmp((TCHAR*)pCur, _T("\r\n"), 2)) {
lineCount += 1;
pCur += csz;
}
- else if (*(TCHAR *)pCur == _T('\n')) {
+ else if (*(TCHAR*)pCur == _T('\n')) {
lineCount += 1;
}
}
@@ -796,7 +793,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
}
}
}
- if (((tUC) && (*(TCHAR *)pCur == _T('\r'))) || ((!tUC) && (*(char *)pCur == '\r'))) {
+ if (((tUC) && (*(TCHAR*)pCur == _T('\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;
@@ -822,18 +819,18 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
return NULL;
}
for (pCur = pBuf;(pCur < pBuf+readSz);pCur+=csz) {
- if ((tUC) && ((!_tcsncmp((TCHAR *)pCur, _T("\r\n"), 2)) || (*(TCHAR *)pCur == _T('\n'))) ||
+ if ((tUC) && ((!_tcsncmp((TCHAR*)pCur, _T("\r\n"), 2)) || (*(TCHAR*)pCur == _T('\n'))) ||
((!tUC) && (((!strncmp((char *)pCur, "\r\n", 2)) || (*(char *)pCur == '\n'))))) {
CloseHandle(hFile);
if (tUC) {
- *(TCHAR *)pCur = _T('\0');
+ *(TCHAR*)pCur = _T('\0');
}
else {
*(char *)pCur = '\0';
}
if (tUC) {
- res = (TCHAR *)pBuf;
+ res = (TCHAR*)pBuf;
}
else {
res = mir_a2t((char *)pBuf);
@@ -847,7 +844,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
CloseHandle(hFile);
if (tUC) {
- res = (TCHAR *)pBuf;
+ res = (TCHAR*)pBuf;
}
else {
res = mir_a2t((char *)pBuf);
@@ -859,11 +856,11 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai) {
if (readSz == bufSz-csz) {
// buffer must be increased
bufSz += TXTFILEBUFSZ*csz;
- if (((tUC) && (*(TCHAR *)pCur == _T('\r'))) || ((!tUC) && (*(char *)pCur == '\r'))) {
+ if (((tUC) && (*(TCHAR*)pCur == _T('\r'))) || ((!tUC) && (*(char *)pCur == '\r'))) {
pCur -= csz;
}
icur = pCur - pBuf;
- pBuf = ( PBYTE )mir_realloc(pBuf, bufSz);
+ pBuf = (PBYTE)mir_realloc(pBuf, bufSz);
pCur = pBuf+icur;
ZeroMemory(pCur+1, TXTFILEBUFSZ*csz);
}
@@ -925,7 +922,7 @@ static TCHAR *parseUserName(ARGUMENTSINFO *ai) {
}
ai->flags |= AIF_DONTPARSE;
len = UNLEN;
- res = ( TCHAR* )mir_alloc(len + 1);
+ res = (TCHAR*)mir_alloc(len + 1);
if (res == NULL) {
return NULL;
}
diff --git a/plugins/Variables/tokenregister.cpp b/plugins/Variables/tokenregister.cpp
index 20f8f7c280..0418c3024f 100644
--- a/plugins/Variables/tokenregister.cpp
+++ b/plugins/Variables/tokenregister.cpp
@@ -225,15 +225,15 @@ TCHAR *parseFromRegister(ARGUMENTSINFO *ai)
else if (thisVr->szService != NULL)
callRes = CallService( thisVr->szService, (WPARAM)0, (LPARAM)ai );
- if (( TCHAR* )callRes != NULL)
- res = mir_tstrdup(( TCHAR* )callRes );
+ if ((TCHAR*)callRes != NULL)
+ res = mir_tstrdup((TCHAR*)callRes );
}
if (( void* )callRes != NULL) {
if (trCopy.flags & TRF_CLEANUP ) {
if (trCopy.flags & TRF_CLEANUPFUNC )
- trCopy.cleanupFunctionT(( TCHAR* )callRes );
+ trCopy.cleanupFunctionT((TCHAR*)callRes );
else if (trCopy.szCleanupService != NULL)
CallService( trCopy.szCleanupService, 0, (LPARAM)callRes );
}
diff --git a/plugins/Variables/variables.cpp b/plugins/Variables/variables.cpp
index d10e42a1ab..f5666b4279 100644
--- a/plugins/Variables/variables.cpp
+++ b/plugins/Variables/variables.cpp
@@ -94,12 +94,12 @@ TCHAR *getArguments(TCHAR *string, TCHAR ***aargv, int *aargc) {
break;
}
if (bNewArg) {
- argv = ( TCHAR** )mir_realloc(argv, (argc+1)*sizeof(TCHAR *));
+ argv = ( TCHAR** )mir_realloc(argv, (argc+1)*sizeof(TCHAR*));
if (argv == NULL) {
return NULL;
}
if (cur > scur) {
- argv[argc] = ( TCHAR* )mir_alloc((cur-scur+2)*sizeof(TCHAR));
+ argv[argc] = (TCHAR*)mir_alloc((cur-scur+2)*sizeof(TCHAR));
if (argv[argc] == NULL) {
return NULL;
}
@@ -225,7 +225,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
if (*cur == _T('\0')) {
*scur = _T('\0');
- string = ( TCHAR* )mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR));
+ string = (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR));
continue;
}
MoveMemory(scur, cur, (_tcslen(cur)+1)*sizeof(TCHAR));
@@ -247,7 +247,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
fi->eCount += 1;
continue;
}
- token = ( TCHAR* )mir_alloc((tcur-scur+1)*sizeof(TCHAR));
+ token = (TCHAR*)mir_alloc((tcur-scur+1)*sizeof(TCHAR));
if (token == NULL) {
fi->eCount += 1;
return NULL;
@@ -312,7 +312,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
}
// cur should now point at the character after FIELD_CHAR or after the last ')'
if (tr != NULL) {
- pargv = ( TCHAR** )mir_alloc((argc+1)*sizeof(TCHAR *));
+ pargv = ( TCHAR** )mir_alloc((argc+1)*sizeof(TCHAR*));
if (pargv == NULL) {
fi->eCount += 1;
return NULL;
@@ -349,7 +349,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
// if the var contains the escape character, this character must be doubled, we don't want it to act as an esacpe char
/*for (tcur=parsedToken;*tcur != '\0';tcur++) {
if (*tcur == DONTPARSE_CHAR) {//|| (*(var+pos) == ')')) {
- parsedToken = realloc(parsedToken, strlen(parsedToken) + 2);
+ parsedToken = mir_realloc(parsedToken, strlen(parsedToken) + 2);
if (parsedToken == NULL) {
fi->err = EMEM;
return NULL;
@@ -366,7 +366,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
curPos = cur-string;
if (tokenLen < parsedTokenLen) {
// string needs more memory
- string = ( TCHAR* )mir_realloc(string, (initStrLen-tokenLen+parsedTokenLen+1)*sizeof(TCHAR));
+ string = (TCHAR*)mir_realloc(string, (initStrLen-tokenLen+parsedTokenLen+1)*sizeof(TCHAR));
if (string == NULL) {
fi->eCount += 1;
return NULL;
@@ -380,7 +380,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
int len;
len = _tcslen(string);
- string = ( TCHAR* )mir_realloc(string, (len+1)*sizeof(TCHAR));
+ string = (TCHAR*)mir_realloc(string, (len+1)*sizeof(TCHAR));
}
if (( ai.flags & AIF_DONTPARSE ) || tmpVarPos >= 0)
pos += parsedTokenLen;
@@ -400,7 +400,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
if (argv != NULL)
mir_free(argv);
- return ( TCHAR* )mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR));
+ return (TCHAR*)mir_realloc(string, (_tcslen(string)+1)*sizeof(TCHAR));
}
/*