[Libreoffice-commits] core.git: 2 commits - cui/source include/sfx2 sfx2/source sw/source
Caolán McNamara
caolanm at redhat.com
Mon Apr 3 09:40:01 UTC 2017
cui/source/tabpages/swpossizetabpage.cxx | 1
include/sfx2/bindings.hxx | 8 +--
sfx2/source/control/bindings.cxx | 65 ++++++++++++-------------------
sw/source/ui/frmdlg/wrap.cxx | 2
4 files changed, 32 insertions(+), 44 deletions(-)
New commits:
commit ed6c5a4908edb7d4ab075127b710a92e2abc753f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 3 09:45:34 2017 +0100
coverity#440972 Dereference before null check
Change-Id: If4a1da1859dbdf19a7084341003fd6c41700971f
Reviewed-on: https://gerrit.libreoffice.org/36040
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/sfx2/bindings.hxx b/include/sfx2/bindings.hxx
index ee9463358ab0..283864368b5c 100644
--- a/include/sfx2/bindings.hxx
+++ b/include/sfx2/bindings.hxx
@@ -105,12 +105,10 @@ private:
SfxCallMode nCall, const SfxPoolItem **pInternalArgs, bool bGlobalOnly=false);
SAL_DLLPRIVATE void SetSubBindings_Impl( SfxBindings* );
SAL_DLLPRIVATE void UpdateSlotServer_Impl(); // Update SlotServer
- SAL_DLLPRIVATE SfxItemSet* CreateSet_Impl( SfxStateCache* &pCache,
- const SfxSlot* &pRealSlot,
- const SfxSlotServer**,
- SfxFoundCacheArr_Impl& );
+ SAL_DLLPRIVATE SfxItemSet* CreateSet_Impl(SfxStateCache& rCache, const SfxSlot* &pRealSlot,
+ const SfxSlotServer**, SfxFoundCacheArr_Impl&);
SAL_DLLPRIVATE std::size_t GetSlotPos( sal_uInt16 nId, std::size_t nStartSearchAt = 0 );
- SAL_DLLPRIVATE void Update_Impl( SfxStateCache* pCache );
+ SAL_DLLPRIVATE void Update_Impl(SfxStateCache& rCache);
static SAL_DLLPRIVATE void UpdateControllers_Impl(
const SfxFoundCache_Impl& rFound,
const SfxPoolItem *pItem,
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index bd64b8942679..dff88933905e 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -86,12 +86,12 @@ struct SfxFoundCache_Impl
{
sal_uInt16 nWhichId; // If available: Which-Id, else: nSlotId
const SfxSlot* pSlot; // Pointer to <Master-Slot>
- SfxStateCache* pCache; // Pointer to StatusCache, if possible NULL
+ SfxStateCache& rCache; // Pointer to StatusCache
- SfxFoundCache_Impl(sal_uInt16 nW, const SfxSlot *pS, SfxStateCache *pC ):
- nWhichId(nW),
- pSlot(pS),
- pCache(pC)
+ SfxFoundCache_Impl(sal_uInt16 nW, const SfxSlot *pS, SfxStateCache& rC)
+ : nWhichId(nW)
+ , pSlot(pS)
+ , rCache(rC)
{}
};
@@ -296,16 +296,12 @@ void SfxBindings::HidePopupCtrls_Impl( bool bHide )
pImpl->ePopupAction = SfxPopupAction::DELETE;
}
-
-void SfxBindings::Update_Impl
-(
- SfxStateCache* pCache // The up to date SfxStatusCache
-)
+void SfxBindings::Update_Impl(SfxStateCache& rCache /*The up to date SfxStatusCache*/)
{
- if( pCache->GetDispatch().is() && pCache->GetItemLink() )
+ if (rCache.GetDispatch().is() && rCache.GetItemLink())
{
- pCache->SetCachedState(true);
- if ( !pCache->GetInternalController() )
+ rCache.SetCachedState(true);
+ if (!rCache.GetInternalController())
return;
}
@@ -317,7 +313,7 @@ void SfxBindings::Update_Impl
const SfxSlot *pRealSlot = nullptr;
const SfxSlotServer* pMsgServer = nullptr;
SfxFoundCacheArr_Impl aFound;
- SfxItemSet *pSet = CreateSet_Impl( pCache, pRealSlot, &pMsgServer, aFound );
+ SfxItemSet *pSet = CreateSet_Impl(rCache, pRealSlot, &pMsgServer, aFound);
bool bUpdated = false;
if ( pSet )
{
@@ -341,17 +337,13 @@ void SfxBindings::Update_Impl
delete pSet;
}
- if ( !bUpdated && pCache )
+ if (!bUpdated)
{
- // When pCache == NULL and no SlotServer
- // (for example due to locked Dispatcher! ),
- // obviously do not try to update
- SfxFoundCache_Impl aFoundCache(0, pRealSlot, pCache );
+ SfxFoundCache_Impl aFoundCache(0, pRealSlot, rCache);
UpdateControllers_Impl( aFoundCache, nullptr, SfxItemState::DISABLED);
}
}
-
void SfxBindings::InvalidateSlotsInMap_Impl()
{
InvalidateSlotMap::const_iterator pIter = pImpl->m_aInvalidateSlots.begin();
@@ -418,7 +410,7 @@ void SfxBindings::Update
return;
}
- Update_Impl(pCache);
+ Update_Impl(*pCache);
}
pImpl->bAllDirty = false;
@@ -1166,7 +1158,7 @@ void SfxBindings::UpdateSlotServer_Impl()
SfxItemSet* SfxBindings::CreateSet_Impl
(
- SfxStateCache*& pCache, // in: Status-Cache from nId
+ SfxStateCache& rCache, // in: Status-Cache from nId
const SfxSlot*& pRealSlot, // out: RealSlot to nId
const SfxSlotServer** pMsgServer, // out: Slot-Server to nId
SfxFoundCacheArr_Impl& rFound // out: List of Caches for Siblings
@@ -1175,7 +1167,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl
DBG_ASSERT( !pImpl->bMsgDirty, "CreateSet_Impl with dirty MessageServer" );
assert(pDispatcher);
- const SfxSlotServer* pMsgSvr = pCache->GetSlotServer(*pDispatcher, pImpl->xProv);
+ const SfxSlotServer* pMsgSvr = rCache.GetSlotServer(*pDispatcher, pImpl->xProv);
if (!pMsgSvr)
return nullptr;
@@ -1189,17 +1181,15 @@ SfxItemSet* SfxBindings::CreateSet_Impl
SfxItemPool &rPool = pShell->GetPool();
- // get the status method, which is served by the pCache
+ // get the status method, which is served by the rCache
SfxStateFunc pFnc = nullptr;
pRealSlot = pMsgSvr->GetSlot();
- // Note: pCache can be NULL!
-
pFnc = pRealSlot->GetStateFnc();
// the RealSlot is always on
SfxFoundCache_Impl *pFound = new SfxFoundCache_Impl(
- pRealSlot->GetWhich(rPool), pRealSlot, pCache );
+ pRealSlot->GetWhich(rPool), pRealSlot, rCache);
rFound.push_back( pFound );
// Search through the bindings for slots served by the same function. This , // will only affect slots which are present in the found interface.
@@ -1233,7 +1223,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl
{
SfxFoundCache_Impl *pFoundCache = new SfxFoundCache_Impl(
pSibling->GetWhich(rPool),
- pSibling, pSiblingCache );
+ pSibling, *pSiblingCache);
rFound.push_back( pFoundCache );
}
@@ -1268,29 +1258,29 @@ void SfxBindings::UpdateControllers_Impl
SfxItemState eState // state of item
)
{
- SfxStateCache* pCache = rFound.pCache;
+ SfxStateCache& rCache = rFound.rCache;
const SfxSlot* pSlot = rFound.pSlot;
- DBG_ASSERT( !pCache || !pSlot || pCache->GetId() == pSlot->GetSlotId(), "SID mismatch" );
+ DBG_ASSERT( !pSlot || rCache.GetId() == pSlot->GetSlotId(), "SID mismatch" );
// bound until now, the Controller to update the Slot.
- if ( pCache && pCache->IsControllerDirty() )
+ if (rCache.IsControllerDirty())
{
if ( SfxItemState::DONTCARE == eState )
{
// ambiguous
- pCache->SetState( SfxItemState::DONTCARE, INVALID_POOL_ITEM );
+ rCache.SetState( SfxItemState::DONTCARE, INVALID_POOL_ITEM );
}
else if ( SfxItemState::DEFAULT == eState &&
SfxItemPool::IsSlot(rFound.nWhichId) )
{
// no Status or Default but without Pool
SfxVoidItem aVoid(0);
- pCache->SetState( SfxItemState::UNKNOWN, &aVoid );
+ rCache.SetState( SfxItemState::UNKNOWN, &aVoid );
}
else if ( SfxItemState::DISABLED == eState )
- pCache->SetState(SfxItemState::DISABLED, nullptr);
+ rCache.SetState(SfxItemState::DISABLED, nullptr);
else
- pCache->SetState(SfxItemState::DEFAULT, pItem);
+ rCache.SetState(SfxItemState::DEFAULT, pItem);
}
}
@@ -1351,9 +1341,8 @@ bool SfxBindings::NextJob_Impl(Timer * pTimer)
bool bWasDirty = pCache->IsControllerDirty();
if ( bWasDirty )
{
- Update_Impl( pCache );
- DBG_ASSERT( nCount == pImpl->pCaches.size(),
- "Reschedule in StateChanged => buff" );
+ Update_Impl(*pCache);
+ DBG_ASSERT(nCount == pImpl->pCaches.size(), "Reschedule in StateChanged => buff");
}
// skip to next function binding
commit 6eabb8fc773b73321705d7a3e52bbe6d6fd7e48f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Apr 3 10:24:22 2017 +0100
coverity#1403734 Mixing enum types
Change-Id: I46a9a85e7f70502f703ee9fb0f94abd83952d120
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 4e669fd6dcf3..fc6c0e3f4b3f 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -1147,6 +1147,7 @@ IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyClickHdl, Button*, void)
{
RangeModifyHdl(*m_pWidthMF);
}
+
IMPL_LINK_NOARG(SvxSwPosSizeTabPage, RangeModifyHdl, Control&, void)
{
if(m_bPositioningDisabled)
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index f70090a1cba6..2f10d4a566e9 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -461,7 +461,7 @@ void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet)
nBottom = aVal.nMaxHeight - aVal.nHeight;
{
- if (aVal.nAnchorType == (css::text::TextContentAnchorType)RndStdIds::FLY_AS_CHAR)
+ if (aVal.nAnchorType == css::text::TextContentAnchorType_AS_CHARACTER)
{
nLeft = nRight;
More information about the Libreoffice-commits
mailing list