sw/source/core/doc/doc.cxx | 5 +++-- sw/source/core/doc/docnew.cxx | 18 +++++++++--------- sw/source/core/unocore/unotext.cxx | 2 +- sw/source/filter/basflt/shellio.cxx | 5 ++++- 4 files changed, 17 insertions(+), 13 deletions(-)
New commits: commit d3fe01de1e004ecf1af1d28d48cc53cf25457e72 Author: Michael Stahl <mst...@redhat.com> Date: Thu Jun 21 00:20:03 2012 +0200 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 diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index cd2804d..bdacd9a 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 e8b60c3..d95cbaa 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 a1043ef..c61db33 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 7cfe5e3..72eeeb3 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits