diff options
author | Oliver Schneider <oliver@assarbad.net> | 2018-10-09 23:19:01 +0300 |
---|---|---|
committer | Oliver Schneider <oliver@assarbad.net> | 2018-10-09 23:19:01 +0300 |
commit | c26c2bc4a1e97ea50a2daad620c343e6c5dd81c1 (patch) | |
tree | b0aeee294bcb1aa69bdfdc34fe2e9043c4012e50 /windirstat/Controls | |
parent | 3008e91efac446fc21d607485cb787c457401a8b (diff) |
Fixed a number of warnings from the static analyzer and switched to GetTickCount64 (or a surrogate function on pre-Vista) whereever we use millisecond values
Diffstat (limited to 'windirstat/Controls')
-rw-r--r-- | windirstat/Controls/TreeListControl.cpp | 12 | ||||
-rw-r--r-- | windirstat/Controls/TreeListControl.h | 8 | ||||
-rw-r--r-- | windirstat/Controls/ownerdrawnlistcontrol.cpp | 7 | ||||
-rw-r--r-- | windirstat/Controls/pacman.cpp | 18 | ||||
-rw-r--r-- | windirstat/Controls/pacman.h | 2 | ||||
-rw-r--r-- | windirstat/Controls/sortinglistcontrol.cpp | 5 | ||||
-rw-r--r-- | windirstat/Controls/treemap.cpp | 3 | ||||
-rw-r--r-- | windirstat/Controls/typeview.cpp | 3 |
8 files changed, 37 insertions, 21 deletions
diff --git a/windirstat/Controls/TreeListControl.cpp b/windirstat/Controls/TreeListControl.cpp index 8271d1d..10cf005 100644 --- a/windirstat/Controls/TreeListControl.cpp +++ b/windirstat/Controls/TreeListControl.cpp @@ -264,17 +264,7 @@ void CTreeListItem::SetVisible(bool visible) if(visible) { ASSERT(!IsVisible()); - m_vi = new VISIBLEINFO; - if(GetParent() == NULL) - { - m_vi->indent = 0; - } - else - { - m_vi->indent = GetParent()->GetIndent() + 1; - } - m_vi->image = -1; - m_vi->isExpanded = false; + m_vi = new VISIBLEINFO((GetParent() == NULL) ? 0 : GetParent()->GetIndent() + 1); } else { diff --git a/windirstat/Controls/TreeListControl.h b/windirstat/Controls/TreeListControl.h index 2a554a9..d21d251 100644 --- a/windirstat/Controls/TreeListControl.h +++ b/windirstat/Controls/TreeListControl.h @@ -55,6 +55,12 @@ class CTreeListItem: public COwnerDrawnListItem CArray<CTreeListItem *, CTreeListItem *> sortedChildren; CPacman pacman; + + VISIBLEINFO(int iIndent) + : indent(iIndent) + , image(-1) + , isExpanded(false) + {} }; public: @@ -185,7 +191,7 @@ protected: afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); - afx_msg BOOL OnEraseBkgnd(CDC* pDC); + // afx_msg BOOL OnEraseBkgnd(CDC* pDC); }; #endif // __WDS_TREELISTCONTROL_H__ diff --git a/windirstat/Controls/ownerdrawnlistcontrol.cpp b/windirstat/Controls/ownerdrawnlistcontrol.cpp index 5878f93..0d7bfee 100644 --- a/windirstat/Controls/ownerdrawnlistcontrol.cpp +++ b/windirstat/Controls/ownerdrawnlistcontrol.cpp @@ -210,6 +210,9 @@ COwnerDrawnListControl::COwnerDrawnListControl(LPCTSTR name, int rowHeight) , m_showGrid(false) , m_showStripes(false) , m_showFullRowSelection(false) + , m_yFirstItem(-1) + , m_windowColor(CLR_NONE) + , m_stripeColor(CLR_NONE) { ASSERT(rowHeight > 0); InitializeColors(); @@ -606,10 +609,14 @@ int COwnerDrawnListControl::GetSubItemWidth(COwnerDrawnListItem *item, int subit BEGIN_MESSAGE_MAP(COwnerDrawnListControl, CSortingListControl) ON_WM_ERASEBKGND() +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_DIVIDERDBLCLICKA, 0, OnHdnDividerdblclick) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_DIVIDERDBLCLICKW, 0, OnHdnDividerdblclick) ON_WM_VSCROLL() +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMCHANGINGA, 0, OnHdnItemchanging) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMCHANGINGW, 0, OnHdnItemchanging) ON_WM_SHOWWINDOW() END_MESSAGE_MAP() diff --git a/windirstat/Controls/pacman.cpp b/windirstat/Controls/pacman.cpp index 3e4d801..f9fd0f2 100644 --- a/windirstat/Controls/pacman.cpp +++ b/windirstat/Controls/pacman.cpp @@ -29,16 +29,20 @@ namespace { - DWORD UPDATEINTERVAL = 40; // ms - double MOUTHSPEED = 0.0030; // aperture alteration / ms + const ULONGLONG UPDATEINTERVAL = 40; // ms + const double MOUTHSPEED = 0.0030; // aperture alteration / ms } CPacman::CPacman() - : m_readJobs(0) + : m_bgcolor(::GetSysColor(COLOR_WINDOW)) , m_speed(0.0005) , m_moving(false) + , m_readJobs(0) + , m_toTheRight(true) + , m_position(0) + , m_mouthOpening(false) + , m_aperture(0) , m_lastUpdate(0) - , m_bgcolor(::GetSysColor(COLOR_WINDOW)) { Reset(); } @@ -64,7 +68,7 @@ void CPacman::SetSpeed(double speed) void CPacman::Start(bool start) { m_moving = start; - m_lastUpdate = ::GetTickCount(); + m_lastUpdate = _GetTickCount64(); } bool CPacman::Drive(ULONGLONG readJobs) @@ -76,8 +80,8 @@ bool CPacman::Drive(ULONGLONG readJobs) return false; } - DWORD now = ::GetTickCount(); - DWORD delta = now - m_lastUpdate; + const ULONGLONG now = _GetTickCount64(); + const ULONGLONG delta = now - m_lastUpdate; if(delta < UPDATEINTERVAL) { diff --git a/windirstat/Controls/pacman.h b/windirstat/Controls/pacman.h index 0bc6daa..2bfc0d3 100644 --- a/windirstat/Controls/pacman.h +++ b/windirstat/Controls/pacman.h @@ -49,7 +49,7 @@ private: double m_position; // 0...1 bool m_mouthOpening; // Mouth is opening double m_aperture; // 0...1 - DWORD m_lastUpdate; // TickCount + ULONGLONG m_lastUpdate; // TickCount }; #endif // __WDS_PACMAN_H__ diff --git a/windirstat/Controls/sortinglistcontrol.cpp b/windirstat/Controls/sortinglistcontrol.cpp index 7f17115..21c81b4 100644 --- a/windirstat/Controls/sortinglistcontrol.cpp +++ b/windirstat/Controls/sortinglistcontrol.cpp @@ -261,10 +261,15 @@ int CALLBACK CSortingListControl::_CompareFunc(LPARAM lParam1, LPARAM lParam2, L } BEGIN_MESSAGE_MAP(CSortingListControl, CListCtrl) +#pragma warning(suppress: 26454) ON_NOTIFY_REFLECT(LVN_GETDISPINFO, OnLvnGetdispinfo) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHdnItemclick) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHdnItemclick) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMDBLCLICKA, 0, OnHdnItemdblclick) +#pragma warning(suppress: 26454) ON_NOTIFY(HDN_ITEMDBLCLICKW, 0, OnHdnItemdblclick) ON_WM_DESTROY() END_MESSAGE_MAP() diff --git a/windirstat/Controls/treemap.cpp b/windirstat/Controls/treemap.cpp index f91dd00..9cfe604 100644 --- a/windirstat/Controls/treemap.cpp +++ b/windirstat/Controls/treemap.cpp @@ -215,6 +215,9 @@ CTreemap::Options CTreemap::GetOldDefaultOptions() } CTreemap::CTreemap(Callback *callback) + : m_Lx(0.) + , m_Ly(0.) + , m_Lz(0.) { m_callback = callback; SetOptions(&_defaultOptions); diff --git a/windirstat/Controls/typeview.cpp b/windirstat/Controls/typeview.cpp index 3a83972..04442bb 100644 --- a/windirstat/Controls/typeview.cpp +++ b/windirstat/Controls/typeview.cpp @@ -217,8 +217,10 @@ int CExtensionListControl::CListItem::Compare(const CSortingListItem *baseOther, BEGIN_MESSAGE_MAP(CExtensionListControl, COwnerDrawnListControl) ON_WM_MEASUREITEM_REFLECT() ON_WM_DESTROY() +#pragma warning(suppress: 26454) ON_NOTIFY_REFLECT(LVN_DELETEITEM, OnLvnDeleteitem) ON_WM_SETFOCUS() +#pragma warning(suppress: 26454) ON_NOTIFY_REFLECT(LVN_ITEMCHANGED, OnLvnItemchanged) ON_WM_KEYDOWN() END_MESSAGE_MAP() @@ -276,7 +278,6 @@ void CExtensionListControl::Initialize() void CExtensionListControl::OnDestroy() { - SetImageList(NULL, LVSIL_SMALL); COwnerDrawnListControl::OnDestroy(); } |