diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-09 08:52:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-21 08:42:30 +0200 |
commit | 528632660b72b105345945c13c5b68060d94a91b (patch) | |
tree | 860508d482959abeb9175f0ce6b9e65954269f95 /basic/source/runtime/iosys.cxx | |
parent | aee66aa85e75f67135e5c6079a281e18402d261a (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 'basic/source/runtime/iosys.cxx')
-rw-r--r-- | basic/source/runtime/iosys.cxx | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 472c4321e0ec..fca1a1c17cc7 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -141,33 +141,23 @@ void SbiStream::MapError() { if( pStrm ) { - switch( pStrm->GetError() ) - { - case ERRCODE_NONE: - nError = 0; - break; - case SVSTREAM_FILE_NOT_FOUND: + ErrCode nEC = pStrm->GetError(); + if (nEC == ERRCODE_NONE) + nError = ERRCODE_NONE; + else if (nEC == SVSTREAM_FILE_NOT_FOUND) nError = ERRCODE_BASIC_FILE_NOT_FOUND; - break; - case SVSTREAM_PATH_NOT_FOUND: + else if (nEC ==SVSTREAM_PATH_NOT_FOUND) nError = ERRCODE_BASIC_PATH_NOT_FOUND; - break; - case SVSTREAM_TOO_MANY_OPEN_FILES: + else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES) nError = ERRCODE_BASIC_TOO_MANY_FILES; - break; - case SVSTREAM_ACCESS_DENIED: + else if (nEC ==SVSTREAM_ACCESS_DENIED) nError = ERRCODE_BASIC_ACCESS_DENIED; - break; - case SVSTREAM_INVALID_PARAMETER: + else if (nEC ==SVSTREAM_INVALID_PARAMETER) nError = ERRCODE_BASIC_BAD_ARGUMENT; - break; - case SVSTREAM_OUTOFMEMORY: + else if (nEC ==SVSTREAM_OUTOFMEMORY) nError = ERRCODE_BASIC_NO_MEMORY; - break; - default: + else nError = ERRCODE_BASIC_IO_ERROR; - break; - } } } @@ -656,7 +646,7 @@ SbiIoSystem::SbiIoSystem() i = nullptr; } nChan = 0; - nError = 0; + nError = ERRCODE_NONE; } SbiIoSystem::~SbiIoSystem() @@ -666,13 +656,14 @@ SbiIoSystem::~SbiIoSystem() ErrCode SbiIoSystem::GetError() { - ErrCode n = nError; nError = 0; + ErrCode n = nError; + nError = ERRCODE_NONE; return n; } void SbiIoSystem::Open(short nCh, const OString& rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen) { - nError = 0; + nError = ERRCODE_NONE; if( nCh >= CHANNELS || !nCh ) { nError = ERRCODE_BASIC_BAD_CHANNEL; |