diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2002-09-18 09:03:06 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2002-09-18 09:03:06 +0000 |
commit | 8ff54086743436e539883ef692925a31332a7752 (patch) | |
tree | 7733ab1e150b4aa6604dbd05ff26a84939ab171c /io | |
parent | 70ef9f2719a41d152f21e02ba0e7ab775de8eafb (diff) |
#102869# available and skipBytes now throw NotConnected exceptions, in case the input stream has been closed before
Diffstat (limited to 'io')
-rw-r--r-- | io/source/stm/omark.cxx | 18 | ||||
-rw-r--r-- | io/source/stm/opipe.cxx | 17 |
2 files changed, 30 insertions, 5 deletions
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx index 085813ac14d9..4f3254dd9888 100644 --- a/io/source/stm/omark.cxx +++ b/io/source/stm/omark.cxx @@ -2,9 +2,9 @@ * * $RCSfile: omark.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2002-07-09 15:15:15 $ + * last change: $Author: jbu $ $Date: 2002-09-18 10:02:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -243,7 +243,19 @@ void OMarkableOutputStream::flush(void) BufferSizeExceededException, RuntimeException) { - // Markable must ignore flush ! + Reference< XOutputStream > output; + { + MutexGuard guard( m_mutex ); + output = m_output; + } + + // Markable cannot flush buffered data, because the data may get rewritten, + // however one can forward the flush to the chained stream to give it + // a chance to write data buffered in the chained stream. + if( output.is() ) + { + output->flush(); + } } void OMarkableOutputStream::closeOutput(void) diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx index 4b3d8c283f72..7909306a6f08 100644 --- a/io/source/stm/opipe.cxx +++ b/io/source/stm/opipe.cxx @@ -2,9 +2,9 @@ * * $RCSfile: opipe.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jbu $ $Date: 2002-07-09 15:15:17 $ + * last change: $Author: jbu $ $Date: 2002-09-18 10:03:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -282,6 +282,13 @@ void OPipeImpl::skipBytes(sal_Int32 nBytesToSkip) RuntimeException ) { MutexGuard guard( m_mutexAccess ); + if( m_bInputStreamClosed ) + { + throw NotConnectedException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Pipe::skipBytes NotConnectedException" ) ), + *this ); + } + if( nBytesToSkip + m_nBytesToSkip > MAX_BUFFER_SIZE || 0 > nBytesToSkip + m_nBytesToSkip ) { throw BufferSizeExceededException( @@ -301,6 +308,12 @@ sal_Int32 OPipeImpl::available(void) RuntimeException ) { MutexGuard guard( m_mutexAccess ); + if( m_bInputStreamClosed ) + { + throw NotConnectedException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "Pipe::available NotConnectedException" ) ), + *this ); + } checkInvariant(); return m_pFIFO->getSize(); } |