sw/inc/bparr.hxx                 |   13 +++++-------
 sw/source/core/bastyp/bparr.cxx  |   42 +++++++++++++++++++--------------------
 sw/source/core/docnode/nodes.cxx |    6 ++---
 3 files changed, 30 insertions(+), 31 deletions(-)

New commits:
commit 2d5090419e0113f5b411ee84bfc55926a19da411
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Tue Jun 27 12:22:59 2017 +0200

    inline ElementPtr
    
    Change-Id: I93a9527283a819a95563565a252a5088253c91c0
    Reviewed-on: https://gerrit.libreoffice.org/39293
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx
index cbb63d36956a..46260762b9d4 100644
--- a/sw/inc/bparr.hxx
+++ b/sw/inc/bparr.hxx
@@ -40,7 +40,6 @@ public:
     inline sal_uLong GetPos() const;
     inline BigPtrArray& GetArray() const;
 };
-typedef BigPtrEntry* ElementPtr;
 
 // 1000 entries per Block = a bit less then 4K
 #define MAXENTRY 1000
@@ -51,9 +50,9 @@ typedef BigPtrEntry* ElementPtr;
 // if complete compression is desired, 100 has to be specified
 #define COMPRESSLVL 80
 
-struct BlockInfo {                  // block info:
+struct BlockInfo {
     BigPtrArray* pBigArr;           ///< in this array the block is located
-    ElementPtr* pData;              ///< data block
+    BigPtrEntry** pData;            ///< data block
     sal_uLong nStart, nEnd;         ///< start- and end index
     sal_uInt16 nElem;               ///< number of elements
 };
@@ -61,7 +60,7 @@ struct BlockInfo {                  // block info:
 class SW_DLLPUBLIC BigPtrArray
 {
 protected:
-    BlockInfo**     m_ppInf;              // block info
+    BlockInfo**     m_ppInf;              ///< block info
     sal_uLong       m_nSize;              ///< number of elements
     sal_uInt16      m_nMaxBlock;          ///< current max. number of blocks
     sal_uInt16      m_nBlock;             ///< number of blocks
@@ -82,12 +81,12 @@ public:
 
     sal_uLong Count() const { return m_nSize; }
 
-    void Insert( const ElementPtr& r, sal_uLong pos );
+    void Insert( BigPtrEntry* p, sal_uLong pos );
     void Remove( sal_uLong pos, sal_uLong n = 1 );
     void Move( sal_uLong from, sal_uLong to );
-    void Replace( sal_uLong pos, const ElementPtr& r);
+    void Replace( sal_uLong pos, BigPtrEntry* p);
 
-    ElementPtr operator[]( sal_uLong ) const;
+    BigPtrEntry* operator[]( sal_uLong ) const;
 };
 
 inline sal_uLong BigPtrEntry::GetPos() const
diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx
index 443d1944362f..5aac6c226c23 100644
--- a/sw/source/core/bastyp/bparr.cxx
+++ b/sw/source/core/bastyp/bparr.cxx
@@ -75,13 +75,13 @@ void BigPtrArray::Move( sal_uLong from, sal_uLong to )
     {
         sal_uInt16 cur = Index2Block( from );
         BlockInfo* p = m_ppInf[ cur ];
-        ElementPtr pElem = p->pData[ from - p->nStart ];
+        BigPtrEntry* pElem = p->pData[ from - p->nStart ];
         Insert( pElem, to ); // insert first, then delete!
         Remove( ( to < from ) ? ( from + 1 ) : from );
     }
 }
 
-ElementPtr BigPtrArray::operator[]( sal_uLong idx ) const
+BigPtrEntry* BigPtrArray::operator[]( sal_uLong idx ) const
 {
     assert(idx < m_nSize); // operator[]: Index out of bounds
     m_nCur = Index2Block( idx );
@@ -183,7 +183,7 @@ BlockInfo* BigPtrArray::InsBlock( sal_uInt16 pos )
 
     p->nEnd--;  // no elements
     p->nElem = 0;
-    p->pData = new ElementPtr [ MAXENTRY ];
+    p->pData = new BigPtrEntry* [ MAXENTRY ];
     p->pBigArr = this;
     return p;
 }
@@ -203,7 +203,7 @@ void BigPtrArray::BlockDel( sal_uInt16 nDel )
     }
 }
 
-void BigPtrArray::Insert( const ElementPtr& rElem, sal_uLong pos )
+void BigPtrArray::Insert( BigPtrEntry* pElem, sal_uLong pos )
 {
     CHECKIDX( ppInf, nBlock, nSize, nCur );
 
@@ -240,8 +240,8 @@ void BigPtrArray::Insert( const ElementPtr& rElem, 
sal_uLong pos )
             if( q->nElem )
             {
                 int nCount = q->nElem;
-                ElementPtr *pFrom = q->pData + nCount,
-                                    *pTo = pFrom+1;
+                BigPtrEntry** pFrom = q->pData + nCount;
+                BigPtrEntry** pTo   = pFrom + 1;
                 while( nCount-- )
                     ++( *--pTo = *--pFrom )->m_nOffset;
             }
@@ -258,7 +258,7 @@ void BigPtrArray::Insert( const ElementPtr& rElem, 
sal_uLong pos )
             {
                 // Something was moved before the current position and all
                 // pointer might be invalid. Thus restart Insert.
-                Insert( rElem, pos );
+                Insert( pElem, pos );
                 return ;
             }
 
@@ -266,7 +266,7 @@ void BigPtrArray::Insert( const ElementPtr& rElem, 
sal_uLong pos )
         }
 
         // entry does not fit anymore - clear space
-        ElementPtr pLast = p->pData[ MAXENTRY-1 ];
+        BigPtrEntry* pLast = p->pData[ MAXENTRY-1 ];
         pLast->m_nOffset = 0;
         pLast->m_pBlock = q;
 
@@ -283,15 +283,15 @@ void BigPtrArray::Insert( const ElementPtr& rElem, 
sal_uLong pos )
     if( pos != p->nElem )
     {
         int nCount = p->nElem - sal_uInt16(pos);
-        ElementPtr *pFrom = p->pData + p->nElem;
-        ElementPtr *pTo   = pFrom + 1;
+        BigPtrEntry* *pFrom = p->pData + p->nElem;
+        BigPtrEntry* *pTo   = pFrom + 1;
         while( nCount-- )
             ++( *--pTo = *--pFrom )->m_nOffset;
     }
     // insert element and update indices
-    rElem->m_nOffset = sal_uInt16(pos);
-    rElem->m_pBlock = p;
-    p->pData[ pos ] = rElem;
+    pElem->m_nOffset = sal_uInt16(pos);
+    pElem->m_pBlock = p;
+    p->pData[ pos ] = pElem;
     p->nEnd++;
     p->nElem++;
     m_nSize++;
@@ -321,8 +321,8 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
         // move elements if needed
         if( ( pos + nel ) < sal_uLong(p->nElem) )
         {
-            ElementPtr *pTo = p->pData + pos;
-            ElementPtr *pFrom = pTo + nel;
+            BigPtrEntry* *pTo = p->pData + pos;
+            BigPtrEntry* *pFrom = pTo + nel;
             int nCount = p->nElem - nel - sal_uInt16(pos);
             while( nCount-- )
             {
@@ -386,14 +386,14 @@ void BigPtrArray::Remove( sal_uLong pos, sal_uLong n )
     CHECKIDX( ppInf, nBlock, nSize, nCur );
 }
 
-void BigPtrArray::Replace( sal_uLong idx, const ElementPtr& rElem)
+void BigPtrArray::Replace( sal_uLong idx, BigPtrEntry* pElem)
 {
     assert(idx < m_nSize); // Index out of bounds
     m_nCur = Index2Block( idx );
     BlockInfo* p = m_ppInf[ m_nCur ];
-    rElem->m_nOffset = sal_uInt16(idx - p->nStart);
-    rElem->m_pBlock = p;
-    p->pData[ idx - p->nStart ] = rElem;
+    pElem->m_nOffset = sal_uInt16(idx - p->nStart);
+    pElem->m_pBlock = p;
+    p->pData[ idx - p->nStart ] = pElem;
 }
 
 /** Compress the array */
@@ -434,8 +434,8 @@ sal_uInt16 BigPtrArray::Compress()
                 n = nLast;
 
             // move elements from current to last block
-            ElementPtr* pElem = pLast->pData + pLast->nElem;
-            ElementPtr* pFrom = p->pData;
+            BigPtrEntry** pElem = pLast->pData + pLast->nElem;
+            BigPtrEntry** pFrom = p->pData;
             for( sal_uInt16 nCount = n, nOff = pLast->nElem;
                             nCount; --nCount, ++pElem )
             {
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 2b609e97a361..123062b86c1c 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2188,7 +2188,7 @@ void SwNodes::ForEach( sal_uLong nStart, sal_uLong nEnd,
         BlockInfo** pp = m_ppInf + cur;
         BlockInfo* p = *pp;
         sal_uInt16 nElem = sal_uInt16( nStart - p->nStart );
-        ElementPtr* pElem = p->pData + nElem;
+        BigPtrEntry** pElem = p->pData + nElem;
         nElem = p->nElem - nElem;
         for(;;)
         {
@@ -2314,14 +2314,14 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong 
nSz, bool bDel )
 void SwNodes::InsertNode( const SwNodePtr pNode,
                           const SwNodeIndex& rPos )
 {
-    const ElementPtr pIns = pNode;
+    BigPtrEntry* pIns = pNode;
     BigPtrArray::Insert( pIns, rPos.GetIndex() );
 }
 
 void SwNodes::InsertNode( const SwNodePtr pNode,
                           sal_uLong nPos )
 {
-    const ElementPtr pIns = pNode;
+    BigPtrEntry* pIns = pNode;
     BigPtrArray::Insert( pIns, nPos );
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to