summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-06-10 21:32:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-06-10 22:11:33 +0100
commit88b104f44acff8087dfe3833bb91c63604ced98b (patch)
tree6c7aee2f8cf919d994e1b9640ab8c1dd921837f8 /dbaccess
parentdc4d9481f36a18db1dfe3b931780edbe32266e5f (diff)
coverity#1302618 deref of NULL
on examination this PreparePaint virtual is only called from SvTreeListBox::PaintEntry1 and PaintEntry1 is only called from SvImpLBox::Paint in a for(sal_uInt16 n=0; n< nCount && pEntry; n++) { /*long nMaxRight=*/ pView->PaintEntry1 loop so pEntry always exists given that test. Re-jig things so these families of method take a reference instead of a pointer so verifying it cannot be NULL and a whole pile of else paths fall away Change-Id: Ied40acb1c2263c21b4447832f8cb86f64ed9e80d
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/app/AppDetailView.cxx37
-rw-r--r--dbaccess/source/ui/app/AppDetailView.hxx2
-rw-r--r--dbaccess/source/ui/control/listviewitems.cxx4
-rw-r--r--dbaccess/source/ui/inc/listviewitems.hxx2
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx4
5 files changed, 23 insertions, 26 deletions
diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx
index 7329b0b4cd3a..df30a5eef519 100644
--- a/dbaccess/source/ui/app/AppDetailView.cxx
+++ b/dbaccess/source/ui/app/AppDetailView.cxx
@@ -100,34 +100,31 @@ void OCreationList::Paint(vcl::RenderContext& rRenderContext, const Rectangle& _
rRenderContext.SetFont(m_aOriginalFont);
}
-void OCreationList::PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry* _pEntry)
+void OCreationList::PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry)
{
Wallpaper aEntryBackground(m_aOriginalBackgroundColor);
- if (_pEntry)
- {
- if (_pEntry == GetCurEntry())
- {
- // draw a selection background
- bool bIsMouseDownEntry = ( _pEntry == m_pMouseDownEntry );
- vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, GetBoundingRect(_pEntry),
- bIsMouseDownEntry ? 1 : 2, false, true, false );
- if (bIsMouseDownEntry)
- {
- vcl::Font aFont(rRenderContext.GetFont());
- aFont.SetColor(rRenderContext.GetSettings().GetStyleSettings().GetHighlightTextColor());
- rRenderContext.SetFont(aFont);
- }
+ if (&rEntry == GetCurEntry())
+ {
+ // draw a selection background
+ bool bIsMouseDownEntry = ( &rEntry == m_pMouseDownEntry );
+ vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, GetBoundingRect(&rEntry),
+ bIsMouseDownEntry ? 1 : 2, false, true, false );
- // and temporary set a transparent background, for all the other
- // paint operations the SvTreeListBox is going to do
- aEntryBackground = Wallpaper();
- _pEntry->SetBackColor(Color(COL_TRANSPARENT));
+ if (bIsMouseDownEntry)
+ {
+ vcl::Font aFont(rRenderContext.GetFont());
+ aFont.SetColor(rRenderContext.GetSettings().GetStyleSettings().GetHighlightTextColor());
+ rRenderContext.SetFont(aFont);
}
+
+ // and temporary set a transparent background, for all the other
+ // paint operations the SvTreeListBox is going to do
+ aEntryBackground = Wallpaper();
}
rRenderContext.SetBackground(aEntryBackground);
- _pEntry->SetBackColor(aEntryBackground.GetColor());
+ rEntry.SetBackColor(aEntryBackground.GetColor());
}
void OCreationList::SelectSearchEntry( const void* _pEntry )
diff --git a/dbaccess/source/ui/app/AppDetailView.hxx b/dbaccess/source/ui/app/AppDetailView.hxx
index 3b4286abe7ac..a429ff5490e4 100644
--- a/dbaccess/source/ui/app/AppDetailView.hxx
+++ b/dbaccess/source/ui/app/AppDetailView.hxx
@@ -71,7 +71,7 @@ namespace dbaui
void updateHelpText();
protected:
- virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry* _pEntry) SAL_OVERRIDE;
+ virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry) SAL_OVERRIDE;
virtual Rectangle GetFocusRect( SvTreeListEntry* _pEntry, long _nLine ) SAL_OVERRIDE;
virtual void ModelHasCleared() SAL_OVERRIDE;
diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx
index 3120d08d89e9..5f4d28de944b 100644
--- a/dbaccess/source/ui/control/listviewitems.cxx
+++ b/dbaccess/source/ui/control/listviewitems.cxx
@@ -45,7 +45,7 @@ namespace dbaui
}
void OBoldListboxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry)
+ const SvViewDataEntry* pView, const SvTreeListEntry& rEntry)
{
if (m_bEmphasized)
{
@@ -59,7 +59,7 @@ namespace dbaui
}
else
{
- SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, pEntry);
+ SvLBoxString::Paint(rPos, rDev, rRenderContext, pView, rEntry);
}
}
diff --git a/dbaccess/source/ui/inc/listviewitems.hxx b/dbaccess/source/ui/inc/listviewitems.hxx
index 8703e34c85de..d632d0da07f0 100644
--- a/dbaccess/source/ui/inc/listviewitems.hxx
+++ b/dbaccess/source/ui/inc/listviewitems.hxx
@@ -42,7 +42,7 @@ namespace dbaui
virtual sal_uInt16 GetType() const SAL_OVERRIDE;
virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) SAL_OVERRIDE;
virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* _pViewData) SAL_OVERRIDE;
bool isEmphasized() const { return m_bEmphasized; }
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 0b35a87ead0c..aa1ba97bf273 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -350,11 +350,11 @@ public:
}
virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) SAL_OVERRIDE;
};
void OColumnString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
+ const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/)
{
rRenderContext.Push(PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR);
if(m_bReadOnly)