[Libreoffice-commits] core.git: svx/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Apr 19 06:17:53 UTC 2016


 svx/source/xml/xmlexport.cxx |   59 +++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 32 deletions(-)

New commits:
commit cf56b5d44fdc989f5ed2f5121bb43f452317fae4
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Mon Apr 18 09:40:04 2016 +0000

    cppcheck: silence known condition warning svx xmlexport
    
    Change-Id: If2dcb406d7bd1be8f5552ba75b6cabdbb6c97cb5
    Reviewed-on: https://gerrit.libreoffice.org/24208
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index c83c7b6..fda59d3 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 )


More information about the Libreoffice-commits mailing list