Kaydet (Commit) 8e2293e0 authored tarafından László Németh's avatar László Németh

tdf#89319 remove redundant file seekings in XLS export

Normally StartRecord() is called with closed records and with end position
of the stream set by EndRecord(), so the mrStrm.Seek( STREAM_SEEK_TO_END )
in the InitRecord() is a redundant call. The patch removes this call,
and sets it only for the non redundant cases: when there is an unclosed
record in StartRecord() or a continue record in StartContinue().

Change-Id: Iecbcaf01cbfe6094fa73d5ed41dba5f01417edb3
üst ee3f2409
...@@ -109,6 +109,8 @@ void XclExpStream::StartRecord( sal_uInt16 nRecId, sal_Size nRecSize ) ...@@ -109,6 +109,8 @@ void XclExpStream::StartRecord( sal_uInt16 nRecId, sal_Size nRecSize )
DisableEncryption(); DisableEncryption();
mnMaxContSize = mnCurrMaxSize = mnMaxRecSize; mnMaxContSize = mnCurrMaxSize = mnMaxRecSize;
mnPredictSize = nRecSize; mnPredictSize = nRecSize;
if ( mbInRec )
mrStrm.Seek( STREAM_SEEK_TO_END );
mbInRec = true; mbInRec = true;
InitRecord( nRecId ); InitRecord( nRecId );
SetSliceSize( 0 ); SetSliceSize( 0 );
...@@ -380,7 +382,7 @@ sal_uInt64 XclExpStream::SetSvStreamPos(sal_uInt64 const nPos) ...@@ -380,7 +382,7 @@ sal_uInt64 XclExpStream::SetSvStreamPos(sal_uInt64 const nPos)
void XclExpStream::InitRecord( sal_uInt16 nRecId ) void XclExpStream::InitRecord( sal_uInt16 nRecId )
{ {
mrStrm.Seek( STREAM_SEEK_TO_END ); OSL_ENSURE( mrStrm.remainingSize() == 0, "XclExpStream::InitRecord - not in end position" );
mrStrm.WriteUInt16( nRecId ); mrStrm.WriteUInt16( nRecId );
mnLastSizePos = mrStrm.Tell(); mnLastSizePos = mrStrm.Tell();
...@@ -417,6 +419,7 @@ void XclExpStream::StartContinue() ...@@ -417,6 +419,7 @@ void XclExpStream::StartContinue()
UpdateRecSize(); UpdateRecSize();
mnCurrMaxSize = mnMaxContSize; mnCurrMaxSize = mnMaxContSize;
mnPredictSize -= mnCurrSize; mnPredictSize -= mnCurrSize;
mrStrm.Seek( STREAM_SEEK_TO_END );
InitRecord( EXC_ID_CONT ); InitRecord( EXC_ID_CONT );
} }
......
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