summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-31 18:55:45 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-31 18:55:45 +0000
commit41ecc6f11fcfeab9428c3d5c974b26b264577a78 (patch)
tree301cdb47c787fe4fa912175ff97f924796c1507f /plugins
parentcf488b3a97eb641d271cf0b3f183fc914ee0caf2 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@10348 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TabSRMM/src/msglog.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index 7b4a7312b3..86e25f8497 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1155,16 +1155,14 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
dat->bufferOffset = 0;
switch (dat->stage) {
case STREAMSTAGE_HEADER:
- if (dat->buffer) mir_free(dat->buffer);
- dat->buffer = CreateRTFHeader(dat->dlgDat);
+ replaceStr(dat->buffer, CreateRTFHeader(dat->dlgDat));
dat->stage = STREAMSTAGE_EVENTS;
break;
case STREAMSTAGE_EVENTS:
if (dat->eventsToInsert) {
do {
- if (dat->buffer) mir_free(dat->buffer);
- dat->buffer = Template_CreateRTFFromDbEvent(dat->dlgDat, dat->hContact, dat->hDbEvent, !dat->isEmpty, dat);
+ replaceStr(dat->buffer, Template_CreateRTFFromDbEvent(dat->dlgDat, dat->hContact, dat->hDbEvent, !dat->isEmpty, dat));
if (dat->buffer)
dat->hDbEventLast = dat->hDbEvent;
dat->hDbEvent = db_event_next(dat->hContact, dat->hDbEvent);
@@ -1180,8 +1178,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
//fall through
case STREAMSTAGE_TAIL:
- if (dat->buffer) mir_free(dat->buffer);
- dat->buffer = CreateRTFTail(dat->dlgDat);
+ replaceStr(dat->buffer, CreateRTFTail(dat->dlgDat));
dat->stage = STREAMSTAGE_STOP;
break;
@@ -1194,10 +1191,8 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
*pcb = min(cb, dat->bufferLen - dat->bufferOffset);
CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
dat->bufferOffset += *pcb;
- if (dat->bufferOffset == dat->bufferLen) {
- mir_free(dat->buffer);
- dat->buffer = NULL;
- }
+ if (dat->bufferOffset == dat->bufferLen)
+ replaceStr(dat->buffer, NULL);
return 0;
}
@@ -1429,11 +1424,11 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
streamData.eventsToInsert = count;
streamData.isEmpty = fAppend ? GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOG)) == 0 : 1;
streamData.dbei = dbei_s;
+ streamData.isAppend = fAppend;
EDITSTREAM stream = { 0 };
stream.pfnCallback = LogStreamInEvents;
- stream.dwCookie = (DWORD_PTR)& streamData;
- streamData.isAppend = fAppend;
+ stream.dwCookie = (DWORD_PTR)&streamData;
LONG startAt;
if (fAppend) {
@@ -1494,7 +1489,7 @@ void TSAPI StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAp
SendDlgItemMessage(hwndDlg, IDC_LOG, WM_SETREDRAW, TRUE, 0);
InvalidateRect(GetDlgItem(hwndDlg, IDC_LOG), NULL, FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_QUOTE), dat->hDbEventLast != NULL);
- if (streamData.buffer) mir_free(streamData.buffer);
+ mir_free(streamData.buffer);
}
// NLS functions (for unicode version only) encoding stuff..