summaryrefslogtreecommitdiff
path: root/plugins/Variables/src
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-12-01 00:07:01 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-12-01 00:07:01 +0000
commitb2fad485cd5b41744ef0cc4a02722c021afd926c (patch)
treeaa19403cd699066600e8306be8ad33e4a17fba6f /plugins/Variables/src
parentfc62f1f1e1f8af40a1f7efe0ba3afc358fb66ef3 (diff)
ZeroMemory -> memset, few bugs fised
git-svn-id: http://svn.miranda-ng.org/main/trunk@11184 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Variables/src')
-rw-r--r--plugins/Variables/src/help.cpp10
-rw-r--r--plugins/Variables/src/parse_math.cpp4
-rw-r--r--plugins/Variables/src/parse_miranda.cpp2
-rw-r--r--plugins/Variables/src/parse_str.cpp28
-rw-r--r--plugins/Variables/src/parse_system.cpp20
-rw-r--r--plugins/Variables/src/variables.cpp10
6 files changed, 37 insertions, 37 deletions
diff --git a/plugins/Variables/src/help.cpp b/plugins/Variables/src/help.cpp
index ed9a034559..62cce73d33 100644
--- a/plugins/Variables/src/help.cpp
+++ b/plugins/Variables/src/help.cpp
@@ -493,7 +493,7 @@ static BOOL CALLBACK processTokenListMessage(HWND hwndDlg, UINT msg, WPARAM wPar
if (tokenString == NULL)
break;
- ZeroMemory(tokenString, (len+1)*sizeof(TCHAR));
+ memset(tokenString, 0, ((len + 1) * sizeof(TCHAR)));
mir_sntprintf(tokenString, len + 1, _T("%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);
@@ -613,7 +613,7 @@ static INT_PTR CALLBACK inputDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
dat = (INPUTDLGDATA*)mir_alloc(sizeof(INPUTDLGDATA));
- ZeroMemory(dat, sizeof(INPUTDLGDATA));
+ memset(dat, 0, sizeof(INPUTDLGDATA));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
// splitter things
dat->splitterPos = (INT_PTR)db_get_dw(NULL, MODULENAME, SETTING_SPLITTERPOS, -1);
@@ -1076,7 +1076,7 @@ static INT_PTR CALLBACK helpDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
// return the largest of all pages
for (i = 0; i < count; i++) {
TabCtrl_GetItem(hTab, i, &tci);
- ZeroMemory(&pageMinMax, sizeof(pageMinMax));
+ memset(&pageMinMax, 0, 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);
@@ -1197,13 +1197,13 @@ INT_PTR showHelpService(WPARAM wParam, LPARAM lParam)
if (fi == NULL)
fi = (FORMATINFO*)mir_alloc(sizeof(FORMATINFO));
- ZeroMemory(fi, sizeof(FORMATINFO));
+ memset(fi, 0, sizeof(FORMATINFO));
fi->cbSize = sizeof(FORMATINFO);
fi->szFormat = (char *)lParam;
if (vhs == NULL)
vhs = (VARHELPINFO*)mir_alloc(sizeof(VARHELPINFO));
- ZeroMemory(vhs, sizeof(VARHELPINFO));
+ memset(vhs, 0, sizeof(VARHELPINFO));
vhs->cbSize = sizeof(VARHELPINFO);
vhs->fi = fi;
vhs->hwndCtrl = (HWND)wParam;
diff --git a/plugins/Variables/src/parse_math.cpp b/plugins/Variables/src/parse_math.cpp
index b7bf78f26e..bd11a39c9f 100644
--- a/plugins/Variables/src/parse_math.cpp
+++ b/plugins/Variables/src/parse_math.cpp
@@ -60,7 +60,7 @@ static TCHAR *parseHex(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (zeros + _tcslen(szVal) + 3)*sizeof(TCHAR));
+ memset(res, 0, ((zeros + _tcslen(szVal) + 3) * sizeof(TCHAR)));
_tcscpy(res, _T("0x"));
for (i = 0; i < zeros; i++)
*(res + 2 + i) = '0';
@@ -145,7 +145,7 @@ static TCHAR *parseNum(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (zeros + _tcslen(szVal) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((zeros + _tcslen(szVal) + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
for (unsigned i = 0; i < zeros; i++)
*cur++ = '0';
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 335df51fb3..da55f2b00a 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -505,7 +505,7 @@ static HANDLE findDbEvent(MCONTACT hContact, HANDLE hDbEvent, int flags)
BOOL bEventOk;
do {
- ZeroMemory(&dbe, sizeof(DBEVENTINFO));
+ memset(&dbe, 0, sizeof(DBEVENTINFO));
dbe.cbSize = sizeof(DBEVENTINFO);
dbe.cbBlob = 0;
dbe.pBlob = NULL;
diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp
index e4721c0fdf..1d993f8b4c 100644
--- a/plugins/Variables/src/parse_str.cpp
+++ b/plugins/Variables/src/parse_str.cpp
@@ -117,7 +117,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai)
if (res == NULL)
return res;
- ZeroMemory(res, ((cur - ai->targv[1]) + 1)*sizeof(TCHAR));
+ memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1], cur - ai->targv[1]);
_tcscat(res, szReplacement);
return res;
@@ -168,7 +168,7 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((_tcslen(ai->targv[1]) + _tcslen(ai->targv[2]) + 1) * sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1], pos);
_tcscpy(res + pos, ai->targv[2]);
_tcscpy(res + pos + _tcslen(ai->targv[2]), ai->targv[1] + pos);
@@ -189,7 +189,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (len + 1)*sizeof(TCHAR));
+ memset(res, 0, ((len + 1) * sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1], len);
return res;
}
@@ -274,7 +274,7 @@ static TCHAR *parsePad(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
for (unsigned int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -301,7 +301,7 @@ static TCHAR *parsePadright(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (addcount + _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((addcount + _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
_tcscpy(res, ai->targv[1]);
TCHAR *cur = res + _tcslen(ai->targv[1]);
for (unsigned int i = 0; i < addcount; i++)
@@ -328,7 +328,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (padding + 1)*sizeof(TCHAR));
+ memset(res, 0, ((padding + 1) * sizeof(TCHAR)));
TCHAR *cur = res;
for (int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -357,7 +357,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (padding + 1)*sizeof(TCHAR));
+ memset(res, 0, ((padding + 1) * sizeof(TCHAR)));
TCHAR *cur = res + padding - addcount;
for (int i = 0; i < addcount; i++)
*cur++ = padchar;
@@ -381,7 +381,7 @@ static TCHAR *parseRepeat(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (count * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((count * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
for (int i = 0; i < count; i++)
_tcscat(res, ai->targv[1]);
@@ -433,7 +433,7 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (len + 1)*sizeof(TCHAR));
+ memset(res, 0, ((len + 1)*sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1] + _tcslen(ai->targv[1]) - len, len);
return res;
}
@@ -458,7 +458,7 @@ static TCHAR *parseScroll(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (2 * _tcslen(ai->targv[1]) + 1)*sizeof(TCHAR));
+ memset(res, 0, ((2 * _tcslen(ai->targv[1]) + 1) * sizeof(TCHAR)));
_tcscpy(res, ai->targv[1]);
_tcscat(res, ai->targv[1]);
MoveMemory(res, res + move, (_tcslen(res + move) + 1)*sizeof(TCHAR));
@@ -487,7 +487,7 @@ static TCHAR *parseStrchr(ARGUMENTSINFO *ai)
return NULL;
char *szVal[34];
- ZeroMemory(szVal, sizeof(szVal));
+ memset(szVal, 0, sizeof(szVal));
TCHAR *c = _tcschr(ai->targv[1], *ai->targv[2]);
if (c == NULL || *c == 0)
return mir_tstrdup(_T("0"));
@@ -602,7 +602,7 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai)
return NULL;
TCHAR *res = (TCHAR*)mir_alloc((to - from + 1)*sizeof(TCHAR));
- ZeroMemory(res, (to - from + 1)*sizeof(TCHAR));
+ memset(res, 0, ((to - from + 1) * sizeof(TCHAR)));
_tcsncpy(res, ai->targv[1] + from, to - from);
return res;
}
@@ -651,7 +651,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (ecur - scur + 2)*sizeof(TCHAR));
+ memset(res, 0, ((ecur - scur + 2) * sizeof(TCHAR)));
_tcsncpy(res, scur, ecur - scur + 1);
return res;
@@ -722,7 +722,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w)
if (res == NULL)
return NULL;
- ZeroMemory(res, (ecur - scur + 1)*sizeof(TCHAR));
+ memset(res, 0, ((ecur - scur + 1) * sizeof(TCHAR)));
_tcsncpy(res, scur, ecur - scur);
return res;
}
diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp
index 9788f986cd..c6d1fdb765 100644
--- a/plugins/Variables/src/parse_system.cpp
+++ b/plugins/Variables/src/parse_system.cpp
@@ -275,8 +275,8 @@ static TCHAR *parseDiffTime(ARGUMENTSINFO *ai)
if (ai->argc != 3)
return NULL;
- ZeroMemory(&t0, sizeof(t0));
- ZeroMemory(&t1, sizeof(t1));
+ memset(&t0, 0, sizeof(t0));
+ memset(&t1, 0, sizeof(t1));
if (getTime(ai->targv[1], &t0) != 0)
return NULL;
@@ -316,7 +316,7 @@ static TCHAR *parseEnvironmentVariable(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, (len + 1)*sizeof(TCHAR));
+ memset(res, 0, ((len + 1) * sizeof(TCHAR)));
if (ExpandEnvironmentStrings(ai->targv[1], res, len) == 0) {
mir_free(res);
return NULL;
@@ -352,7 +352,7 @@ static TCHAR *parseFindWindow(ARGUMENTSINFO *ai)
return NULL;
TCHAR *res = (TCHAR*)mir_alloc((len + 1)*sizeof(TCHAR));
- ZeroMemory(res, (len + 1)*sizeof(TCHAR));
+ memset(res, 0, ((len + 1) * sizeof(TCHAR)));
GetWindowText(hWin, res, len + 1);
return res;
}
@@ -490,7 +490,7 @@ static TCHAR *parseRegistryValue(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, len);
+ memset(res, 0, (len * sizeof(TCHAR)));
err = RegQueryValueEx(hKey, ai->targv[2], NULL, &type, (BYTE*)res, &len);
if ((err != ERROR_SUCCESS) || (type != REG_SZ)) {
RegCloseKey(hKey);
@@ -508,7 +508,7 @@ static int TsToSystemTime(SYSTEMTIME *sysTime, time_t timestamp)
if (pTime == NULL)
return -1;
- ZeroMemory(sysTime, sizeof(SYSTEMTIME));
+ memset(sysTime, 0, sizeof(SYSTEMTIME));
sysTime->wDay = pTime->tm_mday;
sysTime->wDayOfWeek = pTime->tm_wday;
sysTime->wHour = pTime->tm_hour;
@@ -647,7 +647,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
// count number of lines
do {
- ZeroMemory(pBuf, bufSz);
+ memset(pBuf, 0, bufSz);
if (ReadFile(hFile, pBuf, bufSz - csz, &readSz, NULL) == 0) {
CloseHandle(hFile);
mir_free(pBuf);
@@ -730,7 +730,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
mir_free(pBuf);
return NULL;
}
- ZeroMemory(pBuf, bufSz);
+ memset(pBuf, 0, bufSz);
pCur = pBuf;
do {
icur = 0;
@@ -780,7 +780,7 @@ static TCHAR *parseTextFile(ARGUMENTSINFO *ai)
icur = pCur - pBuf;
pBuf = (PBYTE)mir_realloc(pBuf, bufSz);
pCur = pBuf + icur;
- ZeroMemory(pCur + 1, TXTFILEBUFSZ*csz);
+ memset((pCur + 1), 0, (TXTFILEBUFSZ * csz));
}
}
while (readSz > 0);
@@ -840,7 +840,7 @@ static TCHAR *parseUserName(ARGUMENTSINFO *ai)
if (res == NULL)
return NULL;
- ZeroMemory(res, len + 1);
+ memset(res, 0, (len + 1));
if (!GetUserName(res, &len)) {
mir_free(res);
return NULL;
diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp
index fe0899d6ad..cc1818eca9 100644
--- a/plugins/Variables/src/variables.cpp
+++ b/plugins/Variables/src/variables.cpp
@@ -299,7 +299,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi)
pargv[i+1] = argv[i];
pargv[0] = tr->tszTokenString;
- ZeroMemory(&ai, sizeof(ai));
+ memset(&ai, 0, sizeof(ai));
ai.cbSize = sizeof(ai);
ai.argc = argc+1;
ai.targv = pargv;
@@ -389,19 +389,19 @@ static INT_PTR formatStringService(WPARAM wParam, LPARAM lParam)
TCHAR *tszFormat, *orgFormat, *tszSource, *orgSource, *tRes;
if (((FORMATINFO *)wParam)->cbSize >= sizeof(FORMATINFO)) {
- ZeroMemory(&tempFi, sizeof(FORMATINFO));
+ memset(&tempFi, 0, sizeof(FORMATINFO));
CopyMemory(&tempFi, (FORMATINFO *)wParam, sizeof(FORMATINFO));
fi = &tempFi;
}
else if (((FORMATINFO *)wParam)->cbSize == FORMATINFOV2_SIZE) {
- ZeroMemory(&tempFi, sizeof(FORMATINFO));
+ memset(&tempFi, 0, sizeof(FORMATINFO));
CopyMemory(&tempFi, (FORMATINFO *)wParam, FORMATINFOV2_SIZE);
fi = &tempFi;
}
else {
// old struct, must be ANSI
fiv1 = (FORMATINFOV1 *)wParam;
- ZeroMemory(&tempFi, sizeof(FORMATINFO));
+ memset(&tempFi, 0, sizeof(FORMATINFO));
tempFi.cbSize = sizeof(FORMATINFO);
tempFi.hContact = fiv1->hContact;
tempFi.szFormat = fiv1->szFormat;
@@ -481,7 +481,7 @@ int setParseOptions(struct ParseOptions *po)
if (po == NULL)
po = &gParseOpts;
- ZeroMemory(po, sizeof(struct ParseOptions));
+ memset(po, 0, sizeof(struct ParseOptions));
if (!db_get_b(NULL, MODULENAME, SETTING_STRIPALL, 0)) {
po->bStripEOL = db_get_b(NULL, MODULENAME, SETTING_STRIPCRLF, 0);
po->bStripWS = db_get_b(NULL, MODULENAME, SETTING_STRIPWS, 0);