summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-06-16 15:38:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-06-16 15:38:29 +0300
commitace3026d65c497ce24036e9a11434d8fe33ff330 (patch)
treefac81bd5e7450eef8e65cd60172e04bdba761824
parent02b83d28f8e22a07061e3d5af70daab35df4a589 (diff)
code cleaning
-rw-r--r--plugins/UserInfoEx/src/ctrl_base.cpp50
-rw-r--r--plugins/UserInfoEx/src/psp_base.cpp6
2 files changed, 16 insertions, 40 deletions
diff --git a/plugins/UserInfoEx/src/ctrl_base.cpp b/plugins/UserInfoEx/src/ctrl_base.cpp
index 9a2780cf60..7b435fc2cd 100644
--- a/plugins/UserInfoEx/src/ctrl_base.cpp
+++ b/plugins/UserInfoEx/src/ctrl_base.cpp
@@ -177,14 +177,12 @@ CCtrlList::CCtrlList(HWND hOwnerDlg) :
**/
CCtrlList::~CCtrlList()
{
- INT_PTR i;
-
SetUserData(_hOwnerDlg, NULL);
+
// delete data
- for (i = 0 ; i < count; i++)
- {
+ for (int i = 0 ; i < count; i++)
delete (*this)[i];
- }
+
// delete the list
LIST<CBaseCtrl>::destroy();
}
@@ -204,15 +202,9 @@ void CCtrlList::Release()
**/
void CCtrlList::OnReset()
{
- INT_PTR i;
-
- for (i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++)
if (items[i])
- {
items[i]->OnReset();
- }
- }
}
/**
@@ -222,15 +214,11 @@ void CCtrlList::OnReset()
BOOL CCtrlList::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
{
BOOL bChanged = 0;
- INT_PTR i;
- for (i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++)
if (PtrIsValid(items[i]))
- {
bChanged |= items[i]->OnInfoChanged(hContact, pszProto);
- }
- }
+
return bChanged;
}
@@ -240,15 +228,9 @@ BOOL CCtrlList::OnInfoChanged(MCONTACT hContact, LPCSTR pszProto)
**/
void CCtrlList::OnApply(MCONTACT hContact, LPCSTR pszProto)
{
- INT_PTR i;
-
- for (i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++)
if (PtrIsValid(items[i]))
- {
items[i]->OnApply(hContact, pszProto);
- }
- }
}
/**
@@ -258,18 +240,13 @@ void CCtrlList::OnApply(MCONTACT hContact, LPCSTR pszProto)
void CCtrlList::OnChangedByUser(uint16_t idCtrl, uint16_t wChangedMsg)
{
// prefilter messages to avoid unessesary search operations
- switch (wChangedMsg)
- {
+ switch (wChangedMsg) {
case EN_UPDATE:
case EN_CHANGE:
case CBN_SELCHANGE:
- {
- CBaseCtrl *pResult = CBaseCtrl::GetObj(_hOwnerDlg, idCtrl);
- if (PtrIsValid(pResult) && (pResult->_cbSize == sizeof(CBaseCtrl)))
- {
- pResult->OnChangedByUser(wChangedMsg);
- }
- }
+ CBaseCtrl *pResult = CBaseCtrl::GetObj(_hOwnerDlg, idCtrl);
+ if (PtrIsValid(pResult) && (pResult->_cbSize == sizeof(CBaseCtrl)))
+ pResult->OnChangedByUser(wChangedMsg);
}
}
@@ -279,13 +256,10 @@ void CCtrlList::OnChangedByUser(uint16_t idCtrl, uint16_t wChangedMsg)
**/
INT_PTR CCtrlList::OnSetTextColour(HWND hCtrl, HDC hdc)
{
- if (IsWindow(hCtrl) && myGlobals.ShowPropsheetColours)
- {
+ if (IsWindow(hCtrl) && myGlobals.ShowPropsheetColours) {
CBaseCtrl* pCtrl = CBaseCtrl::GetObj(hCtrl);
if (PtrIsValid(pCtrl) && (pCtrl->_cbSize == sizeof(CBaseCtrl)))
- {
return pCtrl->OnSetTextColour(hdc);
- }
}
return FALSE;
}
diff --git a/plugins/UserInfoEx/src/psp_base.cpp b/plugins/UserInfoEx/src/psp_base.cpp
index 8b42524e17..514e12a992 100644
--- a/plugins/UserInfoEx/src/psp_base.cpp
+++ b/plugins/UserInfoEx/src/psp_base.cpp
@@ -38,8 +38,9 @@ bool PSPBaseDlg::OnInitDialog()
bool PSPBaseDlg::OnRefresh()
{
- if (auto *pszProto = GetBaseProto())
- return m_ctrlList->OnInfoChanged(m_hContact, pszProto);
+ if (auto *pszProto = GetBaseProto())
+ if (m_ctrlList)
+ return m_ctrlList->OnInfoChanged(m_hContact, pszProto);
return false;
}
@@ -48,6 +49,7 @@ bool PSPBaseDlg::OnApply()
{
if (auto *pszProto = GetBaseProto())
m_ctrlList->OnApply(m_hContact, pszProto);
+
return true;
}