diff options
author | Oliver-Rainer Wittmann <orw@apache.org> | 2012-08-14 12:40:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-19 16:38:47 +0100 |
commit | b751e3915ef527c9af07b995c95fb353c3c81a42 (patch) | |
tree | 13253618d7fd058a8465177d3767a3c338cb3ab3 /sot | |
parent | d0a956f1d80aaf4be6d19d339bd46addc8c16861 (diff) |
some refactoring on <StgHeader>
(cherry picked from commit 9c3ef4ee67c1d3f416c02b9db6d1adbc7ca6d549)
Conflicts:
sot/source/sdstor/stgelem.cxx
Change-Id: I3f826dc98af5ad5cee5c2566006ab405f0730c3c
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/stgelem.cxx | 10 | ||||
-rw-r--r-- | sot/source/sdstor/stgelem.hxx | 26 |
2 files changed, 19 insertions, 17 deletions
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 265381e0c257..e34f0689f588 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -110,7 +110,7 @@ void StgHeader::Init() SetTOCStart( STG_EOF ); SetDataFATStart( STG_EOF ); - for( short i = 0; i < 109; i++ ) + for( short i = 0; i < cFATPagesInHeader; i++ ) SetFATPage( i, STG_FREE ); } @@ -145,7 +145,7 @@ sal_Bool StgHeader::Load( SvStream& r ) >> nDataFATSize // 40 # of data FATpages >> nMasterChain // 44 chain to the next master block >> nMaster; // 48 # of additional master blocks - for( short i = 0; i < 109; i++ ) + for( short i = 0; i < cFATPagesInHeader; i++ ) r >> nMasterFAT[ i ]; return ( r.GetErrorCode() == ERRCODE_NONE && Check() ); @@ -172,7 +172,7 @@ sal_Bool StgHeader::Store( StgIo& rIo ) << nDataFATSize // 40 # of data FAT pages << nMasterChain // 44 chain to the next master block << nMaster; // 48 # of additional master blocks - for( short i = 0; i < 109; i++ ) + for( short i = 0; i < cFATPagesInHeader; i++ ) r << nMasterFAT[ i ]; bDirty = !rIo.Good(); return sal_Bool( !bDirty ); @@ -209,7 +209,7 @@ sal_Bool StgHeader::Check() sal_Int32 StgHeader::GetFATPage( short n ) const { - if( n >= 0 && n < 109 ) + if( n >= 0 && n < cFATPagesInHeader ) return nMasterFAT[ n ]; else return STG_EOF; @@ -217,7 +217,7 @@ sal_Int32 StgHeader::GetFATPage( short n ) const void StgHeader::SetFATPage( short n, sal_Int32 nb ) { - if( n >= 0 && n < 109 ) + if( n >= 0 && n < cFATPagesInHeader ) { if( nMasterFAT[ n ] != nb ) bDirty = sal_True, nMasterFAT[ n ] = nb; diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx index e2bfad340755..5e7b6c4d7fc7 100644 --- a/sot/source/sdstor/stgelem.hxx +++ b/sot/source/sdstor/stgelem.hxx @@ -36,8 +36,10 @@ SvStream& operator<<( SvStream&, const ClsId& ); class StgHeader { + static const sal_uInt8 cFATPagesInHeader = 109; + sal_uInt8 cSignature[ 8 ]; // 00 signature (see below) - ClsId aClsId; // 08 Class ID + ClsId aClsId; // 08 Class ID sal_Int32 nVersion; // 18 version number sal_uInt16 nByteOrder; // 1C Unicode byte order indicator sal_Int16 nPageSize; // 1E 1 << nPageSize = block size @@ -52,7 +54,7 @@ class StgHeader sal_Int32 nDataFATSize; // 40 # of data fat blocks sal_Int32 nMasterChain; // 44 chain to the next master block sal_Int32 nMaster; // 48 # of additional master blocks - sal_Int32 nMasterFAT[ 109 ]; // 4C first 109 master FAT pages + sal_Int32 nMasterFAT[ cFATPagesInHeader ]; // 4C first [cFATPagesInHeader] master FAT pages public: StgHeader(); @@ -61,23 +63,23 @@ public: sal_Bool Load( SvStream& ); sal_Bool Store( StgIo& ); sal_Bool Check(); // check the signature and version - short GetByteOrder() const { return nByteOrder; } - sal_Int32 GetTOCStart() const { return nTOCstrm; } + short GetByteOrder() const { return nByteOrder; } + sal_Int32 GetTOCStart() const { return nTOCstrm; } void SetTOCStart( sal_Int32 n ); - sal_Int32 GetDataFATStart() const { return nDataFAT; } + sal_Int32 GetDataFATStart() const { return nDataFAT; } void SetDataFATStart( sal_Int32 n ); - sal_Int32 GetDataFATSize() const { return nDataFATSize; } + sal_Int32 GetDataFATSize() const { return nDataFATSize; } void SetDataFATSize( sal_Int32 n ); - sal_Int32 GetThreshold() const { return nThreshold; } - short GetPageSize() const { return nPageSize; } + sal_Int32 GetThreshold() const { return nThreshold; } + short GetPageSize() const { return nPageSize; } short GetDataPageSize() const { return nDataPageSize; } - sal_Int32 GetFATSize() const { return nFATSize; } + sal_Int32 GetFATSize() const { return nFATSize; } void SetFATSize( sal_Int32 n ); - sal_Int32 GetFATChain() const { return nMasterChain; } + sal_Int32 GetFATChain() const { return nMasterChain; } void SetFATChain( sal_Int32 n ); - sal_Int32 GetMasters() const { return nMaster; } + sal_Int32 GetMasters() const { return nMaster; } void SetMasters( sal_Int32 n ); - short GetFAT1Size() const { return 109; } + short GetFAT1Size() const { return cFATPagesInHeader; } const ClsId& GetClassId() const { return aClsId; } sal_Int32 GetFATPage( short ) const; void SetFATPage( short, sal_Int32 ); |