sw/source/filter/ascii/parasc.cxx | 12 ++++++------ sw/source/filter/html/swhtml.cxx | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-)
New commits: commit ce30c6316f7c7ffc727b2d852b6b42c8fefa52bd Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 14 14:05:12 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Sep 18 09:06:03 2018 +0200 loplugin:useuniqueptr in SwHTMLParser::SetAttr_ Change-Id: I8acc0df204417846d275dbba290177d0f166f3d9 Reviewed-on: https://gerrit.libreoffice.org/60605 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 70c9d7cb99c4..0e00318fe7c3 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -2689,7 +2689,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, HTMLAttr* pAttr; SwContentNode* pCNd; - HTMLAttrs aFields; + std::vector<std::unique_ptr<HTMLAttr>> aFields; for( auto n = m_aSetAttrTab.size(); n; ) { @@ -2884,7 +2884,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, } else { - aFields.push_back( pAttr); + aFields.emplace_back( pAttr); } } pAttrPam->DeleteMark(); @@ -2992,7 +2992,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, m_aMoveFlyCnts.erase( m_aMoveFlyCnts.begin() + n ); } } - for (auto const& field : aFields) + for (auto & field : aFields) { pCNd = field->nSttPara.GetNode().GetContentNode(); pAttrPam->GetPoint()->nNode = field->nSttPara; @@ -3010,7 +3010,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, m_xDoc->getIDocumentContentOperations().InsertPoolItem( *pAttrPam, *field->pItem ); - delete field; + field.reset(); } aFields.clear(); } commit 6649cd063832f8571d08ed264599d589ed6d60cc Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 14 13:54:33 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Sep 18 09:05:56 2018 +0200 loplugin:useuniqueptr in AsciiReader::Read Change-Id: Id8701c91d272850368db80b1ebabf11ea2a028f5 Reviewed-on: https://gerrit.libreoffice.org/60604 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index a23bdfc77b41..f4962f61692d 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -83,11 +83,11 @@ ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUSt return ERR_SWG_READ_ERROR; } - SwASCIIParser* pParser = new SwASCIIParser( &rDoc, rPam, *m_pStream, - !m_bInsertMode, m_aOption.GetASCIIOpts() ); + std::unique_ptr<SwASCIIParser> pParser(new SwASCIIParser( &rDoc, rPam, *m_pStream, + !m_bInsertMode, m_aOption.GetASCIIOpts() )); ErrCode nRet = pParser->CallParser(); - delete pParser; + pParser.reset(); // after Read reset the options m_aOption.ResetASCIIOpts(); return nRet; @@ -143,12 +143,12 @@ ErrCode SwASCIIParser::CallParser() ::StartProgress( STR_STATSTR_W4WREAD, 0, nFileSize, pDoc->GetDocShell() ); - SwPaM* pInsPam = nullptr; + std::unique_ptr<SwPaM> pInsPam; sal_Int32 nSttContent = 0; if (!bNewDoc) { const SwNodeIndex& rTmp = pPam->GetPoint()->nNode; - pInsPam = new SwPaM( rTmp, rTmp, 0, -1 ); + pInsPam.reset(new SwPaM( rTmp, rTmp, 0, -1 )); nSttContent = pPam->GetPoint()->nContent.GetIndex(); } @@ -237,7 +237,7 @@ ErrCode SwASCIIParser::CallParser() pItemSet.reset(); } - delete pInsPam; + pInsPam.reset(); ::EndProgress( pDoc->GetDocShell() ); return nError; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits