summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-12 13:33:34 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-12 13:54:17 +0100
commit1bd5e8bc058c2e67aa2f5f99e326819f3d33b067 (patch)
treefb437c3a164ad52beae6b77290d331109e173d4f /oox
parentc0cb909ba7f01e3d644e8555289be3ab0785d15d (diff)
coverity#735762 Unchecked dynamic_cast
Change-Id: If5ce403d9a216847532d5a2898e95c9bbde71570
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/pptshape.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index a2dd7288219c..c5a2d06dbc05 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -378,6 +378,15 @@ void PPTShape::applyShapeReference( const oox::drawingml::Shape& rReferencedShap
Shape::applyShapeReference( rReferencedShape, bUseText );
}
+namespace
+{
+ bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape)
+ {
+ PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape);
+ return pShape && pShape->getShapeLocation() == Master;
+ }
+}
+
oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
{
oox::drawingml::ShapePtr aShapePtr;
@@ -385,8 +394,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
while( aRevIter != rShapes.rend() )
{
if ( (*aRevIter)->getSubType() == nMasterPlaceholder &&
- ( !bMasterOnly ||
- ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) )
+ ( !bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()) ) )
{
aShapePtr = *aRevIter;
break;
@@ -400,15 +408,6 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
return aShapePtr;
}
-namespace
-{
- bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape)
- {
- PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape);
- return pShape && pShape->getShapeLocation() == Master;
- }
-}
-
oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
{
oox::drawingml::ShapePtr aShapePtr;