[Libreoffice-commits] core.git: 2 commits - sw/inc sw/qa sw/source

Stephan Bergmann sbergman at redhat.com
Mon Mar 23 02:54:51 PDT 2015


 sw/inc/calbck.hxx                |   47 +++++++++++++++++++--------------------
 sw/qa/core/uwriter.cxx           |    2 -
 sw/source/core/fields/expfld.cxx |    2 -
 3 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 5aaf17d2f6f2762fd34108a49d04de7b8e3090eb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Mar 23 10:50:37 2015 +0100

    -Werror,-Winconsistent-missing-override
    
    Change-Id: Iad15e1e9df25fdace5ca17dde71eb1e9a25ee13e

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 5818d9b..1e0f985 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1404,7 +1404,7 @@ namespace
         TestClient() : m_nModifyCount(0), m_nNotifyCount(0) {};
         virtual void Modify( const SfxPoolItem*, const SfxPoolItem*) SAL_OVERRIDE
         { ++m_nModifyCount; }
-        virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
+        virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) SAL_OVERRIDE
         {
             if(typeid(TestHint) == typeid(rHint))
                 ++m_nNotifyCount;
commit 5fb7f222f51b93a9dfffa0fe211a5b3e0c83757e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Mar 23 10:20:54 2015 +0100

    Revert "make ClientIteratorBase only know about WriterListener"
    
    This reverts commit 0bf4e6e21101a66bb63778ab49006ee90c16ea94,
    ~SwFmt in sw/source/core/attr/format.cxx contains
    
      SwClient* pDepend = (SwClient*)GetDepends();
      ...
    
    that is unclear to me how to adapt to this commit's changes.

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 6ad3116..6a121ef 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -98,7 +98,6 @@ class SW_DLLPUBLIC SwClient : ::sw::WriterListener
     // avoids making the details of the linked list and the callback method public
     friend class SwModify;
     friend class sw::ClientIteratorBase;
-    template<typename E, typename S> friend class SwIterator;
 
     SwModify *pRegisteredIn;        ///< event source
 
@@ -193,7 +192,7 @@ public:
 
     void Add(SwClient *pDepend);
     SwClient* Remove(SwClient *pDepend);
-    const sw::WriterListener* GetDepends() const  { return pRoot; }
+    const SwClient* GetDepends() const  { return static_cast<SwClient*>(pRoot); }
 
     // get information about attribute
     virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
@@ -251,11 +250,11 @@ namespace sw
         protected:
             const SwModify& m_rRoot;
             // the current object in an iteration
-            WriterListener* m_pCurrent;
+            SwClient* m_pCurrent;
             // in case the current object is already removed, the next object in the list
             // is marked down to become the current object in the next step
             // this is necessary because iteration requires access to members of the current object
-            WriterListener* m_pPosition;
+            SwClient* m_pPosition;
             static SW_DLLPUBLIC ClientIteratorBase* our_pClientIters;
 
             ClientIteratorBase( const SwModify& rModify )
@@ -263,15 +262,15 @@ namespace sw
             {
                 MoveTo(our_pClientIters);
                 our_pClientIters = this;
-                m_pCurrent = m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends());
+                m_pCurrent = m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
             }
-            WriterListener* GetLeftOfPos() { return m_pPosition->m_pLeft; }
-            WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; }
-            WriterListener* GoStart()
+            SwClient* GetLeftOfPos() { return static_cast<SwClient*>(m_pPosition->m_pLeft); }
+            SwClient* GetRightOfPos() { return static_cast<SwClient*>(m_pPosition->m_pRight); }
+            SwClient* GoStart()
             {
-                if((m_pPosition = const_cast<WriterListener*>(m_rRoot.GetDepends())))
+                if((m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends())))
                     while( m_pPosition->m_pLeft )
-                        m_pPosition = m_pPosition->m_pLeft;
+                        m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft);
                 return m_pCurrent = m_pPosition;
             }
             ~ClientIteratorBase() SAL_OVERRIDE
