diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-12-13 23:09:10 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-12-14 00:21:18 +0100 |
commit | 43eca2d9f8d87363b5f4bf8c5df92bf06be08c08 (patch) | |
tree | f44052ffe4cc1d49035cfc113aef42aed468f4bc /package/source/zippackage | |
parent | 2ffeaecdf0bbef478408fb6753ec6cf9ea043b16 (diff) |
package: Create memory buffer only when we need it - if we use parallelism
Otherwise write directly to the resulting zip file.
Change-Id: I75097969f0cccf0b45da591c71221e5ae18668cb
Diffstat (limited to 'package/source/zippackage')
-rw-r--r-- | package/source/zippackage/ZipPackage.cxx | 6 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 8da7c1ff00af..5f9c179820bc 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1043,10 +1043,9 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq // the manifest.xml is never encrypted - so pass an empty reference ZipOutputStream::setEntry(pEntry); aZipOut.writeLOC(pEntry); - ZipOutputEntry aZipEntry(m_xContext, *pEntry, NULL); + ZipOutputEntry aZipEntry(aZipOut.getStream(), m_xContext, *pEntry, NULL); aZipEntry.write(pBuffer->getSequence()); aZipEntry.closeEntry(); - aZipOut.rawWrite(aZipEntry.getData()); aZipOut.rawCloseEntry(); } @@ -1097,10 +1096,9 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: // there is no encryption in this format currently ZipOutputStream::setEntry(pEntry); aZipOut.writeLOC(pEntry); - ZipOutputEntry aZipEntry(m_xContext, *pEntry, NULL); + ZipOutputEntry aZipEntry(aZipOut.getStream(), m_xContext, *pEntry, NULL); aZipEntry.write(pBuffer->getSequence()); aZipEntry.closeEntry(); - aZipOut.rawWrite(aZipEntry.getData()); aZipOut.rawCloseEntry(); } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 2c9562b04c78..54d0def91af9 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -815,15 +815,16 @@ bool ZipPackageStream::saveChild( if (bParallelDeflate) { // Start a new thread deflating this zip entry - ZipOutputEntry *pZipEntry = new ZipOutputEntry(m_xContext, *pTempEntry, this, bToBeEncrypted); + ZipOutputEntry *pZipEntry = new ZipOutputEntry( + css::uno::Reference<css::io::XOutputStream>(), + m_xContext, *pTempEntry, this, bToBeEncrypted); rZipOut.addDeflatingThread( pZipEntry, new DeflateThread(pZipEntry, xStream) ); } else { rZipOut.writeLOC(pTempEntry, bToBeEncrypted); - ZipOutputEntry aZipEntry(m_xContext, *pTempEntry, this, bToBeEncrypted); + ZipOutputEntry aZipEntry(rZipOut.getStream(), m_xContext, *pTempEntry, this, bToBeEncrypted); deflateZipEntry(&aZipEntry, xStream); - rZipOut.rawWrite(aZipEntry.getData()); rZipOut.rawCloseEntry(bToBeEncrypted); } } |