Kaydet (Commit) 3f7d7a21 authored tarafından Miklos Vajna's avatar Miklos Vajna

sot: prefix remaining StgStrm members

Change-Id: I2a70543bf3137f8d5a76e610a2aff6a3a3fcab4e
üst 11b3555e
...@@ -725,8 +725,8 @@ StgDirStrm::StgDirStrm( StgIo& r ) ...@@ -725,8 +725,8 @@ StgDirStrm::StgDirStrm( StgIo& r )
{ {
if( r.GetError() ) if( r.GetError() )
return; return;
m_nEntries = nPageSize / STGENTRY_SIZE; m_nEntries = m_nPageSize / STGENTRY_SIZE;
if( nStart == STG_EOF ) if( m_nStart == STG_EOF )
{ {
StgEntry aRoot; StgEntry aRoot;
aRoot.Init(); aRoot.Init();
...@@ -739,9 +739,9 @@ StgDirStrm::StgDirStrm( StgIo& r ) ...@@ -739,9 +739,9 @@ StgDirStrm::StgDirStrm( StgIo& r )
{ {
// temporarily use this instance as owner, so // temporarily use this instance as owner, so
// the TOC pages can be removed. // the TOC pages can be removed.
pEntry = reinterpret_cast<StgDirEntry*>(this); // just for a bit pattern m_pEntry = reinterpret_cast<StgDirEntry*>(this); // just for a bit pattern
SetupEntry( 0, m_pRoot ); SetupEntry( 0, m_pRoot );
pEntry = NULL; m_pEntry = NULL;
} }
} }
...@@ -757,7 +757,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) ...@@ -757,7 +757,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
void* p = ( n == STG_FREE ) ? NULL : GetEntry( n ); void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
if( p ) if( p )
{ {
SvStream *pUnderlyingStream = rIo.GetStrm(); SvStream *pUnderlyingStream = m_rIo.GetStrm();
sal_uInt64 nCur = pUnderlyingStream->Tell(); sal_uInt64 nCur = pUnderlyingStream->Tell();
sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->Seek(STREAM_SEEK_TO_END); sal_uInt64 nUnderlyingStreamSize = pUnderlyingStream->Seek(STREAM_SEEK_TO_END);
pUnderlyingStream->Seek(nCur); pUnderlyingStream->Seek(nCur);
...@@ -768,7 +768,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) ...@@ -768,7 +768,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
if( !bOk ) if( !bOk )
{ {
delete pCur; delete pCur;
rIo.SetError( SVSTREAM_GENERALERROR ); m_rIo.SetError( SVSTREAM_GENERALERROR );
// an error occurred // an error occurred
return; return;
} }
...@@ -787,7 +787,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) ...@@ -787,7 +787,7 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper )
if (nLeaf != STG_FREE && nLeaf == n) if (nLeaf != STG_FREE && nLeaf == n)
{ {
delete pCur; delete pCur;
rIo.SetError( SVSTREAM_GENERALERROR ); m_rIo.SetError( SVSTREAM_GENERALERROR );
return; return;
} }
} }
...@@ -847,7 +847,7 @@ bool StgDirStrm::SetSize( sal_Int32 nBytes ) ...@@ -847,7 +847,7 @@ bool StgDirStrm::SetSize( sal_Int32 nBytes )
if ( nBytes < 0 ) if ( nBytes < 0 )
nBytes = 0; nBytes = 0;
nBytes = ( ( nBytes + nPageSize - 1 ) / nPageSize ) * nPageSize; nBytes = ( ( nBytes + m_nPageSize - 1 ) / m_nPageSize ) * m_nPageSize;
return StgStrm::SetSize( nBytes ); return StgStrm::SetSize( nBytes );
} }
...@@ -857,16 +857,16 @@ bool StgDirStrm::Store() ...@@ -857,16 +857,16 @@ bool StgDirStrm::Store()
{ {
if( !m_pRoot || !m_pRoot->IsDirty() ) if( !m_pRoot || !m_pRoot->IsDirty() )
return true; return true;
if( !m_pRoot->StoreStreams( rIo ) ) if( !m_pRoot->StoreStreams( m_rIo ) )
return false; return false;
// After writing all streams, the data FAT stream has changed, // After writing all streams, the data FAT stream has changed,
// so we have to commit the root again // so we have to commit the root again
m_pRoot->Commit(); m_pRoot->Commit();
// We want a completely new stream, so fake an empty stream // We want a completely new stream, so fake an empty stream
sal_Int32 nOldStart = nStart; // save for later deletion sal_Int32 nOldStart = m_nStart; // save for later deletion
sal_Int32 nOldSize = nSize; sal_Int32 nOldSize = m_nSize;
nStart = nPage = STG_EOF; m_nStart = m_nPage = STG_EOF;
nSize = m_nPos = 0; m_nSize = m_nPos = 0;
m_nOffset = 0; m_nOffset = 0;
// Delete all temporary entries // Delete all temporary entries
m_pRoot->DelTemp( false ); m_pRoot->DelTemp( false );
...@@ -875,12 +875,12 @@ bool StgDirStrm::Store() ...@@ -875,12 +875,12 @@ bool StgDirStrm::Store()
m_pRoot->Enum( n ); m_pRoot->Enum( n );
if( !SetSize( n * STGENTRY_SIZE ) ) if( !SetSize( n * STGENTRY_SIZE ) )
{ {
nStart = nOldStart; nSize = nOldSize; m_nStart = nOldStart; m_nSize = nOldSize;
m_pRoot->RevertAll(); m_pRoot->RevertAll();
return false; return false;
} }
// set up the cache elements for the new stream // set up the cache elements for the new stream
if( !Copy( STG_FREE, nSize ) ) if( !Copy( STG_FREE, m_nSize ) )
{ {
m_pRoot->RevertAll(); m_pRoot->RevertAll();
return false; return false;
...@@ -892,7 +892,7 @@ bool StgDirStrm::Store() ...@@ -892,7 +892,7 @@ bool StgDirStrm::Store()
return false; return false;
} }
// fill any remaining entries with empty data // fill any remaining entries with empty data
sal_Int32 ne = nSize / STGENTRY_SIZE; sal_Int32 ne = m_nSize / STGENTRY_SIZE;
StgEntry aEmpty; StgEntry aEmpty;
aEmpty.Init(); aEmpty.Init();
while( n < ne ) while( n < ne )
...@@ -907,7 +907,7 @@ bool StgDirStrm::Store() ...@@ -907,7 +907,7 @@ bool StgDirStrm::Store()
} }
// Now we can release the old stream // Now we can release the old stream
m_pFat->FreePages( nOldStart, true ); m_pFat->FreePages( nOldStart, true );
rIo.m_aHdr.SetTOCStart( nStart ); m_rIo.m_aHdr.SetTOCStart( m_nStart );
return true; return true;
} }
...@@ -915,7 +915,7 @@ bool StgDirStrm::Store() ...@@ -915,7 +915,7 @@ bool StgDirStrm::Store()
void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty ) void* StgDirStrm::GetEntry( sal_Int32 n, bool bDirty )
{ {
return n < 0 || n >= nSize / STGENTRY_SIZE return n < 0 || n >= m_nSize / STGENTRY_SIZE
? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty ); ? NULL : GetPtr( n * STGENTRY_SIZE, true, bDirty );
} }
...@@ -929,7 +929,7 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const OUString& rName ) ...@@ -929,7 +929,7 @@ StgDirEntry* StgDirStrm::Find( StgDirEntry& rStg, const OUString& rName )
aEntry.Init(); aEntry.Init();
if( !aEntry.SetName( rName ) ) if( !aEntry.SetName( rName ) )
{ {
rIo.SetError( SVSTREAM_GENERALERROR ); m_rIo.SetError( SVSTREAM_GENERALERROR );
return NULL; return NULL;
} }
// Look in the directory attached to the entry // Look in the directory attached to the entry
...@@ -949,7 +949,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn ...@@ -949,7 +949,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn
aEntry.SetType( eType ); aEntry.SetType( eType );
if( !aEntry.SetName( rName ) ) if( !aEntry.SetName( rName ) )
{ {
rIo.SetError( SVSTREAM_GENERALERROR ); m_rIo.SetError( SVSTREAM_GENERALERROR );
return NULL; return NULL;
} }
StgDirEntry* pRes = Find( rStg, rName ); StgDirEntry* pRes = Find( rStg, rName );
...@@ -957,7 +957,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn ...@@ -957,7 +957,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn
{ {
if( !pRes->m_bInvalid ) if( !pRes->m_bInvalid )
{ {
rIo.SetError( SVSTREAM_CANNOT_MAKE ); m_rIo.SetError( SVSTREAM_CANNOT_MAKE );
return NULL; return NULL;
} }
pRes->m_bInvalid = pRes->m_bInvalid =
...@@ -978,7 +978,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn ...@@ -978,7 +978,7 @@ StgDirEntry* StgDirStrm::Create( StgDirEntry& rStg, const OUString& rName, StgEn
} }
else else
{ {
rIo.SetError( SVSTREAM_CANNOT_MAKE ); m_rIo.SetError( SVSTREAM_CANNOT_MAKE );
delete pRes; pRes = NULL; delete pRes; pRes = NULL;
} }
} }
......
This diff is collapsed.
...@@ -61,27 +61,27 @@ public: ...@@ -61,27 +61,27 @@ public:
class StgStrm { // base class for all streams class StgStrm { // base class for all streams
protected: protected:
StgIo& rIo; // I/O system StgIo& m_rIo; // I/O system
StgFAT* m_pFat; // FAT stream for allocations StgFAT* m_pFat; // FAT stream for allocations
StgDirEntry* pEntry; // dir entry (for ownership) StgDirEntry* m_pEntry; // dir entry (for ownership)
sal_Int32 nStart; // 1st data page sal_Int32 m_nStart; // 1st data page
sal_Int32 nSize; // stream size in bytes sal_Int32 m_nSize; // stream size in bytes
sal_Int32 m_nPos; // current byte position sal_Int32 m_nPos; // current byte position
sal_Int32 nPage; // current logical page sal_Int32 m_nPage; // current logical page
short m_nOffset; // offset into current page short m_nOffset; // offset into current page
short nPageSize; // logical page size short m_nPageSize; // logical page size
std::vector<sal_Int32> m_aPagesCache; std::vector<sal_Int32> m_aPagesCache;
void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize = NULL); void scanBuildPageChainCache(sal_Int32 *pOptionalCalcSize = NULL);
bool Copy( sal_Int32 nFrom, sal_Int32 nBytes ); bool Copy( sal_Int32 nFrom, sal_Int32 nBytes );
explicit StgStrm( StgIo& ); explicit StgStrm( StgIo& );
public: public:
virtual ~StgStrm(); virtual ~StgStrm();
StgIo& GetIo() { return rIo; } StgIo& GetIo() { return m_rIo; }
sal_Int32 GetPos() const { return m_nPos; } sal_Int32 GetPos() const { return m_nPos; }
sal_Int32 GetStart() const { return nStart; } sal_Int32 GetStart() const { return m_nStart; }
sal_Int32 GetSize() const { return nSize; } sal_Int32 GetSize() const { return m_nSize; }
sal_Int32 GetPage() const { return nPage; } sal_Int32 GetPage() const { return m_nPage; }
sal_Int32 GetPages() const { return ( nSize + nPageSize - 1 ) / nPageSize;} sal_Int32 GetPages() const { return ( m_nSize + m_nPageSize - 1 ) / m_nPageSize;}
short GetOffset() const { return m_nOffset;} short GetOffset() const { return m_nOffset;}
void SetEntry( StgDirEntry& ); void SetEntry( StgDirEntry& );
virtual bool SetSize( sal_Int32 ); virtual bool SetSize( sal_Int32 );
......
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