summaryrefslogtreecommitdiff
path: root/plugins/WebView
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/WebView
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/WebView')
-rw-r--r--plugins/WebView/src/webview.cpp2
-rw-r--r--plugins/WebView/src/webview_alerts.cpp24
-rw-r--r--plugins/WebView/src/webview_datawnd.cpp2
-rw-r--r--plugins/WebView/src/webview_getdata.cpp35
4 files changed, 32 insertions, 31 deletions
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp
index 51387e5908..6efe057862 100644
--- a/plugins/WebView/src/webview.cpp
+++ b/plugins/WebView/src/webview.cpp
@@ -236,7 +236,7 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb
SetDlgItemText(hWindow, IDC_DATA, _T(""));
CHARFORMAT2 cfFM;
- ZeroMemory(&cfFM, sizeof(cfFM));
+ memset(&cfFM, 0, sizeof(cfFM));
cfFM.cbSize = sizeof(CHARFORMAT2);
cfFM.dwMask = CFM_COLOR | CFM_CHARSET | CFM_FACE | ENM_LINK | ENM_MOUSEEVENTS | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_SIZE;
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp
index 6d879a0b42..e583c4ed4e 100644
--- a/plugins/WebView/src/webview_alerts.cpp
+++ b/plugins/WebView/src/webview_alerts.cpp
@@ -271,15 +271,15 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
int alertIndex = 0, eventIndex = 0;
char tempraw[MAXSIZE1];
- ZeroMemory(&tempraw, sizeof(tempraw));
- ZeroMemory(&raw, sizeof(raw));
+ memset(&tempraw, 0, sizeof(tempraw));
+ memset(&raw, 0, sizeof(raw));
strncpy(tempraw, truncated, SIZEOF(tempraw));
- ZeroMemory(&alertstring, sizeof(alertstring));
- ZeroMemory(&Alerttempstring, sizeof(Alerttempstring));
- ZeroMemory(&Alerttempstring2, sizeof(Alerttempstring2));
- ZeroMemory(&cachecompare, sizeof(cachecompare));
+ memset(&alertstring, 0, sizeof(alertstring));
+ memset(&Alerttempstring, 0, sizeof(Alerttempstring));
+ memset(&Alerttempstring2, 0, sizeof(Alerttempstring2));
+ memset(&cachecompare, 0, sizeof(cachecompare));
// alerts
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) { // ALERTS
@@ -436,7 +436,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
WErrorPopup((MCONTACT)contactname, TranslateT("Cannot read from file"));
else {
- ZeroMemory(&cachecompare, sizeof(cachecompare));
+ memset(&cachecompare, 0, sizeof(cachecompare));
fread(cachecompare, sizeof(cachecompare), 1, pcachefile);
fclose(pcachefile);
}
@@ -532,20 +532,20 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
alertpos = strstr(tempraw, Alerttempstring);
statalertpos = alertpos - tempraw;
- ZeroMemory(&alertpos, sizeof(alertpos));
+ memset(&alertpos, 0, sizeof(alertpos));
//end string
alertpos = strstr(tempraw, Alerttempstring2);
statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2);
if (statalertpos > statalertposend) {
memset(&tempraw, ' ', statalertpos);
- ZeroMemory(&alertpos, sizeof(alertpos));
+ memset(&alertpos, 0, sizeof(alertpos));
alertpos = strstr(tempraw, Alerttempstring2);
statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2);
}
if (statalertpos < statalertposend) {
- ZeroMemory(&raw, sizeof(raw));
+ memset(&raw, 0, sizeof(raw));
//start string
alertpos = strstr(tempraw, Alerttempstring);
@@ -557,7 +557,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if (statalertpos > statalertposend) {
memset(&tempraw, ' ', statalertpos);
- ZeroMemory(&alertpos, sizeof(alertpos));
+ memset(&alertpos, 0, sizeof(alertpos));
alertpos = strstr(tempraw, Alerttempstring2);
statalertposend = alertpos - tempraw + (int)strlen(Alerttempstring2);
}
@@ -648,7 +648,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
WErrorPopup((MCONTACT)contactname, TranslateT("Cannot read from file"));
else {
- ZeroMemory(&cachecompare, sizeof(cachecompare));
+ memset(&cachecompare, 0, sizeof(cachecompare));
fread(cachecompare, sizeof(cachecompare), 1, pcachefile);
fclose(pcachefile);
}
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp
index ea05a9142c..a552c52554 100644
--- a/plugins/WebView/src/webview_datawnd.cpp
+++ b/plugins/WebView/src/webview_datawnd.cpp
@@ -51,7 +51,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara
int startsel = 0, endsel = 0;
char buff[MAXSIZE1];
- ZeroMemory(&NewSearchstr, sizeof(NewSearchstr));
+ memset(&NewSearchstr, 0, sizeof(NewSearchstr));
int len = GetWindowTextLength(GetDlgItem(ParentHwnd, IDC_DATA));
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index 9de894fd3e..02c724c07d 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -59,13 +59,14 @@ void GetData(void *param)
Startingup = 0;
- ZeroMemory(&url, sizeof(url));
- ZeroMemory(&contactname, sizeof(contactname));
- ZeroMemory(&tempstring, sizeof(tempstring));
- ZeroMemory(&tempstring2, sizeof(tempstring2));
- ZeroMemory(&dbv, sizeof(dbv));
- ZeroMemory(&tstr, sizeof(tstr));
- ZeroMemory(&timestring, sizeof(timestring));
+ memset(&url, 0, sizeof(url));
+ memset(&contactname, 0, sizeof(contactname));
+ memset(&tempstring, 0, sizeof(tempstring));
+ memset(&tempstring2, 0, sizeof(tempstring2));
+ memset(&szInfo, 0, sizeof(szInfo));
+ memset(&dbv, 0, sizeof(dbv));
+ memset(&tstr, 0, sizeof(tstr));
+ memset(&timestring, 0, sizeof(timestring));
db_set_b(hContact, MODULENAME, STOP_KEY, 0);
@@ -199,19 +200,19 @@ void GetData(void *param)
pos = strstr(truncated2, tempstring);
statpos = pos - truncated2;
- ZeroMemory(&pos, sizeof(pos));
+ memset(&pos, 0, sizeof(pos)); // XXX: looks bad.
// end string
pos = strstr(truncated2, tempstring2);
- statposend = pos - truncated2 + (int)strlen(tempstring2);
+ statposend = pos - truncated2 + strlen(tempstring2);
if (statpos > statposend) {
memset(&truncated2, ' ', statpos);
- ZeroMemory(&pos, sizeof(pos));
+ memset(&pos, 0, sizeof(pos)); // XXX: looks bad.
pos = strstr(truncated2, tempstring2);
- statposend = pos - truncated2 + (int)strlen(tempstring2);
+ statposend = pos - truncated2 + strlen(tempstring2);
}
if (statpos < statposend) {
- ZeroMemory(&raw, sizeof(raw));
+ memset(&raw, 0, sizeof(raw));
// get size for malloc
MallocSize = statposend - statpos;
@@ -227,7 +228,7 @@ void GetData(void *param)
if (statpos > statposend) {
memset(&truncated2, ' ', statpos);
- ZeroMemory(&pos, sizeof(pos));
+ memset(&pos, 0, sizeof(pos)); // XXX
pos = strstr(truncated2, tempstring2);
statposend = pos - truncated2 + (int)strlen(tempstring2);
}
@@ -285,8 +286,8 @@ void GetData(void *param)
setlocale(LC_ALL, "");
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- ZeroMemory(&temptime, sizeof(temptime));
- ZeroMemory(&tstr, sizeof(tstr));
+ memset(&temptime, 0, sizeof(temptime));
+ memset(&tstr, 0, sizeof(tstr));
ftime = time(NULL);
nTime = localtime(&ftime);
// 12 hour
@@ -304,8 +305,8 @@ void GetData(void *param)
}
else {
db_get_ts(hContact, "CList", "MyHandle", &dbv);
- ZeroMemory(&temptime, sizeof(temptime));
- ZeroMemory(&tstr, sizeof(tstr));
+ memset(&temptime, 0, sizeof(temptime));
+ memset(&tstr, 0, sizeof(tstr));
ftime = time(NULL);
nTime = localtime(&ftime);
// 12 hour