diff options
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msglog.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 6cee6c70b6..acc0cfc38c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -460,7 +460,7 @@ bool CMsgDialog::OnInitDialog() m_maxHistory = M.GetDword(m_hContact, "maxhist", M.GetDword("maxhist", 0));
m_curHistory = 0;
if (m_maxHistory)
- m_hHistoryEvents = (MEVENT*)mir_alloc(m_maxHistory * sizeof(MEVENT));
+ m_hHistoryEvents = (MEVENT*)mir_alloc((m_maxHistory+1) * sizeof(MEVENT));
else
m_hHistoryEvents = nullptr;
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 13514af2fa..143c55b36f 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -666,8 +666,8 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe BOOL showDate = dwEffectiveFlags & MWF_LOG_SHOWDATES;
if (dat->m_hHistoryEvents) {
- if (dat->m_curHistory == dat->m_maxHistory) {
- memmove(dat->m_hHistoryEvents, &dat->m_hHistoryEvents[1], sizeof(HANDLE) * (dat->m_maxHistory - 1));
+ if (dat->m_curHistory > dat->m_maxHistory) {
+ memmove(dat->m_hHistoryEvents, &dat->m_hHistoryEvents[1], sizeof(MEVENT) * dat->m_maxHistory);
dat->m_curHistory--;
}
dat->m_hHistoryEvents[dat->m_curHistory++] = streamData->hDbEvent;
@@ -1460,7 +1460,7 @@ void CLogWindow::ReplaceIcons(LONG startAt, int fAppend, BOOL isSent) CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smadd);
}
- if (m_pDlg.m_hHistoryEvents && m_pDlg.m_curHistory == m_pDlg.m_maxHistory) {
+ if (m_pDlg.m_hHistoryEvents && m_pDlg.m_curHistory > m_pDlg.m_maxHistory) {
wchar_t szPattern[50];
mir_snwprintf(szPattern, L"~-+%d+-~", m_pDlg.m_hHistoryEvents[0]);
|