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

sot: prefix members of StgHeader

Change-Id: I4885ae825484afd53d7026a8d55a0ec8eddf4d86
üst 7ca450cb
...@@ -70,43 +70,43 @@ SvStream& WriteClsId( SvStream& r, const ClsId& rId ) ...@@ -70,43 +70,43 @@ SvStream& WriteClsId( SvStream& r, const ClsId& rId )
///////////////////////////// class StgHeader ///////////////////////////// class StgHeader
StgHeader::StgHeader() StgHeader::StgHeader()
: nVersion( 0 ) : m_nVersion( 0 )
, nByteOrder( 0 ) , m_nByteOrder( 0 )
, nPageSize( 0 ) , m_nPageSize( 0 )
, nDataPageSize( 0 ) , m_nDataPageSize( 0 )
, bDirty( sal_uInt8(false) ) , m_bDirty( sal_uInt8(false) )
, nFATSize( 0 ) , m_nFATSize( 0 )
, nTOCstrm( 0 ) , m_nTOCstrm( 0 )
, nReserved( 0 ) , m_nReserved( 0 )
, nThreshold( 0 ) , m_nThreshold( 0 )
, nDataFAT( 0 ) , m_nDataFAT( 0 )
, nDataFATSize( 0 ) , m_nDataFATSize( 0 )
, nMasterChain( 0 ) , m_nMasterChain( 0 )
, nMaster( 0 ) , m_nMaster( 0 )
{ {
memset( cSignature, 0, sizeof( cSignature ) ); memset( m_cSignature, 0, sizeof( m_cSignature ) );
memset( &aClsId, 0, sizeof( ClsId ) ); memset( &m_aClsId, 0, sizeof( ClsId ) );
memset( cReserved, 0, sizeof( cReserved ) ); memset( m_cReserved, 0, sizeof( m_cReserved ) );
memset( nMasterFAT, 0, sizeof( nMasterFAT ) ); memset( m_nMasterFAT, 0, sizeof( m_nMasterFAT ) );
} }
void StgHeader::Init() void StgHeader::Init()
{ {
memcpy( cSignature, cStgSignature, 8 ); memcpy( m_cSignature, cStgSignature, 8 );
memset( &aClsId, 0, sizeof( ClsId ) ); memset( &m_aClsId, 0, sizeof( ClsId ) );
nVersion = 0x0003003B; m_nVersion = 0x0003003B;
nByteOrder = 0xFFFE; m_nByteOrder = 0xFFFE;
nPageSize = 9; // 512 bytes m_nPageSize = 9; // 512 bytes
nDataPageSize = 6; // 64 bytes m_nDataPageSize = 6; // 64 bytes
bDirty = sal_uInt8(false); m_bDirty = sal_uInt8(false);
memset( cReserved, 0, sizeof( cReserved ) ); memset( m_cReserved, 0, sizeof( m_cReserved ) );
nFATSize = 0; m_nFATSize = 0;
nTOCstrm = 0; m_nTOCstrm = 0;
nReserved = 0; m_nReserved = 0;
nThreshold = 4096; m_nThreshold = 4096;
nDataFAT = 0; m_nDataFAT = 0;
nDataFATSize = 0; m_nDataFATSize = 0;
nMasterChain = STG_EOF; m_nMasterChain = STG_EOF;
SetTOCStart( STG_EOF ); SetTOCStart( STG_EOF );
SetDataFATStart( STG_EOF ); SetDataFATStart( STG_EOF );
...@@ -130,53 +130,53 @@ bool StgHeader::Load( StgIo& rIo ) ...@@ -130,53 +130,53 @@ bool StgHeader::Load( StgIo& rIo )
bool StgHeader::Load( SvStream& r ) bool StgHeader::Load( SvStream& r )
{ {
r.Seek( 0L ); r.Seek( 0L );
r.Read( cSignature, 8 ); r.Read( m_cSignature, 8 );
ReadClsId( r, aClsId ); // 08 Class ID ReadClsId( r, m_aClsId ); // 08 Class ID
r.ReadInt32( nVersion ) // 1A version number r.ReadInt32( m_nVersion ) // 1A version number
.ReadUInt16( nByteOrder ) // 1C Unicode byte order indicator .ReadUInt16( m_nByteOrder ) // 1C Unicode byte order indicator
.ReadInt16( nPageSize ) // 1E 1 << nPageSize = block size .ReadInt16( m_nPageSize ) // 1E 1 << nPageSize = block size
.ReadInt16( nDataPageSize ); // 20 1 << this size == data block size .ReadInt16( m_nDataPageSize ); // 20 1 << this size == data block size
r.SeekRel( 10 ); r.SeekRel( 10 );
r.ReadInt32( nFATSize ) // 2C total number of FAT pages r.ReadInt32( m_nFATSize ) // 2C total number of FAT pages
.ReadInt32( nTOCstrm ) // 30 starting page for the TOC stream .ReadInt32( m_nTOCstrm ) // 30 starting page for the TOC stream
.ReadInt32( nReserved ) // 34 .ReadInt32( m_nReserved ) // 34
.ReadInt32( nThreshold ) // 38 minimum file size for big data .ReadInt32( m_nThreshold ) // 38 minimum file size for big data
.ReadInt32( nDataFAT ) // 3C page # of 1st data FAT block .ReadInt32( m_nDataFAT ) // 3C page # of 1st data FAT block
.ReadInt32( nDataFATSize ) // 40 # of data FATpages .ReadInt32( m_nDataFATSize ) // 40 # of data FATpages
.ReadInt32( nMasterChain ) // 44 chain to the next master block .ReadInt32( m_nMasterChain ) // 44 chain to the next master block
.ReadInt32( nMaster ); // 48 # of additional master blocks .ReadInt32( m_nMaster ); // 48 # of additional master blocks
for( short i = 0; i < cFATPagesInHeader; i++ ) for( short i = 0; i < cFATPagesInHeader; i++ )
r.ReadInt32( nMasterFAT[ i ] ); r.ReadInt32( m_nMasterFAT[ i ] );
return (r.GetErrorCode() == ERRCODE_NONE) && Check(); return (r.GetErrorCode() == ERRCODE_NONE) && Check();
} }
bool StgHeader::Store( StgIo& rIo ) bool StgHeader::Store( StgIo& rIo )
{ {
if( !bDirty ) if( !m_bDirty )
return true; return true;
SvStream& r = *rIo.GetStrm(); SvStream& r = *rIo.GetStrm();
r.Seek( 0L ); r.Seek( 0L );
r.Write( cSignature, 8 ); r.Write( m_cSignature, 8 );
WriteClsId( r, aClsId ); // 08 Class ID WriteClsId( r, m_aClsId ); // 08 Class ID
r.WriteInt32( nVersion ) // 1A version number r.WriteInt32( m_nVersion ) // 1A version number
.WriteUInt16( nByteOrder ) // 1C Unicode byte order indicator .WriteUInt16( m_nByteOrder ) // 1C Unicode byte order indicator
.WriteInt16( nPageSize ) // 1E 1 << nPageSize = block size .WriteInt16( m_nPageSize ) // 1E 1 << nPageSize = block size
.WriteInt16( nDataPageSize ) // 20 1 << this size == data block size .WriteInt16( m_nDataPageSize ) // 20 1 << this size == data block size
.WriteInt32( 0 ).WriteInt32( 0 ).WriteInt16( 0 ) .WriteInt32( 0 ).WriteInt32( 0 ).WriteInt16( 0 )
.WriteInt32( nFATSize ) // 2C total number of FAT pages .WriteInt32( m_nFATSize ) // 2C total number of FAT pages
.WriteInt32( nTOCstrm ) // 30 starting page for the TOC stream .WriteInt32( m_nTOCstrm ) // 30 starting page for the TOC stream
.WriteInt32( nReserved ) // 34 .WriteInt32( m_nReserved ) // 34
.WriteInt32( nThreshold ) // 38 minimum file size for big data .WriteInt32( m_nThreshold ) // 38 minimum file size for big data
.WriteInt32( nDataFAT ) // 3C page # of 1st data FAT block .WriteInt32( m_nDataFAT ) // 3C page # of 1st data FAT block
.WriteInt32( nDataFATSize ) // 40 # of data FAT pages .WriteInt32( m_nDataFATSize ) // 40 # of data FAT pages
.WriteInt32( nMasterChain ) // 44 chain to the next master block .WriteInt32( m_nMasterChain ) // 44 chain to the next master block
.WriteInt32( nMaster ); // 48 # of additional master blocks .WriteInt32( m_nMaster ); // 48 # of additional master blocks
for( short i = 0; i < cFATPagesInHeader; i++ ) for( short i = 0; i < cFATPagesInHeader; i++ )
r.WriteInt32( nMasterFAT[ i ] ); r.WriteInt32( m_nMasterFAT[ i ] );
bDirty = sal_uInt8(!rIo.Good()); m_bDirty = sal_uInt8(!rIo.Good());
return !bDirty; return !m_bDirty;
} }
static bool lcl_wontoverflow(short shift) static bool lcl_wontoverflow(short shift)
...@@ -195,23 +195,23 @@ static bool isKnownSpecial(sal_Int32 nLocation) ...@@ -195,23 +195,23 @@ static bool isKnownSpecial(sal_Int32 nLocation)
// Perform thorough checks also on unknown variables // Perform thorough checks also on unknown variables
bool StgHeader::Check() bool StgHeader::Check()
{ {
return memcmp( cSignature, cStgSignature, 8 ) == 0 return memcmp( m_cSignature, cStgSignature, 8 ) == 0
&& (short) ( nVersion >> 16 ) == 3 && (short) ( m_nVersion >> 16 ) == 3
&& nPageSize == 9 && m_nPageSize == 9
&& lcl_wontoverflow(nPageSize) && lcl_wontoverflow(m_nPageSize)
&& lcl_wontoverflow(nDataPageSize) && lcl_wontoverflow(m_nDataPageSize)
&& nFATSize > 0 && m_nFATSize > 0
&& nTOCstrm >= 0 && m_nTOCstrm >= 0
&& nThreshold > 0 && m_nThreshold > 0
&& ( isKnownSpecial(nDataFAT) || ( nDataFAT >= 0 && nDataFATSize > 0 ) ) && ( isKnownSpecial(m_nDataFAT) || ( m_nDataFAT >= 0 && m_nDataFATSize > 0 ) )
&& ( isKnownSpecial(nMasterChain) || nMasterChain >=0 ) && ( isKnownSpecial(m_nMasterChain) || m_nMasterChain >=0 )
&& nMaster >= 0; && m_nMaster >= 0;
} }
sal_Int32 StgHeader::GetFATPage( short n ) const sal_Int32 StgHeader::GetFATPage( short n ) const
{ {
if( n >= 0 && n < cFATPagesInHeader ) if( n >= 0 && n < cFATPagesInHeader )
return nMasterFAT[ n ]; return m_nMasterFAT[ n ];
else else
return STG_EOF; return STG_EOF;
} }
...@@ -220,40 +220,40 @@ void StgHeader::SetFATPage( short n, sal_Int32 nb ) ...@@ -220,40 +220,40 @@ void StgHeader::SetFATPage( short n, sal_Int32 nb )
{ {
if( n >= 0 && n < cFATPagesInHeader ) if( n >= 0 && n < cFATPagesInHeader )
{ {
if( nMasterFAT[ n ] != nb ) if( m_nMasterFAT[ n ] != nb )
bDirty = sal_uInt8(true), nMasterFAT[ n ] = nb; m_bDirty = sal_uInt8(true), m_nMasterFAT[ n ] = nb;
} }
} }
void StgHeader::SetTOCStart( sal_Int32 n ) void StgHeader::SetTOCStart( sal_Int32 n )
{ {
if( n != nTOCstrm ) bDirty = sal_uInt8(true), nTOCstrm = n; if( n != m_nTOCstrm ) m_bDirty = sal_uInt8(true), m_nTOCstrm = n;
} }
void StgHeader::SetDataFATStart( sal_Int32 n ) void StgHeader::SetDataFATStart( sal_Int32 n )
{ {
if( n != nDataFAT ) bDirty = sal_uInt8(true), nDataFAT = n; if( n != m_nDataFAT ) m_bDirty = sal_uInt8(true), m_nDataFAT = n;
} }
void StgHeader::SetDataFATSize( sal_Int32 n ) void StgHeader::SetDataFATSize( sal_Int32 n )
{ {
if( n != nDataFATSize ) bDirty = sal_uInt8(true), nDataFATSize = n; if( n != m_nDataFATSize ) m_bDirty = sal_uInt8(true), m_nDataFATSize = n;
} }
void StgHeader::SetFATSize( sal_Int32 n ) void StgHeader::SetFATSize( sal_Int32 n )
{ {
if( n != nFATSize ) bDirty = sal_uInt8(true), nFATSize = n; if( n != m_nFATSize ) m_bDirty = sal_uInt8(true), m_nFATSize = n;
} }
void StgHeader::SetFATChain( sal_Int32 n ) void StgHeader::SetFATChain( sal_Int32 n )
{ {
if( n != nMasterChain ) if( n != m_nMasterChain )
bDirty = sal_uInt8(true), nMasterChain = n; m_bDirty = sal_uInt8(true), m_nMasterChain = n;
} }
void StgHeader::SetMasters( sal_Int32 n ) void StgHeader::SetMasters( sal_Int32 n )
{ {
if( n != nMaster ) bDirty = sal_uInt8(true), nMaster = n; if( n != m_nMaster ) m_bDirty = sal_uInt8(true), m_nMaster = n;
} }
///////////////////////////// class StgEntry ///////////////////////////// class StgEntry
......
...@@ -35,25 +35,25 @@ class StgHeader ...@@ -35,25 +35,25 @@ class StgHeader
{ {
static const sal_uInt8 cFATPagesInHeader = 109; static const sal_uInt8 cFATPagesInHeader = 109;
sal_uInt8 cSignature[ 8 ]; // 00 signature (see below) sal_uInt8 m_cSignature[ 8 ]; // 00 signature (see below)
ClsId aClsId; // 08 Class ID ClsId m_aClsId; // 08 Class ID
sal_Int32 nVersion; // 18 version number sal_Int32 m_nVersion; // 18 version number
sal_uInt16 nByteOrder; // 1C Unicode byte order indicator sal_uInt16 m_nByteOrder; // 1C Unicode byte order indicator
sal_Int16 nPageSize; // 1E 1 << nPageSize = block size sal_Int16 m_nPageSize; // 1E 1 << nPageSize = block size
sal_Int16 nDataPageSize; // 20 1 << this size == data block size sal_Int16 m_nDataPageSize; // 20 1 << this size == data block size
sal_uInt8 bDirty; // 22 internal dirty flag (should be sal_uInt8 m_bDirty; // 22 internal dirty flag (should be
// bool, but probably required to // bool, but probably required to
// be exactly one byte) // be exactly one byte)
sal_uInt8 cReserved[ 9 ]; // 23 sal_uInt8 m_cReserved[ 9 ]; // 23
sal_Int32 nFATSize; // 2C total number of FAT pages sal_Int32 m_nFATSize; // 2C total number of FAT pages
sal_Int32 nTOCstrm; // 30 starting page for the TOC stream sal_Int32 m_nTOCstrm; // 30 starting page for the TOC stream
sal_Int32 nReserved; // 34 sal_Int32 m_nReserved; // 34
sal_Int32 nThreshold; // 38 minimum file size for big data sal_Int32 m_nThreshold; // 38 minimum file size for big data
sal_Int32 nDataFAT; // 3C page # of 1st data FAT block sal_Int32 m_nDataFAT; // 3C page # of 1st data FAT block
sal_Int32 nDataFATSize; // 40 # of data fat blocks sal_Int32 m_nDataFATSize; // 40 # of data fat blocks
sal_Int32 nMasterChain; // 44 chain to the next master block sal_Int32 m_nMasterChain; // 44 chain to the next master block
sal_Int32 nMaster; // 48 # of additional master blocks sal_Int32 m_nMaster; // 48 # of additional master blocks
sal_Int32 nMasterFAT[ cFATPagesInHeader ]; // 4C first [cFATPagesInHeader] master FAT pages sal_Int32 m_nMasterFAT[ cFATPagesInHeader ]; // 4C first [cFATPagesInHeader] master FAT pages
public: public:
StgHeader(); StgHeader();
...@@ -62,20 +62,20 @@ public: ...@@ -62,20 +62,20 @@ public:
bool Load( SvStream& ); bool Load( SvStream& );
bool Store( StgIo& ); bool Store( StgIo& );
bool Check(); // check the signature and version bool Check(); // check the signature and version
sal_Int32 GetTOCStart() const { return nTOCstrm; } sal_Int32 GetTOCStart() const { return m_nTOCstrm; }
void SetTOCStart( sal_Int32 n ); void SetTOCStart( sal_Int32 n );
sal_Int32 GetDataFATStart() const { return nDataFAT; } sal_Int32 GetDataFATStart() const { return m_nDataFAT; }
void SetDataFATStart( sal_Int32 n ); void SetDataFATStart( sal_Int32 n );
sal_Int32 GetDataFATSize() const { return nDataFATSize; } sal_Int32 GetDataFATSize() const { return m_nDataFATSize; }
void SetDataFATSize( sal_Int32 n ); void SetDataFATSize( sal_Int32 n );
sal_Int32 GetThreshold() const { return nThreshold; } sal_Int32 GetThreshold() const { return m_nThreshold; }
short GetPageSize() const { return nPageSize; } short GetPageSize() const { return m_nPageSize; }
short GetDataPageSize() const { return nDataPageSize; } short GetDataPageSize() const { return m_nDataPageSize; }
sal_Int32 GetFATSize() const { return nFATSize; } sal_Int32 GetFATSize() const { return m_nFATSize; }
void SetFATSize( sal_Int32 n ); void SetFATSize( sal_Int32 n );
sal_Int32 GetFATChain() const { return nMasterChain; } sal_Int32 GetFATChain() const { return m_nMasterChain; }
void SetFATChain( sal_Int32 n ); void SetFATChain( sal_Int32 n );
sal_Int32 GetMasters() const { return nMaster; } sal_Int32 GetMasters() const { return m_nMaster; }
void SetMasters( sal_Int32 n ); void SetMasters( sal_Int32 n );
static short GetFAT1Size() { return cFATPagesInHeader; } static short GetFAT1Size() { return cFATPagesInHeader; }
sal_Int32 GetFATPage( short ) const; sal_Int32 GetFATPage( short ) const;
......
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