[Libreoffice-commits] core.git: 2 commits - filter/source sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 31 06:34:07 UTC 2018


 filter/source/msfilter/svdfppt.cxx  |   13 +++++--------
 sd/source/filter/eppt/pptx-text.cxx |    6 ++----
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit cdb750653e680c4c30239423ed201ed7a03eda8b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 30 13:54:13 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 31 07:33:55 2018 +0100

    loplugin:useuniqueptr in ParagraphObj::ParagraphObj
    
    Change-Id: I4c5dcdad18988381b64479cad077234978437795
    Reviewed-on: https://gerrit.libreoffice.org/62661
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index c6c538437ee8..eef5558dbed3 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -724,11 +724,9 @@ ParagraphObj::ParagraphObj(css::uno::Reference< css::text::XTextContent > const
                     css::uno::Any aAny( aXTextPortionE->nextElement() );
                     if ( aAny >>= aXCursorText )
                     {
-                        PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
+                        std::unique_ptr<PortionObj> pPortionObj(new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection ));
                         if ( pPortionObj->Count() )
-                            mvPortions.push_back( std::unique_ptr<PortionObj>(pPortionObj) );
-                        else
-                            delete pPortionObj;
+                            mvPortions.push_back( std::move(pPortionObj) );
                     }
                 }
             }
commit 2a8f860a7199585ad8ae61cfacdc39f2ac3afdb8
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Oct 30 13:47:16 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Oct 31 07:33:40 2018 +0100

    loplugin:useuniqueptr in PPTTextObj::PPTTextObj
    
    Change-Id: Ib150ecf2dbcc0e3be1d7b1d4daba6065605597ee
    Reviewed-on: https://gerrit.libreoffice.org/62660
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 581788294902..ac8728cd424f 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -6730,7 +6730,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                             // now will search for possible textextensions such as date/time fields
                             // or ParaTabStops and append them on this textobj
                             rIn.Seek( nFilePos );
-                            ::std::vector< PPTFieldEntry* > FieldList;
+                            ::std::vector< std::unique_ptr<PPTFieldEntry> > FieldList;
                             auto nEndRecPos = DffPropSet::SanitizeEndPos(rIn, aClientTextBoxHd.GetRecEndFilePos());
                             while (rIn.Tell() < nEndRecPos)
                             {
@@ -6906,22 +6906,22 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                 if (xEntry)
                                 {
                                     // sorting fields ( hi >> lo )
-                                    ::std::vector< PPTFieldEntry* >::iterator it = FieldList.begin();
+                                    auto it = FieldList.begin();
                                     for( ; it != FieldList.end(); ++it ) {
                                         if ( (*it)->nPos < xEntry->nPos ) {
                                             break;
                                         }
                                     }
                                     if ( it != FieldList.end() ) {
-                                        FieldList.insert(it, xEntry.release());
+                                        FieldList.insert(it, std::move(xEntry));
                                     } else {
-                                        FieldList.push_back(xEntry.release());
+                                        FieldList.push_back( std::move(xEntry));
                                     }
                                 }
                             }
                             if ( !FieldList.empty() )
                             {
-                                ::std::vector< PPTFieldEntry* >::iterator FE = FieldList.begin();
+                                auto FE = FieldList.begin();
                                 auto& aCharPropList = aStyleTextPropReader.aCharPropList;
 
                                 sal_Int32   i = nParagraphs - 1;
@@ -7068,9 +7068,6 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
                                     }
                                     n--;
                                 }
-                                for(PPTFieldEntry* j : FieldList) {
-                                    delete j;
-                                }
                             }
                             mxImplTextObj->maParagraphList.resize( nParagraphs );
                             for (size_t nCurCharPos = 0, nCurPos = 0;


More information about the Libreoffice-commits mailing list