summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2014-11-28 21:19:14 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2014-11-28 21:19:14 +0000
commit6895d635acb37ba42e53ba95ca3eee2ddbbef24d (patch)
treef85a1d97784c4597099864119acb027b9a3f2dba /plugins/TabSRMM
parent8ef06acf351fdb6034b6e13670d84bfd79161956 (diff)
Massive code cleanup and fixes for a lot of warnings reported in #837
git-svn-id: http://svn.miranda-ng.org/main/trunk@11136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp7
-rw-r--r--plugins/TabSRMM/src/container.cpp12
-rw-r--r--plugins/TabSRMM/src/controls.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/TabSRMM/src/msglog.cpp7
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp4
-rw-r--r--plugins/TabSRMM/src/templates.cpp3
-rw-r--r--plugins/TabSRMM/src/themes.cpp19
9 files changed, 25 insertions, 33 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index 3d46372ed1..2f21dfed4e 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -414,6 +414,11 @@ void BB_UpdateIcons(HWND hdlg, TWindowData *dat)
void TSAPI BB_InitDlgButtons(TWindowData *dat)
{
+ if (dat == 0)
+ return;
+ HWND hdlg = dat->hwnd;
+ if (hdlg == 0)
+ return;
RECT rect;
int i;
int lwidth = 0, rwidth = 0;
@@ -425,9 +430,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
int cx = 0, cy = 0;
int lcount = LButtonsList.getCount();
int rcount = RButtonsList.getCount();
- HWND hdlg = dat->hwnd;
- if (dat == 0 || hdlg == 0) { return; }
if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED &&
!SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) {
isThemed = FALSE;
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 1962c1b8e1..5f74bbd09c 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -619,7 +619,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
LONG y_pad = M.GetByte("y-pad", 3) + ((pContainer->dwFlags & CNT_TABSBOTTOM) ? 1 : 0);
if (pContainer->dwFlagsEx & TCF_FLAT)
- y_pad += 1; //(pContainer->dwFlags & CNT_TABSBOTTOM ? 1 : 2);
+ y_pad++; //(pContainer->dwFlags & CNT_TABSBOTTOM ? 1 : 2);
TabCtrl_SetPadding(GetDlgItem(hwndDlg, IDC_MSGTABS), x_pad, y_pad);
@@ -838,14 +838,12 @@ panel_found:
}
else if (((LPNMHDR)lParam)->code == NM_RCLICK) {
POINT pt;
- MCONTACT hContact = 0;
- HMENU hMenu;
-
GetCursorPos(&pt);
+ MCONTACT hContact = 0;
SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact);
if (hContact) {
int iSel = 0;
- hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
+ HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0);
iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL);
if (iSel)
CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), hContact);
@@ -1000,9 +998,7 @@ panel_found:
{
RECT rc;
LONG dwNewLeft;
- BOOL skinnedMode = bSkinned;
-
- skinnedMode |= (IsThemeActive() ? 1 : 0);
+ BOOL skinnedMode = bSkinned | (IsThemeActive() ? 1 : 0);
GetWindowRect(hwndDlg, &rc);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index f26f1e3990..b09bfdc44b 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -448,7 +448,7 @@ void CMenuBar::updateState(const HMENU hMenu) const
if (dat) {
::CheckMenuItem(hMenu, ID_VIEW_SHOWMENUBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOMENUBAR ? MF_UNCHECKED : MF_CHECKED);
::CheckMenuItem(hMenu, ID_VIEW_SHOWSTATUSBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOSTATUSBAR ? MF_UNCHECKED : MF_CHECKED);
- ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED);
+ ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | (dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED));
::CheckMenuItem(hMenu, ID_VIEW_SHOWTITLEBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOTITLE ? MF_UNCHECKED : MF_CHECKED);
::EnableMenuItem(hMenu, ID_VIEW_SHOWTITLEBAR, CSkin::m_skinEnabled && CSkin::m_frameSkins ? MF_GRAYED : MF_ENABLED);
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index c5fd0dc581..adeaedb97e 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -520,7 +520,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
ack.type = ACKTYPE_MESSAGE;
ack.result = ACKRESULT_SUCCESS;
- if (job->hContact && job->iAcksNeeded && job->hContact && job->iStatus == SendQueue::SQ_INPROGRESS) {
+ if (job->hContact && job->iAcksNeeded && job->iStatus == SendQueue::SQ_INPROGRESS) {
if (IsWindow(job->hOwnerWnd))
::SendMessage(job->hOwnerWnd, HM_EVENTSENT, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack);
else
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index ab677d6451..9b334fb22f 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -3231,7 +3231,7 @@ quote_from_last:
}
_dlgReturn(hwndDlg, TRUE);
}
- {
+ if(dat) {
TContainerData *pContainer = dat->pContainer;
if (dat->iOpenJobs > 0 && lParam != 2) {
if (dat->dwFlags & MWF_ERRORSTATE) {
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index a448be6be0..e5299a53da 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -126,13 +126,12 @@ static void TrimMessage(TCHAR *msg)
void TSAPI CacheLogFonts()
{
- int i;
HDC hdc = GetDC(NULL);
logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
ReleaseDC(NULL, hdc);
- ZeroMemory(logfonts, sizeof(LOGFONTA) * MSGDLGFONTCOUNT + 2);
- for (i = 0; i < MSGDLGFONTCOUNT; i++) {
+ ZeroMemory(logfonts, sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2));
+ for (int i = 0; i < MSGDLGFONTCOUNT; i++) {
LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE);
mir_snprintf(rtfFontsGlobal[i], SIZEOF(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);
}
@@ -149,7 +148,7 @@ void TSAPI CacheLogFonts()
COLORREF clr;
LOGFONTA lf;
- for (i = 0; i < IPFONTCOUNT; i++) {
+ for (int i = 0; i < IPFONTCOUNT; i++) {
if (CInfoPanel::m_ipConfig.hFonts[i])
DeleteObject(CInfoPanel::m_ipConfig.hFonts[i]);
LoadLogfont(i + 100, &lf, &clr, FONTMODULE);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index fd5b0f1342..d9a47724af 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -580,7 +580,7 @@ void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const
void SendQueue::UpdateSaveAndSendButton(TWindowData *dat)
{
if (dat) {
- HWND hwndDlg = dat->hwnd;
+ HWND hwndDlg = dat->hwnd;
GETTEXTLENGTHEX gtxl = {0};
gtxl.codepage = CP_UTF8;
@@ -829,7 +829,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
}
if (iJobIndex >= 0 && iJobIndex < NR_SENDJOBS) {
- SendJob* job = &m_jobs[iJobIndex];
+ SendJob *job = &m_jobs[iJobIndex];
char szKeyName[20];
TCHAR tszHeader[150];
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp
index 4bd8f52bae..d03e5c81f8 100644
--- a/plugins/TabSRMM/src/templates.cpp
+++ b/plugins/TabSRMM/src/templates.cpp
@@ -118,11 +118,10 @@ void LoadDefaultTemplates()
INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TWindowData *dat;
TemplateEditorInfo *teInfo = 0;
TTemplateSet *tSet;
int i;
- dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
/*
* since this dialog needs a MessageWindowData * but has no container, we can store
* the extended info struct in pContainer *)
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 44284695f3..7e2e4833ae 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -841,7 +841,6 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename)
m_dwFlags |= IMAGE_FLAG_DIVIDED;
m_bf.BlendFlags = 0;
m_bf.BlendOp = AC_SRC_OVER;
- m_bf.AlphaFormat = 0;
m_dwFlags |= IMAGE_PERPIXEL_ALPHA;
m_bf.AlphaFormat = AC_SRC_ALPHA;
if (m_inner_height <= 0 || m_inner_width <= 0) {
@@ -1371,7 +1370,6 @@ void CSkin::Load(void)
if (!m_tszFileName[0] || !::PathFileExists(m_tszFileName))
return;
- TCHAR *p;
TCHAR *szSections = (TCHAR*)mir_alloc(6004);
int i = 1, j = 0;
UINT data;
@@ -1407,10 +1405,9 @@ void CSkin::Load(void)
m_DisableScrollbars = M.GetByte("disableVScroll", 0) ? true : false;
ZeroMemory(szSections, 6000);
- p = szSections;
GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName);
szSections[3001] = szSections[3000] = 0;
- p = szSections;
+ TCHAR *p = szSections;
while (lstrlen(p) > 1) {
if (p[0] != '%') {
p += (lstrlen(p) + 1);
@@ -1719,19 +1716,19 @@ void CSkin::setupAeroSkins()
float fmax = max(max(fr, fg), fb);
if (fmax == fr) {
- fr *= (alphafactor / 100 * 2.2);
+ fr *= (alphafactor / 100.0 * 2.2);
fr = min(fr, 255);
fb = min(fb * alphafactor / 100, 255);
fg = min(fg * alphafactor / 100, 255);
}
else if (fmax == fg) {
- fg *= (alphafactor / 100 * 2.2);
+ fg *= (alphafactor / 100.0 * 2.2);
fg = min(fg, 255);
fr = min(fr * alphafactor / 100, 255);
fb = min(fb * alphafactor / 100, 255);
}
else {
- fb *= (alphafactor / 100 * 2.2);
+ fb *= (alphafactor / 100.0 * 2.2);
fb = min(fb, 255);
fr = min(fr * alphafactor / 100, 255);
fg = min(fg * alphafactor / 100, 255);
@@ -1838,11 +1835,9 @@ void CSkin::setupAeroSkins()
void CSkin::SkinCalcFrameWidth()
{
- int xBorder, yBorder, yCaption;
-
- xBorder = GetSystemMetrics(SM_CXSIZEFRAME);
- yBorder = GetSystemMetrics(SM_CYSIZEFRAME);
- yCaption = GetSystemMetrics(SM_CYCAPTION);
+ int xBorder = GetSystemMetrics(SM_CXSIZEFRAME);
+ int yBorder = GetSystemMetrics(SM_CYSIZEFRAME);
+ int yCaption = GetSystemMetrics(SM_CYCAPTION);
m_realSkinnedFrame_left = m_SkinnedFrame_left - xBorder;
m_realSkinnedFrame_right = m_SkinnedFrame_right - xBorder;