summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-08-07 10:09:07 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-08-07 10:09:07 +0200
commitca16ec4346cec871163c0b9ff361c7ad8bc74c16 (patch)
treebf562e32414ef25907e4f8f377f2b0d7385eb484 /sw
parent47585cea02f00ac15b05c092e5392bd76e78daf9 (diff)
Avoid illegal downcasts from BigPtrEntry to SwNode
...and while at it, remove the need for the TempBigPtrEntry derivation. Change-Id: Ic758f646578a90a28632b1368fed209eb84f9c1c
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/bparr.hxx3
-rw-r--r--sw/source/core/docnode/nodes.cxx18
2 files changed, 5 insertions, 16 deletions
diff --git a/sw/inc/bparr.hxx b/sw/inc/bparr.hxx
index 3c5ea878067e..741534d2e7b1 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 06375d943b11..8efb97775c71 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 );