summaryrefslogtreecommitdiff
path: root/tools
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 /tools
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 'tools')
-rw-r--r--tools/source/stream/stream.cxx4
-rw-r--r--tools/source/stream/strmunx.cxx12
-rw-r--r--tools/source/stream/strmwnt.cxx8
3 files changed, 12 insertions, 12 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index a91e6bf16341..871d8f69b5ac 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -373,7 +373,7 @@ void SvStream::ClearError()
m_nError = ERRCODE_NONE;
}
-void SvStream::SetError( sal_uInt32 nErrorCode )
+void SvStream::SetError( ErrCode nErrorCode )
{
if (m_nError == ERRCODE_NONE)
m_nError = nErrorCode;
@@ -1552,7 +1552,7 @@ bool SvStream::SetStreamSize(sal_uInt64 const nSize)
#ifdef DBG_UTIL
DBG_ASSERT(Tell()==nFPos,"SetStreamSize failed");
#endif
- return (m_nError == 0);
+ return (m_nError == ERRCODE_NONE);
}
SvStream& endl( SvStream& rStr )
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index bb5d3de9fff7..d3f79e6c3712 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -177,9 +177,9 @@ public:
StreamData() : rHandle( nullptr ) { }
};
-static sal_uInt32 GetSvError( int nErrno )
+static ErrCode GetSvError( int nErrno )
{
- static struct { int nErr; sal_uInt32 sv; } errArr[] =
+ static struct { int nErr; ErrCode sv; } errArr[] =
{
{ 0, ERRCODE_NONE },
{ EACCES, SVSTREAM_ACCESS_DENIED },
@@ -214,7 +214,7 @@ static sal_uInt32 GetSvError( int nErrno )
{ (int)0xFFFF, SVSTREAM_GENERALERROR }
};
- sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error
+ ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
@@ -229,9 +229,9 @@ static sal_uInt32 GetSvError( int nErrno )
return nRetVal;
}
-static sal_uInt32 GetSvError( oslFileError nErrno )
+static ErrCode GetSvError( oslFileError nErrno )
{
- static struct { oslFileError nErr; sal_uInt32 sv; } errArr[] =
+ static struct { oslFileError nErr; ErrCode sv; } errArr[] =
{
{ osl_File_E_None, ERRCODE_NONE },
{ osl_File_E_ACCES, SVSTREAM_ACCESS_DENIED },
@@ -254,7 +254,7 @@ static sal_uInt32 GetSvError( oslFileError nErrno )
{ (oslFileError)0xFFFF, SVSTREAM_GENERALERROR }
};
- sal_uInt32 nRetVal = SVSTREAM_GENERALERROR; // default error
+ ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index cfd84f39d7bc..5b7009eda1a5 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -44,9 +44,9 @@ public:
}
};
-static std::size_t GetSvError( DWORD nWntError )
+static ErrCode GetSvError( DWORD nWntError )
{
- static struct { DWORD wnt; std::size_t sv; } errArr[] =
+ static struct { DWORD wnt; ErrCode sv; } errArr[] =
{
{ ERROR_SUCCESS, ERRCODE_NONE },
{ ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED },
@@ -86,7 +86,7 @@ static std::size_t GetSvError( DWORD nWntError )
{ (DWORD)0xFFFFFFFF, SVSTREAM_GENERALERROR }
};
- std::size_t nRetVal = SVSTREAM_GENERALERROR; // default error
+ ErrCode nRetVal = SVSTREAM_GENERALERROR; // default error
int i=0;
do
{
@@ -339,7 +339,7 @@ void SvFileStream::Open( const OUString& rFilename, StreamMode nMode )
if( (pInstanceData->hFile==INVALID_HANDLE_VALUE) &&
(nAccessMode & GENERIC_WRITE))
{
- std::size_t nErr = ::GetSvError( GetLastError() );
+ ErrCode nErr = ::GetSvError( GetLastError() );
if(nErr==SVSTREAM_ACCESS_DENIED || nErr==SVSTREAM_SHARING_VIOLATION)
{
nMode &= (~StreamMode::WRITE);