Kaydet (Commit) ca16ec43 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Avoid illegal downcasts from BigPtrEntry to SwNode

...and while at it, remove the need for the TempBigPtrEntry derivation.

Change-Id: Ic758f646578a90a28632b1368fed209eb84f9c1c
üst 47585cea
...@@ -34,9 +34,8 @@ class BigPtrEntry ...@@ -34,9 +34,8 @@ class BigPtrEntry
BlockInfo* pBlock; BlockInfo* pBlock;
sal_uInt16 nOffset; sal_uInt16 nOffset;
public: public:
virtual ~BigPtrEntry() {}
protected:
BigPtrEntry() : pBlock(0), nOffset(0) {} BigPtrEntry() : pBlock(0), nOffset(0) {}
virtual ~BigPtrEntry() {}
inline sal_uLong GetPos() const; inline sal_uLong GetPos() const;
inline BigPtrArray& GetArray() const; inline BigPtrArray& GetArray() const;
......
...@@ -2213,16 +2213,6 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd, ...@@ -2213,16 +2213,6 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
ForEach( rStart.GetIndex(), rEnd.GetIndex(), fnForEach, pArgs ); 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 ) void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
{ {
sal_uLong nEnd = nDelPos + nSz; sal_uLong nEnd = nDelPos + nSz;
...@@ -2275,11 +2265,11 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel ) ...@@ -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 ) if( bDel )
{ {
sal_uLong nCnt = nSz; 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 // set temporary object
// JP 24.08.98: this should actually be removed because one could // 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 ) ...@@ -2292,13 +2282,13 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
{ {
delete pDel; delete pDel;
pDel = pPrev; pDel = pPrev;
sal_uLong nPrevNdIdx = pPrev->GetIndex(); sal_uLong nPrevNdIdx = pPrev->GetPos();
BigPtrEntry* pTempEntry = &aTempEntries[nCnt]; BigPtrEntry* pTempEntry = &aTempEntries[nCnt];
BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry ); BigPtrArray::Replace( nPrevNdIdx+1, pTempEntry );
if( nCnt ) if( nCnt )
pPrev = (*this)[ nPrevNdIdx - 1 ]; pPrev = (*this)[ nPrevNdIdx - 1 ];
} }
nDelPos = pDel->GetIndex() + 1; nDelPos = pDel->GetPos() + 1;
} }
BigPtrArray::Remove( nDelPos, nSz ); BigPtrArray::Remove( nDelPos, nSz );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment