summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-10-20 22:54:49 +0200
committerMatúš Kukan <matus.kukan@collabora.com>2014-11-17 10:49:21 +0100
commit3e7ab1ac1dc91544bdc58949ac62853b0ee33760 (patch)
treea8db0425f71f9bb2327e9d43b44612146319727b /package
parent4d1cb2dc5f1cae97ea44bded3b68d57076e21731 (diff)
ZipOutputEntry: m_pCurrentEntry is always set
Change-Id: Ib6a69a83f4a378df838b2231b9eba7fba49cd9f1
Diffstat (limited to 'package')
-rw-r--r--package/source/zipapi/ZipOutputEntry.cxx83
1 files changed, 38 insertions, 45 deletions
diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx
index b73f0a2d4f75..ca08abbec3cf 100644
--- a/package/source/zipapi/ZipOutputEntry.cxx
+++ b/package/source/zipapi/ZipOutputEntry.cxx
@@ -64,62 +64,55 @@ ZipOutputEntry::~ZipOutputEntry( void )
{
}
-void SAL_CALL ZipOutputEntry::closeEntry( )
+void SAL_CALL ZipOutputEntry::closeEntry()
throw(IOException, RuntimeException)
{
- ZipEntry *pEntry = m_pCurrentEntry;
- if (pEntry)
+ m_aDeflater.finish();
+ while (!m_aDeflater.finished())
+ doDeflate();
+
+ if ((m_pCurrentEntry->nFlag & 8) == 0)
{
- m_aDeflater.finish();
- while (!m_aDeflater.finished())
- doDeflate();
- if ((pEntry->nFlag & 8) == 0)
+ if (m_pCurrentEntry->nSize != m_aDeflater.getTotalIn())
{
- if (pEntry->nSize != m_aDeflater.getTotalIn())
- {
- OSL_FAIL("Invalid entry size");
- }
- if (pEntry->nCompressedSize != m_aDeflater.getTotalOut())
- {
- // Different compression strategies make the merit of this
- // test somewhat dubious
- pEntry->nCompressedSize = m_aDeflater.getTotalOut();
- }
- if (pEntry->nCrc != m_aCRC.getValue())
- {
- OSL_FAIL("Invalid entry CRC-32");
- }
+ OSL_FAIL("Invalid entry size");
}
- else
+ if (m_pCurrentEntry->nCompressedSize != m_aDeflater.getTotalOut())
{
- if ( !m_bEncryptCurrentEntry )
- {
- pEntry->nSize = m_aDeflater.getTotalIn();
- pEntry->nCompressedSize = m_aDeflater.getTotalOut();
- }
- pEntry->nCrc = m_aCRC.getValue();
+ // Different compression strategies make the merit of this
+ // test somewhat dubious
+ m_pCurrentEntry->nCompressedSize = m_aDeflater.getTotalOut();
}
- m_aDeflater.reset();
- m_aCRC.reset();
-
- if (m_bEncryptCurrentEntry)
+ if (m_pCurrentEntry->nCrc != m_aCRC.getValue())
{
- m_bEncryptCurrentEntry = false;
-
- m_xCipherContext.clear();
+ OSL_FAIL("Invalid entry CRC-32");
+ }
+ }
+ else
+ {
+ if ( !m_bEncryptCurrentEntry )
+ {
+ m_pCurrentEntry->nSize = m_aDeflater.getTotalIn();
+ m_pCurrentEntry->nCompressedSize = m_aDeflater.getTotalOut();
+ }
+ m_pCurrentEntry->nCrc = m_aCRC.getValue();
+ }
+ m_aDeflater.reset();
+ m_aCRC.reset();
- uno::Sequence< sal_Int8 > aDigestSeq;
- if ( m_xDigestContext.is() )
- {
- aDigestSeq = m_xDigestContext->finalizeDigestAndDispose();
- m_xDigestContext.clear();
- }
+ if (m_bEncryptCurrentEntry)
+ {
+ 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();
}
- m_pCurrentEntry = NULL;
- m_pCurrentStream = NULL;
+
+ if ( m_pCurrentStream )
+ m_pCurrentStream->setDigest( aDigestSeq );
}
}