summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-09 08:52:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-21 08:42:30 +0200
commit528632660b72b105345945c13c5b68060d94a91b (patch)
tree860508d482959abeb9175f0ce6b9e65954269f95 /dbaccess
parentaee66aa85e75f67135e5c6079a281e18402d261a (diff)
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 <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx34
1 files changed, 15 insertions, 19 deletions
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>& xInputStream,
const uno::Reference<XComponent>& xModelComponent,
const uno::Reference<XComponentContext> & 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<XComponent>& 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<XComponent> 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;
}
}
}