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

Mark Page aptitude at btconnect.com
Fri Nov 25 12:46:55 UTC 2016


 vcl/source/filter/graphicfilter.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ca48cb1dfa212128e0987897a69edc1980ebca90
Author: Mark Page <aptitude at btconnect.com>
Date:   Fri Nov 25 10:50:33 2016 +0000

    Modify pFilterConfigItem to a smart pointer
    
    Change-Id: Ie964f064f4f5d3735878c2a6b4f6d4b801a8e8e9
    Reviewed-on: https://gerrit.libreoffice.org/31195
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 84cd26f..1a77aae 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -19,6 +19,7 @@
 
 #include <config_folders.h>
 
+#include <o3tl/make_unique.hxx>
 #include <osl/mutex.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
@@ -1337,7 +1338,7 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
     GfxLinkType                    eLinkType = GfxLinkType::NONE;
     bool                           bDummyContext = rGraphic.IsDummyContext();
     const bool                     bLinkSet = rGraphic.IsLink();
-    FilterConfigItem*              pFilterConfigItem = nullptr;
+    std::unique_ptr<FilterConfigItem> pFilterConfigItem;
 
     Size                aPreviewSizeHint( 0, 0 );
     bool                bAllowPartialStreamRead = false;
@@ -1726,13 +1727,13 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
                 if( nFormat != GRFILTER_FORMAT_DONTKNOW )
                 {
                     aShortName = GetImportFormatShortName( nFormat ).toAsciiUpperCase();
-                    if ( ( pFilterConfigItem == nullptr ) && aShortName == "PCD" )
+                    if ( ( !pFilterConfigItem ) && aShortName == "PCD" )
                     {
                         OUString aFilterConfigPath( "Office.Common/Filter/Graphic/Import/PCD" );
-                        pFilterConfigItem = new FilterConfigItem( aFilterConfigPath );
+                        pFilterConfigItem = o3tl::make_unique<FilterConfigItem>( aFilterConfigPath );
                     }
                 }
-                if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem ) )
+                if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
                     nStatus = GRFILTER_FORMATERROR;
                 else
                 {
@@ -1790,7 +1791,6 @@ sal_uInt16 GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPat
         rGraphic.Clear();
     }
 
-    delete pFilterConfigItem;
     return nStatus;
 }
 


More information about the Libreoffice-commits mailing list