From 04aafba860f613c20e7078d038cc83eb02de0b54 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 29 Apr 2021 12:24:31 +0200 Subject: loplugin:stringadd simplify some *StringBuffer operations pulled from a larger patch which I created with a more permissive variant of this plugin Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875 Tested-by: Jenkins Reviewed-by: Noel Grandin --- io/source/acceptor/acc_socket.cxx | 17 +++++------------ io/source/connector/ctr_socket.cxx | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) (limited to 'io') diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index 96d777fd0d8b..50a6db4bc13a 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -146,18 +146,11 @@ namespace io_acceptor { void SocketConnection::completeConnectionString() { - OUStringBuffer buf( 256 ); - buf.append( ",peerPort=" ); - buf.append( m_socket.getPeerPort() ); - buf.append( ",peerHost=" ); - buf.append( m_socket.getPeerHost( ) ); - - buf.append( ",localPort=" ); - buf.append( m_socket.getLocalPort() ); - buf.append( ",localHost=" ); - buf.append( m_socket.getLocalHost() ); - - m_sDescription += buf; + m_sDescription += + ",peerPort=" + OUString::number(m_socket.getPeerPort()) + + ",peerHost=" + m_socket.getPeerHost( ) + + ",localPort=" + OUString::number( m_socket.getLocalPort() ) + + ",localHost=" + m_socket.getLocalHost(); } sal_Int32 SocketConnection::read( Sequence < sal_Int8 > & aReadBytes , sal_Int32 nBytesToRead ) diff --git a/io/source/connector/ctr_socket.cxx b/io/source/connector/ctr_socket.cxx index 164cd4f6f31c..98b4131be407 100644 --- a/io/source/connector/ctr_socket.cxx +++ b/io/source/connector/ctr_socket.cxx @@ -105,18 +105,11 @@ namespace stoc_connector { nPort = m_socket.getPeerPort(); - OUStringBuffer buf( 256 ); - buf.append( ",peerPort=" ); - buf.append( nPort ); - buf.append( ",peerHost=" ); - buf.append( m_socket.getPeerHost() ); - - buf.append( ",localPort=" ); - buf.append( nPort ); - buf.append( ",localHost=" ); - buf.append( m_socket.getLocalHost( ) ); - - m_sDescription += buf; + m_sDescription += + ",peerPort=" + OUString::number( nPort ) + + ",peerHost=" + m_socket.getPeerHost() + + ",localPort=" + OUString::number( nPort ) + + ",localHost=" + m_socket.getLocalHost( ); } sal_Int32 SocketConnection::read( Sequence < sal_Int8 > & aReadBytes , sal_Int32 nBytesToRead ) -- cgit