diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2007-04-19 08:24:37 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2007-04-19 08:24:37 +0000 |
commit | 61283d594daf71651c67ce944d13dcb140821b29 (patch) | |
tree | 0d29549c503ecc2734e2c9c1f9768f9fdb08fe69 /sot | |
parent | bce47b4faa82136a669dea23edbe832d28102e5b (diff) |
INTEGRATION: CWS fwk64 (1.9.28); FILE MERGED
2007/04/02 10:02:57 mav 1.9.28.3: #i75574# allow commit for readonly stream since it is used on initialization
2007/04/02 10:01:37 mav 1.9.28.2: #i75574# allow commit for readonly stream since it is used on initialization
2007/03/21 10:00:25 mav 1.9.28.1: #i75574# do not allow to write to readonly streams; let even readonly substorage get correct bDirect flag
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/stgdir.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index dc13ecb53dc9..3a30141cc1b2 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -4,9 +4,9 @@ * * $RCSfile: stgdir.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: obo $ $Date: 2006-09-17 16:09:35 $ + * last change: $Author: ihi $ $Date: 2007-04-19 09:24:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -313,8 +313,10 @@ INT32 StgDirEntry::GetSize() BOOL StgDirEntry::SetSize( INT32 nNewSize ) { - if( !bDirect && !pTmpStrm && !Strm2Tmp() ) + if ( !( nMode & STREAM_WRITE ) + || !bDirect && !pTmpStrm && !Strm2Tmp() ) return FALSE; + if( nNewSize < nPos ) nPos = nNewSize; if( pTmpStrm ) @@ -405,13 +407,18 @@ INT32 StgDirEntry::Seek( INT32 nNew ) else { INT32 nSize = aEntry.GetSize(); + if( nNew < 0 ) nNew = nSize; - // enlarge? + + // try to enlarge, the readonly streams should not allow this if( nNew > nSize ) { - if( !SetSize( nNew ) ) + if ( !( nMode & STREAM_WRITE ) || !SetSize( nNew ) ) + { + OSL_ENSURE( nMode & STREAM_WRITE, "Trying to resize readonly stream by seeking, could be a wrong offset!" ); return nPos; + } else return Seek( nNew ); } @@ -441,7 +448,7 @@ INT32 StgDirEntry::Read( void* p, INT32 nLen ) INT32 StgDirEntry::Write( const void* p, INT32 nLen ) { - if( nLen <= 0 ) + if( nLen <= 0 || !( nMode & STREAM_WRITE ) ) return 0; // Was this stream committed internally and reopened in direct mode? @@ -524,6 +531,8 @@ void StgDirEntry::Copy( BaseStorageStream& rDest ) BOOL StgDirEntry::Commit() { + // OSL_ENSURE( nMode & STREAM_WRITE, "Trying to commit readonly stream!" ); + aSave = aEntry; BOOL bRes = TRUE; if( aEntry.GetType() == STG_STREAM ) |