Kaydet (Commit) 3e7ab1ac authored tarafından Matúš Kukan's avatar Matúš Kukan

ZipOutputEntry: m_pCurrentEntry is always set

Change-Id: Ib6a69a83f4a378df838b2231b9eba7fba49cd9f1
üst 4d1cb2dc
...@@ -64,28 +64,26 @@ ZipOutputEntry::~ZipOutputEntry( void ) ...@@ -64,28 +64,26 @@ ZipOutputEntry::~ZipOutputEntry( void )
{ {
} }
void SAL_CALL ZipOutputEntry::closeEntry( ) void SAL_CALL ZipOutputEntry::closeEntry()
throw(IOException, RuntimeException) throw(IOException, RuntimeException)
{ {
ZipEntry *pEntry = m_pCurrentEntry;
if (pEntry)
{
m_aDeflater.finish(); m_aDeflater.finish();
while (!m_aDeflater.finished()) while (!m_aDeflater.finished())
doDeflate(); doDeflate();
if ((pEntry->nFlag & 8) == 0)
if ((m_pCurrentEntry->nFlag & 8) == 0)
{ {
if (pEntry->nSize != m_aDeflater.getTotalIn()) if (m_pCurrentEntry->nSize != m_aDeflater.getTotalIn())
{ {
OSL_FAIL("Invalid entry size"); OSL_FAIL("Invalid entry size");
} }
if (pEntry->nCompressedSize != m_aDeflater.getTotalOut()) if (m_pCurrentEntry->nCompressedSize != m_aDeflater.getTotalOut())
{ {
// Different compression strategies make the merit of this // Different compression strategies make the merit of this
// test somewhat dubious // test somewhat dubious
pEntry->nCompressedSize = m_aDeflater.getTotalOut(); m_pCurrentEntry->nCompressedSize = m_aDeflater.getTotalOut();
} }
if (pEntry->nCrc != m_aCRC.getValue()) if (m_pCurrentEntry->nCrc != m_aCRC.getValue())
{ {
OSL_FAIL("Invalid entry CRC-32"); OSL_FAIL("Invalid entry CRC-32");
} }
...@@ -94,18 +92,16 @@ void SAL_CALL ZipOutputEntry::closeEntry( ) ...@@ -94,18 +92,16 @@ void SAL_CALL ZipOutputEntry::closeEntry( )
{ {
if ( !m_bEncryptCurrentEntry ) if ( !m_bEncryptCurrentEntry )
{ {
pEntry->nSize = m_aDeflater.getTotalIn(); m_pCurrentEntry->nSize = m_aDeflater.getTotalIn();
pEntry->nCompressedSize = m_aDeflater.getTotalOut(); m_pCurrentEntry->nCompressedSize = m_aDeflater.getTotalOut();
} }
pEntry->nCrc = m_aCRC.getValue(); m_pCurrentEntry->nCrc = m_aCRC.getValue();
} }
m_aDeflater.reset(); m_aDeflater.reset();
m_aCRC.reset(); m_aCRC.reset();
if (m_bEncryptCurrentEntry) if (m_bEncryptCurrentEntry)
{ {
m_bEncryptCurrentEntry = false;
m_xCipherContext.clear(); m_xCipherContext.clear();
uno::Sequence< sal_Int8 > aDigestSeq; uno::Sequence< sal_Int8 > aDigestSeq;
...@@ -118,9 +114,6 @@ void SAL_CALL ZipOutputEntry::closeEntry( ) ...@@ -118,9 +114,6 @@ void SAL_CALL ZipOutputEntry::closeEntry( )
if ( m_pCurrentStream ) if ( m_pCurrentStream )
m_pCurrentStream->setDigest( aDigestSeq ); m_pCurrentStream->setDigest( aDigestSeq );
} }
m_pCurrentEntry = NULL;
m_pCurrentStream = NULL;
}
} }
void SAL_CALL ZipOutputEntry::write( const Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength ) void SAL_CALL ZipOutputEntry::write( const Sequence< sal_Int8 >& rBuffer, sal_Int32 nNewOffset, sal_Int32 nNewLength )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment