[Libreoffice-commits] core.git: 12 commits - sc/source sd/source sfx2/source svx/source sw/qa sw/source
Caolán McNamara
caolanm at redhat.com
Fri Jun 6 03:33:22 PDT 2014
sc/source/ui/app/inputwin.cxx | 13 ++++++-------
sc/source/ui/docshell/macromgr.cxx | 6 ++++--
sd/source/ui/view/frmview.cxx | 3 ++-
sfx2/source/appl/workwin.cxx | 2 +-
svx/source/fmcomp/gridcell.cxx | 10 +++-------
sw/qa/extras/inc/swmodeltestbase.hxx | 1 +
sw/source/core/doc/textboxhelper.cxx | 2 +-
sw/source/core/frmedt/fefly1.cxx | 4 ++--
sw/source/core/unocore/unocoll.cxx | 5 +++--
sw/source/uibase/dochdl/swdtflvr.cxx | 7 ++++---
sw/source/uibase/utlui/glbltree.cxx | 9 ++++++---
11 files changed, 33 insertions(+), 29 deletions(-)
New commits:
commit 4da7559ab335d342ebc5b5f06539b5fc4ea4a3cb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 11:08:49 2014 +0100
coverity#1219787 Explicit null dereferenced
Change-Id: Idb13242d25583b1c323b5a20ecc10f10b8b82465
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index e2b7d12..0741dd8 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -153,7 +153,7 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage* pPage, sal_Int32 nIndex, std::list
++nCount;
}
assert(pRet);
- return uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY));
+ return pRet ? uno::makeAny(uno::Reference<drawing::XShape>(pRet->getUnoShape(), uno::UNO_QUERY)) : uno::Any();
}
SwFrmFmt* SwTextBoxHelper::findTextBox(SwFrmFmt* pShape)
commit e9585fc11bb39edc1f02b20b482c39ba8013f381
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 11:06:28 2014 +0100
coverity#1219791 Uncaught exception
Change-Id: I018e8bc7f514b0d720bea19aa854aa776be366be
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index cccb2c3..084d486 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -604,12 +604,13 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16
if ( pDoc )
{
uno::Any aGlobs;
- if ( !pDoc->GetDocShell()->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) )
+ BasicManager *pBasicMan = pDoc->GetDocShell()->GetBasicManager();
+ if (pBasicMan && !pBasicMan->GetGlobalUNOConstant("VBAGlobals", aGlobs))
{
uno::Sequence< uno::Any > aArgs(1);
aArgs[ 0 ] <<= pDoc->GetDocShell()->GetModel();
aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.word.Globals", aArgs );
- pDoc->GetDocShell()->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
+ pBasicMan->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
}
aGlobs >>= xRet;
}
commit 92781adcdc57ac9df58f6c499d7fb337364cf8af
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 11:02:13 2014 +0100
coverity#1158094 Unchecked dynamic_cast
Change-Id: Ieac19e8dbb8328791d0c7110e9c787ec7c3bd448
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 4168322..79d55a5 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1067,18 +1067,14 @@ void DbLimitedLengthField::implAdjustGenericFieldSetting( const Reference< XProp
}
}
-
void DbLimitedLengthField::implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen )
{
- dynamic_cast< Edit* >( m_pWindow )->SetMaxTextLen( _nMaxLen );
- if ( m_pPainter )
- dynamic_cast< Edit* >( m_pPainter )->SetMaxTextLen( _nMaxLen );
+ dynamic_cast<Edit&>(*m_pWindow).SetMaxTextLen(_nMaxLen);
+ if (m_pPainter)
+ dynamic_cast<Edit&>(*m_pPainter).SetMaxTextLen(_nMaxLen);
}
-
//= DbTextField
-
-
DbTextField::DbTextField(DbGridColumn& _rColumn)
:DbLimitedLengthField(_rColumn)
,m_pEdit( NULL )
commit b487a48294dad588e16443d195e4526e10eaf022
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 11:00:18 2014 +0100
coverity#1078570 Unchecked dynamic_cast
Change-Id: I9cfdcad1c5e36b9cc6b44dcd3a25018bda6281ce
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 3ca656c..25c329f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1940,7 +1940,7 @@ void SwFEShell::SetObjTitle( const OUString& rTitle )
SwFrmFmt* pFmt = FindFrmFmt( pObj );
if ( pFmt->Which() == RES_FLYFRMFMT )
{
- GetDoc()->SetFlyFrmTitle( *(dynamic_cast<SwFlyFrmFmt*>(pFmt)),
+ GetDoc()->SetFlyFrmTitle( dynamic_cast<SwFlyFrmFmt&>(*pFmt),
rTitle );
}
else
commit bde63c71fcf593ad5830f15ba0a913c5910972a6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:57:23 2014 +0100
coverity#735905 Unchecked dynamic_cast
Change-Id: I419ece67081531d42e6dd49ab8c7d71d5a9b6182
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index a20dceb..3ca656c 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1962,7 +1962,7 @@ OUString SwFEShell::GetObjDescription() const
const SwFrmFmt* pFmt = FindFrmFmt( pObj );
if ( pFmt->Which() == RES_FLYFRMFMT )
{
- return dynamic_cast<const SwFlyFrmFmt*>(pFmt)->GetObjDescription();
+ return dynamic_cast<const SwFlyFrmFmt&>(*pFmt).GetObjDescription();
}
return pObj->GetDescription();
}
commit ff38a90357a366298e5eb49e0cd4bd20fbd76c73
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:55:45 2014 +0100
coverity#735889 Unchecked dynamic_cast
Change-Id: Ia55f575f6bfd1d90c2a517db8a76d7d22cdfd6e4
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index d163881..b55a8eb 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -275,6 +275,7 @@ private:
// create the dump
SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
+ CPPUNIT_ASSERT(pTxtDoc);
SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
SwRootFrm* pLayout = pDoc->GetCurrentLayout();
pLayout->dumpAsXml(pXmlWriter);
commit e1ac3f386c892c5d0e79ceccd1e6e791dce9fcf1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:50:28 2014 +0100
coverity#735812 Dereference after null check
Change-Id: Ie839246f637d079e8e16553c85c682d599d86b58
diff --git a/sc/source/ui/docshell/macromgr.cxx b/sc/source/ui/docshell/macromgr.cxx
index 263ed4e..b4e0e33 100644
--- a/sc/source/ui/docshell/macromgr.cxx
+++ b/sc/source/ui/docshell/macromgr.cxx
@@ -132,7 +132,9 @@ void ScMacroManager::InitUserFuncData()
Reference< container::XContainer > xModuleContainer;
SfxObjectShell* pShell = mpDoc->GetDocumentShell();
- if (pShell && !pShell->GetBasicManager()->GetName().isEmpty())
+ if (!pShell)
+ return;
+ if (!pShell->GetBasicManager()->GetName().isEmpty())
{
sProjectName = pShell->GetBasicManager()->GetName();
}
@@ -151,7 +153,7 @@ void ScMacroManager::InitUserFuncData()
xModuleContainer->addContainerListener( mxContainerListener );
}
}
- catch( uno::Exception& )
+ catch (const uno::Exception&)
{
}
}
commit 246aba2af9a7e8f958124d7f16d68da2ff7791a6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:48:35 2014 +0100
coverity#735802 Unchecked dynamic_cast
Change-Id: I798d5a5f1e28e88b23f478d241a8fcd7519f905f
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c547a9e..a05c3a5 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1096,15 +1096,14 @@ IMPL_LINK_NOARG(ScInputBarGroup, ClickHdl)
void ScInputBarGroup::TriggerToolboxLayout()
{
Window *w=GetParent();
- ScInputWindow *pParent;
- pParent=dynamic_cast<ScInputWindow*>(w);
+ ScInputWindow &rParent = dynamic_cast<ScInputWindow&>(*w);
SfxViewFrame* pViewFrm = SfxViewFrame::Current();
// Capture the vertical position of this window in the toolbar, when we increase
// the size of the toolbar to accomadate expanded line input we need to take this
// into account
if ( !nVertOffset )
- nVertOffset = pParent->GetItemPosRect( pParent->GetItemCount() - 1 ).Top();
+ nVertOffset = rParent.GetItemPosRect( rParent.GetItemCount() - 1 ).Top();
if ( pViewFrm )
{
@@ -1120,9 +1119,9 @@ void ScInputBarGroup::TriggerToolboxLayout()
if ( xLayoutManager.is() )
{
if ( aMultiTextWnd.GetNumLines() > 1)
- pParent->SetToolbarLayoutMode( TBX_LAYOUT_LOCKVERT );
+ rParent.SetToolbarLayoutMode( TBX_LAYOUT_LOCKVERT );
else
- pParent->SetToolbarLayoutMode( TBX_LAYOUT_NORMAL );
+ rParent.SetToolbarLayoutMode( TBX_LAYOUT_NORMAL );
xLayoutManager->lock();
DataChangedEvent aFakeUpdate( DATACHANGED_SETTINGS, NULL, SETTINGS_STYLE );
// this basically will trigger the reposititioning of the
@@ -1131,11 +1130,11 @@ void ScInputBarGroup::TriggerToolboxLayout()
// controlled by mbCalc. Additionally the ImplFormat above is
// controlled via mbFormat. It seems the easiest way to get these
// booleans set is to send in the fake event below.
- pParent->DataChanged( aFakeUpdate);
+ rParent.DataChanged( aFakeUpdate);
// highest item in toolbar will have been calculated via the
// event above. Call resize on InputBar to pick up the height
// change
- pParent->Resize();
+ rParent.Resize();
// unlock relayouts the toolbars in the 4 quadrants
xLayoutManager->unlock();
}
commit 11e1744772b6645056bf15611e7123cbfcf357c7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:44:54 2014 +0100
coverity#705041 Dereference after null check
Change-Id: I94b1f0e6d1f8bdf7929b68682727e8b1fdde67d2
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index eefa791..9da3e4c 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -832,9 +832,12 @@ void SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry
case CTX_EDIT_LINK:
{
OSL_ENSURE(pCont, "edit without entry ? " );
- SfxStringItem aName(FN_EDIT_REGION,
- pCont->GetSection()->GetSectionName());
- rDispatch.Execute(FN_EDIT_REGION, SFX_CALLMODE_ASYNCHRON, &aName, 0L);
+ if (pCont)
+ {
+ SfxStringItem aName(FN_EDIT_REGION,
+ pCont->GetSection()->GetSectionName());
+ rDispatch.Execute(FN_EDIT_REGION, SFX_CALLMODE_ASYNCHRON, &aName, 0L);
+ }
}
break;
case CTX_DELETE:
commit f37f08c9b59a4da5ce2145909a45922937b8ada8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:41:36 2014 +0100
coverity#705013 Unchecked dynamic_cast
Change-Id: I6dc2de6ab35e07f924204e2740003936cf6d4a0b
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index f34c1fa..1ada150 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3688,7 +3688,8 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
// the mark is still a DdeBookmark
// we replace it with a Bookmark, so it will get saved etc.
::sw::mark::IMark* const pMark = ppMark->get();
- SwServerObject* const pServerObject = dynamic_cast<SwServerObject *>(&refObj);
+ ::sfx2::SvLinkSource* p = &refObj;
+ SwServerObject& rServerObject = dynamic_cast<SwServerObject&>(*p);
// collecting state of old mark
SwPaM aPaM(pMark->GetMarkStart());
@@ -3701,7 +3702,7 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
OUString sMarkName = pMark->GetName();
// remove mark
- pServerObject->SetNoServer(); // this removes the connection between SwServerObject and mark
+ rServerObject.SetNoServer(); // this removes the connection between SwServerObject and mark
// N.B. ppMark was not loaded from file and cannot have xml:id
pMarkAccess->deleteMark(ppMark);
@@ -3710,7 +3711,7 @@ bool SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
aPaM,
sMarkName,
IDocumentMarkAccess::BOOKMARK);
- pServerObject->SetDdeBookmark(*pNewMark);
+ rServerObject.SetDdeBookmark(*pNewMark);
}
bDelBookmrk = false;
commit ca1b74f647ebcd5eb8e7e6447d5b21b890d5460f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:29:13 2014 +0100
coverity#704789 Dereference after null check
Change-Id: Iac238d68502cab137ce1530bffca4909cd9ea956
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index e952a74..392ba87 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -1785,7 +1785,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
{
case SFX_SETDOCKINGRECTS :
{
- if ( nPos == USHRT_MAX )
+ if (nPos == USHRT_MAX || !pDockWin)
return;
Rectangle aOuterRect( GetTopRect_Impl() );
commit 9af87824936f2334cc6420768e81a624f36a1dc8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 6 10:26:52 2014 +0100
coverity#704779 Unchecked dynamic_cast
Change-Id: Ida8bdc0930142ecf602b5aef4414cc6302bfa18b
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 3121d64..d780e1d 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -578,7 +578,8 @@ void FrameView::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < :
const sal_Int32 nLength = rSequence.getLength();
if (nLength)
{
- const bool bImpress = dynamic_cast< SdDrawDocument* >(GetModel())->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
+ SdDrawDocument* pDrawDocument = dynamic_cast<SdDrawDocument*>(GetModel());
+ const bool bImpress = pDrawDocument && pDrawDocument->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
bool bBool = false;
sal_Int32 nInt32 = 0;
More information about the Libreoffice-commits
mailing list