[Libreoffice-commits] core.git: 4 commits - connectivity/source extensions/source framework/inc framework/source sw/source

Stephan Bergmann sbergman at redhat.com
Wed Mar 19 01:48:16 PDT 2014


 connectivity/source/drivers/evoab2/NConnection.hxx |    2 
 extensions/source/update/check/updateinfo.hxx      |    4 
 framework/inc/tabwin/tabwindow.hxx                 |    4 
 framework/source/tabwin/tabwindow.cxx              |   87 +++++++++------------
 sw/source/core/table/swnewtable.cxx                |    2 
 5 files changed, 45 insertions(+), 54 deletions(-)

New commits:
commit 75122338eba5515786198b734d43577d727e3c67
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 19 09:21:58 2014 +0100

    libstdc++ abs vs std::abs confusion (-Werror,-Wabsolute-value)
    
    Change-Id: I55fdcdfb25a2d6456eff044eb4af8fa00905d6e8

diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 0186a22..b74132f 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -205,7 +205,7 @@ static SwTableBox* lcl_LeftBorder2Box( long nLeft, const SwTableLine* pLine )
             // HACK: It appears that rounding errors may result in positions not matching
             // exactly, so allow a little tolerance. This happens at least with merged cells
             // in the doc from fdo#38414 .
