diff options
Diffstat (limited to 'package/source/zipapi/ZipOutputEntry.cxx')
-rw-r--r-- | package/source/zipapi/ZipOutputEntry.cxx | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx index f08e687c43a4..c63dc1691136 100644 --- a/package/source/zipapi/ZipOutputEntry.cxx +++ b/package/source/zipapi/ZipOutputEntry.cxx @@ -99,20 +99,20 @@ void ZipOutputEntryBase::closeEntry() deflaterReset(); m_aCRC.reset(); - if (m_bEncryptCurrentEntry) - { - m_xCipherContext.clear(); + if (!m_bEncryptCurrentEntry) + return; - uno::Sequence< sal_Int8 > aDigestSeq; - if ( m_xDigestContext.is() ) - { - aDigestSeq = m_xDigestContext->finalizeDigestAndDispose(); - m_xDigestContext.clear(); - } + m_xCipherContext.clear(); - if ( m_pCurrentStream ) - m_pCurrentStream->setDigest( aDigestSeq ); + uno::Sequence< sal_Int8 > aDigestSeq; + if ( m_xDigestContext.is() ) + { + aDigestSeq = m_xDigestContext->finalizeDigestAndDispose(); + m_xDigestContext.clear(); } + + if ( m_pCurrentStream ) + m_pCurrentStream->setDigest( aDigestSeq ); } void ZipOutputEntryBase::processDeflated( const uno::Sequence< sal_Int8 >& deflateBuffer, sal_Int32 nLength ) @@ -148,19 +148,19 @@ void ZipOutputEntryBase::processDeflated( const uno::Sequence< sal_Int8 >& defla } } - if ( isDeflaterFinished() && m_bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is() ) + if ( !(isDeflaterFinished() && m_bEncryptCurrentEntry && m_xDigestContext.is() && m_xCipherContext.is()) ) + return; + + // FIXME64: sequence not 64bit safe. + uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->finalizeCipherContextAndDispose(); + if ( aEncryptionBuffer.hasElements() ) { - // FIXME64: sequence not 64bit safe. - uno::Sequence< sal_Int8 > aEncryptionBuffer = m_xCipherContext->finalizeCipherContextAndDispose(); - if ( aEncryptionBuffer.hasElements() ) - { - m_xOutStream->writeBytes( aEncryptionBuffer ); + m_xOutStream->writeBytes( aEncryptionBuffer ); - // the sizes as well as checksum for encrypted streams are calculated here - m_pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength(); - m_pCurrentEntry->nSize = m_pCurrentEntry->nCompressedSize; - m_aCRC.update( aEncryptionBuffer ); - } + // the sizes as well as checksum for encrypted streams are calculated here + m_pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength(); + m_pCurrentEntry->nSize = m_pCurrentEntry->nCompressedSize; + m_aCRC.update( aEncryptionBuffer ); } } |