[Libreoffice-commits] core.git: Branch 'feature/perfwork4' - package/source

Matúš Kukan matus.kukan at collabora.com
Thu Oct 23 00:21:24 PDT 2014


 package/source/zippackage/ZipPackageStream.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 8c10cb5edc6902a96dc265d36faad0a8382b1a4a
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Thu Oct 23 09:07:38 2014 +0200

    HACK to avoid expensive and pointless deflating of jpeg files
    
    This is not intended to land in master; it's just for testing.
    
    Change-Id: If93cb78dcef903584de7b23f37282852c6d69f35

diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index c65d903..ff76105 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -768,8 +768,18 @@ bool ZipPackageStream::saveChild(
             // the entry is provided to the ZipOutputStream that will delete it
             pAutoTempEntry.release();
 
-            if (pTempEntry->nMethod == STORED)
+            if (pTempEntry->nMethod == STORED || rPath.endsWith(".jpeg"))
             {
+                // Do not try to deflate jpeg files, pretend they are compressed already
+                // Unfortunately we don't know CRC value
+                if (rPath.endsWith(".jpeg"))
+                {
+                    uno::Reference< io::XSeekable > xSeek(xStream, uno::UNO_QUERY);
+                    pTempEntry->nSize = pTempEntry->nCompressedSize = xSeek->getLength();
+                    pTempEntry->nCrc = 0;
+                    pTempEntry->nMethod = STORED;
+                    pTempEntry->nFlag &= ~(pTempEntry->nFlag & 8);
+                }
                 sal_Int32 nLength;
                 uno::Sequence< sal_Int8 > aSeq(n_ConstBufferSize);
                 rZipOut.writeLOC(pTempEntry, bToBeEncrypted);


More information about the Libreoffice-commits mailing list