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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 24 18:31:27 UTC 2020


 svx/source/gallery2/galtheme.cxx |    8 ++++----
 vcl/source/gdi/impgraph.cxx      |   20 ++++++++++----------
 vcl/source/treelist/imap.cxx     |    4 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 7589e8413411aa4e0bf437ec0a7080c577a9c1d9
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Jan 23 21:28:03 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 24 19:30:45 2020 +0100

    no need for these to be heap-allocated
    
    Change-Id: I50a4350198e3c2b8eb669b43fb40e4b01dcb67ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87291
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 91a141f90bac..3b078f45008b 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -692,11 +692,11 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, bo
                         if( nId1 == COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
                             nId2 == COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
                         {
-                            std::unique_ptr<VersionCompat> pCompat(new VersionCompat( *pIStm, StreamMode::READ ));
+                            VersionCompat aCompat( *pIStm, StreamMode::READ );
 
                             pIStm->ReadUInt32( nThemeId );
 
-                            if( pCompat->GetVersion() >= 2 )
+                            if( aCompat.GetVersion() >= 2 )
                             {
                                 pIStm->ReadCharAsBool( bThemeNameFromResource );
                             }
@@ -1417,13 +1417,13 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
             nId1 == COMPAT_FORMAT( 'G', 'A', 'L', 'R' ) &&
             nId2 == COMPAT_FORMAT( 'E', 'S', 'R', 'V' ) )
         {
-            std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rIStm, StreamMode::READ ));
+            VersionCompat   aCompat( rIStm, StreamMode::READ );
             sal_uInt32      nTemp32;
             bool            bThemeNameFromResource = false;
 
             rIStm.ReadUInt32( nTemp32 );
 
-            if( pCompat->GetVersion() >= 2 )
+            if( aCompat.GetVersion() >= 2 )
             {
                 rIStm.ReadCharAsBool( bThemeNameFromResource );
             }
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 0591606dba86..067497301e02 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1263,7 +1263,7 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
     if( GRAPHIC_FORMAT_50 == nId )
     {
         // read new style header
-        std::unique_ptr<VersionCompat> pCompat( new VersionCompat( rIStm, StreamMode::READ ) );
+        VersionCompat aCompat( rIStm, StreamMode::READ );
 
         rIStm.ReadInt32( nType );
         sal_Int32 nLen;
@@ -1401,7 +1401,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
             rOStm.WriteUInt32( GRAPHIC_FORMAT_50 );
 
             // write new style header
-            std::unique_ptr<VersionCompat> pCompat( new VersionCompat( rOStm, StreamMode::WRITE, 1 ) );
+            VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
 
             rOStm.WriteInt32( static_cast<sal_Int32>(meType) );
 
@@ -1792,10 +1792,10 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
         Graphic         aGraphic;
         GfxLink         aLink;
 
-        // read compat info
-        std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rIStm, StreamMode::READ ));
-        pCompat.reset(); // destructor writes stuff into the header
-
+        // read compat info, destructor writes stuff into the header
+        {
+            VersionCompat aCompat( rIStm, StreamMode::READ );
+        }
         ReadGfxLink( rIStm, aLink );
 
         // set dummy link to avoid creation of additional link after filtering;
@@ -1967,10 +1967,10 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
         // native format
         rOStm.WriteUInt32( NATIVE_FORMAT_50 );
 
-        // write compat info
-        std::unique_ptr<VersionCompat> pCompat(new VersionCompat( rOStm, StreamMode::WRITE, 1 ));
-        pCompat.reset(); // destructor writes stuff into the header
-
+        // write compat info, destructor writes stuff into the header
+        {
+            VersionCompat aCompat( rOStm, StreamMode::WRITE, 1 );
+        }
         rImpGraphic.mpGfxLink->SetPrefMapMode( rImpGraphic.ImplGetPrefMapMode() );
         rImpGraphic.mpGfxLink->SetPrefSize( rImpGraphic.ImplGetPrefSize() );
         WriteGfxLink( rOStm, *rImpGraphic.mpGfxLink );
diff --git a/vcl/source/treelist/imap.cxx b/vcl/source/treelist/imap.cxx
index 536c9c819a8f..3c08c220d3fc 100644
--- a/vcl/source/treelist/imap.cxx
+++ b/vcl/source/treelist/imap.cxx
@@ -79,7 +79,7 @@ void IMapObject::Write( SvStream& rOStm ) const
     rOStm.WriteBool( bActive );
     write_uInt16_lenPrefixed_uInt8s_FromOUString(rOStm, aTarget, eEncoding);
 
-    std::unique_ptr<IMapCompat> pCompat(new IMapCompat( rOStm, StreamMode::WRITE ));
+    IMapCompat aCompat( rOStm, StreamMode::WRITE );
 
     WriteIMapObject( rOStm );
     aEventList.Write( rOStm );                                      // V4
@@ -108,7 +108,7 @@ void IMapObject::Read( SvStream& rIStm )
 
     // make URL absolute
     aURL = URIHelper::SmartRel2Abs( INetURLObject(""), aURL, URIHelper::GetMaybeFileHdl(), true, false, INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism::Unambiguous );
-    std::unique_ptr<IMapCompat> pCompat(new IMapCompat( rIStm, StreamMode::READ ));
+    IMapCompat aCompat( rIStm, StreamMode::READ );
 
     ReadIMapObject( rIStm );
 


More information about the Libreoffice-commits mailing list