[Libreoffice-commits] core.git: sw/inc sw/source
Stephan Bergmann
sbergman at redhat.com
Thu Aug 7 01:10:04 PDT 2014
sw/inc/bparr.hxx | 3 +--
sw/source/core/docnode/nodes.cxx | 18 ++++--------------
2 files changed, 5 insertions(+), 16 deletions(-)
New commits:
commit ca16ec4346cec871163c0b9ff361c7ad8bc74c16
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Aug 7 10:09:07 2014 +0200
Avoid illegal downcasts from BigPtrEntry to SwNode
...and while at it, remove the need for the TempBigPtrEntry derivation.
Change-Id: Ic758f646578a90a28632b1368fed209eb84f9c1c
diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx
index 3c5ea87..741534d 100644
--- a/sw/inc/bparr.hxx
+++ b/sw/inc/bparr.hxx
@@ -34,9 +34,8 @@ class BigPtrEntry
BlockInfo* pBlock;
sal_uInt16 nOffset;
public:
- virtual ~BigPtrEntry() {}
-protected:
BigPtrEntry() : pBlock(0), nOffset(0) {}
+ virtual ~BigPtrEntry() {}
inline sal_uLong GetPos() const;
inline BigPtrArray& GetArray() const;
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 06375d9..8efb977 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2213,16 +2213,6 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
ForEach( rStart.GetIndex(), rEnd.GetIndex(), fnForEach, pArgs );
}
-namespace {
-
-//TODO: seems to be not/wrongly used
-struct TempBigPtrEntry : public BigPtrEntry
-{
- TempBigPtrEntry() {}
-};
-
-}
-
void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
{
sal_uLong nEnd = nDelPos + nSz;
@@ -2275,11 +2265,11 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
}
}
- std::vector<TempBigPtrEntry> aTempEntries;
+ std::vector<BigPtrEntry> aTempEntries;
if( bDel )
{
sal_uLong nCnt = nSz;
- SwNode *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ];
+ BigPtrEntry *pDel = (*this)[ nDelPos+nCnt-1 ], *pPrev = (*this)[ nDelPos+nCnt-2 ];
// set temporary object
// JP 24.08.98: this should actually be removed because one could
@@ -2292,13 +2282,13 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
{
delete pDel;
pDel = pPrev;
- sal_uLong nPrevNdIdx = pPrev->GetIndex();
+ sal_uLong nPrevNdIdx = pPrev->GetPos();
BigPtrEntry* pTempEntry = &aTempEntries[nCnt];
BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
if( nCnt )
pPrev = (*this)[ nPrevNdIdx - 1 ];
}
- nDelPos = pDel->GetIndex() + 1;
+ nDelPos = pDel->GetPos() + 1;
}
BigPtrArray::Remove( nDelPos, nSz );
More information about the Libreoffice-commits
mailing list