From 528632660b72b105345945c13c5b68060d94a91b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 9 Feb 2017 08:52:13 +0200 Subject: convert ErrCode to strong typedef would have preferred to re-use o3tl::strong_int, of which this is a modified copy, but there are lots of convenience accessors which are nice to define on the class. Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a Reviewed-on: https://gerrit.libreoffice.org/38497 Tested-by: Jenkins Reviewed-by: Noel Grandin --- dbaccess/source/filter/xml/xmlfilter.cxx | 34 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'dbaccess') diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 6dd868a4a0b1..b5477eeae235 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -74,7 +74,7 @@ namespace dbaxml { using namespace ::com::sun::star::util; /// read a component (file + filter version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference& xInputStream, const uno::Reference& xModelComponent, const uno::Reference & rxContext, @@ -95,7 +95,7 @@ sal_Int32 ReadThroughComponent( // get filter OSL_ENSURE( _xFilter.is(), "Can't instantiate filter component." ); if( !_xFilter.is() ) - return 1; + return ErrCode(1); // connect parser and filter xParser->setDocumentHandler( _xFilter ); @@ -116,11 +116,11 @@ sal_Int32 ReadThroughComponent( #else (void)r; #endif - return 1; + return ErrCode(1); } catch (const SAXException&) { - return 1; + return ErrCode(1); } catch (const packages::zip::ZipIOException&) { @@ -137,7 +137,7 @@ sal_Int32 ReadThroughComponent( /// read a component (storage version) -sal_Int32 ReadThroughComponent( +ErrCode ReadThroughComponent( const uno::Reference< embed::XStorage >& xStorage, const uno::Reference& xModelComponent, const sal_Char* pStreamName, @@ -185,7 +185,7 @@ sal_Int32 ReadThroughComponent( } catch (const uno::Exception&) { - return 1; // TODO/LATER: error handling + return ErrCode(1); // TODO/LATER: error handling } uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); @@ -197,7 +197,7 @@ sal_Int32 ReadThroughComponent( } // TODO/LATER: better error handling - return 1; + return ErrCode(1); } @@ -331,7 +331,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) SetNumberFormatsSupplier(xNum); uno::Reference xModel(GetModel(),UNO_QUERY); - sal_Int32 nRet = ReadThroughComponent( xStorage + ErrCode nRet = ReadThroughComponent( xStorage ,xModel ,"settings.xml" ,"Settings.xml" @@ -358,18 +358,14 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) } else { - switch( nRet ) + if ( nRet == ERRCODE_IO_BROKENPACKAGE ) + ;// TODO/LATER: no way to transport the error outside from the filter! + else { - case ERRCODE_IO_BROKENPACKAGE: - // TODO/LATER: no way to transport the error outside from the filter! - break; - default: - { - // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! - ErrorHandler::HandleError( nRet ); - if( nRet & ERRCODE_WARNING_MASK ) - bRet = true; - } + // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly! But for now this is the only way! + ErrorHandler::HandleError( nRet ); + if( nRet.IsWarning() ) + bRet = true; } } } -- cgit