Kaydet (Commit) dee0a619 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Revert "reduce unnecessary realloc'ing"

This reverts commit 9f6e6fab, which is wrong, as
it would cause the functions to now try to read aReadBytes.getLength() bytes if
that is initially larger than nBytesToRead.
üst c076babe
...@@ -198,12 +198,13 @@ namespace io_acceptor { ...@@ -198,12 +198,13 @@ namespace io_acceptor {
{ {
notifyListeners(this, &_started, callStarted); notifyListeners(this, &_started, callStarted);
if( aReadBytes.getLength() < nBytesToRead ) if( aReadBytes.getLength() != nBytesToRead )
{ {
aReadBytes.realloc( nBytesToRead ); aReadBytes.realloc( nBytesToRead );
} }
sal_Int32 i = m_socket.read( aReadBytes.getArray() , aReadBytes.getLength() ); sal_Int32 i = 0;
i = m_socket.read( aReadBytes.getArray() , aReadBytes.getLength() );
if(i != nBytesToRead) if(i != nBytesToRead)
{ {
...@@ -219,10 +220,7 @@ namespace io_acceptor { ...@@ -219,10 +220,7 @@ namespace io_acceptor {
throw ioException; throw ioException;
} }
if( i < aReadBytes.getLength() )
{
aReadBytes.realloc( i );
}
return i; return i;
} }
else else
......
...@@ -49,16 +49,11 @@ namespace stoc_connector { ...@@ -49,16 +49,11 @@ namespace stoc_connector {
{ {
if( ! m_nStatus ) if( ! m_nStatus )
{ {
if( aReadBytes.getLength() < nBytesToRead ) if( aReadBytes.getLength() != nBytesToRead )
{ {
aReadBytes.realloc( nBytesToRead ); aReadBytes.realloc( nBytesToRead );
} }
sal_Int32 n = m_pipe.read( aReadBytes.getArray() , aReadBytes.getLength() ); return m_pipe.read( aReadBytes.getArray() , aReadBytes.getLength() );
if( n < aReadBytes.getLength() )
{
aReadBytes.realloc( n );
}
return n;
} }
else { else {
throw IOException(); throw IOException();
......
...@@ -123,7 +123,7 @@ namespace stoc_connector { ...@@ -123,7 +123,7 @@ namespace stoc_connector {
{ {
notifyListeners(this, &_started, callStarted); notifyListeners(this, &_started, callStarted);
if( aReadBytes.getLength() < nBytesToRead ) if( aReadBytes.getLength() != nBytesToRead )
{ {
aReadBytes.realloc( nBytesToRead ); aReadBytes.realloc( nBytesToRead );
} }
...@@ -143,10 +143,7 @@ namespace stoc_connector { ...@@ -143,10 +143,7 @@ namespace stoc_connector {
throw ioException; throw ioException;
} }
if( i < aReadBytes.getLength() )
{
aReadBytes.realloc( i );
}
return i; return i;
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment