const_cast: convert some C-style casts and remove some redundant ones

Change-Id: Ib6842b6215ff70a31299d1410ed66c3ea34e7c78
This commit is contained in:
Stephan Bergmann
2015-03-26 15:31:07 +01:00
parent b549220522
commit af3cb5e85a
2 changed files with 8 additions and 8 deletions

View File

@@ -65,19 +65,19 @@ StorageBase::~StorageBase()
sal_uLong StorageBase::GetError() const
{
sal_uLong n = m_nError;
((StorageBase*) this)->m_nError = SVSTREAM_OK;
const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK;
return n;
}
void StorageBase::SetError( sal_uLong n ) const
{
if( !m_nError )
((StorageBase*) this)->m_nError = n;
const_cast<StorageBase*>(this)->m_nError = n;
}
void StorageBase::ResetError() const
{
((StorageBase*) this)->m_nError = SVSTREAM_OK;
const_cast<StorageBase*>(this)->m_nError = SVSTREAM_OK;
}
// Retrieve the underlying SvStream for info purposes
@@ -542,7 +542,7 @@ Storage::~Storage()
const OUString& Storage::GetName() const
{
if( !bIsRoot && Validate() )
pEntry->aEntry.GetName( ((Storage*) this)->aName );
pEntry->aEntry.GetName( const_cast<Storage*>(this)->aName );
return aName;
}
@@ -794,7 +794,7 @@ bool Storage::CopyTo( BaseStorage* pDest ) const
SetError( SVSTREAM_ACCESS_DENIED );
return false;
}
Storage* pThis = (Storage*) this;
Storage* pThis = const_cast<Storage*>(this);
pDest->SetClassId( GetClassId() );
pDest->SetDirty();
SvStorageInfoList aList;

View File

@@ -207,9 +207,9 @@ void SotStorageStream::SetSize(sal_uInt64 const nNewSize)
sal_uInt32 SotStorageStream::GetSize() const
{
sal_uLong nPos = Tell();
((SotStorageStream *)this)->Seek( STREAM_SEEK_TO_END );
const_cast<SotStorageStream *>(this)->Seek( STREAM_SEEK_TO_END );
sal_uLong nSize = Tell();
((SotStorageStream *)this)->Seek( nPos );
const_cast<SotStorageStream *>(this)->Seek( nPos );
return nSize;
}
@@ -600,7 +600,7 @@ const OUString & SotStorage::GetName() const
{
DBG_ASSERT( Owner(), "must be owner" );
if( m_pOwnStg )
((SotStorage *)this)->m_aName = m_pOwnStg->GetName();
const_cast<SotStorage *>(this)->m_aName = m_pOwnStg->GetName();
}
return m_aName;
}