summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-06-21 00:20:03 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-21 00:20:03 +0200
commitd3fe01de1e004ecf1af1d28d48cc53cf25457e72 (patch)
tree456ff8c5eeaef0c5817e6a20d380691565e92f63 /sw/source
parent38ebb2f94f08009e3e7386449006d06f901400ed (diff)
fix problems in 1015cd4ff73ee25e55b4da8c8bc55a41e652da87:
- inverted check in SwDoc::RemoveInvisibleContent - various too short end positions in DeleteAndDestroy calls in SwDoc::~SwDoc and SwDoc::ClearDoc - std::copy to begin() of empty vector in SwReader::Read replaced with std::back_inserter; the vector is used as a set here so the end position should work just as well Change-Id: Ib2ddd788fade4ee1a8beb702d5321c503985fba4
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/doc.cxx5
-rw-r--r--sw/source/core/doc/docnew.cxx18
-rw-r--r--sw/source/core/unocore/unotext.cxx2
-rw-r--r--sw/source/filter/basflt/shellio.cxx5
4 files changed, 17 insertions, 13 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index cd2804dc4902..bdacd9adf0f4 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2245,8 +2245,9 @@ bool SwDoc::RemoveInvisibleContent()
pParent = pTmp;
}
- SwSectionFmts::iterator it = std::find( aSectFmts.begin(), aSectFmts.end(), pSect->GetFmt() );
- if ( it != aSectFmts.end() )
+ SwSectionFmts::iterator it = std::find(
+ aSectFmts.begin(), aSectFmts.end(), pSect->GetFmt() );
+ if (it == aSectFmts.end())
aSectFmts.insert( aSectFmts.begin(), pSect->GetFmt() );
}
if( pSect->GetCondition().Len() )
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index e8b60c3e59b4..d95cbaa3dfc0 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -632,14 +632,14 @@ SwDoc::~SwDoc()
// array, we should delete it as the last. With this we avoid
// remangling the Formats all the time!
if( 2 < pTxtFmtCollTbl->size() )
- DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
- DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
+ DeleteAndDestroy(*pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size());
+ DeleteAndDestroy(*pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size());
delete pTxtFmtCollTbl;
OSL_ENSURE( pDfltGrfFmtColl == (*pGrfFmtCollTbl)[0],
"DefaultGrfCollection must always be at the start" );
- DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
+ DeleteAndDestroy(*pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size());
// Is the result anyway - no _DEL array!
// pGrfFmtCollTbl->Remove( 0, n );
delete pGrfFmtCollTbl;
@@ -876,20 +876,20 @@ void SwDoc::ClearDoc()
// array, we should delete it as the last. With this we avoid
// remangling the Formats all the time!
if( 2 < pTxtFmtCollTbl->size() )
- DeleteAndDestroy( *pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size()-2 );
- DeleteAndDestroy( *pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size()-1 );
- DeleteAndDestroy( *pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size()-1 );
- DeleteAndDestroy( *pCharFmtTbl, 1, pCharFmtTbl->size()-1 );
+ DeleteAndDestroy(*pTxtFmtCollTbl, 2, pTxtFmtCollTbl->size());
+ DeleteAndDestroy(*pTxtFmtCollTbl, 1, pTxtFmtCollTbl->size());
+ DeleteAndDestroy(*pGrfFmtCollTbl, 1, pGrfFmtCollTbl->size());
+ DeleteAndDestroy(*pCharFmtTbl, 1, pCharFmtTbl->size());
if( pCurrentView )
{
// search the FrameFormat of the root frm. This is not allowed to delete
pFrmFmtTbl->erase( std::find( pFrmFmtTbl->begin(), pFrmFmtTbl->end(), pCurrentView->GetLayout()->GetFmt() ) );
- DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
+ DeleteAndDestroy(*pFrmFmtTbl, 1, pFrmFmtTbl->size());
pFrmFmtTbl->push_back( pCurrentView->GetLayout()->GetFmt() );
}
else //swmod 071029//swmod 071225
- DeleteAndDestroy( *pFrmFmtTbl, 1, pFrmFmtTbl->size()-1 );
+ DeleteAndDestroy(*pFrmFmtTbl, 1, pFrmFmtTbl->size());
xForbiddenCharsTable.clear();
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index a1043ef8f5e0..c61db3341706 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1668,7 +1668,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
// see if there are frames already anchored to this node
std::vector<SwFrmFmt*> aAnchoredFrames;
- for (int i = 0; i < (int)m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i)
+ for (size_t i = 0; i < m_pImpl->m_pDoc->GetSpzFrmFmts()->size(); ++i)
{
SwFrmFmt* pFrmFmt = (*m_pImpl->m_pDoc->GetSpzFrmFmts())[i];
const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 7cfe5e31953b..72eeeb3bc2c1 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -168,7 +168,10 @@ sal_uLong SwReader::Read( const Reader& rOptions )
// Speicher mal alle Fly's
if( pCrsr )
- std::copy( pDoc->GetSpzFrmFmts()->begin(), pDoc->GetSpzFrmFmts()->end(), aFlyFrmArr.begin() );
+ {
+ std::copy(pDoc->GetSpzFrmFmts()->begin(),
+ pDoc->GetSpzFrmFmts()->end(), std::back_inserter(aFlyFrmArr));
+ }
xub_StrLen nSttCntnt = pPam->GetPoint()->nContent.GetIndex();