[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 16 08:59:57 UTC 2019


 sc/source/filter/html/htmlpars.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 112d32a543f6431e3048d2744d80156db786e094
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jan 15 10:08:08 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jan 16 09:59:29 2019 +0100

    use unique_ptr in ScHTMLLayoutParser::Image
    
    Change-Id: If580fda8445894cbf3ed174d86673851a98af73c
    Reviewed-on: https://gerrit.libreoffice.org/66421
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index bce592228825..a7d14a5fdb85 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -1327,12 +1327,11 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
     }
 
     sal_uInt16 nFormat;
-    Graphic* pGraphic = new Graphic;
+    std::unique_ptr<Graphic> pGraphic(new Graphic);
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
     if ( ERRCODE_NONE != GraphicFilter::LoadGraphic( pImage->aURL, pImage->aFilterName,
             *pGraphic, &rFilter, &nFormat ) )
     {
-        delete pGraphic;
         return ; // Bad luck
     }
     if (!mxActEntry->bHasGraphic)
@@ -1341,12 +1340,12 @@ void ScHTMLLayoutParser::Image( HtmlImportInfo* pInfo )
         mxActEntry->aAltText.clear();
     }
     pImage->aFilterName = rFilter.GetImportFormatName( nFormat );
-    pImage->pGraphic.reset( pGraphic );
+    pImage->pGraphic = std::move( pGraphic );
     if ( !(pImage->aSize.Width() && pImage->aSize.Height()) )
     {
         OutputDevice* pDefaultDev = Application::GetDefaultDevice();
-        pImage->aSize = pDefaultDev->LogicToPixel( pGraphic->GetPrefSize(),
-            pGraphic->GetPrefMapMode() );
+        pImage->aSize = pDefaultDev->LogicToPixel( pImage->pGraphic->GetPrefSize(),
+            pImage->pGraphic->GetPrefMapMode() );
     }
     if (!mxActEntry->maImageList.empty())
     {


More information about the Libreoffice-commits mailing list