From ebc0a15515c2e29259a7e229cfbdfb5d26fc3006 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 28 May 2014 12:50:02 +0200 Subject: remove more unnecesary OUString constructor use when throwing exceptions Change-Id: I6edfb6b6745499f802b0e3c0e096a36fb7c32aac --- io/source/stm/omark.cxx | 10 +++++----- io/source/stm/opipe.cxx | 18 +++++++++--------- io/source/stm/opump.cxx | 10 +++------- 3 files changed, 17 insertions(+), 21 deletions(-) (limited to 'io') diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx index bd026b498255..138117a96023 100644 --- a/io/source/stm/omark.cxx +++ b/io/source/stm/omark.cxx @@ -631,7 +631,7 @@ sal_Int32 OMarkableInputStream::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 } else { throw NotConnectedException( - OUString("MarkableInputStream::readBytes NotConnectedException") , + "MarkableInputStream::readBytes NotConnectedException", *this ); } return nBytesRead; @@ -693,7 +693,7 @@ sal_Int32 OMarkableInputStream::readSomeBytes(Sequence< sal_Int8 >& aData, sal_I else { throw NotConnectedException( - OUString("MarkableInputStream::readSomeBytes NotConnectedException") , + "MarkableInputStream::readSomeBytes NotConnectedException", *this ); } return nBytesRead; @@ -709,7 +709,7 @@ void OMarkableInputStream::skipBytes(sal_Int32 nBytesToSkip) { if ( nBytesToSkip < 0 ) throw BufferSizeExceededException( - OUString("precondition not met: XInputStream::skipBytes: non-negative integer required!"), + "precondition not met: XInputStream::skipBytes: non-negative integer required!", *this ); @@ -728,7 +728,7 @@ sal_Int32 OMarkableInputStream::available(void) throw (NotConnectedException, Ru else { throw NotConnectedException( - OUString("MarkableInputStream::available NotConnectedException") , + "MarkableInputStream::available NotConnectedException", *this ); } @@ -754,7 +754,7 @@ void OMarkableInputStream::closeInput(void) throw (NotConnectedException, Runtim } else { throw NotConnectedException( - OUString("MarkableInputStream::closeInput NotConnectedException") , + "MarkableInputStream::closeInput NotConnectedException", *this ); } } diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx index a6871c43abce..7d4f9159004b 100644 --- a/io/source/stm/opipe.cxx +++ b/io/source/stm/opipe.cxx @@ -153,7 +153,7 @@ sal_Int32 OPipeImpl::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRe if( m_bInputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::readBytes NotConnectedException"), + "Pipe::readBytes NotConnectedException", *this ); } sal_Int32 nOccupiedBufferLen = m_pFIFO->getSize(); @@ -192,7 +192,7 @@ sal_Int32 OPipeImpl::readSomeBytes(Sequence< sal_Int8 >& aData, sal_Int32 nMaxBy if( m_bInputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::readSomeBytes NotConnectedException"), + "Pipe::readSomeBytes NotConnectedException", *this ); } if( m_pFIFO->getSize() ) @@ -224,7 +224,7 @@ void OPipeImpl::skipBytes(sal_Int32 nBytesToSkip) if( m_bInputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::skipBytes NotConnectedException"), + "Pipe::skipBytes NotConnectedException", *this ); } @@ -233,7 +233,7 @@ void OPipeImpl::skipBytes(sal_Int32 nBytesToSkip) > std::numeric_limits< sal_Int32 >::max() - m_nBytesToSkip) ) { throw BufferSizeExceededException( - OUString("Pipe::skipBytes BufferSizeExceededException"), + "Pipe::skipBytes BufferSizeExceededException", *this ); } m_nBytesToSkip += nBytesToSkip; @@ -252,7 +252,7 @@ sal_Int32 OPipeImpl::available(void) if( m_bInputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::available NotConnectedException"), + "Pipe::available NotConnectedException", *this ); } return m_pFIFO->getSize(); @@ -287,14 +287,14 @@ void OPipeImpl::writeBytes(const Sequence< sal_Int8 >& aData) if( m_bOutputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::writeBytes NotConnectedException (outputstream)"), + "Pipe::writeBytes NotConnectedException (outputstream)", *this ); } if( m_bInputStreamClosed ) { throw NotConnectedException( - OUString("Pipe::writeBytes NotConnectedException (inputstream)"), + "Pipe::writeBytes NotConnectedException (inputstream)", *this ); } @@ -325,13 +325,13 @@ void OPipeImpl::writeBytes(const Sequence< sal_Int8 >& aData) catch ( I_FIFO_OutOfBoundsException & ) { throw BufferSizeExceededException( - OUString("Pipe::writeBytes BufferSizeExceededException"), + "Pipe::writeBytes BufferSizeExceededException", *this ); } catch ( I_FIFO_OutOfMemoryException & ) { throw BufferSizeExceededException( - OUString("Pipe::writeBytes BufferSizeExceededException"), + "Pipe::writeBytes BufferSizeExceededException", *this ); } diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx index d5c010e66356..51b4bb83226d 100644 --- a/io/source/stm/opump.cxx +++ b/io/source/stm/opump.cxx @@ -262,18 +262,14 @@ void Pump::run() if( ! rInput.is() ) { - NotConnectedException exception( - OUString("no input stream set") , Reference((OWeakObject*)this) ); - throw exception; + throw NotConnectedException( "no input stream set", (OWeakObject*)this ); } Sequence< sal_Int8 > aData; while( rInput->readSomeBytes( aData, 65536 ) ) { if( ! rOutput.is() ) { - NotConnectedException exception( - OUString("no output stream set") , Reference( (OWeakObject*)this) ); - throw exception; + throw NotConnectedException( "no output stream set", (OWeakObject*)this ); } rOutput->writeBytes( aData ); osl_yieldThread(); @@ -372,7 +368,7 @@ void Pump::start() throw( RuntimeException, std::exception ) else { throw RuntimeException( - OUString("Pump::start Couldn't create worker thread"), + "Pump::start Couldn't create worker thread", *this); } } -- cgit