summaryrefslogtreecommitdiff
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-05 22:54:16 +0100
commitd10d70d8181753426f9c816cdd2ffca246b2c48c (patch)
treed49f05396e56667df0075d5d6800680e71eca206
parente639042357efda281cb28d0707b2d683be64360a (diff)
ZipOutputEntry: m_pCurrentEntry is always set
Change-Id: Ib6a69a83f4a378df838b2231b9eba7fba49cd9f1
-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 );
}
}