-            if( abs( nCurrLeft - nLeft ) <= ( nLeft / 1000 ))
+            if( std::abs( nCurrLeft - nLeft ) <= ( nLeft / 1000 ))
                 return pBox;
             if( nCurrLeft >= nLeft )
             {
commit d3bc04b780829902d2f68c743410ae599d144e8b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 19 08:58:57 2014 +0100

    loplugin:passstringbyref
    
    Change-Id: I0cbb49b29f0b1ee69f342d14d4560924e7bc5d11

diff --git a/connectivity/source/drivers/evoab2/NConnection.hxx b/connectivity/source/drivers/evoab2/NConnection.hxx
index 7c529ab..206e5df 100644
--- a/connectivity/source/drivers/evoab2/NConnection.hxx
+++ b/connectivity/source/drivers/evoab2/NConnection.hxx
@@ -68,7 +68,7 @@ namespace connectivity
             virtual void construct(const OUString& _rUrl,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo ) throw( ::com::sun::star::sdbc::SQLException);
 
             inline OString getPassword() { return m_aPassword; }
-            inline void         setPassword( OString aStr ) { m_aPassword = aStr; }
+            inline void         setPassword( OString const & aStr ) { m_aPassword = aStr; }
             // own methods
             inline const OEvoabDriver& getDriver() const { return m_rDriver; }
 
commit 42bfcce1231f8f91056ddbc3ad8771e57b540b52
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 19 08:40:48 2014 +0100

    loplugin:passstringbyref
    
    Change-Id: If08dab3956da5c0ee90d6a788f6f34a936e792d7

diff --git a/extensions/source/update/check/updateinfo.hxx b/extensions/source/update/check/updateinfo.hxx
index 67acd55..9896270 100644
--- a/extensions/source/update/check/updateinfo.hxx
+++ b/extensions/source/update/check/updateinfo.hxx
@@ -41,8 +41,8 @@ struct ReleaseNote
     sal_uInt8 Pos2;
     OUString URL2;
 
-    ReleaseNote(sal_uInt8 pos, const OUString aURL) : Pos(pos), URL(aURL), Pos2(0), URL2() {};
-    ReleaseNote(sal_uInt8 pos, const OUString aURL, sal_uInt8 pos2, const OUString aURL2) : Pos(pos), URL(aURL), Pos2(pos2), URL2(aURL2) {};
+    ReleaseNote(sal_uInt8 pos, const OUString& aURL) : Pos(pos), URL(aURL), Pos2(0), URL2() {};
+    ReleaseNote(sal_uInt8 pos, const OUString& aURL, sal_uInt8 pos2, const OUString& aURL2) : Pos(pos), URL(aURL), Pos2(pos2), URL2(aURL2) {};
 
     ReleaseNote(const ReleaseNote& rn) :Pos(rn.Pos), URL(rn.URL), Pos2(rn.Pos2), URL2(rn.URL2) {};
     ReleaseNote & operator=( const ReleaseNote& rn) { Pos=rn.Pos; URL=rn.URL; Pos2=rn.Pos2; URL2=rn.URL2; return *this; };
commit 4da1eb8404c726a22c2b43aff544d26ad5d42af6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Mar 18 17:45:07 2014 +0100

    Use SolarMutexGuard directly
    
    Change-Id: Ica2736fd9e249bfa88cfd8fd094af83deadf7737

diff --git a/framework/inc/tabwin/tabwindow.hxx b/framework/inc/tabwin/tabwindow.hxx
index f0dbce0..aa9c1c7 100644
--- a/framework/inc/tabwin/tabwindow.hxx
+++ b/framework/inc/tabwin/tabwindow.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_FRAMEWORK_INC_TABWIN_TABWINDOW_HXX
 
 #include <stdtypes.h>
-#include <threadhelp/threadhelpbase.hxx>
 #include <macros/generic.hxx>
 #include <macros/xinterface.hxx>
 #include <macros/xtypeprovider.hxx>
@@ -39,6 +38,7 @@
 #include <com/sun/star/awt/XSimpleTabController.hpp>
 #include <com/sun/star/awt/XTabListener.hpp>
 
+#include <cppuhelper/basemutex.hxx>
 #include <cppuhelper/propshlp.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 #include <cppuhelper/weak.hxx>
@@ -55,7 +55,7 @@ class TabWindow :  public ::com::sun::star::lang::XTypeProvider             ,
                    public ::com::sun::star::awt::XWindowListener            ,
                    public ::com::sun::star::awt::XTopWindowListener         ,
                    public ::com::sun::star::awt::XSimpleTabController       ,
-                   protected ThreadHelpBase                                 ,   // Struct for right initalization of mutex member! Must be first of baseclasses.
+                   private cppu::BaseMutex,
                    public ::cppu::OBroadcastHelper                          ,
                    public ::cppu::OPropertySetHelper                        ,   // => XPropertySet / XFastPropertySet / XMultiPropertySet
                    public ::cppu::OWeakObject
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index 99664b8..2a5ed23 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -20,8 +20,6 @@
 #include <tabwin/tabwindow.hxx>
 #include <properties.h>
 
-#include <threadhelp/guard.hxx>
-
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/awt/Toolkit.hpp>
 #include <com/sun/star/awt/PosSize.hpp>
@@ -85,9 +83,8 @@ PRIVATE_DEFINE_XSERVICEINFO_BASE        (   TabWindow
 
 DEFINE_INIT_SERVICE                     (   TabWindow, {} )
 
-TabWindow::TabWindow( const css::uno::Reference< css::uno::XComponentContext >& xContext ) :
-    ThreadHelpBase( &Application::GetSolarMutex() )
-    , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() )
+TabWindow::TabWindow( const css::uno::Reference< css::uno::XComponentContext >& xContext )
+    : ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aMutex )
     , ::cppu::OPropertySetHelper  ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) )
     , m_bInitialized( sal_False )
     , m_bDisposed( sal_False )
