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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 17 14:09:21 UTC 2020


 vcl/source/gdi/gdimtf.cxx |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 129629de708b35154a0812eaf19dd19e76e38331
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Nov 17 13:19:16 2020 +0100
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Nov 17 15:08:43 2020 +0100

    Don't use new/delete here when automatic variable is enough
    
    Change-Id: Ia119da3b54fd957f3316637ddaa047cfd6a399fb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105994
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Jenkins

diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 8ffa24994ebb..02f47b5c6bba 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2745,22 +2745,21 @@ SvStream& GDIMetaFile::Read( SvStream& rIStm )
 
 SvStream& GDIMetaFile::Write( SvStream& rOStm )
 {
-    VersionCompat*   pCompat;
     const SvStreamCompressFlags nStmCompressMode = rOStm.GetCompressMode();
     SvStreamEndian   nOldFormat = rOStm.GetEndian();
 
     rOStm.SetEndian( SvStreamEndian::LITTLE );
     rOStm.WriteBytes( "VCLMTF", 6 );
 
-    pCompat = new VersionCompat( rOStm, StreamMode::WRITE, 1 );
-
-    rOStm.WriteUInt32( static_cast<sal_uInt32>(nStmCompressMode) );
-    WriteMapMode( rOStm, m_aPrefMapMode );
-    TypeSerializer aSerializer(rOStm);
-    aSerializer.writeSize(m_aPrefSize);
-    rOStm.WriteUInt32( GetActionSize() );
-
-    delete pCompat;
+    {
+        VersionCompat aCompat(rOStm, StreamMode::WRITE, 1);
+
+        rOStm.WriteUInt32(static_cast<sal_uInt32>(nStmCompressMode));
+        WriteMapMode(rOStm, m_aPrefMapMode);
+        TypeSerializer aSerializer(rOStm);
+        aSerializer.writeSize(m_aPrefSize);
+        rOStm.WriteUInt32(GetActionSize());
+    } // VersionCompat dtor writes stuff into the header
 
     ImplMetaWriteData aWriteData;
 


More information about the Libreoffice-commits mailing list