summaryrefslogtreecommitdiffstats
path: root/io
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 14:19:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-07 15:37:24 +0200
commit33b3439e65bc22c2d149eb18c3d7d9da43699246 (patch)
tree1789ed50b1c08421dcafb55ee868b1f2324d12e7 /io
parentRevert "UITest: Actually time-out the wait" (diff)
downloadcore-33b3439e65bc22c2d149eb18c3d7d9da43699246.tar.gz
core-33b3439e65bc22c2d149eb18c3d7d9da43699246.zip
loplugin:flatten in io
Change-Id: I4f4dbbd4ce279cb25a8e4deba1967b5c23ce1385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91818 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'io')
-rw-r--r--io/source/stm/odata.cxx75
-rw-r--r--io/source/stm/opump.cxx22
-rw-r--r--io/source/stm/streamhelper.cxx29
3 files changed, 63 insertions, 63 deletions
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;
}