summaryrefslogtreecommitdiff
path: root/package/source/zippackage
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-10-20 22:02:48 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-11-17 10:49:21 +0100
commit4d1cb2dc5f1cae97ea44bded3b68d57076e21731 (patch)
tree0f3756ffd2d5232498c679d182bad50bc443927e /package/source/zippackage
parent2d92a84a6aac37e34d1699fdebe0270468b4f746 (diff)
package: Zipping STORED entry is the same as rawWrite and we don't encrypt it
Change-Id: Ie3f8ac261a70c9a2b5182fc7d36938d0a46ec045
Diffstat (limited to 'package/source/zippackage')
-rw-r--r--package/source/zippackage/ZipPackage.cxx4
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx31
2 files changed, 22 insertions, 13 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index a05320a48951..23a737e31264 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -998,9 +998,7 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
try
{
aZipOut.putNextEntry(*pEntry);
- ZipOutputEntry aZipEntry(m_xContext, &aZipOut, *pEntry, NULL);
- aZipEntry.write(aType, 0, nBufferLength);
- aZipEntry.closeEntry();
+ aZipOut.rawWrite(aType, 0, nBufferLength);
aZipOut.rawCloseEntry();
}
catch ( const ::com::sun::star::io::IOException & r )
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 7547e9cf0dc5..edc1c7aa1818 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -485,8 +485,8 @@ bool ZipPackageStream::saveChild(
pTempEntry->sPath = rPath;
pTempEntry->nPathLen = (sal_Int16)( OUStringToOString( pTempEntry->sPath, RTL_TEXTENCODING_UTF8 ).getLength() );
- bool bToBeEncrypted = m_bToBeEncrypted && (rEncryptionKey.getLength() || m_bHaveOwnKey);
- bool bToBeCompressed = bToBeEncrypted ? sal_True : m_bToBeCompressed;
+ const bool bToBeEncrypted = m_bToBeEncrypted && (rEncryptionKey.getLength() || m_bHaveOwnKey);
+ const bool bToBeCompressed = bToBeEncrypted ? sal_True : m_bToBeCompressed;
aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
aPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType( );
@@ -732,20 +732,31 @@ bool ZipPackageStream::saveChild(
try
{
rZipOut.putNextEntry(*pTempEntry, bToBeEncrypted);
- ZipOutputEntry aZipEntry(m_xContext, &rZipOut, *pTempEntry, this, bToBeEncrypted);
// the entry is provided to the ZipOutputStream that will delete it
pAutoTempEntry.release();
-
sal_Int32 nLength;
uno::Sequence < sal_Int8 > aSeq (n_ConstBufferSize);
- do
+
+ if (pTempEntry->nMethod == STORED)
{
- nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
- aZipEntry.write(aSeq, 0, nLength);
+ do
+ {
+ nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
+ rZipOut.rawWrite(aSeq, 0, nLength);
+ }
+ while ( nLength == n_ConstBufferSize );
+ }
+ else
+ {
+ ZipOutputEntry aZipEntry(m_xContext, &rZipOut, *pTempEntry, this, bToBeEncrypted);
+ do
+ {
+ nLength = xStream->readBytes(aSeq, n_ConstBufferSize);
+ aZipEntry.write(aSeq, 0, nLength);
+ }
+ while ( nLength == n_ConstBufferSize );
+ aZipEntry.closeEntry();
}
- while ( nLength == n_ConstBufferSize );
-
- aZipEntry.closeEntry();
rZipOut.rawCloseEntry();
}
catch ( ZipException& )