diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 21:32:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-10 22:11:33 +0100 |
commit | 88b104f44acff8087dfe3833bb91c63604ced98b (patch) | |
tree | 6c7aee2f8cf919d994e1b9640ab8c1dd921837f8 /cui | |
parent | dc4d9481f36a18db1dfe3b931780edbe32266e5f (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 'cui')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 9 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 6 | ||||
-rw-r--r-- | cui/source/customize/macropg.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/thesdlg.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/thesdlg_impl.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/optHeaderTabListbox.cxx | 6 | ||||
-rw-r--r-- | cui/source/options/optlingu.cxx | 14 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 8 |
8 files changed, 25 insertions, 28 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index b3511e977198..b91f0039f62a 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -625,7 +625,7 @@ public: virtual ~SfxAccCfgLBoxString_Impl(); virtual void Paint(const Point& aPos, SvTreeListBox& rDevice, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE; + const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) SAL_OVERRIDE; }; @@ -637,12 +637,9 @@ SfxAccCfgLBoxString_Impl::~SfxAccCfgLBoxString_Impl() {} void SfxAccCfgLBoxString_Impl::Paint(const Point& aPos, SvTreeListBox& /*rDevice*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { - if (!pEntry) - return; - - TAccInfo* pUserData = static_cast<TAccInfo*>(pEntry->GetUserData()); + TAccInfo* pUserData = static_cast<TAccInfo*>(rEntry.GetUserData()); if (!pUserData) return; diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index d472b7f73989..c013d6a98080 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1328,9 +1328,9 @@ public: virtual ~PopupPainter() { } 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 { - SvLBoxString::Paint(rPos, rOutDev, rRenderContext, pView, pEntry); + SvLBoxString::Paint(rPos, rOutDev, rRenderContext, pView, rEntry); rRenderContext.Push(PushFlags::FILLCOLOR); @@ -1343,7 +1343,7 @@ public: nX -= pVScroll->GetSizePixel().Width(); } - const SvViewDataItem* pItem = rOutDev.GetViewDataItem( pEntry, this ); + const SvViewDataItem* pItem = rOutDev.GetViewDataItem( &rEntry, this ); nX -= pItem->maSize.Height(); long nSize = pItem->maSize.Height() / 2; diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx index 8697cf9ce182..a57fb4b7ed9c 100644 --- a/cui/source/customize/macropg.cxx +++ b/cui/source/customize/macropg.cxx @@ -452,7 +452,7 @@ public: IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& sText, Image* pMacroImg, Image* pComponentImg ); 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; }; @@ -467,7 +467,7 @@ IconLBoxString::IconLBoxString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, cons void IconLBoxString::Paint(const Point& aPos, SvTreeListBox& /*aDevice*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& /*rEntry*/) { OUString aTxt(GetText()); if (!aTxt.isEmpty()) diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index d6a375922d51..c346935c2c79 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -147,9 +147,9 @@ AlternativesString::AlternativesString( } void AlternativesString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { - AlternativesExtraData* pData = m_rControlImpl.GetExtraData(pEntry); + AlternativesExtraData* pData = m_rControlImpl.GetExtraData(&rEntry); Point aPos(rPos); rRenderContext.Push(PushFlags::FONT); if (pData && pData->IsHeader()) diff --git a/cui/source/dialogs/thesdlg_impl.hxx b/cui/source/dialogs/thesdlg_impl.hxx index 25b09f51d754..f302947b9fb3 100644 --- a/cui/source/dialogs/thesdlg_impl.hxx +++ b/cui/source/dialogs/thesdlg_impl.hxx @@ -54,7 +54,7 @@ public: SvTreeListEntry* pEntry, sal_uInt16 nFlags, const OUString& rStr ); 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; }; #endif diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx index 404ef64bc7e2..bba08c097ef6 100644 --- a/cui/source/options/optHeaderTabListbox.cxx +++ b/cui/source/options/optHeaderTabListbox.cxx @@ -35,18 +35,18 @@ public: SvLBoxString( pEntry, nFlags, rTxt ) {} 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 OptLBoxString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { rRenderContext.Push(PushFlags::FONT); vcl::Font aFont(rRenderContext.GetFont()); //detect readonly state by asking for a valid Image - if (pEntry && !(!SvTreeListBox::GetCollapsedEntryBmp(pEntry))) + if (!(!SvTreeListBox::GetCollapsedEntryBmp(&rEntry))) aFont.SetColor(Application::GetSettings().GetStyleSettings().GetDeactiveTextColor()); rRenderContext.SetFont(aFont); rRenderContext.DrawText(rPos, GetText()); diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 4b285f554500..7f42d50323b3 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -264,13 +264,13 @@ public: const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} 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; }; void BrwStringDic_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { - ModuleUserData_Impl* pData = static_cast<ModuleUserData_Impl*>(pEntry->GetUserData()); + ModuleUserData_Impl* pData = static_cast<ModuleUserData_Impl*>(rEntry.GetUserData()); Point aPos(rPos); rRenderContext.Push(PushFlags::FONT); if (pData->IsParent()) @@ -441,16 +441,16 @@ public: const OUString& rStr ) : SvLBoxString( pEntry, nFlags, rStr ) {} 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; }; void BrwString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { Point aPos(rPos); aPos.X() += 20; rRenderContext.DrawText(aPos, GetText()); - if (pEntry->GetUserData()) + if (rEntry.GetUserData()) { Point aNewPos(aPos); aNewPos.X() += rRenderContext.GetTextWidth(GetText()); @@ -459,7 +459,7 @@ void BrwString_Impl::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::Rend aFont.SetWeight(WEIGHT_BOLD); //??? convert the lower byte from the user date into a string - OptionsUserData aData(reinterpret_cast<sal_uLong>(pEntry->GetUserData())); + OptionsUserData aData(reinterpret_cast<sal_uLong>(rEntry.GetUserData())); if (aData.HasNumericValue()) { OUStringBuffer sTxt; diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index b1fded465be2..ecd32b8522fa 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -335,16 +335,16 @@ public: const OUString& rStr ) : SvLBoxString(pEntry,nFlags,rStr){} 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 OfaImpBrwString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext, - const SvViewDataEntry* /*pView*/, const SvTreeListEntry* pEntry) + const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry) { rRenderContext.DrawText(rPos, GetText()); - if (pEntry->GetUserData()) + if (rEntry.GetUserData()) { - ImpUserData* pUserData = static_cast<ImpUserData*>(pEntry->GetUserData()); + ImpUserData* pUserData = static_cast<ImpUserData*>(rEntry.GetUserData()); Point aNewPos(rPos); aNewPos.X() += rRenderContext.GetTextWidth(GetText()); vcl::Font aOldFont(rRenderContext.GetFont()); |