Fix inconsistent compression method for encrypted ZIP packages.

While fixing n#653688, turned out we write method=STORED into local
file headers, and method=DEFLATED into central directory structure
for encrypted ODF. Damn side-effects - fixed as hopefully intended
here.
This commit is contained in:
Thorsten Behrens
2011-12-16 01:30:22 +01:00
parent e0436514c3
commit f9128f9848

View File

@@ -657,16 +657,16 @@ bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const Conte
rInfo.pStream->SetToBeEncrypted( sal_True );
}
// Remove hacky bit from entry flags
if ( pTempEntry->nFlag & ( 1 << 4 ) )
{
pTempEntry->nFlag &= ~( 1 << 4 );
pTempEntry->nMethod = STORED;
}
// Then copy it back afterwards...
ZipPackageFolder::copyZipEntry ( rInfo.pStream->aEntry, *pTempEntry );
// Remove hacky bit from entry flags
if ( rInfo.pStream->aEntry.nFlag & ( 1 << 4 ) )
{
rInfo.pStream->aEntry.nFlag &= ~( 1 << 4 );
rInfo.pStream->aEntry.nMethod = STORED;
}
// TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving )
if ( rInfo.pStream->IsEncrypted() )
rInfo.pStream->setSize( nOwnStreamOrigSize );