svx/source/gallery2/codec.cxx   |   49 ++--------------------------------------
 svx/source/gallery2/galmisc.cxx |    7 -----
 2 files changed, 4 insertions(+), 52 deletions(-)

New commits:
commit a334219781d3298a3d20d45bd5589cab85de802c
Author:     Caolán McNamara <[email protected]>
AuthorDate: Mon Nov 4 11:11:07 2024 +0000
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Nov 5 09:56:32 2024 +0100

    delete useless parts of GalleryCodec::Read
    
    no point reading this to just to discard it later
    
    the only places reading this are just opening, using
    and close the streams afterwards, so the need
    to even skip over this data doesn't seem to arise.
    
    Change-Id: Ieb2498f458534770c167bbbfb3a4792162238986
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175986
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx
index 062c60dbecc6..19e2a92cb548 100644
--- a/svx/source/gallery2/codec.cxx
+++ b/svx/source/gallery2/codec.cxx
@@ -18,6 +18,7 @@
  */
 
 
+#include <sal/log.hxx>
 #include <tools/stream.hxx>
 #include <tools/zcodec.hxx>
 #include "codec.hxx"
@@ -84,56 +85,12 @@ void GalleryCodec::Read( SvStream& rStmToRead )
     if( !IsCoded( rStm, nVersion ) )
         return;
 
-    sal_uInt32  nCompressedSize, nUnCompressedSize;
-
-    rStm.SeekRel( 6 );
-    rStm.ReadUInt32( nUnCompressedSize ).ReadUInt32( nCompressedSize );
+    rStm.SeekRel( 14 );
 
     // decompress
     if( 1 == nVersion )
     {
-        std::unique_ptr<sal_uInt8[]> pCompressedBuffer(new sal_uInt8[ 
nCompressedSize ]);
-        rStm.ReadBytes(pCompressedBuffer.get(), nCompressedSize);
-        sal_uInt8*  pInBuf = pCompressedBuffer.get();
-        std::unique_ptr<sal_uInt8[]> pOutBuf(new sal_uInt8[ nUnCompressedSize 
]);
-        sal_uInt8*  pTmpBuf = pOutBuf.get();
-        sal_uInt8*  pLast = pOutBuf.get() + nUnCompressedSize - 1;
-        sal_uIntPtr   nIndex = 0, nCountByte, nRunByte;
-        bool    bEndDecoding = false;
-
-        do
-        {
-            nCountByte = *pInBuf++;
-
-            if ( !nCountByte )
-            {
-                nRunByte = *pInBuf++;
-
-                if ( nRunByte > 2 )
-                {
-                    // filling absolutely
-                    memcpy( &pTmpBuf[ nIndex ], pInBuf, nRunByte );
-                    pInBuf += nRunByte;
-                    nIndex += nRunByte;
-
-                    // note WORD alignment
-                    if ( nRunByte & 1 )
-                        pInBuf++;
-                }
-                else if ( nRunByte == 1 )   // End of the image
-                    bEndDecoding = true;
-            }
-            else
-            {
-                const sal_uInt8 cVal = *pInBuf++;
-
-                memset( &pTmpBuf[ nIndex ], cVal, nCountByte );
-                nIndex += nCountByte;
-            }
-        }
-        while ( !bEndDecoding && ( pTmpBuf <= pLast ) );
-
-        rStmToRead.WriteBytes(pOutBuf.get(), nUnCompressedSize);
+        SAL_WARN("svx", "staroffice binary file formats are no longer 
supported inside the gallery!");
     }
     else if( 2 == nVersion )
     {
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index ab5713f7a4df..7e4bdef6c428 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -86,12 +86,7 @@ bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel )
         aCodec.Read( aMemStm );
         aMemStm.Seek( 0 );
 
-        if( 1 == nVersion )
-        {
-            OSL_FAIL( "staroffice binary file formats are no longer supported 
inside the gallery!" );
-            bRet = false;
-        }
-        else if( 2 == nVersion )
+        if ( 2 == nVersion )
         {
             // recall to read as XML
             bRet = GallerySvDrawImport( aMemStm, rModel );

Reply via email to