@@ -95,7 +92,7 @@ TabWindow::TabWindow( const css::uno::Reference< css::uno::XComponentContext >&
     , m_aTitlePropName( "Title" )
     , m_aPosPropName( "Position" )
     , m_xContext( xContext )
-    , m_aListenerContainer( m_aLock.getShareableOslMutex() )
+    , m_aListenerContainer( m_aMutex )
 {
 }
 
@@ -112,12 +109,12 @@ void TabWindow::implts_LayoutWindows() const
     const sal_Int32 nTabControlHeight = 30;
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     css::uno::Reference< css::awt::XDevice > xDevice( m_xTopWindow, css::uno::UNO_QUERY );
     css::uno::Reference< css::awt::XWindow > xWindow( m_xTopWindow, css::uno::UNO_QUERY );
     css::uno::Reference< css::awt::XWindow > xTabControlWindow( m_xTabControlWindow );
     css::uno::Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow );
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     // Convert relativ size to output size.
@@ -239,13 +236,13 @@ void TabWindow::implts_SendNotification( Notification eNotify, sal_Int32 ID, con
 IMPL_LINK( TabWindow, Activate, TabControl*, pTabControl )
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
 
     sal_Int32 nPageId = pTabControl->GetCurPageId();
 
     OUString aTitle = pTabControl->GetPageText( sal_uInt16( nPageId ));
     impl_SetTitle( aTitle );
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     implts_SendNotification( NOTIFY_ACTIVATED, nPageId );
@@ -256,9 +253,9 @@ IMPL_LINK( TabWindow, Activate, TabControl*, pTabControl )
 IMPL_LINK( TabWindow, Deactivate, TabControl*, pTabControl )
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     sal_Int32 nPageId = pTabControl->GetCurPageId();
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     implts_SendNotification( NOTIFY_DEACTIVATED, nPageId );
@@ -280,10 +277,10 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
     css::awt::Size aSize( aDefaultSize );
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexResettableGuard aLock;
     sal_Bool                                               bInitalized( m_bInitialized );
     css::uno::Reference< css::uno::XComponentContext >     xContext( m_xContext );
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     if ( !bInitalized )
@@ -352,9 +349,9 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
             if ( xTopWindow.is() )
             {
                 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-                aLock.lock();
+                aLock.reset();
                 m_bInitialized = sal_True;
-                aLock.unlock();
+                aLock.clear();
                 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
                 css::uno::Reference< css::awt::XWindow > xWindow( xTopWindow, css::uno::UNO_QUERY );
@@ -389,11 +386,11 @@ throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
                 if ( xContainerWindow.is() && xTabControl.is() )
                 {
                     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-                    aLock.lock();
+                    aLock.reset();
                     m_xTopWindow = xTopWindow;
                     m_xContainerWindow = xContainerWindow;
                     m_xTabControlWindow = xTabControl;
-                    aLock.unlock();
+                    aLock.clear();
                     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
                     xWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
@@ -436,14 +433,14 @@ void SAL_CALL TabWindow::dispose() throw (css::uno::RuntimeException, std::excep
     m_aListenerContainer.disposeAndClear( aEvent );
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexResettableGuard aLock;
     css::uno::Reference< css::awt::XWindow > xTabControlWindow( m_xTabControlWindow );
     css::uno::Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow );
     css::uno::Reference< css::awt::XTopWindow > xTopWindow( m_xTopWindow );
     m_xTabControlWindow.clear();
     m_xContainerWindow.clear();
     m_xTopWindow.clear();
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     css::uno::Reference< css::lang::XComponent > xComponent( xTabControlWindow, css::uno::UNO_QUERY );
@@ -459,9 +456,9 @@ void SAL_CALL TabWindow::dispose() throw (css::uno::RuntimeException, std::excep
         xComponent->dispose();
 
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    aLock.lock();
+    aLock.reset();
     m_bDisposed = sal_True;
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 }
 
@@ -469,10 +466,10 @@ void SAL_CALL TabWindow::addEventListener( const css::uno::Reference< css::lang:
 throw (css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     if ( m_bDisposed )
         return;
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener );
@@ -482,10 +479,10 @@ void SAL_CALL TabWindow::removeEventListener( const css::uno::Reference< css::la
 throw (css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     if ( m_bDisposed )
         return;
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener );
@@ -516,8 +513,7 @@ throw( css::uno::RuntimeException, std::exception )
 void SAL_CALL TabWindow::windowShown( const css::lang::EventObject& )
 throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexGuard g;
 
     TabControl* pTabControl = impl_GetTabControl( m_xTabControlWindow );
     if ( pTabControl )
@@ -534,8 +530,7 @@ throw( css::uno::RuntimeException, std::exception )
 void SAL_CALL TabWindow::windowHidden( const css::lang::EventObject& )
 throw( css::uno::RuntimeException, std::exception )
 {
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexGuard g;
     if ( m_xContainerWindow.is() )
     {
         Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
@@ -597,7 +592,7 @@ throw (css::uno::RuntimeException, std::exception)
 throw (css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -608,7 +603,7 @@ throw (css::uno::RuntimeException, std::exception)
     TabControl* pTabControl = impl_GetTabControl( m_xTabControlWindow );
     if ( pTabControl )
         pTabControl->InsertPage( sal_uInt16( nNextTabID ), aTitle );
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     implts_SendNotification( NOTIFY_INSERTED, nNextTabID );
@@ -620,7 +615,7 @@ void SAL_CALL TabWindow::removeTab( ::sal_Int32 ID )
 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -637,7 +632,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
             pTabControl->RemovePage( sal_uInt16( ID ));
             nCurTabId = pTabControl->GetCurPageId();
         }
-        aLock.unlock();
+        aLock.clear();
         /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
         implts_SendNotification( NOTIFY_REMOVED, ID );
@@ -653,7 +648,7 @@ void SAL_CALL TabWindow::setTabProps( ::sal_Int32 ID, const css::uno::Sequence<
 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -687,7 +682,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
             }
 
             /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-            aLock.unlock();
+            aLock.clear();
 
             css::uno::Sequence< css::beans::NamedValue > aNamedValueSeq = getTabProps( ID );
             implts_SendNotification( NOTIFY_CHANGED, ID, aNamedValueSeq );
@@ -698,8 +693,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
 css::uno::Sequence< css::beans::NamedValue > SAL_CALL TabWindow::getTabProps( ::sal_Int32 ID )
 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
 {
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexGuard g;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -725,7 +719,6 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
             return aSeq;
         }
     }
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     return aNamedValueSeq;
 }
@@ -734,7 +727,7 @@ void SAL_CALL TabWindow::activateTab( ::sal_Int32 ID )
 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -753,7 +746,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
             pTabControl->SelectTabPage( sal_uInt16( ID ));
             impl_SetTitle( aTitle );
 
-            aLock.unlock();
+            aLock.clear();
             /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
             if ( nOldID != TAB_PAGE_NOTFOUND )
@@ -766,8 +759,7 @@ throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::ex
 ::sal_Int32 SAL_CALL TabWindow::getActiveTabID()
 throw (css::uno::RuntimeException, std::exception)
 {
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexGuard g;
 
     if ( m_bDisposed )
         throw css::lang::DisposedException();
@@ -783,7 +775,6 @@ throw (css::uno::RuntimeException, std::exception)
     }
 
     return -1;
-    /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 }
 
 void SAL_CALL TabWindow::addTabListener(
@@ -791,10 +782,10 @@ void SAL_CALL TabWindow::addTabListener(
 throw (css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     if ( m_bDisposed )
         return;
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     m_aListenerContainer.addInterface(
@@ -805,10 +796,10 @@ void SAL_CALL TabWindow::removeTabListener( const css::uno::Reference< css::awt:
 throw (css::uno::RuntimeException, std::exception)
 {
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-    Guard aLock( m_aLock );
+    SolarMutexClearableGuard aLock;
     if ( m_bDisposed )
         return;
-    aLock.unlock();
+    aLock.clear();
     /* SAFE AREA ----------------------------------------------------------------------------------------------- */
 
     m_aListenerContainer.removeInterface(


More information about the Libreoffice-commits mailing list