[Libreoffice-commits] core.git: embeddedobj/source

Stephan Bergmann sbergman at redhat.com
Sat Sep 30 21:34:19 UTC 2017


 embeddedobj/source/msole/oleembed.cxx   |   31 ++++++++++++++-----------------
 embeddedobj/source/msole/olepersist.cxx |   16 ++++++++--------
 2 files changed, 22 insertions(+), 25 deletions(-)

New commits:
commit d2978f03bd57e5fe530eb55accc8c5f39b602ff2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Sep 30 22:43:59 2017 +0200

    loplugin:flatten (clang-cl, embeddedobj)
    
    Change-Id: I842ab53693f87fc9b5151ce9b8b385a9dbd53e11
    Reviewed-on: https://gerrit.libreoffice.org/42977
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index e8139480b39d..43dcfa865662 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -63,26 +63,23 @@ using namespace ::com::sun::star;
 
 void OleEmbeddedObject::SwitchComponentToRunningState_Impl()
 {
-    if ( m_pOleComponent )
+    if ( !m_pOleComponent )
     {
-        try
-        {
-            m_pOleComponent->RunObject();
-        }
-        catch( const embed::UnreachableStateException& )
-        {
-            GetRidOfComponent();
-            throw;
-        }
-        catch( const embed::WrongStateException& )
-        {
-            GetRidOfComponent();
-            throw;
-        }
+        throw embed::UnreachableStateException();
     }
-    else
+    try
     {
-        throw embed::UnreachableStateException();
+        m_pOleComponent->RunObject();
+    }
+    catch( const embed::UnreachableStateException& )
+    {
+        GetRidOfComponent();
+        throw;
+    }
+    catch( const embed::WrongStateException& )
+    {
+        GetRidOfComponent();
+        throw;
     }
 }
 
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index b8a42b373bc2..92a493ed59b2 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -1013,16 +1013,16 @@ void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream >
 
     // TODO: use bStoreVisReplace
 
-    if ( xTempInStream.is() )
+    if ( !xTempInStream.is() )
     {
-        // write all the contents to XOutStream
-        uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY_THROW );
-        xTrunc->truncate();
-
-        ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
-    }
-    else
         throw io::IOException(); // TODO:
+    }
+
+    // write all the contents to XOutStream
+    uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY_THROW );
+    xTrunc->truncate();
+
+    ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
 
     // TODO: should the view replacement be in the stream ???
     //       probably it must be specified on storing


More information about the Libreoffice-commits mailing list