summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-01 12:24:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-02 07:48:21 +0000
commitc0f9bdd3e644e3ebf690aff9eb1aeec4f16dbf27 (patch)
treee5bb6d31a17587452dde579803286f68ffc73672 /io
parent52360bf8dd567598593cb212ac85f0c919315618 (diff)
unnecessary use of OUStringBuffer in throwing exceptions
Change-Id: Iec1473264426f19c31e72260dfce9494389e474f Reviewed-on: https://gerrit.libreoffice.org/33788 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'io')
-rw-r--r--io/source/acceptor/acc_socket.cxx27
-rw-r--r--io/source/stm/omark.cxx48
2 files changed, 29 insertions, 46 deletions
diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx
index 6d6a7b17bf5e..e1cf5a3f3664 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -307,34 +307,29 @@ namespace io_acceptor {
{
if( ! m_addr.setPort( m_nPort ) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - invalid tcp/ip port " );
- message.append( (sal_Int32) m_nPort );
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - invalid tcp/ip port " +
+ OUString::number( m_nPort ));
}
if( ! m_addr.setHostname( m_sSocketName.pData ) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - invalid host " );
- message.append( m_sSocketName );
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - invalid host " + m_sSocketName );
}
m_socket.setOption( osl_Socket_OptionReuseAddr, 1);
if(! m_socket.bind(m_addr) )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - couldn't bind on " );
- message.append( m_sSocketName ).append( ":" ).append((sal_Int32)m_nPort);
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - couldn't bind on " +
+ m_sSocketName + ":" + OUString::number(m_nPort));
}
if(! m_socket.listen() )
{
- OUStringBuffer message( 128 );
- message.append( "acc_socket.cxx:SocketAcceptor::init - error - can't listen on " );
- message.append( m_sSocketName ).append( ":" ).append( (sal_Int32) m_nPort);
- throw ConnectionSetupException( message.makeStringAndClear() );
+ throw ConnectionSetupException(
+ "acc_socket.cxx:SocketAcceptor::init - error - can't listen on " +
+ m_sSocketName + ":" + OUString::number(m_nPort) );
}
}
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index dc9fbb8b260a..551012f9b483 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -212,11 +212,9 @@ void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( Mark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::deleteMark unknown mark (" );
- buf.append( Mark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
+ *this, 0);
}
else {
m_mapMarks.erase( ii );
@@ -230,11 +228,9 @@ void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( nMark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::jumpToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0);
}
else {
m_nCurrentPos = (*ii).second;
@@ -256,11 +252,9 @@ sal_Int32 OMarkableOutputStream::offsetToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableOutputStream::offsetToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this, 0);
+ throw IllegalArgumentException(
+ "MarkableOutputStream::offsetToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0);
}
return m_nCurrentPos - (*ii).second;
}
@@ -650,11 +644,9 @@ void OMarkableInputStream::deleteMark(sal_Int32 Mark)
map<sal_Int32,sal_Int32,less<sal_Int32> >::iterator ii = m_mapMarks.find( Mark );
if( ii == m_mapMarks.end() ) {
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::deleteMark unknown mark (" );
- buf.append( Mark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
+ *this , 0 );
}
else {
m_mapMarks.erase( ii );
@@ -669,11 +661,9 @@ void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::jumpToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this , 0 );
}
else
{
@@ -695,11 +685,9 @@ sal_Int32 OMarkableInputStream::offsetToMark(sal_Int32 nMark)
if( ii == m_mapMarks.end() )
{
- OUStringBuffer buf( 128 );
- buf.append( "MarkableInputStream::offsetToMark unknown mark (" );
- buf.append( nMark );
- buf.append( ")");
- throw IllegalArgumentException( buf.makeStringAndClear(), *this , 0 );
+ throw IllegalArgumentException(
+ "MarkableInputStream::offsetToMark unknown mark (" + OUString::number(nMark) + ")",
+ *this, 0 );
}
return m_nCurrentPos - (*ii).second;
}