diff options
author | Mikhail Voitenko <mav@openoffice.org> | 2002-02-21 12:00:06 +0000 |
---|---|---|
committer | Mikhail Voitenko <mav@openoffice.org> | 2002-02-21 12:00:06 +0000 |
commit | ff0232f8a839314b7a47111334de1e435f5ee926 (patch) | |
tree | 07bb17c23cc405318759d18b862e0a5e2c20c941 /sot | |
parent | 19c4444d024b66666544498b65ac672fd12cacb7 (diff) |
#97690# resize stream in case of overjumping seek
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 72f28fa31dd5..67ddd412bd48 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ucbstorage.cxx,v $ * - * $Revision: 1.65 $ + * $Revision: 1.66 $ * - * last change: $Author: mav $ $Date: 2002-02-19 17:05:30 $ + * last change: $Author: mav $ $Date: 2002-02-21 13:00:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1069,13 +1069,25 @@ ULONG UCBStorageStream_Impl::SeekPos( ULONG nPos ) // the temp stream pointer points to the end now aResult = m_pStream->Tell(); - if( m_bSourceRead && aResult < nPos ) + if( aResult < nPos ) { - aResult += ReadSourceWriteTemporary( nPos - aResult ); - if( aResult < nPos ) - m_bSourceRead = FALSE; + if( m_bSourceRead ) + { + aResult += ReadSourceWriteTemporary( nPos - aResult ); + if( aResult < nPos ) + m_bSourceRead = FALSE; + + DBG_ASSERT( aResult == m_pStream->Tell(), "Error in stream arithmetic!\n" ); + } - DBG_ASSERT( aResult == m_pStream->Tell(), "Error in stream arithmetic!\n" ); + if( !m_bSourceRead ) + { + // it means that all the Source stream was copied already + // but the required position still was not reached + m_pStream->SetStreamSize( nPos ); + aResult = m_pStream->Seek( STREAM_SEEK_TO_END ); + DBG_ASSERT( aResult == nPos, "Error in stream arithmetic!\n" ); + } } } } |