From f4a296b2a5d331ae83eec693ad17e0be92a479eb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Apr 2024 19:33:29 +0300 Subject: =?UTF-8?q?fixes=20#4371=20(tabSRMM:=20=D0=BE=D0=BF=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20"=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0=D0=BB=20X=20?= =?UTF-8?q?=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8"=20=D0=BD=D0=B5=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D0=BE=20=D1=81=D1=87=D0=B8=D1=82=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=BE?= =?UTF-8?q?=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/TabSRMM') 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]); -- cgit v1.2.3