io/source/stm/odata.cxx        |   75 ++++++++++++++++++++---------------------
 io/source/stm/opump.cxx        |   22 ++++++------
 io/source/stm/streamhelper.cxx |   29 ++++++++-------
 3 files changed, 63 insertions(+), 63 deletions(-)

New commits:
commit 33b3439e65bc22c2d149eb18c3d7d9da43699246
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Apr 7 14:19:30 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Apr 7 15:37:24 2020 +0200

    loplugin:flatten in io
    
    Change-Id: I4f4dbbd4ce279cb25a8e4deba1967b5c23ce1385
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91818
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 6ffd12c89387..3e802b2d37a5 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -907,30 +907,29 @@ void OObjectOutputStream::writeObject( const Reference< 
XPersistObject > & xPObj
 
 void OObjectOutputStream::connectToMarkable()
 {
-    if( ! m_bValidMarkable ) {
-        if( ! m_bValidStream )
+    if(  m_bValidMarkable )
+        return;
+
+    if( ! m_bValidStream )
+        throw NotConnectedException();
+
+    // find the markable stream !
+    Reference< XInterface > rTry(m_output);
+    while( true ) {
+        if( ! rTry.is() )
         {
             throw NotConnectedException();
         }
-
-        // find the markable stream !
-        Reference< XInterface > rTry(m_output);
-        while( true ) {
-            if( ! rTry.is() )
-            {
-                throw NotConnectedException();
-            }
-            Reference < XMarkableStream > markable( rTry , UNO_QUERY );
-            if( markable.is() )
-            {
-                m_rMarkable = markable;
-                break;
-            }
-            Reference < XActiveDataSource > source( rTry , UNO_QUERY );
-            rTry = source;
+        Reference < XMarkableStream > markable( rTry , UNO_QUERY );
+        if( markable.is() )
+        {
+            m_rMarkable = markable;
+            break;
         }
-        m_bValidMarkable = true;
+        Reference < XActiveDataSource > source( rTry , UNO_QUERY );
+        rTry = source;
     }
+    m_bValidMarkable = true;
 }
 
 
@@ -1180,30 +1179,30 @@ Reference< XPersistObject >  
OObjectInputStream::readObject()
 
 void OObjectInputStream::connectToMarkable()
 {
-    if( ! m_bValidMarkable ) {
-        if( ! m_bValidStream )
+    if(  m_bValidMarkable )        return;
+
+    if( ! m_bValidStream )
+    {
+        throw NotConnectedException( );
+    }
+
+    // find the markable stream !
+    Reference< XInterface > rTry(m_input);
+    while( true ) {
+        if( ! rTry.is() )
         {
             throw NotConnectedException( );
         }
-
-        // find the markable stream !
-        Reference< XInterface > rTry(m_input);
-        while( true ) {
-            if( ! rTry.is() )
-            {
-                throw NotConnectedException( );
-            }
-            Reference<  XMarkableStream > markable( rTry , UNO_QUERY );
-            if( markable.is() )
-            {
-                m_rMarkable = markable;
-                break;
-            }
-            Reference < XActiveDataSink > sink( rTry , UNO_QUERY );
-            rTry = sink;
+        Reference<  XMarkableStream > markable( rTry , UNO_QUERY );
+        if( markable.is() )
+        {
+            m_rMarkable = markable;
+            break;
         }
-        m_bValidMarkable = true;
+        Reference < XActiveDataSink > sink( rTry , UNO_QUERY );
+        rTry = sink;
     }
+    m_bValidMarkable = true;
 }
 
 sal_Int32 OObjectInputStream::createMark()
diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx
index 29f09bdd3e81..cba66d3c50fc 100644
--- a/io/source/stm/opump.cxx
+++ b/io/source/stm/opump.cxx
@@ -146,19 +146,19 @@ void Pump::fireClose()
         }
     }
 
-    if( bFire )
+    if( !bFire )
+        return;
+
+    OInterfaceIteratorHelper iter( m_cnt );
+    while( iter.hasMoreElements() )
     {
-        OInterfaceIteratorHelper iter( m_cnt );
-        while( iter.hasMoreElements() )
+        try
         {
-            try
-            {
-                static_cast< XStreamListener * > ( iter.next() )->closed( );
-            }
-            catch ( const RuntimeException & )
-            {
-                
TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: unexpected 
exception during calling listeners");
-            }
+            static_cast< XStreamListener * > ( iter.next() )->closed( );
+        }
+        catch ( const RuntimeException & )
+        {
+            TOOLS_WARN_EXCEPTION("io.streams","com.sun.star.comp.stoc.Pump: 
unexpected exception during calling listeners");
         }
     }
 }
diff --git a/io/source/stm/streamhelper.cxx b/io/source/stm/streamhelper.cxx
index 2eace1e70d4c..4a2df5891be1 100644
--- a/io/source/stm/streamhelper.cxx
+++ b/io/source/stm/streamhelper.cxx
@@ -68,21 +68,22 @@ void MemRingBuffer::resizeBuffer( sal_Int32 nMinSize )
         nNewLen = m_nBufferLen;
     }
 
-    if( nNewLen != m_nBufferLen ) {
-        if (auto p = static_cast<sal_Int8*>(std::realloc(m_p, nNewLen)))
-            m_p = p;
-        else
-        {
-            throw css::io::BufferSizeExceededException(
-                "MemRingBuffer::resizeBuffer BufferSizeExceededException");
-        }
-
-        if( m_nStart + m_nOccupiedBuffer > m_nBufferLen ) {
-            memmove( &( m_p[m_nStart+(nNewLen-m_nBufferLen)]) , 
&(m_p[m_nStart]) , m_nBufferLen - m_nStart );
-            m_nStart += nNewLen - m_nBufferLen;
-        }
-        m_nBufferLen = nNewLen;
+    if( nNewLen == m_nBufferLen )
+        return;
+
+    auto p = static_cast<sal_Int8*>(std::realloc(m_p, nNewLen));
+    if (!p)
+        throw css::io::BufferSizeExceededException(
+            "MemRingBuffer::resizeBuffer BufferSizeExceededException");
+
+    m_p = p;
+
+
+    if( m_nStart + m_nOccupiedBuffer > m_nBufferLen ) {
+        memmove( &( m_p[m_nStart+(nNewLen-m_nBufferLen)]) , &(m_p[m_nStart]) , 
m_nBufferLen - m_nStart );
+        m_nStart += nNewLen - m_nBufferLen;
     }
+    m_nBufferLen = nNewLen;
 }
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to