summaryrefslogtreecommitdiff
path: root/io/source/acceptor/acc_socket.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-02-21 14:15:39 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-01 07:32:28 +0000
commit9f6e6fabcd5718e0b65437c5ce398e520f47aae1 (patch)
tree63c5667782271ec4faf2e0df0f844a1d4dd9aebe /io/source/acceptor/acc_socket.cxx
parente097e419ee5c47239262a16526f4e37775fb2004 (diff)
reduce unnecessary realloc'ing
Change-Id: Ic597814706573576a0ba330a69a7a38aa97e5224 Reviewed-on: https://gerrit.libreoffice.org/23694 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'io/source/acceptor/acc_socket.cxx')
-rw-r--r--io/source/acceptor/acc_socket.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx
index b1a30a15a82f..3fe29f3c0596 100644
--- a/io/source/acceptor/acc_socket.cxx
+++ b/io/source/acceptor/acc_socket.cxx
@@ -198,13 +198,12 @@ namespace io_acceptor {
{
notifyListeners(this, &_started, callStarted);
- if( aReadBytes.getLength() != nBytesToRead )
+ if( aReadBytes.getLength() < nBytesToRead )
{
aReadBytes.realloc( nBytesToRead );
}
- sal_Int32 i = 0;
- i = m_socket.read( aReadBytes.getArray() , aReadBytes.getLength() );
+ sal_Int32 i = m_socket.read( aReadBytes.getArray() , aReadBytes.getLength() );
if(i != nBytesToRead)
{
@@ -220,7 +219,10 @@ namespace io_acceptor {
throw ioException;
}
-
+ if( i < aReadBytes.getLength() )
+ {
+ aReadBytes.realloc( i );
+ }
return i;
}
else