summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-04-18 09:40:04 +0000
committerjan iversen <jani@documentfoundation.org>2016-04-19 06:17:32 +0000
commitcf56b5d44fdc989f5ed2f5121bb43f452317fae4 (patch)
treedbb6482f60425bdcc90a9c42b179ea517262ce82
parent1be6c440c645e441af0e04ba7711e4b2d80aad63 (diff)
cppcheck: silence known condition warning svx xmlexport
Change-Id: If2dcb406d7bd1be8f5552ba75b6cabdbb6c97cb5 Reviewed-on: https://gerrit.libreoffice.org/24208 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
-rw-r--r--svx/source/xml/xmlexport.cxx59
1 files changed, 27 insertions, 32 deletions
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index c83c7b613978..fda59d3a7169 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -150,7 +150,7 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream, const Reference< lang::XComponent >& xComponent, const char* pImportService )
{
- sal_uInt32 nRet = 0;
+ bool bRet = true;
Reference< document::XGraphicObjectResolver > xGraphicResolver;
SvXMLGraphicHelper *pGraphicHelper = nullptr;
@@ -188,43 +188,38 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
xObjectResolver = pObjectHelper;
}
+ // parse
+ // prepare ParserInputSrouce
+ xml::sax::InputSource aParserInput;
+ aParserInput.aInputStream = xInputStream;
- if( 0 == nRet )
- {
-
- // parse
- // prepare ParserInputSrouce
- xml::sax::InputSource aParserInput;
- aParserInput.aInputStream = xInputStream;
-
- // get parser
- Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
+ // get parser
+ Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
- // prepare filter arguments
- Sequence<Any> aFilterArgs( 2 );
- Any *pArgs = aFilterArgs.getArray();
- *pArgs++ <<= xGraphicResolver;
- *pArgs++ <<= xObjectResolver;
+ // prepare filter arguments
+ Sequence<Any> aFilterArgs( 2 );
+ Any *pArgs = aFilterArgs.getArray();
+ *pArgs++ <<= xGraphicResolver;
+ *pArgs++ <<= xObjectResolver;
- // get filter
- Reference< xml::sax::XDocumentHandler > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext), UNO_QUERY );
- DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
+ // get filter
+ Reference< xml::sax::XDocumentHandler > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext), UNO_QUERY );
+ DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." );
- nRet = 1;
- if( xParser.is() && xFilter.is() )
- {
- // connect parser and filter
- xParser->setDocumentHandler( xFilter );
+ bRet = false;
+ if( xParser.is() && xFilter.is() )
+ {
+ // connect parser and filter
+ xParser->setDocumentHandler( xFilter );
- // connect model and filter
- uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
- xImporter->setTargetDocument( xTargetDocument );
+ // connect model and filter
+ uno::Reference < document::XImporter > xImporter( xFilter, UNO_QUERY );
+ xImporter->setTargetDocument( xTargetDocument );
- // finally, parser the stream
- xParser->parseStream( aParserInput );
+ // finally, parser the stream
+ xParser->parseStream( aParserInput );
- nRet = 0;
- }
+ bRet = true;
}
}
catch( uno::Exception& )
@@ -243,7 +238,7 @@ bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStr
if ( xTargetModel.is() )
xTargetModel->unlockControllers();
- return nRet == 0;
+ return bRet;
}
bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInputStream>& xInputStream )