From 58934a360e8ff68bc81d3fd7e17026f7bbb329f0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 14 Mar 2017 15:55:26 +0300 Subject: some fixes to make Coverity happier --- plugins/TabSRMM/src/chat.h | 4 +++- plugins/TabSRMM/src/chat_options.cpp | 35 +++++++++++++---------------- plugins/TabSRMM/src/chat_window.cpp | 31 +++++++++++++------------ plugins/TabSRMM/src/container.cpp | 27 ++++++++++++---------- plugins/TabSRMM/src/containeroptions.cpp | 23 ++++++++++--------- plugins/TabSRMM/src/controls.h | 2 +- plugins/TabSRMM/src/functions.h | 1 - plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 4 ++-- plugins/TabSRMM/src/msglog.cpp | 4 ++-- plugins/TabSRMM/src/msgoptions.cpp | 4 ++-- plugins/TabSRMM/src/msgs.h | 4 ++++ plugins/TabSRMM/src/sendlater.cpp | 11 +++++---- plugins/TabSRMM/src/taskbar.cpp | 3 ++- 14 files changed, 81 insertions(+), 74 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/src/chat.h b/plugins/TabSRMM/src/chat.h index 25963dae51..6e4df0f2b5 100644 --- a/plugins/TabSRMM/src/chat.h +++ b/plugins/TabSRMM/src/chat.h @@ -106,7 +106,9 @@ int GetTextPixelSize(wchar_t* pszText, HFONT hFont, bool bWidth); // options.c enum { FONTSECTION_AUTO, FONTSECTION_IM, FONTSECTION_IP }; -void LoadMsgDlgFont(int section, int i, LOGFONT * lf, COLORREF * colour, char* szMod); +void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF *colour, char *szModule); +void LoadLogfont(int section, int i, LOGFONTA *lf, COLORREF *colour, char *szModule); + void AddIcons(void); HICON LoadIconEx(char *pszIcoLibName); diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index f3c227e3e4..b4d9224f01 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -177,8 +177,7 @@ static HWND hPathTip = 0; void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szMod) { char str[32]; - int style; - int j = (i >= 100 ? i - 100 : i); + int db_idx = (section == FONTSECTION_IM) ? i : i + 100; FontOptionsList *fol = fontOptionsList; switch (section) { @@ -187,18 +186,18 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM } if (colour) { - mir_snprintf(str, "Font%dCol", i); - *colour = M.GetDword(szMod, str, fol[j].defColour); + mir_snprintf(str, "Font%dCol", db_idx); + *colour = M.GetDword(szMod, str, fol[i].defColour); } if (lf) { - mir_snprintf(str, "Font%dSize", i); - lf->lfHeight = (char)M.GetByte(szMod, str, fol[j].defSize); + mir_snprintf(str, "Font%dSize", db_idx); + lf->lfHeight = (char)M.GetByte(szMod, str, fol[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; - mir_snprintf(str, "Font%dSty", i); - style = M.GetByte(szMod, str, fol[j].defStyle); + mir_snprintf(str, "Font%dSty", db_idx); + int style = M.GetByte(szMod, str, fol[i].defStyle); if (i == MSGFONTID_MESSAGEAREA && section == FONTSECTION_IM && M.GetByte("inputFontFix", 1) == 1) { lf->lfWeight = FW_NORMAL; lf->lfItalic = 0; @@ -211,13 +210,13 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM lf->lfUnderline = style & FONTF_UNDERLINE ? 1 : 0; lf->lfStrikeOut = style & FONTF_STRIKEOUT ? 1 : 0; } - mir_snprintf(str, "Font%dSet", i); - lf->lfCharSet = M.GetByte(szMod, str, fol[j].defCharset); + mir_snprintf(str, "Font%dSet", db_idx); + lf->lfCharSet = M.GetByte(szMod, str, fol[i].defCharset); lf->lfOutPrecision = OUT_DEFAULT_PRECIS; lf->lfClipPrecision = CLIP_DEFAULT_PRECIS; lf->lfQuality = DEFAULT_QUALITY; lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; - mir_snprintf(str, "Font%d", i); + mir_snprintf(str, "Font%d", db_idx); if ((i == 17 && !mir_strcmp(szMod, CHATFONT_MODULE)) || ((i == 20 || i == 21) && !mir_strcmp(szMod, FONTMODULE))) { lf->lfCharSet = SYMBOL_CHARSET; wcsncpy_s(lf->lfFaceName, L"Webdings", _TRUNCATE); @@ -225,7 +224,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM else { ptrW tszDefFace(db_get_wsa(0, szMod, str)); if (tszDefFace == nullptr) - wcsncpy_s(lf->lfFaceName, fol[j].szDefFace, _TRUNCATE); + wcsncpy_s(lf->lfFaceName, fol[i].szDefFace, _TRUNCATE); else wcsncpy_s(lf->lfFaceName, tszDefFace, _TRUNCATE); } @@ -484,7 +483,6 @@ static wchar_t* chatcolorsnames[] = void RegisterFontServiceFonts() { - char szTemp[100]; LOGFONT lf; FontIDW fid = { 0 }; ColourIDW cid = { 0 }; @@ -497,8 +495,7 @@ void RegisterFontServiceFonts() for (int i = 0; i < _countof(IM_fontOptionsList); i++) { fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE); - mir_snprintf(szTemp, "Font%d", i); - strncpy(fid.prefix, szTemp, _countof(fid.prefix)); + mir_snprintf(fid.prefix, "Font%d", i); fid.order = i; wcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; @@ -559,9 +556,8 @@ void RegisterFontServiceFonts() wcsncpy(fid.backgroundGroup, LPGENW("Message Sessions") L"/" LPGENW("Info Panel"), _countof(fid.backgroundGroup)); wcsncpy(fid.backgroundName, LPGENW("Fields background"), _countof(fid.backgroundName)); for (int i = 0; i < IPFONTCOUNT; i++) { - LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE); - mir_snprintf(szTemp, "Font%d", i + 100); - strncpy(fid.prefix, szTemp, _countof(fid.prefix)); + LoadMsgDlgFont(FONTSECTION_IP, i, &lf, &fontOptionsList[i].colour, FONTMODULE); + mir_snprintf(fid.prefix, "Font%d", i + 100); fid.order = i + 100; wcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; @@ -582,10 +578,9 @@ void RegisterFontServiceFonts() wcsncpy(cid.group, LPGENW("Message Sessions") L"/" LPGENW("Group chats"), _countof(cid.group)); strncpy(cid.dbSettingsGroup, CHAT_MODULE, _countof(cid.dbSettingsGroup)); for (int i = 0; i <= 7; i++) { - mir_snprintf(szTemp, "NickColor%d", i); + mir_snprintf(cid.setting, "NickColor%d", i); wcsncpy(cid.name, chatcolorsnames[i], _countof(cid.name)); cid.order = i + 1; - strncpy(cid.setting, szTemp, _countof(cid.setting)); switch (i) { case 5: cid.defcolour = GetSysColor(COLOR_HIGHLIGHT); diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 74c634b913..6a23c3f3d1 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -473,15 +473,17 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w { HWND hwndParent = GetParent(hwnd); CChatRoomDlg *mwdat = (CChatRoomDlg*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); + if (mwdat == nullptr) + return 0; + MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (mwdat != nullptr) - if (mwdat->m_bkeyProcessed && (msg == WM_KEYUP)) { - GetKeyboardState(mwdat->kstate); - if (!(mwdat->kstate[VK_CONTROL] & 0x80) && !(mwdat->kstate[VK_SHIFT] & 0x80)) - mwdat->m_bkeyProcessed = false; - return 0; - } + if (mwdat->m_bkeyProcessed && (msg == WM_KEYUP)) { + GetKeyboardState(mwdat->kstate); + if (!(mwdat->kstate[VK_CONTROL] & 0x80) && !(mwdat->kstate[VK_SHIFT] & 0x80)) + mwdat->m_bkeyProcessed = false; + return 0; + } switch (msg) { case WM_NCCALCSIZE: @@ -789,7 +791,7 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); LOGFONTA lf; - LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, nullptr, FONTMODULE); + LoadLogfont(FONTSECTION_IM, MSGFONTID_MESSAGEAREA, &lf, nullptr, FONTMODULE); SETTEXTEX ste; ste.flags = ST_DEFAULT; @@ -852,7 +854,7 @@ LRESULT CALLBACK CChatRoomDlg::MessageSubclassProc(HWND hwnd, UINT msg, WPARAM w case WM_RBUTTONUP: case WM_MBUTTONUP: COLORREF cr; - LoadLogfont(MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); + LoadLogfont(FONTSECTION_IM, MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -1687,7 +1689,7 @@ void CChatRoomDlg::OnDestroy() FireEvent(MSG_WINDOW_EVT_CLOSE, 0); - memset((void*)&m_pContainer->mOld, -1000, sizeof(MARGINS)); + m_pContainer->ClearMargins(); PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 1); if (m_pContainer->dwFlags & CNT_SIDEBAR) @@ -1843,7 +1845,7 @@ void CChatRoomDlg::onClick_Color(CCtrlButton *pButton) } else { COLORREF cr; - LoadLogfont(MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); + LoadLogfont(FONTSECTION_IM, MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); cf.dwMask = CFM_COLOR; cf.crTextColor = cr; m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); @@ -1996,7 +1998,7 @@ void CChatRoomDlg::RedrawLog() { m_si->LastTime = 0; if (m_si->pLog) { - LOGINFO * pLog = m_si->pLog; + LOGINFO *pLog = m_si->pLog; if (m_si->iEventCount > 60) { int index = 0; while (index < 59) { @@ -2183,9 +2185,6 @@ void CChatRoomDlg::UpdateTitle() INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (m_si == nullptr && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) - return 0; - POINT pt, tmp, cur; RECT rc; @@ -2990,7 +2989,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DWMCOMPOSITIONCHANGED: BB_RefreshTheme(); - memset(&m_pContainer->mOld, -1000, sizeof(MARGINS)); + m_pContainer->ClearMargins(); CProxyWindow::verify(this); break; } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index c4614cd6ec..9163fd0e08 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -552,7 +552,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (pContainer->dwFlagsEx & TCF_FLAT) ws |= TCS_BUTTONS; - memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS)); + pContainer->ClearMargins(); if (pContainer->dwFlagsEx & TCF_SINGLEROWTABCONTROL) { ws &= ~TCS_MULTILINE; @@ -888,19 +888,22 @@ panel_found: } switch (iSelection) { case ID_TABMENU_CLOSETAB: - if (fFromSidebar) + if (fFromSidebar && dat) SendMessage(dat->GetHwnd(), WM_CLOSE, 1, 0); else SendMessage(hwndDlg, DM_CLOSETABATMOUSE, 0, (LPARAM)&pt); break; case ID_TABMENU_CLOSEOTHERTABS: - CloseOtherTabs(hwndTab, *dat); + if (dat) + CloseOtherTabs(hwndTab, *dat); break; case ID_TABMENU_SAVETABPOSITION: - db_set_dw(dat->m_hContact, SRMSGMOD_T, "tabindex", dat->m_iTabID * 100); + if (dat) + db_set_dw(dat->m_hContact, SRMSGMOD_T, "tabindex", dat->m_iTabID * 100); break; case ID_TABMENU_CLEARSAVEDTABPOSITION: - db_unset(dat->m_hContact, SRMSGMOD_T, "tabindex"); + if (dat) + db_unset(dat->m_hContact, SRMSGMOD_T, "tabindex"); break; case ID_TABMENU_LEAVECHATROOM: if (dat && dat->isChat() && dat->m_hContact) { @@ -910,12 +913,12 @@ panel_found: } break; case ID_TABMENU_ATTACHTOCONTAINER: - if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) == -1) - break; - memset(&tci, 0, sizeof(tci)); - tci.mask = TCIF_PARAM; - TabCtrl_GetItem(hwndTab, iItem, &tci); - CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)tci.lParam); + if ((iItem = GetTabItemFromMouse(hwndTab, &pt)) != -1) { + memset(&tci, 0, sizeof(tci)); + tci.mask = TCIF_PARAM; + TabCtrl_GetItem(hwndTab, iItem, &tci); + CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTCONTAINER), hwndDlg, SelectContainerDlgProc, (LPARAM)tci.lParam); + } break; case ID_TABMENU_CONTAINEROPTIONS: if (pContainer->hWndOptions == 0) @@ -1260,7 +1263,7 @@ panel_found: break; case SC_RESTORE: pContainer->oldSize.cx = pContainer->oldSize.cy = 0; - memset((void*)&pContainer->mOld, -1000, sizeof(MARGINS)); + pContainer->ClearMargins(); break; case SC_MINIMIZE: dat = (CTabBaseDlg*)(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA)); diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 8c26532110..8397d885df 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -96,14 +96,13 @@ void TSAPI ApplyContainerSetting(TContainerData *pContainer, DWORD flags, UINT m BroadCastContainer(pContainer, WM_CBD_UPDATED, 0, 0); } -#define NR_O_PAGES 10 -#define NR_O_OPTIONSPERPAGE 10 - -static struct _tagPages +struct { const wchar_t *szTitle, *szDesc; UINT uIds[10]; -} o_pages[] = { +} +static o_pages[] = +{ { LPGENW("General options"), nullptr, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 }, { LPGENW("Window layout"), nullptr, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 }, { LPGENW("Tabs and switch bar"), LPGENW("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0 }, @@ -118,10 +117,12 @@ static struct _tagPages static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow) { - if (iPage >= 0 && iPage < NR_O_PAGES) { - for (int i = 0; i < NR_O_OPTIONSPERPAGE && o_pages[iPage].uIds[i] != 0; i++) - Utils::showDlgControl(hwndDlg, o_pages[iPage].uIds[i], fShow ? SW_SHOW : SW_HIDE); - } + if (iPage < 0 || iPage >= _countof(o_pages)) + return; + + for (int i = 0; i < _countof(o_pages[0].uIds) && o_pages[iPage].uIds[i] != 0; i++) + Utils::showDlgControl(hwndDlg, o_pages[iPage].uIds[i], fShow ? SW_SHOW : SW_HIDE); + if (fShow) { SetDlgItemText(hwndDlg, IDC_TITLEBOX, TranslateW(o_pages[iPage].szTitle)); if (o_pages[iPage].szDesc != nullptr) @@ -183,7 +184,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SendDlgItemMessage(hwndDlg, IDC_TITLEFORMAT, EM_LIMITTEXT, TITLE_FORMATLEN - 1, 0); SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); - for (int i = 0; i < NR_O_PAGES; i++) { + for (int i = 0; i < _countof(o_pages); i++) { tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_PARAM; @@ -192,7 +193,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, HTREEITEM hItem = TreeView_InsertItem(hwndTree, &tvis); if (i == 0) SendMessage(hwndTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hItem); - for (int j = 0; j < NR_O_OPTIONSPERPAGE && o_pages[i].uIds[j] != 0; j++) + for (int j = 0; j < _countof(o_pages[0].uIds) && o_pages[i].uIds[j] != 0; j++) Utils::showDlgControl(hwndDlg, o_pages[i].uIds[j], SW_HIDE); ShowPage(hwndDlg, i, FALSE); } diff --git a/plugins/TabSRMM/src/controls.h b/plugins/TabSRMM/src/controls.h index b1f7e1afa0..93e72f351e 100644 --- a/plugins/TabSRMM/src/controls.h +++ b/plugins/TabSRMM/src/controls.h @@ -29,7 +29,7 @@ #ifndef __CONTROLS_H #define __CONTROLS_H -class CMenuBar +class CMenuBar : public MZeroedObject { public: enum { diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index 1f5dd03cc0..3e286f29b8 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -119,7 +119,6 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei); int TSAPI InitOptions(void); int TSAPI DbEventIsShown(DBEVENTINFO *dbei); -void TSAPI LoadLogfont(int i, LOGFONTA *lf, COLORREF *colour, char *szModule); // custom tab control diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 19571031e5..0c90ee7a48 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -553,7 +553,7 @@ void CTabBaseDlg::DM_InitRichEdit() if (fIsChat) { LOGFONTA lf; - LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, &inputcharcolor, FONTMODULE); + LoadLogfont(FONTSECTION_IM, MSGFONTID_MESSAGEAREA, &lf, &inputcharcolor, FONTMODULE); cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_ITALIC | CFM_BACKCOLOR; cf2.crTextColor = inputcharcolor; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0ad090b764..7279902229 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1227,7 +1227,7 @@ void CSrmmWindow::OnInitDialog() void CSrmmWindow::OnDestroy() { - memset((void*)&m_pContainer->mOld, -1000, sizeof(MARGINS)); + m_pContainer->ClearMargins(); PostMessage(m_pContainer->hwnd, WM_SIZE, 0, 1); if (m_pContainer->dwFlags & CNT_SIDEBAR) m_pContainer->SideBar->removeSession(this); @@ -3094,7 +3094,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DWMCOMPOSITIONCHANGED: BB_RefreshTheme(); - memset((void*)&m_pContainer->mOld, -1000, sizeof(MARGINS)); + m_pContainer->ClearMargins(); CProxyWindow::verify(this); break; diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 2a73f8f2d9..8a95c56780 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -127,7 +127,7 @@ void TSAPI CacheLogFonts() memset(logfonts, 0, (sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2))); for (int i = 0; i < MSGDLGFONTCOUNT; i++) { - LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE); + LoadLogfont(FONTSECTION_IM, i, &logfonts[i], &fontcolors[i], FONTMODULE); mir_snprintf(rtfFontsGlobal[i], "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic, logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY); } mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0); @@ -143,7 +143,7 @@ void TSAPI CacheLogFonts() COLORREF clr; LOGFONTA lf; - LoadLogfont(i + 100, &lf, &clr, FONTMODULE); + LoadLogfont(FONTSECTION_IP, i, &lf, &clr, FONTMODULE); lf.lfUnderline = 0; CInfoPanel::m_ipConfig.hFonts[i] = CreateFontIndirectA(&lf); CInfoPanel::m_ipConfig.clrs[i] = clr; diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 18f478eff2..88b7e23dd3 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -57,10 +57,10 @@ HIMAGELIST CreateStateImageList() return himlStates; } -void TSAPI LoadLogfont(int i, LOGFONTA * lf, COLORREF * colour, char *szModule) +void LoadLogfont(int section, int i, LOGFONTA * lf, COLORREF * colour, char *szModule) { LOGFONT lfResult; - LoadMsgDlgFont((i < 100) ? FONTSECTION_IM : FONTSECTION_IP, i, &lfResult, colour, szModule); + LoadMsgDlgFont(section, i, &lfResult, colour, szModule); if (lf) { lf->lfHeight = lfResult.lfHeight; lf->lfWidth = lfResult.lfWidth; diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 4f447a454d..3ce2656ff3 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -226,6 +226,10 @@ struct TContainerData CSideBar *SideBar; void UpdateTitle(MCONTACT, class CTabBaseDlg* = nullptr); + + void ClearMargins() + { memset(&mOld, 0xfe, sizeof(mOld)); + } }; struct SESSION_INFO; diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 16c3c78c6c..31ac15c4fe 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -152,13 +152,16 @@ CSendLaterJob::~CSendLaterJob() } CSendLater::CSendLater() : -m_sendLaterContactList(5, PtrKeySortT), -m_sendLaterJobList(5), -m_currJob(-1) + m_sendLaterContactList(5, PtrKeySortT), + m_sendLaterJobList(5), + m_currJob(-1), + m_hwndDlg(nullptr), + m_hwndList(nullptr), + m_hwndFilter(nullptr), + m_hFilter(0) { m_fAvail = M.GetByte("sendLaterAvail", 0) != 0; m_last_sendlater_processed = time(0); - m_hwndDlg = 0; m_fIsInteractive = false; m_fErrorPopups = M.GetByte("qmgrErrorPopups", 0) != 0; m_fSuccessPopups = M.GetByte("qmgrSuccessPopups", 0) != 0; diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index f206631744..4fb957d012 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -593,7 +593,8 @@ LRESULT CALLBACK CProxyWindow::wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARA * @param _p owner proxy window object * @return */ -CThumbBase::CThumbBase(const CProxyWindow* _p) +CThumbBase::CThumbBase(const CProxyWindow* _p) : + m_isValid(false) { m_pWnd = _p; m_hbmThumb = 0; -- cgit v1.2.3