package/source/zipapi/ZipFile.cxx | 10 +++++++-- package/source/zippackage/ZipPackageFolder.cxx | 12 +++++------ sfx2/source/appl/appuno.cxx | 26 +------------------------ 3 files changed, 16 insertions(+), 32 deletions(-)
New commits: commit d0ac36dd66664e3d6953de8b3bdd79eeed8d2e70 Author: Thorsten Behrens <tbehr...@suse.com> Date: Fri Dec 16 01:32:43 2011 +0100 Better fix for over-zealous Zip package consistency. Turns out our encrypted zip package code writes out mismatching compression methods in central directory and local file headers - so not only be lenient towards the apple bug (n#653688), but also ours (i.e. keep not comparing nMethod with nHow). diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index ef801f2..16d5a00 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -686,9 +686,15 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) rEntry.sPath = sLOCPath; } - // check basic local file header / entry consistency + // check basic local file header / entry consistency, just + // plain ignore bits 1 & 2 of the flag field - they are either + // purely informative, or even fully undefined (depending on + // nMethod) + // Do *not* compare nMethod / nHow, older versions with + // encrypted streams write mismatching DEFLATE/STORE pairs + // there. bBroken = rEntry.nVersion != nVersion - || rEntry.nFlag != nFlag + || (rEntry.nFlag & ~6L) != (nFlag & ~6L) || rEntry.nTime != nTime || rEntry.nPathLen != nPathLen || !rEntry.sPath.equals( sLOCPath ); commit f9128f9848de25d80bb032b872f03839f6a3b467 Author: Thorsten Behrens <tbehr...@suse.com> Date: Fri Dec 16 01:30:22 2011 +0100 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. diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 60f5cd1..daee0f4 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -657,16 +657,16 @@ bool ZipPackageFolder::saveChild( const ::rtl::OUString &rShortName, const Conte rInfo.pStream->SetToBeEncrypted( sal_True ); } + // Then copy it back afterwards... + ZipPackageFolder::copyZipEntry ( rInfo.pStream->aEntry, *pTempEntry ); + // Remove hacky bit from entry flags - if ( pTempEntry->nFlag & ( 1 << 4 ) ) + if ( rInfo.pStream->aEntry.nFlag & ( 1 << 4 ) ) { - pTempEntry->nFlag &= ~( 1 << 4 ); - pTempEntry->nMethod = STORED; + rInfo.pStream->aEntry.nFlag &= ~( 1 << 4 ); + rInfo.pStream->aEntry.nMethod = STORED; } - // Then copy it back afterwards... - ZipPackageFolder::copyZipEntry ( rInfo.pStream->aEntry, *pTempEntry ); - // TODO/LATER: get rid of this hack ( the encrypted stream size property is changed during saving ) if ( rInfo.pStream->IsEncrypted() ) rInfo.pStream->setSize( nOwnStreamOrigSize ); commit e0436514c3be513fcb0f02fd45be76f88569515b Author: Thorsten Behrens <tbehr...@suse.com> Date: Wed Dec 14 19:35:01 2011 +0100 Removed unused code. Clearly this iteration and reading of the referer, that is then subsequently not used at all by the method, can go. diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 93b0e41..5e44bbf 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -1701,23 +1701,12 @@ SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl() // ----------------------------------------------------------------------- void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star::util::URL& aURL , - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs , + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*lArgs*/ , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aGuard; - sal_uInt32 nPropertyCount = lArgs.getLength(); - ::rtl::OUString aReferer; - for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) ) - { - lArgs[nProperty].Value >>= aReferer; - break; - } - } - ::com::sun::star::uno::Any aAny; ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() ); if( xListener.is() ) @@ -1747,22 +1736,11 @@ void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star:: // ----------------------------------------------------------------------- void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL& aURL , - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*lArgs*/ ) throw (::com::sun::star::uno::RuntimeException) { SolarMutexGuard aGuard; - sal_uInt32 nPropertyCount = lArgs.getLength(); - ::rtl::OUString aReferer; - for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) - { - if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) ) - { - lArgs[nProperty].Value >>= aReferer; - break; - } - } - ::com::sun::star::uno::Any aAny; /*ErrCode nErr = */loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() ); } _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits