Kaydet (Commit) f8dac039 authored tarafından Matteo Casalin's avatar Matteo Casalin

Use mutable instead of const_cast'ing this

Change-Id: I790cd140166bf0041abebbe0c4d9c15e931628f1
üst ed931ff9
...@@ -48,7 +48,7 @@ typedef struct SvGUID ClsId; ...@@ -48,7 +48,7 @@ typedef struct SvGUID ClsId;
class SOT_DLLPUBLIC StorageBase : public SvRefBase class SOT_DLLPUBLIC StorageBase : public SvRefBase
{ {
protected: protected:
sal_uLong m_nError; // error code mutable sal_uLong m_nError; // error code
StreamMode m_nMode; // open mode StreamMode m_nMode; // open mode
bool m_bAutoCommit; bool m_bAutoCommit;
StorageBase(); StorageBase();
......
...@@ -65,19 +65,19 @@ StorageBase::~StorageBase() ...@@ -65,19 +65,19 @@ StorageBase::~StorageBase()
sal_uLong StorageBase::GetError() const sal_uLong StorageBase::GetError() const
{ {
sal_uLong n = m_nError; sal_uLong n = m_nError;
const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK; m_nError = SVSTREAM_OK;
return n; return n;
} }
void StorageBase::SetError( sal_uLong n ) const void StorageBase::SetError( sal_uLong n ) const
{ {
if( !m_nError ) if( !m_nError )
const_cast<StorageBase*>(this)->m_nError = n; m_nError = n;
} }
void StorageBase::ResetError() const void StorageBase::ResetError() const
{ {
const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK; m_nError = SVSTREAM_OK;
} }
OLEStorageBase::OLEStorageBase( StgIo* p, StgDirEntry* pe, StreamMode& nMode ) OLEStorageBase::OLEStorageBase( StgIo* p, StgDirEntry* pe, StreamMode& nMode )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment