From 556373c41fddbac6cbee1c89e7707631270a1852 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 11 Mar 2015 09:06:08 +0000 Subject: V668 no sense in testing the result of new against null Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39 --- xmloff/source/draw/animationexport.cxx | 8 ++----- xmloff/source/draw/sdxmlexp.cxx | 40 ++++++++++++++++------------------ xmloff/source/draw/shapeimport.cxx | 7 ++---- xmloff/source/draw/ximp3dscene.cxx | 7 ++---- xmloff/source/draw/ximpstyl.cxx | 30 ++++++++----------------- 5 files changed, 34 insertions(+), 58 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index b1e3ae7573fc..4129b72369fa 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -549,12 +549,8 @@ AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Refe } mpSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ); - if( mpSdPropHdlFactory ) - { - // set lock to avoid deletion - mpSdPropHdlFactory->acquire(); - } - + // set lock to avoid deletion + mpSdPropHdlFactory->acquire(); } AnimationsExporterImpl::~AnimationsExporterImpl() diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 723542bc48ec..9320d384c09b 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -431,33 +431,31 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent // prepare factory parts mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this ); - if(mpSdPropHdlFactory) - { - // set lock to avoid deletion - mpSdPropHdlFactory->acquire(); - // build one ref - const rtl::Reference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; + // set lock to avoid deletion + mpSdPropHdlFactory->acquire(); - // construct PropertySetMapper - rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef, true); + // build one ref + const rtl::Reference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory; - // get or create text paragraph export - GetTextParagraphExport(); - mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this ); - // set lock to avoid deletion - mpPropertySetMapper->acquire(); + // construct PropertySetMapper + rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef, true); - // chain text attributes - mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); + // get or create text paragraph export + GetTextParagraphExport(); + mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this ); + // set lock to avoid deletion + mpPropertySetMapper->acquire(); - // construct PresPagePropsMapper - xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef, true); + // chain text attributes + mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); - mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this ); - // set lock to avoid deletion - mpPresPagePropsMapper->acquire(); - } + // construct PresPagePropsMapper + xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef, true); + + mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this ); + // set lock to avoid deletion + mpPresPagePropsMapper->acquire(); // add family name GetAutoStylePool()->AddFamily( diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 2a670787c57b..4522e18e0643 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -167,11 +167,8 @@ XMLShapeImportHelper::XMLShapeImportHelper( // construct PresPagePropsMapper xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory, false); mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); - if(mpPresPagePropsMapper) - { - // set lock to avoid deletion - mpPresPagePropsMapper->acquire(); - } + // set lock to avoid deletion + mpPresPagePropsMapper->acquire(); uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY ); const OUString aSName( "com.sun.star.presentation.PresentationDocument" ); diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index dc05038ac5ed..ad3ac71e40fc 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -231,11 +231,8 @@ SvXMLImportContext * SdXML3DSceneAttributesHelper::create3DLightContext( sal_uIn SvXMLImportContext* pContext = new SdXML3DLightContext(mrImport, nPrfx, rLName, xAttrList); // remember SdXML3DLightContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - maList.push_back( static_cast(pContext) ); - } + pContext->AddFirstRef(); + maList.push_back( static_cast(pContext) ); return pContext; } diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 10b60335737e..594ac324743d 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -436,12 +436,9 @@ SvXMLImportContext *SdXMLPageMasterContext::CreateChildContext( pContext = new SdXMLPageMasterStyleContext(GetSdImport(), nPrefix, rLocalName, xAttrList); // remember SdXMLPresentationPlaceholderContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)"); - mpPageMasterStyle = static_cast(pContext); - } + pContext->AddFirstRef(); + DBG_ASSERT(!mpPageMasterStyle, "PageMasterStyle is set, there seem to be two of them (!)"); + mpPageMasterStyle = static_cast(pContext); } // call base class @@ -496,11 +493,8 @@ SvXMLImportContext *SdXMLPresentationPageLayoutContext::CreateChildContext( GetSdImport(), nPrefix, rLocalName, xAttrList); // remember SdXMLPresentationPlaceholderContext for later evaluation - if(pContext) - { - pContext->AddFirstRef(); - maList.push_back( static_cast(pContext) ); - } + pContext->AddFirstRef(); + maList.push_back( static_cast(pContext) ); } // call base class @@ -915,11 +909,8 @@ SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext( XML_STYLE_FAMILY_SD_PRESENTATION_ID); // add this style to the outer StylesContext class for later processing - if(pNew) - { - pContext = pNew; - GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew); - } + pContext = pNew; + GetSdImport().GetShapeImport()->GetStylesContext()->AddStyle(*pNew); } break; } @@ -1533,11 +1524,8 @@ SvXMLImportContext* SdXMLMasterStylesContext::CreateChildContext( pContext = new SdXMLMasterPageContext(GetSdImport(), nPrefix, rLocalName, xAttrList, xNewShapes); - if(pContext) - { - pContext->AddFirstRef(); - maMasterPageList.push_back( static_cast(pContext) ); - } + pContext->AddFirstRef(); + maMasterPageList.push_back( static_cast(pContext) ); } } } -- cgit