@@ -286,7 +285,7 @@ namespace sw
             // SwModify::Add() asserts this
             bool IsChanged() const { return m_pPosition != m_pCurrent; }
             // ensures the iterator to point at a current client
-            WriterListener* Sync() { return m_pCurrent = m_pPosition; }
+            SwClient* Sync() { return m_pCurrent = m_pPosition; }
     };
 }
 
@@ -307,29 +306,29 @@ public:
     TElementType* Last()
     {
         if(!m_pPosition)
-            m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends());
+            m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
         if(!m_pPosition)
-            return PTR_CAST(TElementType,static_cast<SwClient*>(Sync()));
+            return PTR_CAST(TElementType,Sync());
         while(GetRightOfPos())
             m_pPosition = GetRightOfPos();
-        if(static_cast<SwClient*>(m_pPosition)->IsA(TYPE(TElementType)))
-            return PTR_CAST(TElementType,static_cast<SwClient*>(Sync()));
+        if(m_pPosition->IsA(TYPE(TElementType)))
+            return PTR_CAST(TElementType,Sync());
         return Previous();
     }
     TElementType* Next()
     {
         if(!IsChanged())
             m_pPosition = GetRightOfPos();
-        while(m_pPosition && !static_cast<SwClient*>(m_pPosition)->IsA( TYPE(TElementType) ) )
+        while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
             m_pPosition = GetRightOfPos();
-        return PTR_CAST(TElementType,static_cast<SwClient*>(Sync()));
+        return PTR_CAST(TElementType,Sync());
     }
     TElementType* Previous()
     {
         m_pPosition = GetLeftOfPos();
-        while(m_pPosition && !static_cast<SwClient*>(m_pPosition)->IsA( TYPE(TElementType) ) )
+        while(m_pPosition && !m_pPosition->IsA( TYPE(TElementType) ) )
             m_pPosition = GetLeftOfPos();
-        return PTR_CAST(TElementType,static_cast<SwClient*>(Sync()));
+        return PTR_CAST(TElementType,Sync());
     }
     using sw::ClientIteratorBase::IsChanged;
 };
@@ -340,27 +339,27 @@ template< typename TSource > class SwIterator<SwClient, TSource> SAL_FINAL : pri
 public:
     SwIterator( const TSource& rSrc ) : sw::ClientIteratorBase(rSrc) {}
     SwClient* First()
-        { return static_cast<SwClient*>(GoStart()); }
+        { return GoStart(); }
     SwClient* Last()
     {
         if(!m_pPosition)
-            m_pPosition = const_cast<sw::WriterListener*>(m_rRoot.GetDepends());
+            m_pPosition = const_cast<SwClient*>(m_rRoot.GetDepends());
         if(!m_pPosition)
             return m_pCurrent = nullptr;
         while(GetRightOfPos())
             m_pPosition = GetRightOfPos();
-        return static_cast<SwClient*>(Sync());
+        return Sync();
     }
     SwClient* Next()
     {
         if(!IsChanged())
             m_pPosition = GetRightOfPos();
-        return static_cast<SwClient*>(Sync());
+        return Sync();
     }
     SwClient* Previous()
     {
         m_pPosition = GetLeftOfPos();
-        return static_cast<SwClient*>(Sync());
+        return Sync();
     }
     using sw::ClientIteratorBase::IsChanged;
 };
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 80b9ace..24ba569 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -528,7 +528,7 @@ sal_uLong SwSetExpFieldType::GetSeqFormat()
     if( !GetDepends() )
         return SVX_NUM_ARABIC;
 
-    const SwField *pFld = SwIterator<SwFmtFld,SwSetExpFieldType>(*this).First()->GetField();
+    const SwField *pFld = static_cast<const SwFmtFld*>(GetDepends())->GetField();
     return pFld->GetFormat();
 }
 


More information about the Libreoffice-commits mailing list