summaryrefslogtreecommitdiff
path: root/plugins/Variables
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Variables')
-rw-r--r--plugins/Variables/src/contact.cpp21
-rw-r--r--plugins/Variables/src/help.cpp13
-rw-r--r--plugins/Variables/src/parse_alias.cpp13
-rw-r--r--plugins/Variables/src/parse_logic.cpp8
-rw-r--r--plugins/Variables/src/parse_math.cpp4
-rw-r--r--plugins/Variables/src/parse_miranda.cpp5
-rw-r--r--plugins/Variables/src/parse_str.cpp16
-rw-r--r--plugins/Variables/src/parse_system.cpp49
-rw-r--r--plugins/Variables/src/parse_variables.cpp11
-rw-r--r--plugins/Variables/src/variables.cpp33
10 files changed, 91 insertions, 82 deletions
diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp
index 65a92523e4..b5258b422f 100644
--- a/plugins/Variables/src/contact.cpp
+++ b/plugins/Variables/src/contact.cpp
@@ -107,10 +107,6 @@ BYTE getContactInfoType(TCHAR* type)
TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
{
/* returns dynamic allocated buffer with info, or NULL if failed */
- TCHAR *res = NULL;
- char protoname[128], szVal[16];
- PROTOACCOUNT *pa;
-
if (hContact == NULL)
return NULL;
@@ -118,18 +114,22 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
if (szProto == NULL)
return NULL;
+ TCHAR *res = NULL;
switch (type) {
case CCNF_PROTOID:
return mir_a2t(szProto);
- case CCNF_ACCOUNT:
- pa = ProtoGetAccount(szProto);
+ case CCNF_ACCOUNT: {
+ PROTOACCOUNT *pa = ProtoGetAccount(szProto);
return pa ? mir_tstrdup(pa->tszAccountName) : NULL;
+ }
- case CCNF_PROTOCOL:
+ case CCNF_PROTOCOL: {
+ char protoname[128];
if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))
return NULL;
return mir_a2t(protoname);
+ }
case CCNF_STATUS:
return mir_tstrdup((TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_UNICODE));
@@ -165,7 +165,8 @@ TCHAR* getContactInfoT(BYTE type, MCONTACT hContact)
ci.hContact = hContact;
ci.dwFlag = type | CNF_UNICODE;
CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci);
-
+
+ char szVal[16];
memset(szVal, '\0', sizeof(szVal));
switch(ci.type) {
case CNFT_BYTE:
@@ -334,7 +335,7 @@ int getContactFromString(CONTACTSINFO *ci)
return -1;
ci->hContacts[count] = hContact;
- count += 1;
+ count++;
}
}
@@ -346,7 +347,7 @@ int getContactFromString(CONTACTSINFO *ci)
cce[cacheSize].flags = ci->flags;
cce[cacheSize].tszContact = mir_tstrdup(tszContact);
if (cce[cacheSize].tszContact != NULL)
- cacheSize += 1;
+ cacheSize++;
}
}
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index fcc86aa69f..ee22d223ac 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -285,13 +285,9 @@ static TCHAR *getHelpDescription(TOKENREGISTEREX *tr)
static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
{
- char *args, *first, *second;
-
if (tr == NULL)
return NULL;
- args = NULL;
- TCHAR *tArgs = NULL;
if (tr->szHelpText == NULL)
return mir_tstrdup(tr->tszTokenString);
@@ -300,7 +296,8 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
return NULL;
char *cur = helpText;
- first = second = NULL;
+ TCHAR *tArgs = NULL;
+ char *args = NULL, *first = NULL, *second = NULL;
while (*cur != 0) {
if (*cur == '\t') {
if (first == NULL)
@@ -319,8 +316,10 @@ static TCHAR *getTokenDescription(TOKENREGISTEREX *tr)
size_t len = _tcslen(tr->tszTokenString) + (args!=NULL?strlen(args):0) + 3;
TCHAR *desc = (TCHAR*)mir_calloc(len * sizeof(TCHAR));
- if (desc == NULL)
+ if (desc == NULL) {
+ mir_free(helpText);
return NULL;
+ }
if (tr->flags&TRF_FIELD)
mir_sntprintf(desc, len, _T("%c%s%c"), FIELD_CHAR, tr->szTokenString, FIELD_CHAR);
@@ -381,7 +380,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar
HELPDLGDATA *hdd = (HELPDLGDATA *)GetWindowLongPtr(GetParent(hwndDlg), GWLP_USERDATA);
int i = -1;
do {
- i += 1;
+ i++;
tszHelpDesc = tszTokenDesc = NULL;
tr = getTokenRegister(i);
if ((tr == NULL) || (tr->tszTokenString == NULL))
diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp
index d9b31ace06..13c771f128 100644
--- a/plugins/Variables/src/parse_alias.cpp
+++ b/plugins/Variables/src/parse_alias.cpp
@@ -116,14 +116,15 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
}
return 0;
}
+ TCHAR **pargv = (TCHAR**)mir_alloc(argc * sizeof(TCHAR*));
+ if (pargv == NULL)
+ return -1;
ALIASREGISTER *p = new ALIASREGISTER;
p->szAlias = mir_tstrdup(szAlias);
p->szTranslation = mir_tstrdup(szTranslation);
p->argc = argc;
- p->argv = (TCHAR**)mir_alloc(argc * sizeof(TCHAR*));
- if (p->argv == NULL)
- return -1;
+ p->argv = pargv;
for (unsigned j = 0; j < p->argc; j++) {
if (argv[j] != NULL)
@@ -137,12 +138,10 @@ static int addToAliasRegister(TCHAR *szAlias, unsigned int argc, TCHAR** argv, T
static TCHAR *parseAddAlias(ARGUMENTSINFO *ai)
{
- int res;
- char *szHelp, *szArgsA;
-
if (ai->argc != 3)
return NULL;
+ char *szHelp, *szArgsA;
TCHAR *cur = ai->targv[1];
while (isValidTokenChar(*cur))
cur++;
@@ -165,6 +164,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai)
if (i != argc - 1)
_tcscat(szArgs, _T(","));
}
+ int res;
if (szArgs != NULL && argc > 0) {
szArgsA = mir_t2a(szArgs);
@@ -183,6 +183,7 @@ static TCHAR *parseAddAlias(ARGUMENTSINFO *ai)
}
mir_free(szArgs);
mir_free(szHelp);
+ mir_free(argv);
return (res == 0) ? mir_tstrdup(_T("")) : NULL;
}
diff --git a/plugins/Variables/src/parse_logic.cpp b/plugins/Variables/src/parse_logic.cpp
index 42f0ced5c3..9ce10a3a92 100644
--- a/plugins/Variables/src/parse_logic.cpp
+++ b/plugins/Variables/src/parse_logic.cpp
@@ -166,7 +166,6 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai)
if (ai->argc != 5)
return NULL;
- TCHAR *parsed;
TCHAR *res = mir_tstrdup(_T(""));
FORMATINFO fi;
@@ -178,16 +177,19 @@ static TCHAR *parseFor(ARGUMENTSINFO *ai)
mir_free(formatString(&fi));
while (fi.eCount == 0) {
fi.tszFormat = ai->targv[4];
- parsed = formatString(&fi);
+ TCHAR *parsed = formatString(&fi);
if (parsed != NULL) {
if (res == NULL) {
res = (TCHAR*)mir_alloc(_tcslen(parsed) + 1 * sizeof(TCHAR));
- if (res == NULL)
+ if (res == NULL) {
+ mir_free(parsed);
return NULL;
+ }
}
else res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(parsed) + 1)*sizeof(TCHAR));
_tcscat(res, parsed);
+ mir_free(parsed);
}
fi.tszFormat = ai->targv[3];
mir_free(formatString(&fi));
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index bd11a39c9f..54820e48f1 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -142,8 +142,10 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai)
unsigned zeros = max(padding - (signed int)_tcslen(szVal), 0);
TCHAR *res = (TCHAR*)mir_alloc((zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
- if (res == NULL)
+ if (res == NULL) {
+ mir_free(szVal);
return NULL;
+ }
memset(res, 0, ((zeros + _tcslen(szVal) + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index c696c74479..01b7581969 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -209,9 +209,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
if (ai->argc < 4)
return NULL;
- TCHAR *res = NULL, *szDefaultValue = NULL;
MCONTACT hContact = NULL;
-
if (_tcslen(ai->targv[1]) > 0) {
CONTACTSINFO ci = { 0 };
ci.cbSize = sizeof(ci);
@@ -228,6 +226,8 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
}
}
+ TCHAR *res = NULL, *szDefaultValue = NULL;
+
char *szModule = mir_t2a(ai->targv[2]);
char *szSetting = mir_t2a(ai->targv[3]);
@@ -238,6 +238,7 @@ static TCHAR* parseDBSetting(ARGUMENTSINFO *ai)
res = getDBSetting(hContact, szModule, szSetting, szDefaultValue);
mir_free(szModule);
mir_free(szSetting);
+ mir_free(szDefaultValue);
}
return res;
}
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp
index 28df138d44..0f6cb00b0d 100644
--- a/plugins/Variables/src/parse_str.cpp
+++ b/plugins/Variables/src/parse_str.cpp
@@ -211,7 +211,7 @@ static TCHAR *parseLineCount(ARGUMENTSINFO *ai)
TCHAR *cur = ai->targv[1];
while (cur < (ai->targv[1] + _tcslen(ai->targv[1]))) {
if (!_tcsncmp(cur, _T("\r\n"), 2)) {
- count += 1;
+ count++;
cur++;
}
else if (*cur == '\n')
@@ -700,13 +700,13 @@ static TCHAR *getNthWord(TCHAR *szString, int w)
while (*scur == ' ')
scur++;
- count += 1;
+ count++;
while ((count < w) && (scur < szString + _tcslen(szString))) {
if (*scur == ' ') {
while (*scur == ' ')
scur++;
- count += 1;
+ count++;
}
if (count < w)
scur++;
@@ -751,15 +751,15 @@ static TCHAR *parseWord(ARGUMENTSINFO *ai)
return res;
if (res != NULL) {
- res = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR));
- if (res != NULL) {
+ TCHAR *pres = (TCHAR*)mir_realloc(res, (_tcslen(res) + _tcslen(szWord) + 2)*sizeof(TCHAR));
+ if (pres != NULL) {
+ res = pres;
_tcscat(res, _T(" "));
_tcscat(res, szWord);
}
+ mir_free(szWord);
}
- else res = mir_tstrdup(szWord);
-
- mir_free(szWord);
+ else res = szWord;
}
return res;
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 6c18b39846..1c888e24f1 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -440,7 +440,7 @@ static TCHAR *parseProcessRunning(ARGUMENTSINFO *ai)
char *szProc, *ref;
szProc = ref = mir_u2a(ai->targv[1]);
- EnumProcs((PROCENUMPROC)MyProcessEnumerator, (LPARAM)&szProc);
+ EnumProcs(MyProcessEnumerator, (LPARAM)&szProc);
if (szProc != NULL)
ai->flags |= AIF_FALSE;
@@ -454,19 +454,20 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- HKEY hKey;
DWORD len, type;
- int err;
TCHAR *key = mir_tstrdup(ai->targv[1]);
if (key == NULL)
return NULL;
TCHAR *cur = _tcschr(key, '\\');
- if (cur == NULL)
+ if (cur == NULL) {
+ mir_free(key);
return NULL;
+ }
*cur = 0;
+ HKEY hKey;
if (!_tcscmp(key, _T("HKEY_CLASSES_ROOT")))
hKey = HKEY_CLASSES_ROOT;
else if (!_tcscmp(key, _T("HKEY_CURRENT_USER")))
@@ -491,7 +492,7 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai)
return NULL;
memset(res, 0, (len * sizeof(TCHAR)));
- err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
+ int err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
if ((err != ERROR_SUCCESS) || (type != REG_SZ)) {
RegCloseKey(hKey);
mir_free(res);
@@ -586,26 +587,26 @@ static TCHAR *parseTimestamp2Time(ARGUMENTSINFO *ai)
static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
{
- int lineNo, lineCount, csz;
- unsigned int icur, bufSz;
- DWORD fileSz, readSz, totalReadSz;
- unsigned long linePos;
- TCHAR tUC, *res;
- BYTE *pBuf, *pCur;
-
if (ai->argc != 3)
return NULL;
- lineNo = ttoi(ai->targv[2]);
HANDLE hFile = CreateFile(ai->targv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return NULL;
- fileSz = GetFileSize(hFile, NULL);
+ DWORD fileSz = GetFileSize(hFile, NULL);
if (fileSz == INVALID_FILE_SIZE) {
CloseHandle(hFile);
return NULL;
}
+
+ int lineNo = ttoi(ai->targv[2]);
+ int lineCount, csz;
+ unsigned int icur, bufSz;
+ DWORD readSz, totalReadSz;
+ unsigned long linePos;
+ TCHAR tUC, *res;
+ BYTE *pBuf, *pCur;
ReadFile(hFile, &tUC, sizeof(TCHAR), &readSz, NULL);
if (tUC != (TCHAR)0xFEFF) {
tUC = 0;
@@ -620,8 +621,10 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
// complete file
bufSz = fileSz + csz;
pBuf = (PBYTE)mir_calloc(bufSz);
- if (pBuf == NULL)
+ if (pBuf == NULL) {
+ CloseHandle(hFile);
return NULL;
+ }
if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
CloseHandle(hFile);
@@ -657,19 +660,19 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
for (pCur = pBuf; *pCur != '\0'; pCur += csz) {
if (tUC) {
if (!_tcsncmp((TCHAR*)pCur, _T("\r\n"), 2)) {
- lineCount += 1;
+ lineCount++;
pCur += csz;
}
else if (*(TCHAR*)pCur == '\n')
- lineCount += 1;
+ lineCount++;
}
else {
if (!strncmp((char *)pCur, "\r\n", 2)) {
- lineCount += 1;
+ lineCount++;
pCur += csz;
}
else if (*(char *)pCur == '\n')
- lineCount += 1;
+ lineCount++;
}
}
}
@@ -697,19 +700,19 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
if (tUC) {
if (!_tcsncmp((TCHAR*)pCur, _T("\r\n"), 2)) {
- lineCount += 1;
+ lineCount++;
pCur += csz;
}
else if (*(TCHAR*)pCur == '\n')
- lineCount += 1;
+ lineCount++;
}
else {
if (!strncmp((char *)pCur, "\r\n", 2)) {
- lineCount += 1;
+ lineCount++;
pCur += csz;
}
else if (*(char *)pCur == '\n')
- lineCount += 1;
+ lineCount++;
}
}
if (((tUC) && (*(TCHAR*)pCur == '\r')) || ((!tUC) && (*(char *)pCur == '\r'))) {
diff --git a/plugins/Variables/src/parse_variables.cpp b/plugins/Variables/src/parse_variables.cpp
index 30136d8068..8a711a1524 100644
--- a/plugins/Variables/src/parse_variables.cpp
+++ b/plugins/Variables/src/parse_variables.cpp
@@ -37,14 +37,14 @@ static int addToVariablesRegister(TCHAR *szName, TCHAR *szText)
return 0;
}
}
- vr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
- if (vr == NULL)
+ VARIABLEREGISTER *pvr = (VARIABLEREGISTER*)mir_realloc(vr, (vrCount + 1)*sizeof(VARIABLEREGISTER));
+ if (pvr == NULL)
return -1;
+ vr = pvr;
vr[vrCount].szName = mir_tstrdup(szName);
vr[vrCount].szText = mir_tstrdup(szText);
- vr[vrCount].dwOwnerThread = GetCurrentThreadId();
- vrCount += 1;
+ vr[vrCount++].dwOwnerThread = GetCurrentThreadId();
return 0;
}
@@ -63,8 +63,6 @@ static TCHAR *searchVariableRegister(TCHAR *szName)
static TCHAR *parsePut(ARGUMENTSINFO *ai)
{
- FORMATINFO fi;
-
if (ai->argc != 3)
return NULL;
@@ -72,6 +70,7 @@ static TCHAR *parsePut(ARGUMENTSINFO *ai)
if (addToVariablesRegister(ai->targv[1], ai->targv[2]))
return NULL;
+ FORMATINFO fi;
memcpy(&fi, ai->fi, sizeof(fi));
fi.tszFormat = ai->targv[2];
fi.flags |= FIF_TCHAR;
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index af95b31dd5..421e0616c3 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -69,14 +69,14 @@ TCHAR* getArguments(TCHAR *string, TCHAR ***aargv, int *aargc)
case '(':
if (!bDontParse)
- brackets += 1;
+ brackets++;
break;
case ')':
if ((brackets == 0) && (!bDontParse))
bDone = bNewArg = TRUE;
else if ((brackets > 0) && (!bDontParse))
- brackets -= 1;
+ brackets--;
break;
}
if (bNewArg) {
@@ -86,15 +86,17 @@ TCHAR* getArguments(TCHAR *string, TCHAR ***aargv, int *aargc)
if (cur > scur) {
argv[argc] = (TCHAR*)mir_alloc((cur-scur+2)*sizeof(TCHAR));
- if (argv[argc] == NULL)
+ if (argv[argc] == NULL) {
+ mir_free(argv);
return NULL;
+ }
memset(argv[argc], '\0', (cur-(scur+1)+1)*sizeof(TCHAR));
_tcsncpy(argv[argc], scur+1, cur-(scur+1));
}
else argv[argc] = mir_tstrdup(_T(""));
- argc += 1;
+ argc++;
bNewArg = FALSE;
scur = cur;
}
@@ -222,12 +224,12 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
tcur++;
if (tcur == cur) {
- fi->eCount += 1;
+ fi->eCount++;
continue;
}
token = (TCHAR*)mir_alloc((tcur-scur+1)*sizeof(TCHAR));
if (token == NULL) {
- fi->eCount += 1;
+ fi->eCount++;
return NULL;
}
memset(token, '\0', (tcur-scur+1)*sizeof(TCHAR));
@@ -247,7 +249,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
tr = searchRegister(token, (*cur==FIELD_CHAR)?TRF_FIELD:TRF_FUNCTION);
mir_free(token);
if (tmpVarPos < 0 && tr == NULL) {
- fi->eCount += 1;
+ fi->eCount++;
// token not found, continue
continue;
}
@@ -256,7 +258,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
size_t len = _tcslen(tr != NULL ? tr->tszTokenString : fi->tszaTemporaryVars[tmpVarPos]);
cur++;
if (*(cur + len) != FIELD_CHAR) { // the next char after the token should be %
- fi->eCount += 1;
+ fi->eCount++;
continue;
}
cur += len+1;
@@ -267,7 +269,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
cur += _tcslen(tr->tszTokenString)+1;
argcur = getArguments(cur, &argv, &argc);
if ((argcur == cur) || (argcur == NULL)) {
- fi->eCount += 1;
+ fi->eCount++;
// error getting arguments
continue;
}
@@ -292,7 +294,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
if (tr != NULL) {
pargv = ( TCHAR** )mir_alloc((argc+1)*sizeof(TCHAR*));
if (pargv == NULL) {
- fi->eCount += 1;
+ fi->eCount++;
return NULL;
}
for (i=0;i<argc;i++)
@@ -313,7 +315,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
else parsedToken = fi->tszaTemporaryVars[tmpVarPos + 1];
if (parsedToken == NULL) {
- fi->eCount += 1;
+ fi->eCount++;
continue;
}
@@ -346,7 +348,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
// string needs more memory
string = (TCHAR*)mir_realloc(string, (initStrLen-tokenLen+parsedTokenLen+1)*sizeof(TCHAR));
if (string == NULL) {
- fi->eCount += 1;
+ fi->eCount++;
return NULL;
}
}
@@ -385,7 +387,6 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam)
int i;
BOOL copied;
FORMATINFO *fi, tempFi;
- FORMATINFOV1 *fiv1;
TCHAR *tszFormat, *orgFormat, *tszSource, *orgSource, *tRes;
if (((FORMATINFO *)wParam)->cbSize >= sizeof(FORMATINFO)) {
@@ -400,7 +401,7 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam)
}
else {
// old struct, must be ANSI
- fiv1 = (FORMATINFOV1 *)wParam;
+ FORMATINFOV1 *fiv1 = (FORMATINFOV1 *)wParam;
memset(&tempFi, 0, sizeof(FORMATINFO));
tempFi.cbSize = sizeof(FORMATINFO);
tempFi.hContact = fiv1->hContact;
@@ -462,8 +463,8 @@ TCHAR *formatString(FORMATINFO *fi)
return NULL;
/* the service to format a given string */
if ((fi->eCount + fi->pCount) > 5000) {
- fi->eCount += 1;
- fi->pCount += 1;
+ fi->eCount++;
+ fi->pCount++;
log_debugA("Variables: Overflow protection; %d parses", (fi->eCount + fi->pCount));
return NULL;
}