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

sal_uLong/long to ErrCode

Change-Id: I2ba2d867785765e4850c60070e86419f66e25f57
üst f8dac039
...@@ -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:
mutable sal_uLong m_nError; // error code mutable ErrCode m_nError; // error code
StreamMode m_nMode; // open mode StreamMode m_nMode; // open mode
bool m_bAutoCommit; bool m_bAutoCommit;
StorageBase(); StorageBase();
...@@ -58,8 +58,8 @@ public: ...@@ -58,8 +58,8 @@ public:
virtual bool Validate( bool=false ) const = 0; virtual bool Validate( bool=false ) const = 0;
virtual bool ValidateMode( StreamMode ) const = 0; virtual bool ValidateMode( StreamMode ) const = 0;
void ResetError() const; void ResetError() const;
void SetError( sal_uLong ) const; void SetError( ErrCode ) const;
sal_uLong GetError() const; ErrCode GetError() const;
bool Good() const { return bool( m_nError == SVSTREAM_OK ); } bool Good() const { return bool( m_nError == SVSTREAM_OK ); }
StreamMode GetMode() const { return m_nMode; } StreamMode GetMode() const { return m_nMode; }
void SetAutoCommit( bool bSet ) void SetAutoCommit( bool bSet )
......
...@@ -86,7 +86,7 @@ friend class SotStorageStream; ...@@ -86,7 +86,7 @@ friend class SotStorageStream;
BaseStorage * m_pOwnStg; // target storage BaseStorage * m_pOwnStg; // target storage
SvStream * m_pStorStm; // only for SDSTORAGES SvStream * m_pStorStm; // only for SDSTORAGES
sal_uLong m_nError; ErrCode m_nError;
OUString m_aName; // name of the storage OUString m_aName; // name of the storage
bool m_bIsRoot; // e.g.: File Storage bool m_bIsRoot; // e.g.: File Storage
bool m_bDelStm; bool m_bDelStm;
...@@ -135,8 +135,8 @@ public: ...@@ -135,8 +135,8 @@ public:
return m_nVersion; return m_nVersion;
} }
sal_uLong GetError() const { return ERRCODE_TOERROR(m_nError); } ErrCode GetError() const { return ERRCODE_TOERROR(m_nError); }
void SetError( sal_uLong nErrorCode ) void SetError( ErrCode nErrorCode )
{ {
if( m_nError == SVSTREAM_OK ) if( m_nError == SVSTREAM_OK )
m_nError = nErrorCode; m_nError = nErrorCode;
......
...@@ -62,14 +62,14 @@ StorageBase::~StorageBase() ...@@ -62,14 +62,14 @@ StorageBase::~StorageBase()
// The following three methods are declared as const, since they // The following three methods are declared as const, since they
// may be called from within a const method. // may be called from within a const method.
sal_uLong StorageBase::GetError() const ErrCode StorageBase::GetError() const
{ {
sal_uLong n = m_nError; const ErrCode n = m_nError;
m_nError = SVSTREAM_OK; m_nError = SVSTREAM_OK;
return n; return n;
} }
void StorageBase::SetError( sal_uLong n ) const void StorageBase::SetError( ErrCode n ) const
{ {
if( !m_nError ) if( !m_nError )
m_nError = n; m_nError = n;
...@@ -689,7 +689,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString& ...@@ -689,7 +689,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString&
if ( p2 ) if ( p2 )
{ {
sal_uLong nTmpErr = p2->GetError(); ErrCode nTmpErr = p2->GetError();
if( !nTmpErr ) if( !nTmpErr )
{ {
p2->SetClassId( p1->GetClassId() ); p2->SetClassId( p1->GetClassId() );
...@@ -718,7 +718,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString& ...@@ -718,7 +718,7 @@ bool Storage::CopyTo( const OUString& rElem, BaseStorage* pDest, const OUString&
if ( p2 ) if ( p2 )
{ {
sal_uLong nTmpErr = p2->GetError(); ErrCode nTmpErr = p2->GetError();
if( !nTmpErr ) if( !nTmpErr )
{ {
p1->CopyTo( p2 ); p1->CopyTo( p2 );
......
...@@ -392,7 +392,7 @@ bool StgCache::SetSize( sal_Int32 n ) ...@@ -392,7 +392,7 @@ bool StgCache::SetSize( sal_Int32 n )
return Good(); return Good();
} }
void StgCache::SetError( sal_uLong n ) void StgCache::SetError( ErrCode n )
{ {
if( n && !m_nError ) if( n && !m_nError )
m_nError = n; m_nError = n;
......
...@@ -45,7 +45,7 @@ class StgCache ...@@ -45,7 +45,7 @@ class StgCache
typedef std::vector< rtl::Reference< StgPage > > LRUList; typedef std::vector< rtl::Reference< StgPage > > LRUList;
sal_uLong m_nError; // error code ErrCode m_nError; // error code
sal_Int32 m_nPages; // size of data area in pages sal_Int32 m_nPages; // size of data area in pages
sal_uInt16 m_nRef; // reference count sal_uInt16 m_nRef; // reference count
IndexToStgPage maDirtyPages; // hash of all dirty pages IndexToStgPage maDirtyPages; // hash of all dirty pages
...@@ -74,9 +74,9 @@ public: ...@@ -74,9 +74,9 @@ public:
void SetStrm( UCBStorageStream* ); void SetStrm( UCBStorageStream* );
bool IsWritable() { return ( m_pStrm && m_pStrm->IsWritable() ); } bool IsWritable() { return ( m_pStrm && m_pStrm->IsWritable() ); }
bool Good() { return m_nError == SVSTREAM_OK; } bool Good() { return m_nError == SVSTREAM_OK; }
sal_uLong GetError() { return m_nError; } ErrCode GetError() { return m_nError; }
void MoveError( StorageBase& ); void MoveError( StorageBase& );
void SetError( sal_uLong ); void SetError( ErrCode );
void ResetError(); void ResetError();
bool Open( const OUString& rName, StreamMode ); bool Open( const OUString& rName, StreamMode );
void Close(); void Close();
......
...@@ -127,12 +127,12 @@ bool StgIo::CommitAll() ...@@ -127,12 +127,12 @@ bool StgIo::CommitAll()
if( m_aHdr.Store( *this ) ) if( m_aHdr.Store( *this ) )
{ {
m_pStrm->Flush(); m_pStrm->Flush();
sal_uLong n = m_pStrm->GetError(); const ErrCode n = pStrm->GetError();
SetError( n ); SetError( n );
#ifdef DBG_UTIL #ifdef DBG_UTIL
if( n==0 ) ValidateFATs(); if( n==SVSTREAM_OK ) ValidateFATs();
#endif #endif
return n == 0; return n == SVSTREAM_OK;
} }
} }
} }
......
...@@ -469,7 +469,7 @@ SotStorage::SotStorage( BaseStorage * pStor ) ...@@ -469,7 +469,7 @@ SotStorage::SotStorage( BaseStorage * pStor )
} }
m_pOwnStg = pStor; m_pOwnStg = pStor;
sal_uLong nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE; const ErrCode nErr = m_pOwnStg ? m_pOwnStg->GetError() : SVSTREAM_CANNOT_MAKE;
SetError( nErr ); SetError( nErr );
if ( IsOLEStorage() ) if ( IsOLEStorage() )
m_nVersion = SOFFICE_FILEFORMAT_50; m_nVersion = SOFFICE_FILEFORMAT_50;
......
...@@ -428,7 +428,7 @@ public: ...@@ -428,7 +428,7 @@ public:
// for read/write streams it's a copy into a temporary file // for read/write streams it's a copy into a temporary file
OUString m_aTempURL; // URL of this temporary stream OUString m_aTempURL; // URL of this temporary stream
RepresentModes m_nRepresentMode; // should it be used as XInputStream or as SvStream RepresentModes m_nRepresentMode; // should it be used as XInputStream or as SvStream
long m_nError; ErrCode m_nError;
StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing ) StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing )
bool m_bSourceRead; // Source still contains useful information bool m_bSourceRead; // Source still contains useful information
bool m_bModified; // only modified streams will be sent to the original content bool m_bModified; // only modified streams will be sent to the original content
...@@ -457,7 +457,7 @@ public: ...@@ -457,7 +457,7 @@ public:
// but the writing is done at the end of temporary // but the writing is done at the end of temporary
// pointer position is not changed // pointer position is not changed
using SvStream::SetError; using SvStream::SetError;
void SetError( sal_uInt32 nError ); void SetError( ErrCode nError );
void PrepareCachedForReopen( StreamMode nMode ); void PrepareCachedForReopen( StreamMode nMode );
}; };
...@@ -480,7 +480,7 @@ public: ...@@ -480,7 +480,7 @@ public:
::ucbhelper::Content* m_pContent; // the content that provides the storage elements ::ucbhelper::Content* m_pContent; // the content that provides the storage elements
::utl::TempFile* m_pTempFile; // temporary file, only for storages on stream ::utl::TempFile* m_pTempFile; // temporary file, only for storages on stream
SvStream* m_pSource; // original stream, only for storages on a stream SvStream* m_pSource; // original stream, only for storages on a stream
long m_nError; ErrCode m_nError;
StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing ) StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing )
bool m_bModified; // only modified elements will be sent to the original content bool m_bModified; // only modified elements will be sent to the original content
bool m_bCommited; // sending the streams is coordinated by the root storage of the package bool m_bCommited; // sending the streams is coordinated by the root storage of the package
...@@ -524,7 +524,7 @@ public: ...@@ -524,7 +524,7 @@ public:
} }
UCBStorageElementList_Impl& GetChildrenList() UCBStorageElementList_Impl& GetChildrenList()
{ {
long nError = m_nError; const ErrCode nError = m_nError;
ReadContent(); ReadContent();
if ( m_nMode & StreamMode::WRITE ) if ( m_nMode & StreamMode::WRITE )
{ {
...@@ -538,7 +538,7 @@ public: ...@@ -538,7 +538,7 @@ public:
return m_aChildrenList; return m_aChildrenList;
} }
void SetError( long nError ); void SetError( ErrCode nError );
}; };
typedef tools::SvRef<UCBStorage_Impl> UCBStorage_ImplRef; typedef tools::SvRef<UCBStorage_Impl> UCBStorage_ImplRef;
...@@ -1038,7 +1038,7 @@ void UCBStorageStream_Impl::FlushData() ...@@ -1038,7 +1038,7 @@ void UCBStorageStream_Impl::FlushData()
m_bCommited = true; m_bCommited = true;
} }
void UCBStorageStream_Impl::SetError( sal_uInt32 nErr ) void UCBStorageStream_Impl::SetError( ErrCode nErr )
{ {
if ( !m_nError ) if ( !m_nError )
{ {
...@@ -1078,7 +1078,7 @@ BaseStorage* UCBStorageStream_Impl::CreateStorage() ...@@ -1078,7 +1078,7 @@ BaseStorage* UCBStorageStream_Impl::CreateStorage()
Storage *pStorage = new Storage( *pNewStorageStream, m_bDirect ); Storage *pStorage = new Storage( *pNewStorageStream, m_bDirect );
// GetError() call cleares error code for OLE storages, must be changed in future // GetError() call cleares error code for OLE storages, must be changed in future
long nTmpErr = pStorage->GetError(); const ErrCode nTmpErr = pStorage->GetError();
pStorage->SetError( nTmpErr ); pStorage->SetError( nTmpErr );
m_bIsOLEStorage = !nTmpErr; m_bIsOLEStorage = !nTmpErr;
...@@ -1882,7 +1882,7 @@ void UCBStorage_Impl::ReadContent() ...@@ -1882,7 +1882,7 @@ void UCBStorage_Impl::ReadContent()
} }
} }
void UCBStorage_Impl::SetError( long nError ) void UCBStorage_Impl::SetError( ErrCode nError )
{ {
if ( !m_nError ) if ( !m_nError )
{ {
......
...@@ -658,7 +658,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize ...@@ -658,7 +658,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
CopyFile( aTmpURL, aInURL ); CopyFile( aTmpURL, aInURL );
KillFile( aTmpURL ); KillFile( aTmpURL );
sal_uIntPtr nStorErr = 0; ErrCode nStorErr = ERRCODE_NONE;
try try
{ {
...@@ -674,7 +674,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize ...@@ -674,7 +674,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
nStorErr = ERRCODE_IO_GENERAL; nStorErr = ERRCODE_IO_GENERAL;
} }
if( !nStorErr ) if( nStorErr == ERRCODE_NONE )
{ {
aSvDrawStorageRef.Clear(); aSvDrawStorageRef.Clear();
CopyFile( aTmpURL, GetSdvURL() ); CopyFile( aTmpURL, GetSdvURL() );
......
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