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

panoskorovesis (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 17 02:41:56 UTC 2021


 include/vcl/gdimtf.hxx    |   10 --
 vcl/source/gdi/gdimtf.cxx |  159 ----------------------------------------------
 2 files changed, 169 deletions(-)

New commits:
commit 20d48960d7c6d1fda499983853c9c4e4c9b3f9e1
Author:     panoskorovesis <panoskorovesis at outlook.com>
AuthorDate: Mon Aug 9 11:59:58 2021 +0300
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Tue Aug 17 04:41:16 2021 +0200

    Remove unused methods from gdimtf.hxx
    
    Remove GDIMetaFile::Read, ReadGDIMetaFile, GDIMetaFile::Write,
    WriteGDIMetaFile. Their functionality is covered from SvmReader::Read
    and SvmWriter::Write respectively
    
    Change-Id: Id3d22e251d19c2898359a6c1dbeffbc53419540b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120409
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 5293958ddaad..8ce95ed11029 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -182,16 +182,6 @@ public:
     BitmapChecksum  GetChecksum() const;
     sal_uLong       GetSizeBytes() const;
 
-    // Methods for reading and writing the new formats;
-    // the Read method also reads the old format
-    SvStream&       Read( SvStream& rIStm );
-    SvStream&       Write( SvStream& rOStm );
-
-    // Stream-operators write (still) the old format
-    // and read both the old and the new format
-    friend VCL_DLLPUBLIC SvStream& ReadGDIMetaFile(SvStream& rIStm, GDIMetaFile& rGDIMetaFile, ImplMetaReadData* pReadData);
-    friend VCL_DLLPUBLIC SvStream& WriteGDIMetaFile(SvStream& rOStm, const GDIMetaFile& rGDIMetaFile);
-
     /// Creates an antialiased thumbnail
     bool            CreateThumbnail(BitmapEx& rBitmapEx,
                                     BmpConversion nColorConversion = BmpConversion::N24Bit,
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index cceaef8b9afd..60e3ec0f293d 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2612,165 +2612,6 @@ sal_uLong GDIMetaFile::GetSizeBytes() const
     return nSizeBytes;
 }
 
-namespace
-{
-    class DepthGuard
-    {
-    private:
-        ImplMetaReadData& m_rData;
-        rtl_TextEncoding m_eOrigCharSet;
-    public:
-        DepthGuard(ImplMetaReadData& rData, SvStream const & rIStm)
-            : m_rData(rData)
-            , m_eOrigCharSet(m_rData.meActualCharSet)
-        {
-            ++m_rData.mnParseDepth;
-            m_rData.meActualCharSet = rIStm.GetStreamCharSet();
-        }
-        bool TooDeep() const { return m_rData.mnParseDepth > 1024; }
-        ~DepthGuard()
-        {
-            --m_rData.mnParseDepth;
-            m_rData.meActualCharSet = m_eOrigCharSet;
-        }
-    };
-}
-
-SvStream& ReadGDIMetaFile(SvStream& rIStm, GDIMetaFile& rGDIMetaFile, ImplMetaReadData* pData)
-{
-    if (rIStm.GetError())
-    {
-        SAL_WARN("vcl.gdi", "Stream error: " << rIStm.GetError());
-        return rIStm;
-    }
-
-    sal_uLong      nStmPos = rIStm.Tell();
-    SvStreamEndian nOldFormat = rIStm.GetEndian();
-
-    rIStm.SetEndian( SvStreamEndian::LITTLE );
-
-    try
-    {
-        char aId[7];
-        aId[0] = 0;
-        aId[6] = 0;
-        rIStm.ReadBytes( aId, 6 );
-
-        if ( !strcmp( aId, "VCLMTF" ) )
-        {
-            // new format
-            sal_uInt32     nStmCompressMode = 0;
-            sal_uInt32     nCount = 0;
-            std::unique_ptr<VersionCompatRead> pCompat(new VersionCompatRead(rIStm));
-
-            rIStm.ReadUInt32( nStmCompressMode );
-            TypeSerializer aSerializer(rIStm);
-            aSerializer.readMapMode(rGDIMetaFile.m_aPrefMapMode);
-            aSerializer.readSize(rGDIMetaFile.m_aPrefSize);
-            rIStm.ReadUInt32( nCount );
-
-            pCompat.reset(); // destructor writes stuff into the header
-
-            std::unique_ptr<ImplMetaReadData> xReadData;
-            if (!pData)
-            {
-                xReadData.reset(new ImplMetaReadData);
-                pData = xReadData.get();
-            }
-            DepthGuard aDepthGuard(*pData, rIStm);
-
-            if (aDepthGuard.TooDeep())
-                throw std::runtime_error("too much recursion");
-
-            for( sal_uInt32 nAction = 0; ( nAction < nCount ) && !rIStm.eof(); nAction++ )
-            {
-                rtl::Reference<MetaAction> pAction = MetaAction::ReadMetaAction(rIStm, pData);
-                if( pAction )
-                {
-                    if (pAction->GetType() == MetaActionType::COMMENT)
-                    {
-                        MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction.get());
-                        if ( pCommentAct->GetComment() == "EMF_PLUS" )
-                            rGDIMetaFile.UseCanvas( true );
-                    }
-                    rGDIMetaFile.AddAction( pAction );
-                }
-            }
-        }
-        else
-        {
-            rIStm.Seek( nStmPos );
-            SVMConverter( rIStm, rGDIMetaFile );
-        }
-    }
-    catch (...)
-    {
-        SAL_WARN("vcl", "GDIMetaFile exception during load");
-        rIStm.SetError(SVSTREAM_FILEFORMAT_ERROR);
-    };
-
-    // check for errors
-    if( rIStm.GetError() )
-    {
-        rGDIMetaFile.Clear();
-        rIStm.Seek( nStmPos );
-    }
-
-    rIStm.SetEndian( nOldFormat );
-    return rIStm;
-}
-
-SvStream& WriteGDIMetaFile( SvStream& rOStm, const GDIMetaFile& rGDIMetaFile )
-{
-    if( !rOStm.GetError() )
-    {
-        const_cast< GDIMetaFile& >( rGDIMetaFile ).Write( rOStm );
-    }
-    return rOStm;
-}
-
-SvStream& GDIMetaFile::Read( SvStream& rIStm )
-{
-    Clear();
-    ReadGDIMetaFile( rIStm, *this );
-
-    return rIStm;
-}
-
-SvStream& GDIMetaFile::Write( SvStream& rOStm )
-{
-    const SvStreamCompressFlags nStmCompressMode = rOStm.GetCompressMode();
-    SvStreamEndian   nOldFormat = rOStm.GetEndian();
-
-    rOStm.SetEndian( SvStreamEndian::LITTLE );
-    rOStm.WriteBytes( "VCLMTF", 6 );
-
-    {
-        VersionCompatWrite aCompat(rOStm, 1);
-
-        rOStm.WriteUInt32(static_cast<sal_uInt32>(nStmCompressMode));
-        TypeSerializer aSerializer(rOStm);
-        aSerializer.writeMapMode(m_aPrefMapMode);
-        aSerializer.writeSize(m_aPrefSize);
-        rOStm.WriteUInt32(GetActionSize());
-    } // VersionCompatWrite dtor writes stuff into the header
-
-    ImplMetaWriteData aWriteData;
-
-    aWriteData.meActualCharSet = rOStm.GetStreamCharSet();
-
-    MetaAction* pAct = FirstAction();
-    while ( pAct )
-    {
-        pAct->Write( rOStm, &aWriteData );
-        pAct = NextAction();
-    }
-
-    rOStm.SetEndian( nOldFormat );
-
-    return rOStm;
-}
-
 bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConversion, BmpScaleFlag nScaleFlag) const
 {
     // initialization seems to be complicated but is used to avoid rounding errors


More information about the Libreoffice-commits mailing list