[Libreoffice-commits] core.git: 24 commits - basic/source chart2/source codemaker/source connectivity/source cui/source filter/source framework/source idlc/source oox/source reportdesign/source sc/source sd/source svx/source sw/source
Caolán McNamara
caolanm at redhat.com
Fri Oct 24 01:25:32 PDT 2014
basic/source/comp/exprnode.cxx | 5
chart2/source/controller/main/DrawCommandDispatch.cxx | 2
codemaker/source/cppumaker/cppumaker.cxx | 9
codemaker/source/javamaker/javamaker.cxx | 9
connectivity/source/drivers/jdbc/PreparedStatement.cxx | 2
cui/source/dialogs/pastedlg.cxx | 8
filter/source/graphicfilter/icgm/cgm.cxx | 5
filter/source/msfilter/escherex.cxx | 6
filter/source/placeware/tempfile.cxx | 23 -
framework/source/uielement/generictoolbarcontroller.cxx | 6
idlc/source/idlcmain.cxx | 211 ++++++++--------
oox/source/drawingml/diagram/diagram.cxx | 15 -
reportdesign/source/core/sdr/ReportDrawPage.cxx | 24 -
reportdesign/source/core/sdr/RptPage.cxx | 4
reportdesign/source/ui/report/SectionView.cxx | 4
sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx | 2
sd/source/ui/animations/CustomAnimationPane.cxx | 12
svx/source/table/tablecontroller.cxx | 24 -
sw/source/core/undo/undobj1.cxx | 1
sw/source/filter/html/htmlform.cxx | 4
sw/source/filter/ww8/ww8par.cxx | 13
21 files changed, 199 insertions(+), 190 deletions(-)
New commits:
commit d9dde5e57262e2fb91636ca5d1ee91cdb647ba05
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Oct 24 09:22:57 2014 +0100
improve Sttb dumping for truncated case
Change-Id: Ie4c1d01540274e3782487d376168f561766b7a39
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 0f049a4..90fcc8c 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -458,9 +458,10 @@ public:
OUString getStringAtIndex( sal_uInt32 );
};
-Sttb::Sttb() : fExtend( 0 )
-,cData( 0 )
-,cbExtra( 0 )
+Sttb::Sttb()
+ : fExtend(0)
+ , cData(0)
+ , cbExtra(0)
{
}
@@ -499,8 +500,12 @@ void Sttb::Print( FILE* fp )
if ( cData )
{
- for ( sal_Int32 index = 0; index < cData; ++index )
+ for (sal_Int32 index = 0; index < cData; ++index)
+ {
+ if (index >= dataItems.size())
+ fprintf(fp, " Sttb truncated at entry %d(0x%x)\n", static_cast< int >( index ), static_cast< unsigned int >( index ));
fprintf(fp," string dataItem[ %d(0x%x) ] has name %s\n", static_cast< int >( index ), static_cast< unsigned int >( index ), OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
}
}
#endif
commit a52028d55427aa1a2bc51aff307a2436f68576ad
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:32:06 2014 +0100
coverity#1000601 Dereference after null check
Change-Id: I62a2c4661c9cca62e600ea2b679f2491c746210b
diff --git a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
index d75c081..4330c97 100644
--- a/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx
@@ -311,7 +311,7 @@ void ScChangeTrackingExportHelper::WriteEditCell(const ScCellValue& rCell)
rExport.AddAttribute(XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING);
SvXMLElementExport aElemC(rExport, XML_NAMESPACE_TABLE, XML_CHANGE_TRACK_TABLE_CELL, true, true);
- if (!sString.isEmpty())
+ if (rCell.mpEditText && !sString.isEmpty())
{
if (!pEditTextObj)
{
commit 927603576a8021fc1ce984ff6230fdda95b10517
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:29:10 2014 +0100
coverity#1130394 Missing break in switch
Change-Id: I44d08e9ff9591afba1d0ceb3980292d62729d392
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index b4353db..cbd2e2f 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -2228,6 +2228,7 @@ void SwHTMLParser::NewSelect()
case HTML_O_SDONFOCUS:
eScriptType2 = STARBASIC;
+ //fall-through
case HTML_O_ONFOCUS:
nEvent = HTML_ET_ONGETFOCUS;
bSetEvent = true;
@@ -2235,6 +2236,7 @@ void SwHTMLParser::NewSelect()
case HTML_O_SDONBLUR:
eScriptType2 = STARBASIC;
+ //fall-through
case HTML_O_ONBLUR:
nEvent = HTML_ET_ONLOSEFOCUS;
bSetEvent = true;
@@ -2242,6 +2244,7 @@ void SwHTMLParser::NewSelect()
case HTML_O_SDONCLICK:
eScriptType2 = STARBASIC;
+ //fall-through
case HTML_O_ONCLICK:
nEvent = HTML_ET_ONCLICK;
bSetEvent = true;
@@ -2249,6 +2252,7 @@ void SwHTMLParser::NewSelect()
case HTML_O_SDONCHANGE:
eScriptType2 = STARBASIC;
+ //fall-through
case HTML_O_ONCHANGE:
nEvent = HTML_ET_ONCHANGE;
bSetEvent = true;
commit c2f4c300ec70fab27a31c1709837c90680eefede
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:25:43 2014 +0100
coverity#736109 Nesting level does not match indentation
Change-Id: I0f1beadc90eae9750b53062df2512f7c886fd267
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 6e9b330..2992658 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -647,7 +647,7 @@ void java_sql_PreparedStatement::createStatement(JNIEnv* _pEnv)
static const char * cSignature2 = "(Ljava/lang/String;)Ljava/sql/PreparedStatement;";
static jmethodID mID2 = NULL;
if ( !mID2)
- mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );OSL_ENSURE(mID,"Unknown method id!");
+ mID2 = _pEnv->GetMethodID( m_pConnection->getMyClass(), cMethodName, cSignature2 );
if ( mID2 )
out = _pEnv->CallObjectMethod( m_pConnection->getJavaObject(), mID2, args[0].l );
}
commit 74f2beb0d438a62f20d90979110b46d143b35f29
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:22:24 2014 +0100
coverity#736028 Invalid iterator comparison
Change-Id: I3ecb621d124c873556387e3bc5cfd5b9aadd8fc1
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 4a8f784..8741353 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -295,8 +295,9 @@ void Diagram::build( )
}
// assign outline levels
- DiagramData::StringMap::iterator aPresOfIter=getData()->getPresOfNameMap().begin();
- const DiagramData::StringMap::iterator aPresOfEnd=getData()->getPresOfNameMap().end();
+ DiagramData::StringMap& rStringMap = getData()->getPresOfNameMap();
+ DiagramData::StringMap::iterator aPresOfIter=rStringMap.begin();
+ const DiagramData::StringMap::iterator aPresOfEnd=rStringMap.end();
while( aPresOfIter != aPresOfEnd )
{
DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeIterCalcLevel=aPresOfIter->second.begin();
commit ef3e58c4989cc67e3f59955656676cde84831f69
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:20:37 2014 +0100
coverity#736027 Invalid iterator comparison
Change-Id: I099c0562bc52f0625ceac202b34b01025a7fd35d
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 6a69032..4a8f784 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -223,8 +223,9 @@ void Diagram::build( )
++aCurrPoint;
}
- dgm::Connections::const_iterator aCurrCxn( getData()->getConnections( ).begin() );
- const dgm::Connections::const_iterator aEndCxn( getData()->getConnections( ).end() );
+ const dgm::Connections& rConnections = getData()->getConnections();
+ dgm::Connections::const_iterator aCurrCxn(rConnections.begin());
+ const dgm::Connections::const_iterator aEndCxn(rConnections.end());
while( aCurrCxn != aEndCxn )
{
#if OSL_DEBUG_LEVEL > 1
commit fbb78543d3ad357ecda093f70401a27e60483a5c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:11:12 2014 +0100
coverity#736026 Invalid iterator comparison
Change-Id: I04bc103120256614fa76310d3ba0a51c560d9393
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 1c53d74..6a69032 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -150,8 +150,9 @@ void Diagram::build( )
output << "digraph datatree {" << std::endl;
#endif
- dgm::Points::iterator aCurrPoint( getData()->getPoints( ).begin() );
- dgm::Points::iterator aEndPoint( getData()->getPoints( ).end() );
+ dgm::Points& rPoints = getData()->getPoints();
+ dgm::Points::iterator aCurrPoint(rPoints.begin());
+ dgm::Points::iterator aEndPoint(rPoints.end());
while( aCurrPoint != aEndPoint )
{
#if OSL_DEBUG_LEVEL > 1
commit 239a586fb7d971bb4a2330bf2d4dd997b8bd60ca
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 17:06:42 2014 +0100
coverity#735385 try and silence Copy-paste error
Change-Id: Ifc3c705db7f3d88f26753bd189db34ca8ef8160d
diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx
index 51fda0c..ae85a92 100644
--- a/sd/source/ui/animations/CustomAnimationPane.cxx
+++ b/sd/source/ui/animations/CustomAnimationPane.cxx
@@ -2070,10 +2070,10 @@ void CustomAnimationPane::moveSelection( bool bUp )
{
CustomAnimationEffectPtr pEffect = (*aIter++);
- EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
- if( aEffectPos != rEffectSequence.end() )
+ EffectSequence::iterator aUpEffectPos( pSequence->find( pEffect ) );
+ if( aUpEffectPos != rEffectSequence.end() )
{
- EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
+ EffectSequence::iterator aInsertPos( rEffectSequence.erase( aUpEffectPos ) );
if( aInsertPos != rEffectSequence.begin() )
{
@@ -2100,10 +2100,10 @@ void CustomAnimationPane::moveSelection( bool bUp )
{
CustomAnimationEffectPtr pEffect = (*aIter++);
- EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
- if( aEffectPos != rEffectSequence.end() )
+ EffectSequence::iterator aDownEffectPos( pSequence->find( pEffect ) );
+ if( aDownEffectPos != rEffectSequence.end() )
{
- EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
+ EffectSequence::iterator aInsertPos( rEffectSequence.erase( aDownEffectPos ) );
if( aInsertPos != rEffectSequence.end() )
{
commit 2f989f1742c62e0cbb7275216b415ef4cad030c2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:54:56 2014 +0100
coverity#705269 Missing break in switch
Change-Id: I49eb09156b3e8d3f68c13c3acd8696cdf841c109
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 5c2d4fe..572cd16 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -646,6 +646,7 @@ void SwUndoSetFlyFmt::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem )
case FLY_AS_CHAR:
case FLY_AT_CHAR:
nOldCntnt = pAnchor->GetCntntAnchor()->nContent.GetIndex();
+ //fall-through
case FLY_AT_PARA:
case FLY_AT_FLY:
nOldNode = pAnchor->GetCntntAnchor()->nNode.GetIndex();
commit 096452279717d2d13b6140fa80b1442a59e5e874
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:53:08 2014 +0100
coverity#704836 Dereference after null check
Change-Id: Ia2ac113df3fe378308279ecdc4d14ccba9abfae7
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 3cd25b4..13699d4 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -148,26 +148,26 @@ SvxTableController::SvxTableController( SdrObjEditView* pView, const SdrObject*
, mnUpdateEvent( 0 )
{
if( pObj )
- mpModel = pObj->GetModel();
-
- if( mxTableObj.is() )
{
- static_cast< const SdrTableObj* >( pObj )->getActiveCellPos( maCursorFirstPos );
- maCursorLastPos = maCursorFirstPos;
+ mpModel = pObj->GetModel();
- Reference< XTable > xTable( static_cast< const SdrTableObj* >( pObj )->getTable() );
- if( xTable.is() )
+ if( mxTableObj.is() )
{
- mxModifyListener = new SvxTableControllerModifyListener( this );
- xTable->addModifyListener( mxModifyListener );
+ static_cast< const SdrTableObj* >( pObj )->getActiveCellPos( maCursorFirstPos );
+ maCursorLastPos = maCursorFirstPos;
- mxTable.set( dynamic_cast< TableModel* >( xTable.get() ) );
+ Reference< XTable > xTable( static_cast< const SdrTableObj* >( pObj )->getTable() );
+ if( xTable.is() )
+ {
+ mxModifyListener = new SvxTableControllerModifyListener( this );
+ xTable->addModifyListener( mxModifyListener );
+
+ mxTable.set( dynamic_cast< TableModel* >( xTable.get() ) );
+ }
}
}
}
-
-
SvxTableController::~SvxTableController()
{
if( mnUpdateEvent )
commit febbda147aab20d7f25d1e1155b2d49bab0cee9a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:50:17 2014 +0100
coverity#704660 Unchecked dynamic_cast
Change-Id: I9361477855b6d3fa18f0b1e433a5d21683327814
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index c36108b..bbbbf20 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -180,10 +180,10 @@ void OSectionView::SetMarkedToLayer( SdrLayerID _nLayerNo )
{
AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), _nLayerNo) );
pObj->SetLayer( _nLayerNo );
- OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj);
+ OObjectBase& rBaseObj = dynamic_cast<OObjectBase&>(*pObj);
try
{
- pBaseObj->getReportComponent()->setPropertyValue(PROPERTY_OPAQUE,uno::makeAny(_nLayerNo == RPT_LAYER_FRONT));
+ rBaseObj.getReportComponent()->setPropertyValue(PROPERTY_OPAQUE,uno::makeAny(_nLayerNo == RPT_LAYER_FRONT));
}
catch(const uno::Exception&)
{
commit 892e7ba8135be0e195f35b95674d813d828a40de
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:46:29 2014 +0100
coverity#704656 Unchecked dynamic_cast
Change-Id: Ib70eace7de922983528bdd57ba7cc029647a7090
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
index 4fa61a1..5009a66 100644
--- a/reportdesign/source/core/sdr/RptPage.cxx
+++ b/reportdesign/source/core/sdr/RptPage.cxx
@@ -108,8 +108,8 @@ SdrObject* OReportPage::RemoveObject(size_t nObjNum)
pSection->notifyElementRemoved(xShape);
if (pObj->ISA(OUnoObject))
{
- OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObj);
- uno::Reference< container::XChild> xChild(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ OUnoObject& rUnoObj = dynamic_cast<OUnoObject&>(*pObj);
+ uno::Reference< container::XChild> xChild(rUnoObj.GetUnoControlModel(),uno::UNO_QUERY);
if ( xChild.is() )
xChild->setParent(NULL);
}
commit eca5974eb20499d478773d5e374f038f96ebb5c2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:45:13 2014 +0100
coverity#704655 Unchecked dynamic_cast
Change-Id: I04ef0f1067dedf613c29b49082620b097def9198
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
index 80f86ef..8ce2ead 100644
--- a/reportdesign/source/core/sdr/ReportDrawPage.cxx
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -76,15 +76,15 @@ uno::Reference< drawing::XShape > OReportDrawPage::_CreateShape( SdrObject *pOb
if ( pObj->ISA(OUnoObject) )
{
- OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObj);
- if ( pUnoObj->GetObjIdentifier() == OBJ_DLG_FIXEDTEXT )
+ OUnoObject& rUnoObj = dynamic_cast<OUnoObject&>(*pObj);
+ if (rUnoObj.GetObjIdentifier() == OBJ_DLG_FIXEDTEXT)
{
- uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xControlModel(rUnoObj.GetUnoControlModel(),uno::UNO_QUERY);
if ( xControlModel.is() )
xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::makeAny(sal_True));
}
else
- bChangeOrientation = pUnoObj->GetObjIdentifier() == OBJ_DLG_HFIXEDLINE;
+ bChangeOrientation = rUnoObj.GetObjIdentifier() == OBJ_DLG_HFIXEDLINE;
SvxShapeControl* pShape = new SvxShapeControl( pObj );
xShape.set(static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper *>(pShape)),uno::UNO_QUERY);
pShape->setShapeKind(pObj->GetObjIdentifier());
commit 57eee45f5099110d7888eaf5863d4e858f112ff2
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:44:11 2014 +0100
coverity#704654 Unchecked dynamic_cast
Change-Id: I1ed0dc64ebb0243bdd4a03636158538854ac8253
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
index 0c7867f..80f86ef 100644
--- a/reportdesign/source/core/sdr/ReportDrawPage.cxx
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -98,8 +98,8 @@ uno::Reference< drawing::XShape > OReportDrawPage::_CreateShape( SdrObject *pOb
}
else if ( pObj->ISA(SdrOle2Obj) )
{
- SdrOle2Obj* pOle2Obj = dynamic_cast<SdrOle2Obj*>(pObj);
- if ( !pOle2Obj->GetObjRef().is() )
+ SdrOle2Obj& rOle2Obj = dynamic_cast<SdrOle2Obj&>(*pObj);
+ if (!rOle2Obj.GetObjRef().is())
{
sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
uno::Reference < embed::XEmbeddedObject > xObj;
@@ -113,12 +113,12 @@ uno::Reference< drawing::XShape > OReportDrawPage::_CreateShape( SdrObject *pOb
* Das leere OLE-Objekt bekommt ein neues IPObj
**************************************************/
pObj->SetEmptyPresObj(false);
- pOle2Obj->SetOutlinerParaObject(NULL);
- pOle2Obj->SetObjRef(xObj);
- pOle2Obj->SetPersistName(sName);
- pOle2Obj->SetName(sName);
- pOle2Obj->SetAspect(nAspect);
- Rectangle aRect = pOle2Obj->GetLogicRect();
+ rOle2Obj.SetOutlinerParaObject(NULL);
+ rOle2Obj.SetObjRef(xObj);
+ rOle2Obj.SetPersistName(sName);
+ rOle2Obj.SetName(sName);
+ rOle2Obj.SetAspect(nAspect);
+ Rectangle aRect = rOle2Obj.GetLogicRect();
Size aTmp = aRect.GetSize();
awt::Size aSz( aTmp.Width(), aTmp.Height() );
commit 66fae3a2bcef277a7dbf12d730a663edf3330f1a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:42:50 2014 +0100
coverity#704649 Unchecked dynamic_cast
Change-Id: Ibeb096d98cba7a55d9d806802473660d30000924
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index 11cf7ee..bdd48d8 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -349,10 +349,10 @@ MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::Runtime
Reference< XURLTransformer > xURLTransformer = URLTransformer::create( m_xContext );
pMenu = new Toolbarmenu();
m_xMenuManager.set( new MenuBarManager( m_xContext, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, true, true ) );
- if ( m_xMenuManager.is() )
+ if (m_xMenuManager.is())
{
- MenuBarManager* pMgr = dynamic_cast< MenuBarManager* >( m_xMenuManager.get() );
- pMgr->SetItemContainer( m_xMenuDesc );
+ MenuBarManager& rMgr = dynamic_cast<MenuBarManager&>(*m_xMenuManager.get());
+ rMgr.SetItemContainer(m_xMenuDesc);
}
}
commit 2deb0a2651f55c401bd9b84c9373e4140bbdb09b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:41:34 2014 +0100
coverity#704564 Unchecked dynamic_cast
Change-Id: I2dfdc5e1e852011b532b484e566896133208ee86
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 4f3f01a..77fd393 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -497,7 +497,7 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
basegfx::B2DPolyPolygon aPoly;
aPoly.append( aInnerPoly );
- ( dynamic_cast< SdrPathObj* >( pObj ) )->SetPathPoly( aPoly );
+ dynamic_cast<SdrPathObj&>(*pObj).SetPathPoly(aPoly);
}
}
break;
commit bec28033628473bdfde0c5a9e1af522613968051
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:39:45 2014 +0100
coverity#704558 Dereference after null check
Change-Id: I6fe44d8926acd185bb6bc671fb7df8ae935998c1
diff --git a/basic/source/comp/exprnode.cxx b/basic/source/comp/exprnode.cxx
index e245fef..4340848 100644
--- a/basic/source/comp/exprnode.cxx
+++ b/basic/source/comp/exprnode.cxx
@@ -240,13 +240,12 @@ void SbiExprNode::CollectBits()
// If a twig can be converted, True will be returned. In this case
// the result is in the left twig.
-
void SbiExprNode::FoldConstants()
{
if( IsOperand() || eTok == LIKE ) return;
if( pLeft )
pLeft->FoldConstants();
- if( pRight )
+ if (pLeft && pRight)
{
pRight->FoldConstants();
if( pLeft->IsConstant() && pRight->IsConstant()
@@ -419,7 +418,7 @@ void SbiExprNode::FoldConstants()
}
}
}
- else if( pLeft && pLeft->IsNumber() )
+ else if (pLeft && pLeft->IsNumber())
{
nVal = pLeft->nVal;
delete pLeft;
commit dc4d6c59631c6a197a95e1b531babc6169c95907
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:34:06 2014 +0100
coverity#704231 Logically dead code
Change-Id: Ic54f25f40416401be3a95880fe1bdc4496be935c
diff --git a/filter/source/placeware/tempfile.cxx b/filter/source/placeware/tempfile.cxx
index 3f0aeba..3b92552 100644
--- a/filter/source/placeware/tempfile.cxx
+++ b/filter/source/placeware/tempfile.cxx
@@ -33,25 +33,24 @@ oslFileError SAL_CALL my_getTempDirURL( rtl_uString** pustrTempDir )
if ( !pValue )
{
pValue = getenv( "TMP" );
-#if defined(SOLARIS) || defined (LINUX)
if ( !pValue )
+ {
+#if defined(SOLARIS) || defined (LINUX)
pValue = P_tmpdir;
+#else
+ return osl_File_E_NOENT
#endif
+ }
}
- if ( pValue )
- {
- oslFileError error;
- rtl_uString *ustrTempPath = NULL;
+ oslFileError error;
+ rtl_uString *ustrTempPath = NULL;
- rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
- rtl_uString_release( ustrTempPath );
+ rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
+ error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+ rtl_uString_release( ustrTempPath );
- return error;
- }
- else
- return osl_File_E_NOENT;
+ return error;
}
#else
commit 5802eb3a61a413a0d3f7155d36940b1c7a18011e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:31:29 2014 +0100
coverity#704228 'Constant' variable guards dead code
Change-Id: Ia3ccd40ae4a83b58f7d5986273c5bd7d8310b467
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index ab8f74e..335fec6 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -194,15 +194,14 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize )
{
void* pPtr;
sal_uInt8 aBuf[8];
- bool bCompatible;
double nRetValue;
double fDoubleBuf;
float fFloatBuf;
#ifdef OSL_BIGENDIAN
- bCompatible = true;
+ const bool bCompatible = true;
#else
- bCompatible = false;
+ const bool bCompatible = false;
#endif
if (mpSource + mnParaSize + nRealSize > mpEndValidSource)
commit 07ff3d965f10a68bcae93ec216c269fbb7009a6b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:27:59 2014 +0100
coverity#703957 Unchecked return value
Change-Id: I3a5c0239f4615ff0ba832ac4c733c26e25c259e6
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index afcc626..e370e5b 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1249,14 +1249,12 @@ bool EscherPropertyContainer::CreateShapeProperties( const ::com::sun::star::uno
bool bVal = false;
::com::sun::star::uno::Any aAny;
sal_uInt32 nShapeAttr = 0;
- (void)EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString( "Visible" ), true );
- if ( aAny >>= bVal )
+ if (EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, OUString("Visible"), true) && (aAny >>= bVal))
{
if ( !bVal )
nShapeAttr |= 0x20002; // set fHidden = true
}
- (void)EscherPropertyValueHelper::GetPropertyValue( aAny, aXPropSet, OUString( "Printable" ), true );
- if ( aAny >>= bVal )
+ if (EscherPropertyValueHelper::GetPropertyValue(aAny, aXPropSet, OUString( "Printable"), true) && (aAny >>= bVal))
{
if ( !bVal )
nShapeAttr |= 0x10000; // set fPrint = false;
commit 1304a6ae7e60a46a88ded646bb2af8b8f8b926df
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:23:49 2014 +0100
coverity#703936 Unchecked return value
Change-Id: I238cdaeab269bcf3ef7a8969ee6077104c12c8a3
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index 17468a7..85e49f6 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -97,9 +97,11 @@ sal_uLong SvPasteObjectDialog::GetFormat( const TransferableDataHelper& rHelper,
{
//TODO/LATER: why is the Descriptor never used?!
TransferableObjectDescriptor aDesc;
- if( rHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
- ((TransferableDataHelper&)rHelper).GetTransferableObjectDescriptor(
- SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+ if (rHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR))
+ {
+ (void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc);
+ }
if ( !pFormats )
pFormats = &rHelper.GetDataFlavorExVector();
commit 7ed36e0d7beb71667e70dcf256a3a610e839073b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:21:54 2014 +0100
coverity#441992 Uncaught exception
Change-Id: Ibd07b854bbcf9d9e83236669addfd61fe639882a
diff --git a/idlc/source/idlcmain.cxx b/idlc/source/idlcmain.cxx
index 52e05f0..270bf7a 100644
--- a/idlc/source/idlcmain.cxx
+++ b/idlc/source/idlcmain.cxx
@@ -35,131 +35,132 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
}
Options options(argv[0]);
+ sal_Int32 nErrors = 0;
+
try
{
if (!options.initOptions(args))
return (0);
- }
- catch(const IllegalArgument& e)
- {
- fprintf(stderr, "Illegal argument: %s\n%s",
- e.m_message.getStr(),
- options.prepareVersion().getStr());
- return (99);
- }
-
- setIdlc(&options);
- sal_Int32 nErrors = 0;
- if (options.readStdin()) {
- if ( !options.quiet() )
- fprintf(
- stdout, "%s: Compiling stdin\n",
- options.getProgramName().getStr());
- nErrors = compileFile(0);
- if ( ( idlc()->getWarningCount() > 0 ) && !options.quiet() ) {
- fprintf(
- stdout, "%s: detected %lu warnings compiling stdin\n",
- options.getProgramName().getStr(),
- sal::static_int_cast< unsigned long >(
- idlc()->getWarningCount()));
- }
- OString outputUrl;
- if (options.isValid("-O")) {
- outputUrl = convertToFileUrl(options.getOption("-O"));
- if (!outputUrl.endsWith("/")) {
- outputUrl += "/";
+ setIdlc(&options);
+
+ if (options.readStdin()) {
+ if ( !options.quiet() )
+ fprintf(
+ stdout, "%s: Compiling stdin\n",
+ options.getProgramName().getStr());
+ nErrors = compileFile(0);
+ if ( ( idlc()->getWarningCount() > 0 ) && !options.quiet() ) {
+ fprintf(
+ stdout, "%s: detected %lu warnings compiling stdin\n",
+ options.getProgramName().getStr(),
+ sal::static_int_cast< unsigned long >(
+ idlc()->getWarningCount()));
+ }
+ OString outputUrl;
+ if (options.isValid("-O")) {
+ outputUrl = convertToFileUrl(options.getOption("-O"));
+ if (!outputUrl.endsWith("/")) {
+ outputUrl += "/";
+ }
+ outputUrl += "stdin.urd";
+ } else {
+ outputUrl = convertToFileUrl("stdin.urd");
}
- outputUrl += "stdin.urd";
- } else {
- outputUrl = convertToFileUrl("stdin.urd");
+ if (nErrors > 0) {
+ removeIfExists(outputUrl);
+ } else {
+ nErrors = produceFile(outputUrl, 0);
+ }
+ idlc()->reset();
}
- if (nErrors > 0) {
- removeIfExists(outputUrl);
- } else {
- nErrors = produceFile(outputUrl, 0);
+ StringVector const & files = options.getInputFiles();
+ if ( options.verbose() )
+ {
+ fprintf( stdout, "%s: compiling %i source files ... \n",
+ options.getProgramName().getStr(), (int)files.size() );
+ fflush( stdout );
}
- idlc()->reset();
- }
- StringVector const & files = options.getInputFiles();
- if ( options.verbose() )
- {
- fprintf( stdout, "%s: compiling %i source files ... \n",
- options.getProgramName().getStr(), (int)files.size() );
- fflush( stdout );
- }
- for (StringVector::const_iterator i(files.begin());
- i != files.end() && nErrors == 0; ++i)
- {
- OString sysFileName( convertToAbsoluteSystemPath(*i) );
-
- if ( !options.quiet() )
- fprintf(stdout, "Compiling: %s\n",
- (*i).getStr());
- nErrors = compileFile(&sysFileName);
+ for (StringVector::const_iterator i(files.begin());
+ i != files.end() && nErrors == 0; ++i)
+ {
+ OString sysFileName( convertToAbsoluteSystemPath(*i) );
- if ( idlc()->getWarningCount() && !options.quiet() )
- fprintf(stdout, "%s: detected %lu warnings compiling file '%s'\n",
- options.getProgramName().getStr(),
- sal::static_int_cast< unsigned long >(
- idlc()->getWarningCount()),
+ if ( !options.quiet() )
+ fprintf(stdout, "Compiling: %s\n",
(*i).getStr());
-
- // prepare output file name
- OString const strippedFileName(
- sysFileName.copy(sysFileName.lastIndexOf(SEPARATOR) + 1));
- OString outputFile;
- if ( options.isValid("-O") )
- {
- outputFile = (options.getOption("-O"));
- if (!outputFile.endsWith("/")) {
- outputFile += OString('/');
+ nErrors = compileFile(&sysFileName);
+
+ if ( idlc()->getWarningCount() && !options.quiet() )
+ fprintf(stdout, "%s: detected %lu warnings compiling file '%s'\n",
+ options.getProgramName().getStr(),
+ sal::static_int_cast< unsigned long >(
+ idlc()->getWarningCount()),
+ (*i).getStr());
+
+ // prepare output file name
+ OString const strippedFileName(
+ sysFileName.copy(sysFileName.lastIndexOf(SEPARATOR) + 1));
+ OString outputFile;
+ if ( options.isValid("-O") )
+ {
+ outputFile = (options.getOption("-O"));
+ if (!outputFile.endsWith("/")) {
+ outputFile += OString('/');
+ }
+ outputFile += strippedFileName.replaceAt(
+ strippedFileName.getLength() -3 , 3, "urd");
+ } else {
+ outputFile =
+ sysFileName.replaceAt(sysFileName.getLength() -3 , 3, "urd");
}
- outputFile += strippedFileName.replaceAt(
- strippedFileName.getLength() -3 , 3, "urd");
- } else {
- outputFile =
- sysFileName.replaceAt(sysFileName.getLength() -3 , 3, "urd");
- }
- OString const outputFileUrl = convertToFileUrl(outputFile);
+ OString const outputFileUrl = convertToFileUrl(outputFile);
- OString depFileUrl;
- if (options.isValid("-M")) {
- depFileUrl = convertToFileUrl(options.getOption("-M"));
- if (!depFileUrl.endsWith("/")) {
- depFileUrl += "/";
+ OString depFileUrl;
+ if (options.isValid("-M")) {
+ depFileUrl = convertToFileUrl(options.getOption("-M"));
+ if (!depFileUrl.endsWith("/")) {
+ depFileUrl += "/";
+ }
+ depFileUrl += strippedFileName.replaceAt(
+ strippedFileName.getLength() -3 , 3, "d");
}
- depFileUrl += strippedFileName.replaceAt(
- strippedFileName.getLength() -3 , 3, "d");
- }
- if ( nErrors ) {
- if (options.isValid("-M")) {
- removeIfExists(depFileUrl);
+ if ( nErrors ) {
+ if (options.isValid("-M")) {
+ removeIfExists(depFileUrl);
+ }
+ removeIfExists(outputFileUrl);
+ } else {
+ sPair_t const pair(depFileUrl, outputFile);
+ nErrors = produceFile(outputFileUrl,
+ (options.isValid("-M")) ? &pair : 0);
}
- removeIfExists(outputFileUrl);
- } else {
- sPair_t const pair(depFileUrl, outputFile);
- nErrors = produceFile(outputFileUrl,
- (options.isValid("-M")) ? &pair : 0);
- }
- idlc()->reset();
- }
+ idlc()->reset();
+ }
- if ( nErrors > 0 )
- {
- fprintf(stderr, "%s: detected %ld errors%s",
- options.getProgramName().getStr(),
- sal::static_int_cast< long >(nErrors),
- options.prepareVersion().getStr());
- } else
- {
- if ( options.verbose() )
- fprintf(stdout, "%s: returned successful%s",
+ if ( nErrors > 0 )
+ {
+ fprintf(stderr, "%s: detected %ld errors%s",
options.getProgramName().getStr(),
+ sal::static_int_cast< long >(nErrors),
options.prepareVersion().getStr());
+ } else
+ {
+ if ( options.verbose() )
+ fprintf(stdout, "%s: returned successful%s",
+ options.getProgramName().getStr(),
+ options.prepareVersion().getStr());
+ }
+ } catch(const IllegalArgument& e)
+ {
+ fprintf(stderr, "Illegal argument: %s\n%s",
+ e.m_message.getStr(),
+ options.prepareVersion().getStr());
+ return (99);
}
+
return nErrors;
}
commit b536f9ae625cf4e91066c1263f4814a356d0a41e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:17:44 2014 +0100
coverity#441989 Uncaught exception
Change-Id: I579bfc6f4a57aea49e2b023917d0dbd7c3db6c88
diff --git a/codemaker/source/cppumaker/cppumaker.cxx b/codemaker/source/cppumaker/cppumaker.cxx
index 2a698f4..ef21d17 100644
--- a/codemaker/source/cppumaker/cppumaker.cxx
+++ b/codemaker/source/cppumaker/cppumaker.cxx
@@ -42,11 +42,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
if (!options.initOptions(argc, argv)) {
return EXIT_FAILURE;
}
- } catch (IllegalArgument & e) {
- std::cerr << "Illegal option " << e.m_message << '\n';
- return EXIT_FAILURE;
- }
- try {
+
rtl::Reference< TypeManager > typeMgr(new TypeManager);
for (std::vector< OString >::const_iterator i(
options.getExtraInputFiles().begin());
@@ -102,6 +98,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
<< "ERROR: Bad format of <" << e.getUri() << ">, \""
<< e.getDetail() << "\"\n";
return EXIT_FAILURE;
+ } catch (IllegalArgument & e) {
+ std::cerr << "Illegal option " << e.m_message << '\n';
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
commit cd31cfbf170e269a7063e232b062a9ca35b4f5fa
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 23 16:16:44 2014 +0100
coverity#441732 Uncaught exception
Change-Id: Icd11b81566fec7ce4855cd4e54ff3a3d9862d354
diff --git a/codemaker/source/javamaker/javamaker.cxx b/codemaker/source/javamaker/javamaker.cxx
index d74aafa..2e97763 100644
--- a/codemaker/source/javamaker/javamaker.cxx
+++ b/codemaker/source/javamaker/javamaker.cxx
@@ -42,11 +42,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
if (!options.initOptions(argc, argv)) {
return EXIT_FAILURE;
}
- } catch (IllegalArgument & e) {
- std::cerr << "Illegal option " << e.m_message << '\n';
- return EXIT_FAILURE;
- }
- try {
+
rtl::Reference< TypeManager > typeMgr(new TypeManager);
for (std::vector< rtl::OString >::const_iterator i(
options.getExtraInputFiles().begin());
@@ -90,6 +86,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
<< "ERROR: Bad format of <" << e.getUri() << ">, \""
<< e.getDetail() << "\"\n";
return EXIT_FAILURE;
+ } catch (IllegalArgument & e) {
+ std::cerr << "Illegal option " << e.m_message << '\n';
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
More information about the Libreoffice-commits
mailing list