[Libreoffice-commits] core.git: package/source sfx2/source xmloff/source xmlsecurity/source
package/source/xstor/owriteablestream.cxx |2 +- package/source/zippackage/ZipPackageStream.cxx |3 +++ sfx2/source/doc/docfile.cxx | 15 +++ xmloff/source/core/xmlexp.cxx |1 + xmlsecurity/source/xmlsec/nss/ciphercontext.cxx |8 5 files changed, 16 insertions(+), 13 deletions(-) New commits: commit f6536f4db61b73cf7fd4a44bb5ba61eff61f8f91 Author: Michael Stahl AuthorDate: Wed Dec 6 13:54:39 2023 +0100 Commit: Michael Stahl CommitDate: Thu Dec 7 09:28:08 2023 +0100 some cosmetic improvements, better warnings Change-Id: I05a7eeb74088c278aab94519c7f53b0482e38058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160400 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 59e5e94316a3..68bf5d1688a0 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1113,7 +1113,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod } catch ( const uno::Exception& ex ) { -TOOLS_WARN_EXCEPTION( "package.xstor", "Can't write encryption related properties"); +TOOLS_WARN_EXCEPTION("package.xstor", "GetStream: decrypting stream failed"); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); throw io::IOException(ex.Message); // TODO: } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 02282a03c4e5..d3c80cec2dce 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -947,6 +947,9 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() } catch( const packages::WrongPasswordException& ) { +// note: due to SHA1 check this fallback is only done for +// * ODF 1.2 files written by OOo < 3.4beta / LO < 3.5 +// * ODF 1.1/OOoXML files written by any version if ( m_rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 ) { SAL_WARN("package", "ZipPackageStream::getDataStream(): SHA1 mismatch, trying fallbacks..."); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 42fe7d72b8c5..f4dd7b62e10f 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2954,13 +2954,11 @@ void SfxMedium::Download( const Link& aLink ) } -void SfxMedium::Init_Impl() -/* [Description] -Includes a valid:: sun:: com:: star:: util:: URL (If a file name was -previously in there) in the logical name and if available sets the -physical name as the file name. +/** +Sets m_aLogicName to a valid URL and if available sets +the physical name m_aName to the file name. */ - +void SfxMedium::Init_Impl() { Reference< XOutputStream > rOutStream; @@ -4124,7 +4122,7 @@ bool SfxMedium::SignDocumentContentUsingCertificate( } catch ( const uno::Exception& ) { -SAL_WARN( "sfx.doc", "Couldn't use signing functionality!" ); +TOOLS_WARN_EXCEPTION("sfx.doc", "Couldn't use signing functionality!"); } CloseAndRelease(); @@ -4134,6 +4132,7 @@ bool SfxMedium::SignDocumentContentUsingCertificate( return bChanges; } +// note: this is the only function creating scripting signature bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent, bool bSignScriptingContent, bool bHasValidDocumentSignature, @@ -4294,7 +4293,7 @@ bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent, } catch ( const uno::Exception& ) { -SAL_WARN( "sfx.doc", "Couldn't use signing functionality!" ); +TOOLS_WARN_EXCEPTION("sfx.doc", "Couldn't use signing functionality!"); } CloseAndRelease(); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 7c6be149fac3..9900fa4d86fe 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1185,6 +1185,7 @@ lcl_AddGrddl(SvXMLExport const & rExport, const SvXMLExportFlags /*nExportMode*/ #endif } +// note: the point of this is presumably to mitigate SHA/1k info leak of plain text void SvXMLExport::addChaffWhenEncryptedStorage() { uno::Reference< embed::XEncryptionProtectedSource2 > xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY); diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index ff3441249435..9577c6d9c025 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -160,7 +160,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestExport.cxx |8 package/source/manifest/ManifestImport.cxx |6 +++--- package/source/xstor/owriteablestream.cxx |8 package/source/zippackage/ZipPackage.cxx | 16 package/source/zippackage/ZipPackageStream.cxx | 10 +- 5 files changed, 24 insertions(+), 24 deletions(-) New commits: commit 6e4d3c3476fb60116fc7100a30a30ae15f60ce62 Author: Stephan Bergmann AuthorDate: Thu Oct 19 10:30:21 2023 +0200 Commit: Stephan Bergmann CommitDate: Fri Oct 20 07:06:58 2023 +0200 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: package Change-Id: I5d70d9291a64139bc2dc60c63173fef862a00f2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158207 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 79948c9ff068..feeb63353698 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -49,9 +49,9 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con static constexpr OUStringLiteral sPgpKeyIDProperty( u"KeyId" ); static constexpr OUStringLiteral sPgpKeyPacketProperty( u"KeyPacket" ); static constexpr OUStringLiteral sCipherValueProperty ( u"CipherValue" ); -static constexpr OUStringLiteral sFullPathProperty ( u"FullPath" ); -static constexpr OUStringLiteral sVersionProperty ( u"Version" ); -static constexpr OUStringLiteral sMediaTypeProperty( u"MediaType" ); +static constexpr OUString sFullPathProperty ( u"FullPath"_ustr ); +static constexpr OUString sVersionProperty ( u"Version"_ustr ); +static constexpr OUString sMediaTypeProperty( u"MediaType"_ustr ); static constexpr OUStringLiteral sIterationCountProperty ( u"IterationCount" ); static constexpr OUStringLiteral sDerivedKeySizeProperty ( u"DerivedKeySize" ); static constexpr OUStringLiteral sSaltProperty ( u"Salt" ); @@ -62,7 +62,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con static constexpr OUStringLiteral sStartKeyAlgProperty ( u"StartKeyAlgorithm" ); static constexpr OUStringLiteral sDigestAlgProperty( u"DigestAlgorithm" ); -static constexpr OUStringLiteral sWhiteSpace ( u" " ); +static constexpr OUString sWhiteSpace ( u" "_ustr ); const OUString sSHA256_URL_ODF12 ( SHA256_URL_ODF12 ); const OUString sSHA1_Name ( SHA1_NAME ); diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index d2b3177e34cf..2c55bcf87fe9 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -41,9 +41,9 @@ constexpr OUStringLiteral gsSaltProperty ( u"Salt" ); constexpr OUStringLiteral gsInitialisationVectorProperty ( u"InitialisationVector" ); constexpr OUStringLiteral gsSizeProperty ( u"Size" ); constexpr OUStringLiteral gsDigestProperty ( u"Digest" ); -constexpr OUStringLiteral gsEncryptionAlgProperty( u"EncryptionAlgorithm" ); -constexpr OUStringLiteral gsStartKeyAlgProperty ( u"StartKeyAlgorithm" ); -constexpr OUStringLiteral gsDigestAlgProperty( u"DigestAlgorithm" ); +constexpr OUString gsEncryptionAlgProperty( u"EncryptionAlgorithm"_ustr ); +constexpr OUString gsStartKeyAlgProperty ( u"StartKeyAlgorithm"_ustr ); +constexpr OUString gsDigestAlgProperty( u"DigestAlgorithm"_ustr ); ManifestImport::ManifestImport( std::vector < Sequence < PropertyValue > > & rNewManVector ) : bIgnoreEncryptData( false ) diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 1ed64c60e204..bd58f579a326 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -974,8 +974,8 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::ReadPackageStreamProper // The "Compressed" property must be set after "MediaType" property, // since the setting of the last one can change the value of the first one static constexpr OUStringLiteral sMediaType = u"MediaType"; -static constexpr OUStringLiteral sCompressed = u"Compressed"; -static constexpr OUStringLiteral sSize = u"Size"; +static constexpr OUString sCompressed = u"Compressed"_ustr; +static constexpr OUString sSize = u"Size"_ustr; static constexpr OUStringLiteral sEncrypted = u"Encrypted"; if ( m_nStorageType == embed::StorageFormats::OFOPXML || m_nStorageType == embed::StorageFormats::PACKAGE ) { @@ -2770,8 +2770,8 @@ void SAL_CALL OWriteStream::setPropertyValue( const OUString& aPropertyName, con }
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 77e13931fd2221daa56a101ef57d8a129d05c05b Author: Noel Grandin AuthorDate: Mon Aug 28 10:27:34 2023 +0200 Commit: Noel Grandin CommitDate: Mon Aug 28 12:59:32 2023 +0200 incorrect usage of erase..remove idion since commit c95221f151fbaab5f181bb5f8a5428a380d4d1bf Author: Julien Nabet Date: Mon Oct 9 21:19:43 2017 +0200 Replace list by vector InputStreamsList_Impl (package) Change-Id: Icd35f74863e68315c7fa580a1009743cc957192a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156184 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 22f1f54b3311..1ed64c60e204 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1292,7 +1292,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() void OWriteStream_Impl::InputStreamDisposed( OInputCompStream* pStream ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); -m_aInputStreamsVector.erase(std::remove(m_aInputStreamsVector.begin(), m_aInputStreamsVector.end(), pStream )); +m_aInputStreamsVector.erase(std::remove(m_aInputStreamsVector.begin(), m_aInputStreamsVector.end(), pStream ), m_aInputStreamsVector.end()); } void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io::XInputStream >& xDataToCopy, const uno::Sequence< beans::PropertyValue >& aProps, uno::Reference< io::XStream >& xTargetStream )
[Libreoffice-commits] core.git: package/source
package/source/xstor/ocompinstream.cxx|4 - package/source/xstor/owriteablestream.cxx | 22 ++ package/source/xstor/xfactory.cxx |6 - package/source/xstor/xstorage.cxx | 51 ++ package/source/zippackage/ZipPackage.cxx | 30 package/source/zippackage/ZipPackageEntry.cxx |2 package/source/zippackage/ZipPackageFolder.cxx|2 package/source/zippackage/ZipPackageFolderEnumeration.cxx |3 package/source/zippackage/zipfileaccess.cxx |4 - 9 files changed, 58 insertions(+), 66 deletions(-) New commits: commit 89a25bcda3dde0147f7b4f24eccfffa3216c8c0e Author: Mike Kaganski AuthorDate: Sun Apr 23 20:14:19 2023 +0300 Commit: Mike Kaganski CommitDate: Sun Jun 18 09:25:38 2023 +0200 Use getXWeak in package Change-Id: I838b7c0e45a2a701d400fb7189c5396ed4525a70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150860 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index b5931c0c0918..a7dd8ab2191a 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -189,7 +189,7 @@ void OInputCompStream::InternalDispose() // the source object is also a kind of locker for the current object // since the listeners could dispose the object while being notified -lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); +lang::EventObject aSource( getXWeak() ); if ( m_pInterfaceContainer ) m_pInterfaceContainer->disposeAndClear( aSource ); @@ -213,7 +213,7 @@ void SAL_CALL OInputCompStream::dispose( ) if ( m_pInterfaceContainer ) { -lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) ); +lang::EventObject aSource( getXWeak() ); m_pInterfaceContainer->disposeAndClear( aSource ); } diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 97b78249f6d8..22f1f54b3311 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1305,9 +1305,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: uno::Reference < io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW ); -uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream(); -if ( !xTempOut.is() ) -throw uno::RuntimeException(); +uno::Reference < io::XOutputStream > xTempOut(xTempFile->getOutputStream(), uno::UNO_SET_THROW); if ( xDataToCopy.is() ) ::comphelper::OStorageHelper::CopyInputToOutput( xDataToCopy, xTempOut ); @@ -1322,9 +1320,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: // TODO: remember last state of m_bUseCommonEncryption if ( !xTargetStream.is() ) xTargetStream.set( -static_cast< ::cppu::OWeakObject* >( -new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonEncryption ), m_nStorageType ) ), -uno::UNO_QUERY_THROW ); +new OInputSeekStream( xInStream, InsertOwnProps( aProps, m_bUseCommonEncryption ), m_nStorageType ) ); } void OWriteStream_Impl::GetCopyOfLastCommit( uno::Reference< io::XStream >& xTargetStream ) @@ -1989,7 +1985,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() catch( const io::IOException& r ) { throw lang::WrappedTargetRuntimeException("OWriteStream::getOutputStream: Could not create backing temp file", -static_cast < OWeakObject * > ( this ), css::uno::Any ( r ) ); +getXWeak(), css::uno::Any ( r ) ); } if ( !m_pImpl ) @@ -2329,7 +2325,7 @@ void SAL_CALL OWriteStream::dispose() uno::Any aCaught( ::cppu::getCaughtException() ); SAL_INFO("package.xstor", "Rethrow: " << exceptionToString(aCaught)); throw lang::WrappedTargetRuntimeException("Can not commit/revert the storage!", -static_cast< OWeakObject* >( this ), +getXWeak(), aCaught ); } } @@ -2341,7 +2337,7 @@ void SAL_CALL OWriteStream::dispose() // for now the listener is just notified at the end of the method to workaround the problem // in future a more elegant way should be found -lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) ); +lang::EventObject aSource( getXWeak() ); m_aListenersContainer.disposeAndClear( aSource ); } @@ -2458,7 +2454,7 @@ sal_Bool SAL_CALL OWriteStream::hasEncryptionData() uno::Any aCaught(
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx | 31 ++- 1 file changed, 18 insertions(+), 13 deletions(-) New commits: commit e7c30e6c1ee8fbea7d44ab00e2721ff13dfa4da5 Author: Caolán McNamara AuthorDate: Tue Apr 25 12:58:29 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Apr 25 15:10:35 2023 +0200 Resolves: tdf#155005 use of uninitialised value ==2515797== Conditional jump or move depends on uninitialised value(s) ==2515797==at 0x33FAB399: ZipFile::recover() (ZipFile.cxx:1090) ==2515797==by 0x33FA4D32: ZipFile::ZipFile(rtl::Reference, com::sun::star::uno::Reference const&, com::sun::star::uno::Reference, bool, bool) (ZipFile.cxx:111) ==2515797==by 0x33FEF134: void std::_Construct&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool, bool&>(ZipFile*, rtl::Reference&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool&&, bool&) (stl_construct.h:119) ==2515797==by 0x33FED528: void std::_Optional_payload_base::_M_construct&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool, bool&>(rtl::Reference&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool&&, bool&) (optional:278) ==2515797==by 0x33FEB73B: void std::_Optional_base_impl >::_M_construct&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool, bool&>(rtl::Reference&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool&&, bool&) (optional:457) ==2515797==by 0x33FE77DB: std::enable_if&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool, bool&>, ZipFile&>::type std::optional::emplace&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool, bool&>(rtl::Reference&, com::sun::star::uno::Reference&, com::sun::star::uno::Reference const&, bool&&, bool&) (optional:918) ==2515797==by 0x33FD61FD: ZipPackage::initialize(com::sun::star::uno::Sequence const&) (ZipPackage.cxx:760) ==2515797==by 0x64DE1EC: cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments(com::sun::star::uno::Reference const&, com::sun::star::uno::Sequence const&) (servicemanager.cxx:732) ==2515797==by 0x64DDF19: cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments(com::sun::star::uno::Reference const&, bool, com::sun::star::uno::Sequence const&) (servicemanager.cxx:694) ==2515797==by 0x64E0E8F: cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) (servicemanager.cxx:1018) ==2515797==by 0x34A3B25F: OStorage_Impl::OpenOwnPackage() (xstorage.cxx:435) ==2515797==by 0x34A3C16C: OStorage_Impl::ReadContents() (xstorage.cxx:541) ==2515797== Uninitialised value was created by a stack allocation ==2515797==at 0x33FAB02C: ZipFile::recover() (ZipFile.cxx:1034) since: commit abda72eeac19b18c22f57d5443c3955a463605d7 Date: Mon Feb 20 00:32:22 2023 +0100 tdf#82984 tdf#94915 zip64 support (import + export) where - aEntry.nCompressedSize = nCompressedSize; - aEntry.nSize = nSize; was removed before the subsequent use of aEntry.nCompressedSize/aEntry.nSize change things (git show -w for clarity) to check bounds first just for the range the extra fields might be in and read those, and then follow up with the original check that the newly discovered aEntry.nCompressedSize/aEntry.nSize are within the bounds of the overall file Change-Id: Iad4ce8297109b06bc5baf77df4f3e86659cbb4cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150969 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index c1260a7fbf2d..59bdcf8de891 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1084,10 +1084,9 @@ void ZipFile::recover() sal_Int32 nDescrLength = ( aEntry.nMethod == DEFLATED && ( aEntry.nFlag & 8 ) ) ? 16 : 0; -sal_Int64 nDataSize = ( aEntry.nMethod == DEFLATED ) ? aEntry.nCompressedSize : aEntry.nSize; -sal_Int64 nBlockLength = nDataSize + aEntry.nPathLen + aEntry.nExtraLen + 30 + nDescrLength; +sal_Int64 nBlockHeaderLength = aEntry.nPathLen + aEntry.nExtraLen + 30 + nDescrLength; if ( aEntry.nPathLen >= 0 && aEntry.nExtraLen >= 0 -&& ( nGenPos + nPos + nBlockLength ) <= nLength ) +&& ( nGenPos + nPos + nBlockHeaderLength ) <= nLength ) {
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 80805716a409c34203b059f3e03cd934367186c3 Author: Caolán McNamara AuthorDate: Tue Apr 25 12:33:26 2023 +0100 Commit: Caolán McNamara CommitDate: Tue Apr 25 15:10:15 2023 +0200 tdf#155005 fail gracefully on encountering a negative compression value we are using sal_Int64 for this so a large enough value can be interpreted as negative here Change-Id: Id547a24591aca4b6ed7b7955621641a0666b0bd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150968 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 27a366c54f95..c1260a7fbf2d 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1252,6 +1252,12 @@ bool ZipFile::checkSizeAndCRC( const ZipEntry& aEntry ) if( aEntry.nMethod == STORED ) return ( getCRC( aEntry.nOffset, aEntry.nSize ) == aEntry.nCrc ); +if (aEntry.nCompressedSize < 0) +{ +SAL_WARN("package", "bogus compressed size of: " << aEntry.nCompressedSize); +return false; +} + getSizeAndCRC( aEntry.nOffset, aEntry.nCompressedSize, , ); return ( aEntry.nSize == nSize && aEntry.nCrc == nCRC ); }
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) New commits: commit b6d1cb887438733da2465f107da5088f9826435e Author: Caolán McNamara AuthorDate: Thu Mar 9 14:32:06 2023 + Commit: Caolán McNamara CommitDate: Thu Mar 9 20:17:15 2023 + cid#1521901 Pointer to local outside scope Change-Id: I38e76440606afb65a8c1ce419c446e234a513659 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148550 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 78d746ac1b70..27a366c54f95 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -1108,22 +1108,19 @@ void ZipFile::recover() // read 64bit header if (aEntry.nExtraLen > 0) { -Sequence* aExtraBuffer; +Sequence aExtraBuffer; if (nPos + 30 + aEntry.nPathLen + aEntry.nExtraLen <= nBufSize) { -Sequence aTmpBuffer2( +aExtraBuffer = Sequence( &(pBuffer[nPos + 30 + aEntry.nPathLen]), aEntry.nExtraLen); -aExtraBuffer = } else { -Sequence aExtraFields; aGrabber.seek(nGenPos + nPos + 30 + aEntry.nExtraLen); -aGrabber.readBytes(aExtraFields, aEntry.nExtraLen); -aExtraBuffer = +aGrabber.readBytes(aExtraBuffer, aEntry.nExtraLen); } -MemoryByteGrabber aMemGrabberExtra(*aExtraBuffer); +MemoryByteGrabber aMemGrabberExtra(aExtraBuffer); if (aEntry.nExtraLen > 0) { readExtraFields(aMemGrabberExtra, aEntry.nExtraLen, nSize,
[Libreoffice-commits] core.git: package/source
package/source/zipapi/Deflater.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 5eae429d026b3f502e40265376772e2188239fb5 Author: Andrea Gelmini AuthorDate: Wed Mar 8 20:49:06 2023 +0100 Commit: Julien Nabet CommitDate: Thu Mar 9 06:20:54 2023 + Fix typo Change-Id: I4c48c988667ffd9221a0e226ab9c35e1e857e9d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148489 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx index 2c66253fd0ed..9439e3f56bcb 100644 --- a/package/source/zipapi/Deflater.cxx +++ b/package/source/zipapi/Deflater.cxx @@ -83,7 +83,7 @@ sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > , sal_Int #else nResult = z_deflate(pStream.get(), bFinish ? Z_FINISH : Z_NO_FLUSH); #endif -// total_in / total_out may stored only in 32bit, and can owerflow during deflate +// total_in / total_out may stored only in 32bit, and can overflow during deflate // 1 deflate call, uncompress only a few data, so only 1 overflow can happen at once. if (pStream->total_in < nLastTotalIn) {
[Libreoffice-commits] core.git: package/source
package/source/xstor/ohierarchyholder.cxx | 12 ++-- package/source/xstor/ohierarchyholder.hxx |4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) New commits: commit cf4e1e0bb8145ed1feccc7c916b60cb394a2ee92 Author: Noel Grandin AuthorDate: Fri Feb 17 08:40:10 2023 +0200 Commit: Noel Grandin CommitDate: Fri Feb 17 07:33:24 2023 + osl::Mutex->std::mutex in OHierarchyElement_Impl Change-Id: I458cab160f337019402659b5fb738ba85f73ea1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147190 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 209136bcdf36..eafdf4a567f4 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -80,7 +80,7 @@ std::vector OHierarchyHolder_Impl::GetListPathFromString( std::u16stri uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, std::vector& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::unique_lock aGuard( m_aMutex ); if ( !( nStorageMode & embed::ElementModes::WRITE ) && ( nStreamMode & embed::ElementModes::WRITE ) ) throw io::IOException("invalid storage/stream mode combo"); @@ -162,7 +162,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea void OHierarchyElement_Impl::RemoveStreamHierarchically( std::vector& aListPath ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::unique_lock aGuard( m_aMutex ); if ( aListPath.empty() ) throw uno::RuntimeException(); @@ -211,7 +211,7 @@ void OHierarchyElement_Impl::Commit() uno::Reference< embed::XStorage > xOwnStor; { -::osl::MutexGuard aGuard( m_aMutex ); +std::unique_lock aGuard( m_aMutex ); aParent = m_rParent; xOwnStor = m_xOwnStorage; } @@ -229,7 +229,7 @@ void OHierarchyElement_Impl::TestForClosing() { ::rtl::Reference< OHierarchyElement_Impl > xKeepAlive( this ); { -::osl::MutexGuard aGuard( m_aMutex ); +std::unique_lock aGuard( m_aMutex ); if ( m_aOpenStreams.empty() && m_aChildren.empty() ) { @@ -259,7 +259,7 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source try { { -osl::MutexGuard aGuard(m_aMutex); +std::unique_lock aGuard(m_aMutex); uno::Reference< embed::XExtendedStorageStream > xStream(Source.Source, uno::UNO_QUERY); m_aOpenStreams.erase(std::remove_if(m_aOpenStreams.begin(), m_aOpenStreams.end(), @@ -281,7 +281,7 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source void OHierarchyElement_Impl::RemoveElement( const ::rtl::Reference< OHierarchyElement_Impl >& aRef ) { { -::osl::MutexGuard aGuard( m_aMutex ); +std::unique_lock aGuard( m_aMutex ); OHierarchyElementList_Impl::iterator aIter = m_aChildren.begin(); while (aIter != m_aChildren.end()) { diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index e88632fdbb1d..c3ceddabd1b1 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -29,7 +29,7 @@ #include #include - +#include #include #include #include @@ -44,7 +44,7 @@ typedef ::std::vector< css::uno::WeakReference< css::embed::XExtendedStorageStre class OHierarchyElement_Impl : public cppu::WeakImplHelper< css::embed::XTransactionListener > { -::osl::Mutex m_aMutex; +std::mutex m_aMutex; ::rtl::Reference< OHierarchyElement_Impl > m_rParent; css::uno::Reference< css::embed::XStorage > m_xOwnStorage;
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |8 1 file changed, 8 insertions(+) New commits: commit fb1bf9f1fda915b30864e9ad23545930ea6d25fd Author: Caolán McNamara AuthorDate: Sat Oct 22 19:41:10 2022 +0100 Commit: Caolán McNamara CommitDate: Thu Oct 27 09:47:54 2022 +0200 cid#1242675 Untrusted value as argument Change-Id: If8ecad4501d6c555791eae0ae113a34e05f9436f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141670 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index c59035919bb8..828033688189 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -812,6 +812,13 @@ void ZipFile::readLOC( ZipEntry ) aGrabber.ReadInt32(); //size sal_Int16 nPathLen = aGrabber.ReadInt16(); sal_Int16 nExtraLen = aGrabber.ReadInt16(); + +if (nPathLen < 0) +{ +SAL_WARN("package", "bogus path len of: " << nPathLen); +nPathLen = 0; +} + rEntry.nOffset = aGrabber.getPosition() + nPathLen + nExtraLen; // FIXME64: need to read 64bit LOC @@ -821,6 +828,7 @@ void ZipFile::readLOC( ZipEntry ) try { // read always in UTF8, some tools seem not to set UTF8 bit +// coverity[tainted_data] - we've checked negative lens, and up to max short is ok here uno::Sequence aNameBuffer(nPathLen); sal_Int32 nRead = aGrabber.readBytes(aNameBuffer, nPathLen); if (nRead < aNameBuffer.getLength())
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx | 68 +- 1 file changed, 45 insertions(+), 23 deletions(-) New commits: commit 9c779279f513a43724f5a4eeb003d39ef8cc3057 Author: Noel Grandin AuthorDate: Mon May 23 20:24:45 2022 +0200 Commit: Noel Grandin CommitDate: Tue May 24 16:58:14 2022 +0200 use comphelper::ByteReader in XBufferedStream to avoid an intermediary buffer Change-Id: Ic59e701491ac041022ca3e328741f170bb5b7ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134842 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index aff8cce8fd34..79dc5bb68a8e 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -544,34 +546,54 @@ class XBufferedStream : public cppu::WeakImplHelper& xSrcStream ) : mnPos(0) { -const sal_Int32 nBufSize = 8192; - sal_Int32 nRemaining = xSrcStream->available(); -sal_Int32 nRead = 0; -maBytes.reserve(nRemaining); -uno::Sequence aBuf(nBufSize); +uno::Reference< css::lang::XUnoTunnel > xInputTunnel( xSrcStream, uno::UNO_QUERY ); +comphelper::ByteReader* pByteReader = nullptr; +if (xInputTunnel) +pByteReader = reinterpret_cast< comphelper::ByteReader* >( xInputTunnel->getSomething( comphelper::ByteReader::getUnoTunnelId() ) ); -auto readAndCopy = [&]( sal_Int32 nReadSize ) -> sal_Int32 -{ -sal_Int32 nBytes = xSrcStream->readBytes(aBuf, nReadSize); -const sal_Int8* p = aBuf.getConstArray(); -const sal_Int8* pEnd = p + nBytes; -maBytes.insert( maBytes.end(), p, pEnd ); -return nBytes; -}; - -while (nRemaining > nBufSize) +if (pByteReader) { -const auto nBytes = readAndCopy(nBufSize); -if (!nBytes) -break; -nRead += nBytes; -nRemaining -= nBytes; +maBytes.resize(nRemaining); + +sal_Int8* pData = maBytes.data(); +while (nRemaining > 0) +{ +sal_Int32 nRead = pByteReader->readSomeBytes(pData, nRemaining); +nRemaining -= nRead; +pData += nRead; +} } +else +{ +const sal_Int32 nBufSize = 8192; -if (nRemaining) -nRead += readAndCopy(nRemaining); -maBytes.resize(nRead); +sal_Int32 nRead = 0; +maBytes.reserve(nRemaining); +uno::Sequence aBuf(nBufSize); + +auto readAndCopy = [&]( sal_Int32 nReadSize ) -> sal_Int32 +{ +sal_Int32 nBytes = xSrcStream->readBytes(aBuf, nReadSize); +const sal_Int8* p = aBuf.getConstArray(); +const sal_Int8* pEnd = p + nBytes; +maBytes.insert( maBytes.end(), p, pEnd ); +return nBytes; +}; + +while (nRemaining > nBufSize) +{ +const auto nBytes = readAndCopy(nBufSize); +if (!nBytes) +break; +nRead += nBytes; +nRemaining -= nBytes; +} + +if (nRemaining) +nRead += readAndCopy(nRemaining); +maBytes.resize(nRead); +} } virtual sal_Int32 SAL_CALL readBytes( uno::Sequence& rData, sal_Int32 nBytesToRead ) override
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 443799ad8c0f5a2ae78ca03fb38618a2273682aa Author: Noel Grandin AuthorDate: Fri May 20 12:53:07 2022 +0200 Commit: Noel Grandin CommitDate: Fri May 20 18:49:14 2022 +0200 fix OWriteStream implementing XUnoTunnel doh, forgot to return it in the queryInterface in commit 62531ec1091c7b3f6a3577889a18234790ec716d add ByteWriter to reduce memory copying when writing data Change-Id: I460388b55ca38962bf60ef6be6a2b108deee6d73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134678 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 19707a5d4ee5..fee3ec5059b7 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1774,7 +1774,8 @@ uno::Any SAL_CALL OWriteStream::queryInterface( const uno::Type& rType ) , static_cast ( this ) , static_cast ( this ) , static_cast ( this ) -, static_cast ( this ) ); +, static_cast ( this ) +, static_cast ( this ) ); if ( aReturn.hasValue() ) return aReturn ;
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) New commits: commit 240a345bc3891887ed551e780ce619d8da303325 Author: Noel Grandin AuthorDate: Fri May 6 10:40:46 2022 +0200 Commit: Noel Grandin CommitDate: Fri May 6 14:22:15 2022 +0200 tdf#121740 reduce cost of OStorage_Impl::GetElementNames which shows up on the profile Change-Id: I7e4ef9d71d06562dc1c574fe41d616947e3d67e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133926 Tested-by: Noel Grandin Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 0403f2b0f464..a5777deb771e 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1461,17 +1461,24 @@ uno::Sequence< OUString > OStorage_Impl::GetElementNames() ReadContents(); -std::vector< OUString > aElementNames; -aElementNames.reserve( m_aChildrenMap.size() ); +sal_Int32 nCnt = 0; +for ( const auto& pair : m_aChildrenMap ) +for (auto pElement : pair.second) +{ +if ( !pElement->m_bIsRemoved ) +nCnt++; +} +uno::Sequence aElementNames(nCnt); +OUString* pArray = aElementNames.getArray(); for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { if ( !pElement->m_bIsRemoved ) -aElementNames.push_back(pair.first); +*pArray++ = pair.first; } -return comphelper::containerToSequence(aElementNames); +return aElementNames; } void OStorage_Impl::RemoveElement( OUString const & rName, SotElement_Impl* pElement )
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx | 28 - package/source/xstor/xstorage.cxx | 40 - package/source/zippackage/ZipPackage.cxx | 18 +-- package/source/zippackage/ZipPackageFolder.cxx |8 ++--- package/source/zippackage/ZipPackageStream.cxx | 10 +++--- package/source/zippackage/zipfileaccess.cxx|2 - 6 files changed, 53 insertions(+), 53 deletions(-) New commits: commit 8342e4a5c7bd436f869e6c1c23d248556087ebdf Author: Stephan Bergmann AuthorDate: Wed May 4 07:04:01 2022 +0200 Commit: Stephan Bergmann CommitDate: Wed May 4 09:59:24 2022 +0200 Just use Any ctor instead of makeAny in package Change-Id: I527024f34b88ec764488a3766872f1941f8dbb4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133794 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 7c80a6e86152..9e454e016d5e 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -116,7 +116,7 @@ void SetEncryptionKeyProperty_Impl( const uno::Reference< beans::XPropertySet >& throw uno::RuntimeException(); try { -xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::makeAny( aKey ) ); +xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, uno::Any( aKey ) ); } catch ( const uno::Exception& ex ) { @@ -339,7 +339,7 @@ void OWriteStream_Impl::InsertIntoPackageFolder( const OUString& aName, { SAL_WARN_IF( !m_xPackageStream.is(), "package.xstor", "An inserted stream is incomplete!" ); uno::Reference< lang::XUnoTunnel > xTunnel( m_xPackageStream, uno::UNO_QUERY_THROW ); -xParentPackageFolder->insertByName( aName, uno::makeAny( xTunnel ) ); +xParentPackageFolder->insertByName( aName, uno::Any( xTunnel ) ); m_bFlushed = false; m_bHasInsertedStreamOptimization = false; @@ -742,7 +742,7 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt if ( bCompressedIsSet ) { -xPropertySet->setPropertyValue( aComprPropName, uno::makeAny( bCompressed ) ); +xPropertySet->setPropertyValue( aComprPropName, uno::Any( bCompressed ) ); m_bCompressedSetExplicit = true; } @@ -753,8 +753,8 @@ void OWriteStream_Impl::InsertStreamDirectly( const uno::Reference< io::XInputSt // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, -uno::makeAny( uno::Sequence< beans::NamedValue >() ) ); -xPropertySet->setPropertyValue( "Encrypted", uno::makeAny( true ) ); +uno::Any( uno::Sequence< beans::NamedValue >() ) ); +xPropertySet->setPropertyValue( "Encrypted", uno::Any( true ) ); } // the stream should be free soon, after package is stored @@ -843,9 +843,9 @@ void OWriteStream_Impl::Commit() // set to be encrypted but do not use encryption key xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, -uno::makeAny( uno::Sequence< beans::NamedValue >() ) ); +uno::Any( uno::Sequence< beans::NamedValue >() ) ); xPropertySet->setPropertyValue( "Encrypted", -uno::makeAny( true ) ); +uno::Any( true ) ); } else if ( m_bHasCachedEncryptionData ) { @@ -853,7 +853,7 @@ void OWriteStream_Impl::Commit() throw uno::RuntimeException(); xPropertySet->setPropertyValue( STORAGE_ENCRYPTION_KEYS_PROPERTY, -uno::makeAny( m_aEncryptionData.getAsConstNamedValueList() ) ); +uno::Any( m_aEncryptionData.getAsConstNamedValueList() ) ); } // the stream should be free soon, after package is stored @@ -1533,7 +1533,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW ); xPropSet->setPropertyValue( "MediaType", -uno::makeAny( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); +uno::Any( OUString("application/vnd.openxmlformats-package.relationships+xml" ) ) ); m_nRelInfoStatus = RELINFO_READ; } @@ -1557,7 +1557,7 @@ void OWriteStream_Impl::CommitStreamRelInfo( const uno::Reference< embed::XStora // set the mediatype uno::Reference< beans::XPropertySet > xPropSet( xRelsStream, uno::UNO_QUERY_THROW );
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 420 ++ package/source/xstor/xstorage.hxx | 16 + 2 files changed, 215 insertions(+), 221 deletions(-) New commits: commit 17d2cf30760876b07292958d8c90965f01a33efb Author: Noel Grandin AuthorDate: Wed Mar 16 21:19:19 2022 +0200 Commit: Noel Grandin CommitDate: Thu Mar 17 07:34:53 2022 +0100 flatten OStorage a little Change-Id: I4a380d036c3e94f2df41d2c583d51f574d2c161d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131675 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index c99057368421..ef437765a7e4 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -50,20 +50,16 @@ #include #include -#include #include #include #include #include -#include #include #include "xstorage.hxx" #include "owriteablestream.hxx" -#include "disposelistener.hxx" #include "switchpersistencestream.hxx" -#include "ohierarchyholder.hxx" using namespace ::com::sun::star; @@ -73,31 +69,6 @@ using namespace ::com::sun::star; #define THROW_WHERE "" #endif -struct StorInternalData_Impl -{ -rtl::Reference m_xSharedMutex; -comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer; // list of listeners -::std::unique_ptr< ::cppu::OTypeCollection> m_pTypeCollection; -bool m_bIsRoot; -sal_Int32 m_nStorageType; // the mode in which the storage is used -bool m_bReadOnlyWrap; - -::rtl::Reference m_pSubElDispListener; - -::std::vector< uno::WeakReference< lang::XComponent > > m_aOpenSubComponentsVector; - -::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder; - -// the mutex reference MUST NOT be empty -StorInternalData_Impl( const rtl::Reference& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap ) -: m_xSharedMutex( rMutexRef ) -, m_aListenersContainer( rMutexRef->GetMutex() ) -, m_bIsRoot( bRoot ) -, m_nStorageType( nStorageType ) -, m_bReadOnlyWrap( bReadOnlyWrap ) -{} -}; - // static void OStorage_Impl::completeStorageStreamCopy_Impl( const uno::Reference< io::XStream >& xSource, @@ -1761,9 +1732,13 @@ OStorage::OStorage( uno::Reference< io::XInputStream > const & xInputStream, uno::Reference< uno::XComponentContext > const & xContext, sal_Int32 nStorageType ) : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, nStorageType ) ) +, m_xSharedMutex( m_pImpl->m_xMutex ) +, m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_bIsRoot( m_pImpl->m_bIsRoot ) +, m_nStorageType( m_pImpl->m_nStorageType ) +, m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; -m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( uno::Reference< io::XStream > const & xStream, @@ -1772,21 +1747,28 @@ OStorage::OStorage( uno::Reference< io::XStream > const & xStream, uno::Reference< uno::XComponentContext > const & xContext, sal_Int32 nStorageType ) : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, nStorageType ) ) +, m_xSharedMutex( m_pImpl->m_xMutex ) +, m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_bIsRoot( m_pImpl->m_bIsRoot ) +, m_nStorageType( m_pImpl->m_nStorageType ) +, m_bReadOnlyWrap( false ) { m_pImpl->m_pAntiImpl = this; -m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) : m_pImpl( pImpl ) +, m_xSharedMutex( m_pImpl->m_xMutex ) +, m_aListenersContainer( m_pImpl->m_xMutex->GetMutex() ) +, m_bIsRoot( m_pImpl->m_bIsRoot ) +, m_nStorageType( m_pImpl->m_nStorageType ) +, m_bReadOnlyWrap( bReadOnlyWrap ) { // this call can be done only from OStorage_Impl implementation to create child storage -OSL_ENSURE( m_pImpl && m_pImpl->m_xMutex.is(), "The provided pointer & mutex MUST NOT be empty!" ); - -m_pData.reset(new StorInternalData_Impl( m_pImpl->m_xMutex, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap)); +assert( m_pImpl && m_pImpl->m_xMutex.is() && "The provided pointer & mutex MUST NOT be empty!" ); OSL_ENSURE( ( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE || -m_pData->m_bReadOnlyWrap, +m_bReadOnlyWrap, "The wrapper can not allow writing in case implementation does not!" ); if ( !bReadOnlyWrap ) @@ -1795,7 +1777,7 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) OStorage::~OStorage() { -::osl::MutexGuard aGuard( m_pData->m_xSharedMutex->GetMutex() ); +::osl::MutexGuard aGuard(
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit 3c0662373361938822559d43b031b4c63850e32e Author: Caolán McNamara AuthorDate: Wed Feb 23 10:11:08 2022 + Commit: Caolán McNamara CommitDate: Wed Feb 23 12:16:00 2022 +0100 cid#1500664 Dereference before null check this looks sensible at: commit e7c7d6f0e9cf0185188e864f6419667073283dcc Author: Kurt Zenker Date: Thu Sep 11 09:16:30 2003 + INTEGRATION: CWS mav05 (1.1.2); FILE ADDED as: if ( (*pElementIter)->m_bIsStorage ) { OSL_ENSURE( (*pElementIter)->m_pStorage && (*pElementIter)->m_pStorage->m_xPackageFolder.is(), "An inserted storage is incomplete!\n" ); if ( !(*pElementIter)->m_pStorage || !(*pElementIter)->m_pStorage->m_xPackageFolder.is() ) throw uno::RuntimeException(); // TODO xNewElement = uno::Reference< lang::XUnoTunnel >( (*pElementIter)->m_pStorage->m_xPackageFolder, uno::UNO_QUERY ); (*pElementIter)->m_pStorage->Commit(); } and then didn't after: commit 8c64f087f88173b3101307176cccdd03e6558c69 Author: Rüdiger Timm Date: Thu Oct 30 08:48:27 2003 + INTEGRATION: CWS mav08 (1.2.10); FILE MERGED 2003/10/15 08:07:55 mav 1.2.10.2: #i21121# substorages implement transacted mode 2003/10/13 14:26:33 mav 1.2.10.1: #i21121# Transacted mode for storages Change-Id: Ib05359b282d078cd40b41ed8f2fe9242235c9c83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130417 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index ba942c867379..c99057368421 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1130,12 +1130,12 @@ void OStorage_Impl::Commit() if ( pElement->m_bIsStorage ) { +OSL_ENSURE(pElement->m_xStorage, "An inserted storage is incomplete!"); +if (!pElement->m_xStorage) +throw uno::RuntimeException( THROW_WHERE ); + if (pElement->m_xStorage->m_bCommited) { -OSL_ENSURE(pElement->m_xStorage, "An inserted storage is incomplete!"); -if (!pElement->m_xStorage) -throw uno::RuntimeException( THROW_WHERE ); - pElement->m_xStorage->InsertIntoPackageFolder(/*aName*/pair.first, xNewPackageFolder); pElement->m_bIsInserted = false;
[Libreoffice-commits] core.git: package/source pyuno/source registry/source registry/tools reportdesign/source
package/source/zippackage/zipfileaccess.cxx| 38 +++--- pyuno/source/module/pyuno.cxx | 36 ++ pyuno/source/module/pyuno_module.cxx | 45 +++ registry/source/regimpl.cxx| 88 +++--- registry/tools/fileurl.cxx | 35 ++--- registry/tools/options.cxx | 52 reportdesign/source/core/sdr/RptObject.cxx | 39 +++--- reportdesign/source/filter/xml/xmlfilter.cxx | 102 - reportdesign/source/ui/dlg/GroupsSorting.cxx | 124 ++--- reportdesign/source/ui/report/ReportController.cxx | 46 +++ 10 files changed, 298 insertions(+), 307 deletions(-) New commits: commit 494b3e69fd4bef0af19627cf31da98da376019d0 Author: Noel Grandin AuthorDate: Tue Dec 21 20:22:48 2021 +0200 Commit: Noel Grandin CommitDate: Wed Dec 22 07:43:35 2021 +0100 loplugin:flatten in package..reportdesign Change-Id: I2da242fcb59709ebdd0819ec04d051d794da71e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127277 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx index a02d416286f1..85a674ef6e50 100644 --- a/package/source/zippackage/zipfileaccess.cxx +++ b/package/source/zippackage/zipfileaccess.cxx @@ -134,34 +134,32 @@ bool OZipFileAccess::StringGoodForPattern_Impl( const OUString& aString, sal_Int32 nBeginInd = aPattern[0].getLength(); sal_Int32 nEndInd = aString.getLength() - aPattern[nInd].getLength(); -if ( nEndInd >= nBeginInd - && ( nEndInd == aString.getLength() || aString.subView( nEndInd ) == aPattern[nInd] ) - && ( nBeginInd == 0 || aString.subView( 0, nBeginInd ) == aPattern[0] ) ) -{ -for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) -{ -if ( aPattern[nCurInd].isEmpty() ) -continue; +if ( nEndInd < nBeginInd + || ( nEndInd != aString.getLength() && aString.subView( nEndInd ) != aPattern[nInd] ) + || ( nBeginInd != 0 && aString.subView( 0, nBeginInd ) != aPattern[0] ) ) + return false; -if ( nEndInd == nBeginInd ) -return false; +for ( sal_Int32 nCurInd = aPattern.getLength() - 2; nCurInd > 0; nCurInd-- ) +{ +if ( aPattern[nCurInd].isEmpty() ) +continue; -// check that search does not use nEndInd position -sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 ); +if ( nEndInd == nBeginInd ) +return false; -if ( nLastInd == -1 ) -return false; +// check that search does not use nEndInd position +sal_Int32 nLastInd = aString.lastIndexOf( aPattern[nCurInd], nEndInd - 1 ); -if ( nLastInd < nBeginInd ) -return false; +if ( nLastInd == -1 ) +return false; -nEndInd = nLastInd; -} +if ( nLastInd < nBeginInd ) +return false; -return true; +nEndInd = nLastInd; } -return false; +return true; } // XInitialization diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index cdd5e417feeb..c3de37b82a88 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -739,32 +739,30 @@ static PyObject* lcl_getitem_slice( PyUNO const *me, PyObject *pKey ) nLen = xIndexAccess->getCount(); } -if ( xIndexAccess.is() ) +if ( !xIndexAccess ) +return nullptr; + +sal_Int32 nStart = 0, nStop = 0, nStep = 0, nSliceLength = 0; +int nSuccess = lcl_PySlice_GetIndicesEx(pKey, nLen, , , , ); +if ( nSuccess == -1 && PyErr_Occurred() ) +return nullptr; + +PyRef rTuple( PyTuple_New( nSliceLength ), SAL_NO_ACQUIRE, NOT_NULL ); +sal_Int32 nCur, i; +for ( nCur = nStart, i = 0; i < nSliceLength; nCur += nStep, i++ ) { -sal_Int32 nStart = 0, nStop = 0, nStep = 0, nSliceLength = 0; -int nSuccess = lcl_PySlice_GetIndicesEx(pKey, nLen, , , , ); -if ( nSuccess == -1 && PyErr_Occurred() ) -return nullptr; +Any aRet; -PyRef rTuple( PyTuple_New( nSliceLength ), SAL_NO_ACQUIRE, NOT_NULL ); -sal_Int32 nCur, i; -for ( nCur = nStart, i = 0; i < nSliceLength; nCur += nStep, i++ ) { -Any aRet; - -{ -PyThreadDetach antiguard; +PyThreadDetach antiguard; -aRet = xIndexAccess->getByIndex( nCur ); -} -PyRef rRet = runtime.any2PyObject( aRet ); -PyTuple_SetItem( rTuple.get(), i, rRet.getAcquired() ); +aRet = xIndexAccess->getByIndex( nCur ); } - -return rTuple.getAcquired(); +PyRef rRet =
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestImport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1298a6ae9ac2e3cbe4f387a70a47c7fcf491a773 Author: Stephan Bergmann AuthorDate: Sat Nov 27 10:50:15 2021 +0100 Commit: Stephan Bergmann CommitDate: Sat Nov 27 12:59:27 2021 +0100 Fix typo ...in 2132da5066143d7828984bc1aa42d10223bc5824 "loplugin:stringliteraldefine in package", which caused CppunitTest_xmlsecurity_signing to fail with > [_RUN_] testODFEncryptedGPG::TestBody > librdf error ¾¾¾ - XML parser error - Document is empty > warn:sw:113776:113776:sw/source/filter/xml/swxml.cxx:214: SAX parse exception caught while importing: com.sun.star.xml.sax.SAXParseException message: [ line 1]: Document is empty > ~/lo/core/sax/source/fastparser/fastparser.cxx:609 > wrapped: void message: /home/sbergman/lo/core/tools/source/debug/debug.cxx:104 PublicId: SystemId: LineNumber: 1 ColumnNumber: 1 > warn:sw:113776:113776:sw/source/filter/xml/swxml.cxx:214: SAX parse exception caught while importing: com.sun.star.xml.sax.SAXParseException message: [ line 1]: Document is empty > /home/sbergman/lo/core/sax/source/fastparser/fastparser.cxx:609 > wrapped: void message: /home/sbergman/lo/core/tools/source/debug/debug.cxx:104 PublicId: SystemId: LineNumber: 1 ColumnNumber: 1 > warn:sw:113776:113776:sw/source/filter/xml/swxml.cxx:214: SAX parse exception caught while importing: com.sun.star.xml.sax.SAXParseException message: [ line 1]: Document is empty > /home/sbergman/lo/core/sax/source/fastparser/fastparser.cxx:609 > wrapped: void message: /home/sbergman/lo/core/tools/source/debug/debug.cxx:104 PublicId: SystemId: LineNumber: 1 ColumnNumber: 1 > warn:sfx.view:113776:113776:sfx2/source/view/frmload.cxx:489: DBG_UNHANDLED_EXCEPTION in impl_handleCaughtError_nothrow exception: com.sun.star.task.ErrorCodeIOException message: SfxBaseModel::handleLoadError: 0x0x11b /home/sbergman/lo/core/sfx2/source/doc/sfxbasemodel.cxx:2787 errcode: 283 > warn:fwk.loadenv:113776:113776:framework/source/loadenv/loadenv.cxx:202: caught LoadEnvException 6 "interaction request", com.sun.star.task.ErrorCodeRequest "/home/sbergman/lo/core/sfx2/source/doc/objmisc.cxx:1698" while loading > /home/sbergman/lo/core/unotest/source/cpp/macros_test.cxx:67:testODFEncryptedGPG::TestBody > assertion failed > - Expression: xComponent.is() > - loading failed: file:///home/sbergman/lo/core//xmlsecurity/qa/unit/signing/data/encryptedGPG.odt for me Change-Id: I0326d5ab33a9cfe9c23aab4120b49f37548aea39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125936 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 1d9392d9b8e8..f02629543cf4 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -409,7 +409,7 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) aSequence.clear(); } -else if ( (aConvertedName == ELEMENT_ENCRYPTIONMETHOD +else if ( (aConvertedName == ELEMENT_ENCRYPTEDKEY || aConvertedName == ELEMENT_ENCRYPTEDKEY13) && aStack.back().m_bValid ) { if ( !bIgnoreEncryptData )
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestImport.cxx |3 +-- package/source/zippackage/ZipPackage.cxx |7 +++ 2 files changed, 4 insertions(+), 6 deletions(-) New commits: commit 28480639b4d2ad29d48b98ab9fb7a3755cb9d19e Author: Julien Nabet AuthorDate: Sun Oct 3 14:02:58 2021 +0200 Commit: Julien Nabet CommitDate: Sun Oct 3 22:16:55 2021 +0200 drop 'using namespace std' in package Change-Id: Ifa9f5c310a8be988c1058644540ac52f160bc156 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123018 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 76c0be4ea36f..3cab72abacfe 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -31,7 +31,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::beans; using namespace com::sun::star; -using namespace std; constexpr OUStringLiteral gsFileEntryElement ( u"" ELEMENT_FILE_ENTRY ); @@ -106,7 +105,7 @@ constexpr OUStringLiteral gsAES256_URL ( u"" AES256_URL ); constexpr OUStringLiteral gsPBKDF2_Name ( u"" PBKDF2_NAME ); constexpr OUStringLiteral gsPBKDF2_URL ( u"" PBKDF2_URL ); -ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector ) +ManifestImport::ManifestImport( std::vector < Sequence < PropertyValue > > & rNewManVector ) : bIgnoreEncryptData( false ) , bPgpEncryption ( false ) , nDerivedKeySize( 0 ) diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index d70c2bae27a4..8a74267d755f 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -81,7 +81,6 @@ #include #include -using namespace std; using namespace osl; using namespace cppu; using namespace ucbhelper; @@ -1044,7 +1043,7 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut ) } } -void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList ) +void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const std::vector< uno::Sequence < PropertyValue > >& aManList ) { // Write the manifest uno::Reference < XManifestWriter > xWriter = ManifestWriter::create( m_xContext ); @@ -1071,7 +1070,7 @@ void ZipPackage::WriteManifest( ZipOutputStream& aZipOut, const vector< uno::Seq aZipOut.rawCloseEntry(); } -void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno::Sequence < PropertyValue > >& aManList ) +void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const std::vector< uno::Sequence < PropertyValue > >& aManList ) { ZipEntry* pEntry = new ZipEntry; rtl::Reference pBuffer = new ZipPackageBuffer; @@ -1245,7 +1244,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile() } // Create a vector to store data for the manifest.xml file -vector < uno::Sequence < PropertyValue > > aManList; +std::vector < uno::Sequence < PropertyValue > > aManList; static constexpr OUStringLiteral sMediaType(u"MediaType"); static constexpr OUStringLiteral sVersion(u"Version");
[Libreoffice-commits] core.git: package/source pyuno/source reportdesign/source salhelper/source sax/source
package/source/xstor/owriteablestream.cxx |1 - package/source/xstor/xstorage.cxx |2 -- pyuno/source/module/pyuno_module.cxx |1 - reportdesign/source/core/sdr/UndoEnv.cxx |3 --- reportdesign/source/core/sdr/formatnormalizer.cxx |1 - reportdesign/source/ui/dlg/Navigator.cxx |3 +-- salhelper/source/condition.cxx|3 +-- sax/source/fastparser/fastparser.cxx |1 - sax/source/tools/fastserializer.cxx |4 +--- 9 files changed, 3 insertions(+), 16 deletions(-) New commits: commit ad4d09db4a359748f5ecf5e78a3513ef3878e9c1 Author: Noel Grandin AuthorDate: Wed Sep 1 08:57:02 2021 +0200 Commit: Noel Grandin CommitDate: Wed Sep 1 11:20:17 2021 +0200 clang-tidy:readability-redundant-member-init Change-Id: Ic5abfe2d047750d8dfd3ae8cc733fa15d34ea505 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121432 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 89daf8ccafdb..a049a47a8030 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -73,7 +73,6 @@ struct WSInternalData_Impl // the mutex reference MUST NOT be empty WSInternalData_Impl( const rtl::Reference& rMutexRef, sal_Int32 nStorageType ) : m_xSharedMutex( rMutexRef ) -, m_pTypeCollection() , m_aListenersContainer( rMutexRef->GetMutex() ) , m_nStorageType( nStorageType ) {} diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 58524e525e85..e8153d4e79aa 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -92,11 +92,9 @@ struct StorInternalData_Impl StorInternalData_Impl( const rtl::Reference& rMutexRef, bool bRoot, sal_Int32 nStorageType, bool bReadOnlyWrap ) : m_xSharedMutex( rMutexRef ) , m_aListenersContainer( rMutexRef->GetMutex() ) -, m_pTypeCollection() , m_bIsRoot( bRoot ) , m_nStorageType( nStorageType ) , m_bReadOnlyWrap( bReadOnlyWrap ) -, m_pSubElDispListener() {} }; diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index f3c6d92669fb..a5167ef09919 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -94,7 +94,6 @@ class fillStructState public: fillStructState() : used (PyDict_New()) -, initialised () , nPosConsumed (0) { if ( ! used ) diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index 4f7168e4f2e7..45aa4119255d 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -76,8 +76,6 @@ struct ObjectInfo Reference< XPropertySet > xPropertyIntrospection; ObjectInfo() -:aProperties() -,xPropertyIntrospection() { } }; @@ -108,7 +106,6 @@ public: OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel) ,m_aFormatNormalizer( _rModel ) -,m_aConditionUpdater() ,m_nLocks(0) ,m_bReadOnly(false) ,m_bIsUndo(false) diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx index c4d22941fbf3..ae576bc40747 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -58,7 +58,6 @@ namespace rptui FormatNormalizer::FormatNormalizer( const OReportModel& _rModel ) :m_rModel( _rModel ) -,m_xReportDefinition( ) ,m_bFieldListDirty( true ) { } diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 74b06b080cf3..ed7b2b6f6669 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -207,8 +207,7 @@ public: } NavigatorTree::NavigatorTree(std::unique_ptr xTreeView, OReportController& rController) -: comphelper::OSelectionChangeListener() -, OPropertyChangeListener(m_aMutex) +: OPropertyChangeListener(m_aMutex) , m_xTreeView(std::move(xTreeView)) , m_rController(rController) { diff --git a/salhelper/source/condition.cxx b/salhelper/source/condition.cxx index a83cc753e0a7..9f1408debcdf 100644 --- a/salhelper/source/condition.cxx +++ b/salhelper/source/condition.cxx @@ -32,8 +32,7 @@ using namespace salhelper; **/ Condition::Condition(osl::Mutex& aMutex) -: m_aMutex(aMutex), - m_aCondition() +: m_aMutex(aMutex) { } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index ce8d8cc16054..86bd8a734b63 100644 --- a/sax/source/fastparser/fastparser.cxx +++
[Libreoffice-commits] core.git: package/source
package/source/zipapi/Deflater.cxx |2 +- package/source/zipapi/Inflater.cxx |2 +- package/source/zipapi/XUnbufferedStream.cxx |2 +- package/source/zipapi/ZipFile.cxx |8 4 files changed, 7 insertions(+), 7 deletions(-) New commits: commit 95f5c4fb555407461fc1ab41aedbb9043105b9d6 Author: Noel Grandin AuthorDate: Sat Jul 31 10:40:00 2021 +0200 Commit: Noel Grandin CommitDate: Sat Jul 31 18:21:42 2021 +0200 getArray->getConstArray in package so we can avoid the const of making the Sequence singular Change-Id: I939d573c0f1e7a5d3b09a8589c0fda1e9ea38208 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119739 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx index eacbbc9a67ac..ac0ae57cc6a1 100644 --- a/package/source/zipapi/Deflater.cxx +++ b/package/source/zipapi/Deflater.cxx @@ -69,7 +69,7 @@ Deflater::Deflater(sal_Int32 nSetLevel, bool bNowrap) sal_Int32 Deflater::doDeflateBytes (uno::Sequence < sal_Int8 > , sal_Int32 nNewOffset, sal_Int32 nNewLength) { sal_Int32 nResult; -pStream->next_in = reinterpret_cast(sInBuffer.getArray()) + nOffset; +pStream->next_in = const_cast(reinterpret_cast( sInBuffer.getConstArray() + nOffset )); pStream->next_out = reinterpret_cast(rBuffer.getArray())+nNewOffset; pStream->avail_in = nLength; pStream->avail_out = nNewLength; diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx index 408467ce59a1..7f8319038512 100644 --- a/package/source/zipapi/Inflater.cxx +++ b/package/source/zipapi/Inflater.cxx @@ -98,7 +98,7 @@ sal_Int32 Inflater::doInflateBytes (Sequence < sal_Int8 > , sal_Int32 n nLastInflateError = 0; -pStream->next_in = reinterpret_cast( sInBuffer.getArray() + nOffset ); +pStream->next_in = const_cast(reinterpret_cast( sInBuffer.getConstArray() + nOffset )); pStream->avail_in = nLength; pStream->next_out = reinterpret_cast < unsigned char* > ( rBuffer.getArray() + nNewOffset ); pStream->avail_out = nNewLength; diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index c4bebeeb83da..6fe09c1162c1 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -198,7 +198,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa aData.realloc( nHeadRead + nRead ); -sal_Int8* pPureBuffer = aPureData.getArray(); +const sal_Int8* pPureBuffer = aPureData.getConstArray(); sal_Int8* pBuffer = aData.getArray(); for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ ) pBuffer[ nHeadRead + nInd ] = pPureBuffer[ nInd ]; diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 02c2253182b0..0869d58931c9 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -470,7 +470,7 @@ bool ZipFile::StaticHasValidPassword( const uno::Reference< uno::XComponentConte { sal_Int32 nOldLen = aDecryptBuffer.getLength(); aDecryptBuffer.realloc( nOldLen + aDecryptBuffer2.getLength() ); -memcpy( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getArray(), aDecryptBuffer2.getLength() ); +memcpy( aDecryptBuffer.getArray() + nOldLen, aDecryptBuffer2.getConstArray(), aDecryptBuffer2.getLength() ); } if ( aDecryptBuffer.getLength() > n_ConstDigestLength ) @@ -552,7 +552,7 @@ public: auto readAndCopy = [&]( sal_Int32 nReadSize ) -> sal_Int32 { sal_Int32 nBytes = xSrcStream->readBytes(aBuf, nReadSize); -const sal_Int8* p = aBuf.getArray(); +const sal_Int8* p = aBuf.getConstArray(); const sal_Int8* pEnd = p + nBytes; maBytes.insert( maBytes.end(), p, pEnd ); return nBytes; @@ -805,7 +805,7 @@ void ZipFile::readLOC( ZipEntry ) if (nRead < aNameBuffer.getLength()) aNameBuffer.realloc(nRead); -OUString sLOCPath( reinterpret_cast(aNameBuffer.getArray()), +OUString sLOCPath( reinterpret_cast(aNameBuffer.getConstArray()), aNameBuffer.getLength(), RTL_TEXTENCODING_UTF8 ); @@ -1066,7 +1066,7 @@ void ZipFile::recover() Sequence < sal_Int8 > aFileName; aGrabber.seek( nGenPos + nPos + 30 ); aGrabber.readBytes( aFileName, aEntry.nPathLen ); -aEntry.sPath = OUString ( reinterpret_cast(aFileName.getArray()), +aEntry.sPath = OUString ( reinterpret_cast(aFileName.getConstArray()),
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 4bf1fbc9572741c665ae200303e929d908896820 Author: Noel Grandin AuthorDate: Fri Jul 30 11:48:45 2021 +0200 Commit: Noel Grandin CommitDate: Fri Jul 30 17:54:32 2021 +0200 tsan:data race in XBufferedThreadedStream cannot read from maInUseBuffer without holding the lock Change-Id: I4244e1132595a18c1a7ab33803e10b6c29684bf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119707 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index ceb5f6895ba1..c36a1845be6c 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -93,10 +93,10 @@ void XBufferedThreadedStream::produce() */ const Buffer& XBufferedThreadedStream::getNextBlock() { +std::unique_lock aGuard( maBufferProtector ); const sal_Int32 nBufSize = maInUseBuffer.getLength(); if( nBufSize <= 0 || mnOffset >= nBufSize ) { -std::unique_lock aGuard( maBufferProtector ); if( mnOffset >= nBufSize ) maUsedBuffers.push( maInUseBuffer );
[Libreoffice-commits] core.git: package/source
package/source/zipapi/sha1context.cxx |4 ++-- package/source/zipapi/sha1context.hxx |3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) New commits: commit 0f580560e917f37df94ed2e7ddff59661ae93d79 Author: Noel Grandin AuthorDate: Sun Jul 18 19:13:32 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 21:03:38 2021 +0200 osl::Mutex->std::mutex in StarOfficeSHA1DigestContext Change-Id: I924796823230151a3edde2ead875cfc5bc5072d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119282 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx index d13441462a3f..0da0648ea206 100644 --- a/package/source/zipapi/sha1context.cxx +++ b/package/source/zipapi/sha1context.cxx @@ -49,7 +49,7 @@ StarOfficeSHA1DigestContext::~StarOfficeSHA1DigestContext() void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& aData) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pDigest ) throw lang::DisposedException(); @@ -64,7 +64,7 @@ void SAL_CALL StarOfficeSHA1DigestContext::updateDigest(const uno::Sequence<::sa uno::Sequence<::sal_Int8> SAL_CALL StarOfficeSHA1DigestContext::finalizeDigestAndDispose() { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pDigest ) throw lang::DisposedException(); diff --git a/package/source/zipapi/sha1context.hxx b/package/source/zipapi/sha1context.hxx index 3e61cf17e681..6cc09da01bb3 100644 --- a/package/source/zipapi/sha1context.hxx +++ b/package/source/zipapi/sha1context.hxx @@ -23,13 +23,12 @@ #include #include -#include #include class StarOfficeSHA1DigestContext : public cppu::WeakImplHelper { -::osl::Mutex m_aMutex; +std::mutex m_aMutex; void* m_pDigest; StarOfficeSHA1DigestContext() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/sha1context.cxx |4 ++-- package/source/zipapi/sha1context.hxx |3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit 0c14226903804065bf6d6f52a05c2907b8c5a973 Author: Noel Grandin AuthorDate: Sun Jul 18 19:11:25 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 21:03:16 2021 +0200 osl::Mutex->std::mutex in CorrectSHA1DigestContext Change-Id: Ia81e8edd84080a2cb750e2dce7b2e8879b66498e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119281 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx index ab6327234f10..d13441462a3f 100644 --- a/package/source/zipapi/sha1context.cxx +++ b/package/source/zipapi/sha1context.cxx @@ -98,7 +98,7 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext() void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData) { -::osl::MutexGuard aGuard(m_Mutex); +std::lock_guard aGuard(m_Mutex); if (m_bDisposed) throw lang::DisposedException(); @@ -107,7 +107,7 @@ void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_I uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose() { -::osl::MutexGuard aGuard(m_Mutex); +std::lock_guard aGuard(m_Mutex); if (m_bDisposed) throw lang::DisposedException(); diff --git a/package/source/zipapi/sha1context.hxx b/package/source/zipapi/sha1context.hxx index 55e61ee561cb..3e61cf17e681 100644 --- a/package/source/zipapi/sha1context.hxx +++ b/package/source/zipapi/sha1context.hxx @@ -24,6 +24,7 @@ #include #include #include +#include class StarOfficeSHA1DigestContext : public cppu::WeakImplHelper @@ -49,7 +50,7 @@ public: class CorrectSHA1DigestContext : public cppu::WeakImplHelper { -::osl::Mutex m_Mutex; +std::mutex m_Mutex; ::comphelper::Hash m_Hash{::comphelper::HashType::SHA1}; bool m_bDisposed{false}; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/sha1context.cxx | 23 +++ package/source/zipapi/sha1context.hxx |6 -- 2 files changed, 11 insertions(+), 18 deletions(-) New commits: commit 9bae1f1ad6be4d942c73cfbdd7b3ba55eb3fb983 Author: Noel Grandin AuthorDate: Sun Jul 18 19:06:06 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 21:02:52 2021 +0200 no need to use a pImpl in CorrectSHA1DigestContext Change-Id: If7404f63833373c5ac2954c4aac129c52582989c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119280 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/sha1context.cxx b/package/source/zipapi/sha1context.cxx index c036041a2d76..ab6327234f10 100644 --- a/package/source/zipapi/sha1context.cxx +++ b/package/source/zipapi/sha1context.cxx @@ -19,7 +19,6 @@ #include -#include #include #include #include @@ -89,15 +88,7 @@ uno::Reference CorrectSHA1DigestContext::Create() return new CorrectSHA1DigestContext(); } -struct CorrectSHA1DigestContext::Impl -{ -::osl::Mutex m_Mutex; -::comphelper::Hash m_Hash{::comphelper::HashType::SHA1}; -bool m_bDisposed{false}; -}; - CorrectSHA1DigestContext::CorrectSHA1DigestContext() -: m_pImpl(new Impl) { } @@ -107,21 +98,21 @@ CorrectSHA1DigestContext::~CorrectSHA1DigestContext() void SAL_CALL CorrectSHA1DigestContext::updateDigest(const uno::Sequence<::sal_Int8>& rData) { -::osl::MutexGuard aGuard(m_pImpl->m_Mutex); -if (m_pImpl->m_bDisposed) +::osl::MutexGuard aGuard(m_Mutex); +if (m_bDisposed) throw lang::DisposedException(); -m_pImpl->m_Hash.update(reinterpret_cast(rData.getConstArray()), rData.getLength()); +m_Hash.update(reinterpret_cast(rData.getConstArray()), rData.getLength()); } uno::Sequence<::sal_Int8> SAL_CALL CorrectSHA1DigestContext::finalizeDigestAndDispose() { -::osl::MutexGuard aGuard(m_pImpl->m_Mutex); -if (m_pImpl->m_bDisposed) +::osl::MutexGuard aGuard(m_Mutex); +if (m_bDisposed) throw lang::DisposedException(); -m_pImpl->m_bDisposed = true; -std::vector const sha1(m_pImpl->m_Hash.finalize()); +m_bDisposed = true; +std::vector const sha1(m_Hash.finalize()); return uno::Sequence(reinterpret_cast(sha1.data()), sha1.size()); } diff --git a/package/source/zipapi/sha1context.hxx b/package/source/zipapi/sha1context.hxx index 436dfcccbf7c..55e61ee561cb 100644 --- a/package/source/zipapi/sha1context.hxx +++ b/package/source/zipapi/sha1context.hxx @@ -21,6 +21,7 @@ #include +#include #include #include @@ -48,8 +49,9 @@ public: class CorrectSHA1DigestContext : public cppu::WeakImplHelper { -struct Impl; -std::unique_ptr m_pImpl; +::osl::Mutex m_Mutex; +::comphelper::Hash m_Hash{::comphelper::HashType::SHA1}; +bool m_bDisposed{false}; CorrectSHA1DigestContext(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/blowfishcontext.cxx |4 ++-- package/source/zipapi/blowfishcontext.hxx |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit 966ae2345ce09b73c2d8ea47abb983030cc580bf Author: Noel Grandin AuthorDate: Sun Jul 18 19:03:42 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 19:36:59 2021 +0200 osl::Mutex->std::mutex in BlowfishCFB8CipherContext Change-Id: Id70ec156ab9e06a48a5a2571fc0186bd63b280a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119279 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/blowfishcontext.cxx b/package/source/zipapi/blowfishcontext.cxx index 506c6267aa28..d11a9f0d3c01 100644 --- a/package/source/zipapi/blowfishcontext.cxx +++ b/package/source/zipapi/blowfishcontext.cxx @@ -62,7 +62,7 @@ BlowfishCFB8CipherContext::~BlowfishCFB8CipherContext() uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherContext( const uno::Sequence< ::sal_Int8 >& aData ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pCipher ) throw lang::DisposedException(); @@ -96,7 +96,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC uno::Sequence< ::sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::finalizeCipherContextAndDispose() { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pCipher ) throw lang::DisposedException(); diff --git a/package/source/zipapi/blowfishcontext.hxx b/package/source/zipapi/blowfishcontext.hxx index 11f44eed10ba..c0b603c15298 100644 --- a/package/source/zipapi/blowfishcontext.hxx +++ b/package/source/zipapi/blowfishcontext.hxx @@ -22,11 +22,11 @@ #include #include -#include +#include class BlowfishCFB8CipherContext : public cppu::WeakImplHelper< css::xml::crypto::XCipherContext > { -::osl::Mutex m_aMutex; +std::mutex m_aMutex; void* m_pCipher; bool m_bEncrypt; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/switchpersistencestream.cxx | 28 +++ package/source/xstor/switchpersistencestream.hxx |4 +-- 2 files changed, 16 insertions(+), 16 deletions(-) New commits: commit d9f92805f15cf71f53a6a93f81805e088daca3d2 Author: Noel Grandin AuthorDate: Sun Jul 18 18:54:51 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 19:24:14 2021 +0200 osl::Mutex->std::mutex in SwitchablePersistenceStream Change-Id: I4f34f9df3f760f112244845688b34663e5febb79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119278 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index 459f498fb98b..e646a3f06245 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -200,7 +200,7 @@ void SwitchablePersistenceStream::CloseAll_Impl() // css::io::XStream uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInputStream( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( m_pStreamData ) m_pStreamData->m_bInOpen = true; @@ -209,7 +209,7 @@ uno::Reference< io::XInputStream > SAL_CALL SwitchablePersistenceStream::getInpu uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOutputStream( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( m_pStreamData ) m_pStreamData->m_bOutOpen = true; @@ -219,7 +219,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut // css::io::XInputStream ::sal_Int32 SAL_CALL SwitchablePersistenceStream::readBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nBytesToRead ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -233,7 +233,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut ::sal_Int32 SAL_CALL SwitchablePersistenceStream::readSomeBytes( uno::Sequence< ::sal_Int8 >& aData, ::sal_Int32 nMaxBytesToRead ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -247,7 +247,7 @@ uno::Reference< io::XOutputStream > SAL_CALL SwitchablePersistenceStream::getOut void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -261,7 +261,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) ::sal_Int32 SAL_CALL SwitchablePersistenceStream::available( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -275,7 +275,7 @@ void SAL_CALL SwitchablePersistenceStream::skipBytes( ::sal_Int32 nBytesToSkip ) void SAL_CALL SwitchablePersistenceStream::closeInput() { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -288,7 +288,7 @@ void SAL_CALL SwitchablePersistenceStream::closeInput() // css::io::XOutputStream void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sal_Int8 >& aData ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -305,7 +305,7 @@ void SAL_CALL SwitchablePersistenceStream::writeBytes( const uno::Sequence< ::sa void SAL_CALL SwitchablePersistenceStream::flush( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData || m_pStreamData->m_bInStreamBased ) { @@ -325,7 +325,7 @@ void SAL_CALL SwitchablePersistenceStream::flush( ) void SAL_CALL SwitchablePersistenceStream::closeOutput( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -338,7 +338,7 @@ void SAL_CALL SwitchablePersistenceStream::closeOutput( ) // css::io::XTruncate void SAL_CALL SwitchablePersistenceStream::truncate( ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData ) throw io::NotConnectedException(); @@ -356,7 +356,7 @@ void SAL_CALL SwitchablePersistenceStream::truncate( ) // css::io::XSeekable void SAL_CALL SwitchablePersistenceStream::seek( ::sal_Int64 location ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); if ( !m_pStreamData )
[Libreoffice-commits] core.git: package/source
package/source/xstor/disposelistener.cxx |4 ++-- package/source/xstor/disposelistener.hxx |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit afc9c4454f7bab73087c28ed454d1fd00968e124 Author: Noel Grandin AuthorDate: Sun Jul 18 18:50:52 2021 +0200 Commit: Noel Grandin CommitDate: Tue Jul 20 18:55:28 2021 +0200 osl::Mutex->std::mutex in OChildDispListener_Impl Change-Id: I0aa9e24d3ebcb5f89f2bf5b5759fa44985495b6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119277 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/disposelistener.cxx b/package/source/xstor/disposelistener.cxx index f8436971ada8..ab30f99ca129 100644 --- a/package/source/xstor/disposelistener.cxx +++ b/package/source/xstor/disposelistener.cxx @@ -31,13 +31,13 @@ OChildDispListener_Impl::~OChildDispListener_Impl() void OChildDispListener_Impl::OwnerIsDisposed() { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); m_pStorage = nullptr; } void SAL_CALL OChildDispListener_Impl::disposing( const lang::EventObject& Source ) { -::osl::MutexGuard aGuard( m_aMutex ); +std::lock_guard aGuard( m_aMutex ); // ObjectIsDisposed must not contain any locking! if ( m_pStorage && Source.Source.is() ) m_pStorage->ChildIsDisposed( Source.Source ); diff --git a/package/source/xstor/disposelistener.hxx b/package/source/xstor/disposelistener.hxx index 79b0976d8188..b635b58ce30a 100644 --- a/package/source/xstor/disposelistener.hxx +++ b/package/source/xstor/disposelistener.hxx @@ -22,12 +22,12 @@ #include #include -#include +#include class OStorage; class OChildDispListener_Impl : public ::cppu::WeakImplHelper { -::osl::Mutex m_aMutex; +std::mutex m_aMutex; OStorage* m_pStorage; public: ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xfactory.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 46a662ea56db5b466b15004a6e68148561d4a649 Author: Noel Grandin AuthorDate: Wed Jun 2 12:00:59 2021 +0200 Commit: Noel Grandin CommitDate: Wed Jun 2 13:32:08 2021 +0200 improve exception message Change-Id: I8ce4e6afff2dd7b029c7e557739a3c3e0b361c98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116578 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index 192acb7fbeca..f369acca6fd2 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -239,7 +239,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr } if ( !CheckPackageSignature_Impl( xInputStream, xSeekable ) ) -throw io::IOException(); // TODO: this is not a package file +throw io::IOException("package signature check failed, probably not a package file", nullptr); // TODO: this is not a package file return static_cast( new OStorage(xInputStream, nStorageMode, aPropsToSet, m_xContext, nStorageType)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |9 + 1 file changed, 5 insertions(+), 4 deletions(-) New commits: commit 24fad8bf168beb56855d97ede2d4a1dec2a46220 Author: David Blatter AuthorDate: Wed Mar 31 15:57:44 2021 +0200 Commit: Michael Stahl CommitDate: Fri Apr 2 12:51:29 2021 +0200 fix detection of encrypted zip entries if a zip entry is encrypted, bit 1 of the flags field is set. previously bit 1 of the version field was checked. a valid zip with a required version of e.g. 45 generated a 'file is corrupt' error see: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT (sections 4.4.3 and 4.4.4) Change-Id: I8bba6ead582e6cab55c8449f202807b50befea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113420 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 6ee7bdc0d43d..fb90ef02e4e1 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -921,11 +921,11 @@ sal_Int32 ZipFile::readCEN() aMemGrabber.skipBytes ( 2 ); aEntry.nVersion = aMemGrabber.ReadInt16(); +aEntry.nFlag = aMemGrabber.ReadInt16(); -if ( ( aEntry.nVersion & 1 ) == 1 ) +if ( ( aEntry.nFlag & 1 ) == 1 ) throw ZipException("Invalid CEN header (encrypted entry)" ); -aEntry.nFlag = aMemGrabber.ReadInt16(); aEntry.nMethod = aMemGrabber.ReadInt16(); if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED) @@ -1025,9 +1025,10 @@ void ZipFile::recover() MemoryByteGrabber aMemGrabber(aTmpBuffer); aEntry.nVersion = aMemGrabber.ReadInt16(); -if ( ( aEntry.nVersion & 1 ) != 1 ) +aEntry.nFlag = aMemGrabber.ReadInt16(); + +if ( ( aEntry.nFlag & 1 ) != 1 ) { -aEntry.nFlag = aMemGrabber.ReadInt16(); aEntry.nMethod = aMemGrabber.ReadInt16(); if ( aEntry.nMethod == STORED || aEntry.nMethod == DEFLATED ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source pyuno/source reportdesign/source sax/source
package/source/manifest/ManifestExport.cxx | 31 package/source/xstor/owriteablestream.cxx | 30 --- package/source/xstor/xstorage.cxx | 12 +--- package/source/xstor/xstorage.hxx |2 package/source/zippackage/ZipPackage.cxx| 16 ++ package/source/zippackage/ZipPackageStream.cxx |7 -- pyuno/source/module/pyuno_runtime.cxx |3 - reportdesign/source/core/api/ReportDefinition.cxx |8 +-- reportdesign/source/core/api/Section.cxx|4 - reportdesign/source/core/sdr/ReportDrawPage.cxx | 13 ++--- reportdesign/source/filter/xml/xmlColumn.cxx|4 - reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx | 20 +++ reportdesign/source/filter/xml/xmlImportDocumentHandler.cxx |3 - reportdesign/source/ui/misc/statusbarcontroller.cxx |2 sax/source/expatwrap/sax_expat.cxx |4 - 15 files changed, 66 insertions(+), 93 deletions(-) New commits: commit e150c78cdfbe112bd880107b476ac42e72d4643c Author: Noel AuthorDate: Sun Feb 21 12:34:46 2021 +0200 Commit: Noel Grandin CommitDate: Sun Feb 21 19:00:26 2021 +0100 loplugin:refcounting in package..sax Change-Id: I83618f54a4117cd81d8626307716129a761e14c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111274 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 2f6f1ea0d913..c3c4be339646 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -119,7 +120,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con const OUString sPBKDF2_Name ( PBKDF2_NAME ); const OUString sPGP_Name( PGP_NAME ); -::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList; +rtl::Reference<::comphelper::AttributeList> pRootAttrList = new ::comphelper::AttributeList; // find the mediatype of the document if any OUString aDocMediaType; @@ -211,8 +212,6 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con } } -uno::Reference < xml::sax::XAttributeList > xRootAttrList (pRootAttrList); - xHandler->startDocument(); uno::Reference < xml::sax::XExtendedDocumentHandler > xExtHandler ( xHandler, uno::UNO_QUERY ); if ( xExtHandler.is() && bProvideDTD ) @@ -220,7 +219,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xExtHandler->unknown ( MANIFEST_DOCTYPE ); xHandler->ignorableWhitespace ( sWhiteSpace ); } -xHandler->startElement( sManifestElement, xRootAttrList ); +xHandler->startElement( sManifestElement, pRootAttrList ); const uno::Any *pKeyInfoProperty = nullptr; if ( pRootFolderPropSeq ) @@ -271,14 +270,13 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->startElement(isODF13 ? sEncryptedKeyElement13 : sEncryptedKeyElement, nullptr); xHandler->ignorableWhitespace ( sWhiteSpace ); -::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; -uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList); +rtl::Reference<::comphelper::AttributeList> pNewAttrList = new ::comphelper::AttributeList; // TODO: the algorithm should rather be configurable pNewAttrList->AddAttribute( isODF13 ? sAlgorithmAttribute13 : sAlgorithmAttribute, sCdataAttribute, "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ); -xHandler->startElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement, xNewAttrList); +xHandler->startElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement, pNewAttrList); xHandler->endElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement); xHandler->ignorableWhitespace ( sWhiteSpace ); @@ -339,7 +337,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con // now write individual file entries for (const uno::Sequence& rSequence : rManList) { -::comphelper::AttributeList *pAttrList = new ::comphelper::AttributeList; +rtl::Reference<::comphelper::AttributeList> pAttrList = new ::comphelper::AttributeList; OUString aString; const uno::Any *pVector
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |8 package/source/zippackage/ZipPackage.cxx | 13 +++-- package/source/zippackage/ZipPackageStream.cxx |2 +- 3 files changed, 12 insertions(+), 11 deletions(-) New commits: commit 29fefd93b8f8c7bd9fff1d5da2b7bb3fcfa4a89f Author: Noel AuthorDate: Thu Nov 5 11:26:01 2020 +0200 Commit: Noel Grandin CommitDate: Thu Nov 5 17:19:42 2020 +0100 loplugin:reducevarscope in package Change-Id: If35738232ceb0442d57b9e9b37a850e0920e61b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105335 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index e82298de458b..2a76c7b750ed 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -830,11 +830,11 @@ void ZipFile::readLOC( ZipEntry ) sal_Int32 ZipFile::findEND() { // this method is called in constructor only, no need for mutex -sal_Int32 nLength, nPos, nEnd; +sal_Int32 nPos, nEnd; Sequence < sal_Int8 > aBuffer; try { -nLength = static_cast (aGrabber.getLength()); +sal_Int32 nLength = static_cast (aGrabber.getLength()); if (nLength < ENDHDR) return -1; nPos = nLength - ENDHDR - ZIP_MAXNAMELEN; @@ -874,12 +874,12 @@ sal_Int32 ZipFile::findEND() sal_Int32 ZipFile::readCEN() { // this method is called in constructor only, no need for mutex -sal_Int32 nCenPos = -1, nEndPos, nLocPos; +sal_Int32 nCenPos = -1, nLocPos; sal_uInt16 nCount; try { -nEndPos = findEND(); +sal_Int32 nEndPos = findEND(); if (nEndPos == -1) return -1; aGrabber.seek(nEndPos + ENDTOT); diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index bdb5c25a8bf0..34a55fcea869 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -176,9 +176,8 @@ void ZipPackage::parseManifest() const OUString sMeta ("META-INF"); if ( m_xRootFolder->hasByName( sMeta ) ) { -const OUString sManifest ("manifest.xml"); - try { +const OUString sManifest ("manifest.xml"); uno::Reference< XUnoTunnel > xTunnel; Any aAny = m_xRootFolder->getByName( sMeta ); aAny >>= xTunnel; @@ -457,8 +456,8 @@ void ZipPackage::parseContentType() if ( m_nFormat != embed::StorageFormats::OFOPXML ) return; -const OUString aContentTypes("[Content_Types].xml"); try { +const OUString aContentTypes("[Content_Types].xml"); // the content type must exist in OFOPXML format! if ( !m_xRootFolder->hasByName( aContentTypes ) ) throw io::IOException(THROW_WHERE "Wrong format!" ); @@ -899,8 +898,8 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) { -OUString sTemp, sDirName; -sal_Int32 nOldIndex, nStreamIndex; +OUString sTemp; +sal_Int32 nOldIndex; FolderHash::iterator aIter; sal_Int32 nIndex = aName.getLength(); @@ -911,6 +910,8 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) try { +OUString sDirName; +sal_Int32 nStreamIndex; nStreamIndex = aName.lastIndexOf ( '/' ); bool bFolder = nStreamIndex == nIndex-1; if ( nStreamIndex != -1 ) @@ -1105,13 +1106,13 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: sal_Int32 nOverSeqLength = 0; for (const auto& rMan : aManList) { -OUString aPath; OUString aType; OSL_ENSURE( rMan[PKG_MNFST_MEDIATYPE].Name == "MediaType" && rMan[PKG_MNFST_FULLPATH].Name == "FullPath", "The mediatype sequence format is wrong!" ); rMan[PKG_MNFST_MEDIATYPE].Value >>= aType; if ( !aType.isEmpty() ) { +OUString aPath; // only nonempty type makes sense here rMan[PKG_MNFST_FULLPATH].Value >>= aPath; //FIXME: For now we have no way of differentiating defaults from others. diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 71f9ad9f2ba1..1c055dcc2905 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -373,7 +373,6 @@ bool ZipPackageStream::ParsePackageRawStream() bool bOk = false; ::rtl::Reference< BaseEncryptionData > xTempEncrData; -sal_Int32 nMagHackSize = 0; Sequence < sal_Int8 > aHeader ( 4 ); try @@ -395,6 +394,7 @@ bool ZipPackageStream::ParsePackageRawStream() sal_Int32 nChecksumAlgorithm = 0; sal_Int32 nDerivedKeySize = 0;
[Libreoffice-commits] core.git: package/source
package/source/xstor/xfactory.cxx|5 ++--- package/source/xstor/xstor.component |2 +- 2 files changed, 3 insertions(+), 4 deletions(-) New commits: commit 00d62d03dffd41a923c5920941770d37f52fb6e0 Author: Stephan Bergmann AuthorDate: Fri Oct 2 14:22:04 2020 +0200 Commit: Stephan Bergmann CommitDate: Fri Oct 2 20:42:29 2020 +0200 Use the new single-instance="true" attribute in package Change-Id: I3effdd2500de6accaa075cfc80bdd2654dc13801 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103849 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index f398e5f2b909..89e94dc4e3d3 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "xfactory.hxx" @@ -287,9 +288,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* package_OStorageFactory_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence const&) { -static rtl::Reference g_Instance(new OStorageFactory(context)); -g_Instance->acquire(); -return static_cast(g_Instance.get()); +return cppu::acquire(static_cast(new OStorageFactory(context))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/package/source/xstor/xstor.component b/package/source/xstor/xstor.component index 550501f269f6..ff6de82b654f 100644 --- a/package/source/xstor/xstor.component +++ b/package/source/xstor/xstor.component @@ -20,7 +20,7 @@ http://openoffice.org/2010/uno-components;> +constructor="package_OStorageFactory_get_implementation" single-instance="true"> ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/ohierarchyholder.hxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit b8bf1e11c55c0422a6f83d91376b93564c9c0d11 Author: Stephan Bergmann AuthorDate: Sun Sep 27 22:40:15 2020 +0200 Commit: Stephan Bergmann CommitDate: Mon Sep 28 11:21:18 2020 +0200 struct OHierarchyElement_Impl was apparently meant to be a class Change-Id: Id95a70b38fae40a83f21df56f13b48b2dd0f7001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103526 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 97637c1a9ab0..e124d545d9a2 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -33,7 +33,7 @@ #include #include -struct OHierarchyElement_Impl; +class OHierarchyElement_Impl; typedef std::unordered_map< OUString, ::rtl::Reference< OHierarchyElement_Impl > > OHierarchyElementList_Impl; @@ -41,7 +41,7 @@ typedef std::unordered_map< OUString, typedef ::std::vector< css::uno::WeakReference< css::embed::XExtendedStorageStream > > OWeakStorRefVector_Impl; -struct OHierarchyElement_Impl : public cppu::WeakImplHelper< css::embed::XTransactionListener > +class OHierarchyElement_Impl : public cppu::WeakImplHelper< css::embed::XTransactionListener > { ::osl::Mutex m_aMutex; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/ohierarchyholder.cxx |2 +- package/source/xstor/ohierarchyholder.hxx |7 +++ 2 files changed, 4 insertions(+), 5 deletions(-) New commits: commit 5c2263fa4e6c66f9dff2d624674713dbc4fa5b5a Author: Julien Nabet AuthorDate: Sun Sep 27 12:00:24 2020 +0200 Commit: Julien Nabet CommitDate: Sun Sep 27 12:51:28 2020 +0200 Replace list by vector in package/ohierarchyholder + rename OWeakStorRefList_Impl to OWeakStorRefVector_Impl to make it more explicit Change-Id: I231c9e582cbfb4670835fe1ef0ce41692ad8dcb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103501 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index e2f629fa809a..55348f08547c 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -262,7 +262,7 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source uno::Reference< embed::XExtendedStorageStream > xStream(Source.Source, uno::UNO_QUERY); m_aOpenStreams.erase(std::remove_if(m_aOpenStreams.begin(), m_aOpenStreams.end(), -[](const OWeakStorRefList_Impl::value_type& rxStorage) { +[](const OWeakStorRefVector_Impl::value_type& rxStorage) { return !rxStorage.get().is() || rxStorage.get() == xStream; }), m_aOpenStreams.end()); } diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 2c2db2662e13..97637c1a9ab0 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -30,7 +30,6 @@ #include -#include #include #include @@ -39,8 +38,8 @@ struct OHierarchyElement_Impl; typedef std::unordered_map< OUString, ::rtl::Reference< OHierarchyElement_Impl > > OHierarchyElementList_Impl; -typedef ::std::list< css::uno::WeakReference< css::embed::XExtendedStorageStream > > -OWeakStorRefList_Impl; +typedef ::std::vector< css::uno::WeakReference< css::embed::XExtendedStorageStream > > +OWeakStorRefVector_Impl; struct OHierarchyElement_Impl : public cppu::WeakImplHelper< css::embed::XTransactionListener > { @@ -52,7 +51,7 @@ struct OHierarchyElement_Impl : public cppu::WeakImplHelper< css::embed::XTransa OHierarchyElementList_Impl m_aChildren; -OWeakStorRefList_Impl m_aOpenStreams; +OWeakStorRefVector_Impl m_aOpenStreams; public: explicit OHierarchyElement_Impl( const css::uno::Reference< css::embed::XStorage >& xStorage ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.hxx |1 - 1 file changed, 1 deletion(-) New commits: commit 21484629ef81dc0d081fa07866cd164d2450cf1d Author: Julien Nabet AuthorDate: Sun Sep 27 11:59:53 2020 +0200 Commit: Julien Nabet CommitDate: Sun Sep 27 12:42:27 2020 +0200 Remove unused std::list in package/xstorage Change-Id: I4ac4176d60c29645bd8bc5922154cd3b83dac73e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103500 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 6e19a36838f4..959a7aea72e6 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -51,7 +51,6 @@ #include #include -#include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) New commits: commit 5923d4173d5000d3462fa6e55952bfc5101b6bfa Author: Caolán McNamara AuthorDate: Wed Aug 19 09:24:45 2020 +0100 Commit: Caolán McNamara CommitDate: Wed Aug 19 12:00:42 2020 +0200 Restore "bff: terminate on SAXException on malformed input" This reverts commit 50fd69dfe25d14c75f0dae7fa1bf276ea6deefd3. now that... commit 986bd28388df745dd969e7be7c3bda36b2b2cb0e Date: Thu Aug 6 10:50:47 2020 +0100 ofz#24641 libc++abi __cxa_exception has grown another member solved the substantial problem Change-Id: I38734d99a2c8d9e272547ea657555eb4b59a5052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100974 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index d7c0ed9afd54..8a13fd82b32d 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -4744,7 +4744,28 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); -return m_pImpl->GetAllRelationshipsIfAny(); +uno::Sequence< uno::Sequence< beans::StringPair > > aRet; +try +{ +aRet = m_pImpl->GetAllRelationshipsIfAny(); +} +catch (const io::IOException&) +{ +throw; +} +catch (const uno::RuntimeException&) +{ +throw; +} +catch (const uno::Exception &) +{ +uno::Any aCaught( ::cppu::getCaughtException() ); +throw lang::WrappedTargetRuntimeException(THROW_WHERE "Can't getAllRelationships!", + uno::Reference< uno::XInterface >(), + aCaught); +} + +return aRet; } void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno::Sequence< beans::StringPair >& aEntry, sal_Bool bReplace ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 23 +-- 1 file changed, 1 insertion(+), 22 deletions(-) New commits: commit 50fd69dfe25d14c75f0dae7fa1bf276ea6deefd3 Author: Caolán McNamara AuthorDate: Fri Jul 31 17:06:41 2020 +0100 Commit: Caolán McNamara CommitDate: Fri Jul 31 21:19:52 2020 +0200 ofz#23241 Revert "bff: terminate on SAXException on malformed input" This reverts commit 58a96d3ccedbade4f1a8bfbbc4b7d8f1615cfc69. Change-Id: I9d0459c10ece1d4a8e9efeae611cf29d15ca0885 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99893 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 8a13fd82b32d..d7c0ed9afd54 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -4744,28 +4744,7 @@ uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OStorage::getAllRel if ( m_pData->m_nStorageType != embed::StorageFormats::OFOPXML ) throw uno::RuntimeException( THROW_WHERE ); -uno::Sequence< uno::Sequence< beans::StringPair > > aRet; -try -{ -aRet = m_pImpl->GetAllRelationshipsIfAny(); -} -catch (const io::IOException&) -{ -throw; -} -catch (const uno::RuntimeException&) -{ -throw; -} -catch (const uno::Exception &) -{ -uno::Any aCaught( ::cppu::getCaughtException() ); -throw lang::WrappedTargetRuntimeException(THROW_WHERE "Can't getAllRelationships!", - uno::Reference< uno::XInterface >(), - aCaught); -} - -return aRet; +return m_pImpl->GetAllRelationshipsIfAny(); } void SAL_CALL OStorage::insertRelationshipByID( const OUString& sID, const uno::Sequence< beans::StringPair >& aEntry, sal_Bool bReplace ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipOutputEntry.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit b3c4ca3439eea5f81f3e5a98830829fa20c22823 Author: Luboš Luňák AuthorDate: Thu Jul 16 10:47:18 2020 +0200 Commit: Luboš Luňák CommitDate: Thu Jul 16 13:02:33 2020 +0200 properly finish encrypting when parallel zip saving (tdf#134796) More fixing of 353d4528b8ad8ab, that I didn't get quite right in 08161f853571e3. There must be one final processDeflated() call that has isDeflaterFinished() return true, so that encrypting is finalized properly. Change-Id: Id15190cc467a801ccc57e1efe802cdd8fc618a71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98878 Tested-by: Luboš Luňák Reviewed-by: Luboš Luňák diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx index c9a4943cbe19..5115c7a3ebc1 100644 --- a/package/source/zipapi/ZipOutputEntry.cxx +++ b/package/source/zipapi/ZipOutputEntry.cxx @@ -374,6 +374,8 @@ void ZipOutputEntryParallel::writeStream(const uno::Reference< io::XInputStream processDeflated(rBuffer, nLen); } ); +finished = true; +processDeflated( uno::Sequence< sal_Int8 >(), 0 ); // finish encrypting, etc. totalIn = deflater.getTotalIn(); totalOut = deflater.getTotalOut(); closeEntry(); @@ -382,7 +384,6 @@ void ZipOutputEntryParallel::writeStream(const uno::Reference< io::XInputStream void ZipOutputEntryParallel::finishDeflater() { // ThreadedDeflater is called synchronously in one call, so nothing to do here. -finished = true; } sal_Int64 ZipOutputEntryParallel::getDeflaterTotalIn() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestImport.cxx | 142 ++--- 1 file changed, 71 insertions(+), 71 deletions(-) New commits: commit 38cfe86259c63b0080d3f064dd0e7999d276 Author: Stephan Bergmann AuthorDate: Wed Jul 1 13:29:00 2020 +0200 Commit: Stephan Bergmann CommitDate: Wed Jul 1 19:49:56 2020 +0200 Upcoming improved loplugin:staticanonymous -> redundantstatic: package Change-Id: Ie183cb0d374e8d9a02891a765f46583f7cc1c345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97618 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index cc7558f3b87f..9e3508361b56 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -34,77 +34,77 @@ using namespace com::sun::star; using namespace std; -static const OUStringLiteral gsFileEntryElement ( ELEMENT_FILE_ENTRY ); -static const OUStringLiteral gsEncryptionDataElement( ELEMENT_ENCRYPTION_DATA ); -static const OUStringLiteral gsAlgorithmElement ( ELEMENT_ALGORITHM ); -static const OUStringLiteral gsStartKeyAlgElement ( ELEMENT_START_KEY_GENERATION ); -static const OUStringLiteral gsKeyDerivationElement( ELEMENT_KEY_DERIVATION ); - -static const OUStringLiteral gsMediaTypeAttribute ( ATTRIBUTE_MEDIA_TYPE ); -static const OUStringLiteral gsVersionAttribute ( ATTRIBUTE_VERSION ); -static const OUStringLiteral gsFullPathAttribute( ATTRIBUTE_FULL_PATH ); -static const OUStringLiteral gsSizeAttribute( ATTRIBUTE_SIZE ); -static const OUStringLiteral gsSaltAttribute( ATTRIBUTE_SALT ); -static const OUStringLiteral gsInitialisationVectorAttribute ( ATTRIBUTE_INITIALISATION_VECTOR ); -static const OUStringLiteral gsIterationCountAttribute ( ATTRIBUTE_ITERATION_COUNT ); -static const OUStringLiteral gsKeySizeAttribute ( ATTRIBUTE_KEY_SIZE ); -static const OUStringLiteral gsAlgorithmNameAttribute ( ATTRIBUTE_ALGORITHM_NAME ); -static const OUStringLiteral gsStartKeyAlgNameAttribute ( ATTRIBUTE_START_KEY_GENERATION_NAME ); -static const OUStringLiteral gsKeyDerivationNameAttribute ( ATTRIBUTE_KEY_DERIVATION_NAME ); -static const OUStringLiteral gsChecksumAttribute( ATTRIBUTE_CHECKSUM ); -static const OUStringLiteral gsChecksumTypeAttribute( ATTRIBUTE_CHECKSUM_TYPE ); - -static const OUStringLiteral gsKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO ); -static const OUStringLiteral gsManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO ); -static const OUStringLiteral gsEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY ); -static const OUStringLiteral gsEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD ); -static const OUStringLiteral gsPgpDataElement ( ELEMENT_PGPDATA ); -static const OUStringLiteral gsPgpKeyIDElement ( ELEMENT_PGPKEYID ); -static const OUStringLiteral gsPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET ); -static const OUStringLiteral gsAlgorithmAttribute ( ATTRIBUTE_ALGORITHM ); -static const OUStringLiteral gsCipherDataElement( ELEMENT_CIPHERDATA ); -static const OUStringLiteral gsCipherValueElement ( ELEMENT_CIPHERVALUE ); - -static const OUStringLiteral gsManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO ); -static const OUStringLiteral gsEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 ); -static const OUStringLiteral gsEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 ); -static const OUStringLiteral gsPgpDataElement13 ( ELEMENT_PGPDATA13 ); -static const OUStringLiteral gsPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 ); -static const OUStringLiteral gsPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 ); -static const OUStringLiteral gsAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 ); -static const OUStringLiteral gsCipherDataElement13( ELEMENT_CIPHERDATA13 ); -static const OUStringLiteral gsCipherValueElement13 ( ELEMENT_CIPHERVALUE13 ); - -static const OUStringLiteral gsFullPathProperty ( "FullPath" ); -static const OUStringLiteral gsMediaTypeProperty( "MediaType" ); -static const OUStringLiteral gsVersionProperty ( "Version" ); -static const OUStringLiteral gsIterationCountProperty ( "IterationCount" ); -static const OUStringLiteral gsDerivedKeySizeProperty ( "DerivedKeySize" ); -static const OUStringLiteral gsSaltProperty ( "Salt" ); -static const OUStringLiteral gsInitialisationVectorProperty ( "InitialisationVector" ); -static const OUStringLiteral gsSizeProperty ( "Size" ); -static const OUStringLiteral gsDigestProperty ( "Digest" ); -static const OUStringLiteral gsEncryptionAlgProperty( "EncryptionAlgorithm" );
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx |9 +++-- package/source/zippackage/ZipPackageFolder.cxx | 10 +++--- package/source/zippackage/ZipPackageStream.cxx | 21 +++-- 3 files changed, 13 insertions(+), 27 deletions(-) New commits: commit 214077401a736d49e9c9c6e8f1dd348725455fd7 Author: Stephan Bergmann AuthorDate: Thu Jun 4 14:35:27 2020 +0200 Commit: Stephan Bergmann CommitDate: Thu Jun 4 23:29:52 2020 +0200 Upcoming loplugin:elidestringvar: package Change-Id: I10f55bff4619fe7c1cab378aa00d96cf31d0fcd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95511 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 017ee528e616..8a13fd82b32d 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -661,18 +661,15 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes // move storage properties to the destination one ( means changeable properties ) if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { -OUString aMediaTypeString = "MediaType"; -OUString aVersionString = "Version"; -xPropSet->setPropertyValue( aMediaTypeString, uno::makeAny( m_aMediaType ) ); -xPropSet->setPropertyValue( aVersionString, uno::makeAny( m_aVersion ) ); +xPropSet->setPropertyValue( "MediaType", uno::makeAny( m_aMediaType ) ); +xPropSet->setPropertyValue( "Version", uno::makeAny( m_aVersion ) ); } if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { // if this is a root storage, the common key from current one should be moved there bool bIsRoot = false; -OUString aRootString = "IsRoot"; -if ( ( xPropSet->getPropertyValue( aRootString ) >>= bIsRoot ) && bIsRoot ) +if ( ( xPropSet->getPropertyValue( "IsRoot" ) >>= bIsRoot ) && bIsRoot ) { try { diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 3a6b7ee19bbd..c95849df91a0 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -252,20 +252,16 @@ bool ZipPackageFolder::saveChild( sal_Int32 nPBKDF2IterationCount, const rtlRandomPool ) { -const OUString sMediaTypeProperty ("MediaType"); -const OUString sVersionProperty ("Version"); -const OUString sFullPathProperty ("FullPath"); - uno::Sequence < PropertyValue > aPropSet (PKG_SIZE_NOENCR_MNFST); OUString sTempName = rPath + "/"; if ( !GetMediaType().isEmpty() ) { -aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty; +aPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType"; aPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType(); -aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty; +aPropSet[PKG_MNFST_VERSION].Name = "Version"; aPropSet[PKG_MNFST_VERSION].Value <<= GetVersion(); -aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty; +aPropSet[PKG_MNFST_FULLPATH].Name = "FullPath"; aPropSet[PKG_MNFST_FULLPATH].Value <<= sTempName; } else diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index ab237a15f5e4..71f9ad9f2ba1 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -455,13 +455,6 @@ bool ZipPackageStream::saveChild( { bool bSuccess = true; -const OUString sMediaTypeProperty ("MediaType"); -const OUString sVersionProperty ("Version"); -const OUString sFullPathProperty ("FullPath"); -const OUString sInitialisationVectorProperty ("InitialisationVector"); -const OUString sSaltProperty ("Salt"); -const OUString sIterationCountProperty ("IterationCount"); -const OUString sSizeProperty ("Size"); const OUString sDigestProperty ("Digest"); const OUString sEncryptionAlgProperty("EncryptionAlgorithm"); const OUString sStartKeyAlgProperty ("StartKeyAlgorithm"); @@ -484,11 +477,11 @@ bool ZipPackageStream::saveChild( const bool bToBeEncrypted = m_bToBeEncrypted && (rEncryptionKey.hasElements() || m_bHaveOwnKey); const bool bToBeCompressed = bToBeEncrypted || m_bToBeCompressed; -aPropSet[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty; +aPropSet[PKG_MNFST_MEDIATYPE].Name = "MediaType"; aPropSet[PKG_MNFST_MEDIATYPE].Value <<= GetMediaType( ); -aPropSet[PKG_MNFST_VERSION].Name = sVersionProperty; +aPropSet[PKG_MNFST_VERSION].Name = "Version"; aPropSet[PKG_MNFST_VERSION].Value <<= OUString(); // no version is stored for streams currently -aPropSet[PKG_MNFST_FULLPATH].Name = sFullPathProperty; +aPropSet[PKG_MNFST_FULLPATH].Name = "FullPath";
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |5 - 1 file changed, 5 deletions(-) New commits: commit 2f17679a46ca1336cb82ef652e09f423c5b8923d Author: Vasily Melenchuk AuthorDate: Mon Nov 18 11:26:23 2019 +0300 Commit: Thorsten Behrens CommitDate: Mon May 25 10:03:53 2020 +0200 package: ignore unknown encryption parameters. Do not throw an exception if there are encryption parameters, but they are not supported in current output format. Invalid or unsupported encryption then fails higher up the stack. Change-Id: I21e4cf2f73d7c218ab5444b2016e838695163ca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84435 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index c483b53c968a..02aed7a66a2e 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1645,11 +1645,6 @@ uno::Sequence< sal_Int8 > ZipPackage::GetEncryptionKey() for ( const auto& rKey : std::as_const(m_aStorageEncryptionKeys) ) if ( rKey.Name == aNameToFind ) rKey.Value >>= aResult; - -// empty keys are not allowed here -// so it is not important whether there is no key, or the key is empty, it is an error -if ( !aResult.hasElements() ) -throw uno::RuntimeException(THROW_WHERE "No expected key is provided!" ); } else aResult = m_aEncryptionKey; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestExport.cxx | 82 ++--- 1 file changed, 40 insertions(+), 42 deletions(-) New commits: commit ba0d1a850ad118b5889a4814ef6d01b989029a58 Author: Michael Stahl AuthorDate: Mon May 18 12:56:04 2020 +0200 Commit: Michael Stahl CommitDate: Mon May 18 15:24:40 2020 +0200 package: ODF export: fix position of manifest:start-key-generation child META-INF/manifest.xml[8,137]: Error: element "manifest:start-key-generation" was found where no element may occur The problem is that in the schema, manifest:start-key-generation precedes key-derivation but LO writes it in swapped order. This is apparently a workaround for a bug in OOo < 3.2 ODF import and specific to ODF >= 1.2 because the element didn't exist in ODF 1.1; as it turns out we don't care about OOo < 3.4 being able to load encrypted ODF 1.2 documents anway since commit 0b7c3b7d9fa71f59eed75c3e80e5e12245c5e1c5 "tdf#114939 officecfg,sfx2: always use AES/SHA256 in ODF 1.2". Change-Id: I3b62e3eba719f13e39fb24bf9792f764b24ccaeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94413 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index fefb1aa7c1e9..1546b7dbb3c7 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -452,48 +452,6 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->ignorableWhitespace ( sWhiteSpace ); xHandler->endElement( sAlgorithmElement ); -// Key Derivation -pNewAttrList = new ::comphelper::AttributeList; -xNewAttrList = pNewAttrList; - -if ( pKeyInfoProperty ) -{ -pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, - sCdataAttribute, - sPGP_Name ); -// no start-key-generation needed, our session key has -// max size already -bStoreStartKeyGeneration = false; -} -else -{ -pNewAttrList->AddAttribute ( sKeyDerivationNameAttribute, - sCdataAttribute, - sPBKDF2_Name ); - -if ( bStoreStartKeyGeneration ) -{ -aBuffer.append( nDerivedKeySize ); -pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); -} - -sal_Int32 nCount = 0; -*pIterationCount >>= nCount; -aBuffer.append (nCount); -pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); - -*pSalt >>= aSequence; -::comphelper::Base64::encode(aBuffer, aSequence); -pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() ); -} - -xHandler->ignorableWhitespace ( sWhiteSpace ); -xHandler->startElement( sKeyDerivationElement , xNewAttrList); -xHandler->ignorableWhitespace ( sWhiteSpace ); -xHandler->endElement( sKeyDerivationElement ); - -// we have to store start-key-generation element as the last one to workaround the parsing problem -// in OOo3.1 and older versions if ( bStoreStartKeyGeneration ) { // Start Key Generation @@ -528,6 +486,46 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->endElement( sStartKeyGenerationElement ); } +// Key Derivation +pNewAttrList = new ::comphelper::AttributeList; +xNewAttrList = pNewAttrList; + +if (pKeyInfoProperty) +{ +pNewAttrList->AddAttribute(sKeyDerivationNameAttribute, + sCdataAttribute, + sPGP_Name); +// no start-key-generation needed, our session key has +// max size already +bStoreStartKeyGeneration = false; +} +else +{ +pNewAttrList->AddAttribute(sKeyDerivationNameAttribute, + sCdataAttribute, + sPBKDF2_Name); + +if (bStoreStartKeyGeneration) +{ +aBuffer.append(nDerivedKeySize); +pNewAttrList->AddAttribute(sKeySizeAttribute, sCdataAttribute, aBuffer.makeStringAndClear()); +}
[Libreoffice-commits] core.git: package/source xmlsecurity/qa
package/source/manifest/ManifestExport.cxx | 57 +++-- xmlsecurity/qa/unit/signing/signing.cxx| 17 2 files changed, 55 insertions(+), 19 deletions(-) New commits: commit 5eda583443cd0ec323e925395ea734c20fdbcf13 Author: Michael Stahl AuthorDate: Tue Apr 28 13:58:30 2020 +0200 Commit: Michael Stahl CommitDate: Fri May 15 17:51:43 2020 +0200 package: OFFICE-3940 ODF 1.3 export of OpenPGP encryption Import was implemented with a7bf6488ebb544e1efaed0a1e53073df9cc2064d but it doesn't correspond to the schema so see previous commit. Change-Id: Ic19db07da20e88d6533509217a70983938e61beb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93088 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index f30b1604f20e..fefb1aa7c1e9 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -79,6 +79,15 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con const OUString sAlgorithmAttribute ( ATTRIBUTE_ALGORITHM ); const OUString sCipherDataElement ( ELEMENT_CIPHERDATA ); const OUString sCipherValueElement ( ELEMENT_CIPHERVALUE ); +const OUString sManifestKeyInfoElement13( ELEMENT_MANIFEST13_KEYINFO ); +const OUString sEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 ); +const OUString sEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 ); +const OUString sPgpDataElement13( ELEMENT_PGPDATA13 ); +const OUString sPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 ); +const OUString sPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 ); +const OUString sAlgorithmAttribute13( ATTRIBUTE_ALGORITHM13 ); +const OUString sCipherDataElement13 ( ELEMENT_CIPHERDATA13 ); +const OUString sCipherValueElement13( ELEMENT_CIPHERVALUE13 ); const OUString sKeyInfo ( "KeyInfo" ); const OUString sPgpKeyIDProperty( "KeyId" ); const OUString sPgpKeyPacketProperty( "KeyPacket" ); @@ -232,7 +241,11 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->ignorableWhitespace ( sWhiteSpace ); // manifest:keyinfo & children -xHandler->startElement( sManifestKeyInfoElement, nullptr ); +bool const isODF13(aDocVersion.compareTo(ODFVER_013_TEXT) >= 0); +if (!isODF13) +{ +xHandler->startElement(sManifestKeyInfoElement, nullptr); +} xHandler->ignorableWhitespace ( sWhiteSpace ); uno::Sequence< uno::Sequence < beans::NamedValue > > aKeyInfoSequence; @@ -255,64 +268,70 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con if (aPgpKeyID.hasElements() && aCipherValue.hasElements() ) { // manifest:encrypted-key & children - one for each recipient -xHandler->startElement( sEncryptedKeyElement, nullptr ); +xHandler->startElement(isODF13 ? sEncryptedKeyElement13 : sEncryptedKeyElement, nullptr); xHandler->ignorableWhitespace ( sWhiteSpace ); ::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList); // TODO: the algorithm should rather be configurable -pNewAttrList->AddAttribute ( sAlgorithmAttribute, sCdataAttribute, +pNewAttrList->AddAttribute( +isODF13 ? sAlgorithmAttribute13 : sAlgorithmAttribute, +sCdataAttribute, "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ); -xHandler->startElement( sEncryptionMethodElement, xNewAttrList ); -xHandler->endElement( sEncryptionMethodElement ); +xHandler->startElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement, xNewAttrList); +xHandler->endElement(isODF13 ? sEncryptionMethodElement13 : sEncryptionMethodElement); xHandler->ignorableWhitespace ( sWhiteSpace ); -xHandler->startElement( sKeyInfoElement, nullptr ); +// note: the mismatch here corresponds to ODF 1.3 cs01 schema +xHandler->startElement(isODF13 ? sManifestKeyInfoElement13 : sKeyInfoElement, nullptr); xHandler->ignorableWhitespace ( sWhiteSpace ); -xHandler->startElement( sPgpDataElement, nullptr ); +xHandler->startElement(isODF13 ? sPgpDataElement13
[Libreoffice-commits] core.git: package/source xmlsecurity/qa
package/source/manifest/ManifestImport.cxx | 31 +--- xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt |binary 2 files changed, 18 insertions(+), 13 deletions(-) New commits: commit 4f1b0f7d5235140611305b784b58f95fc5b8bd81 Author: Michael Stahl AuthorDate: Fri May 15 15:12:23 2020 +0200 Commit: Michael Stahl CommitDate: Fri May 15 17:51:16 2020 +0200 package: OFFICE-3940 ODF 1.3 import of OpenPGP encryption This was supposed to be implemented by commit a7bf6488ebb544e1efaed0a1e53073df9cc2064d "ODF1.3: import new OpenPGP encryption markup" but it turns out that the ODF 1.3 cs01 schema differs from the implementation: in ODF 1.3 cs01 we have whereas the implementation expects Ideally the inner manifest:keyinfo should be manifest:KeyInfo but not sure if that really matters. Change-Id: I407321c857e7b3ed9f4d04568ca2ea116764b3da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94309 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 952309ca82ec..cc7558f3b87f 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -341,8 +341,8 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re doFileEntry(aConvertedAttribs); else if (aConvertedName == gsManifestKeyInfoElement) //loext:keyinfo ; -else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo -; +else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key +doEncryptedKey(aConvertedAttribs); else aStack.back().m_bValid = false; break; @@ -357,8 +357,12 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re doEncryptionData(aConvertedAttribs); else if (aConvertedName == gsEncryptedKeyElement) //loext:encrypted-key doEncryptedKey(aConvertedAttribs); -else if (aConvertedName == gsEncryptedKeyElement13) //manifest:encrypted-key -doEncryptedKey(aConvertedAttribs); +else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method +doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13); +else if (aConvertedName == gsManifestKeyInfoElement13) //manifest:keyinfo +; +else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData +; else aStack.back().m_bValid = false; break; @@ -377,16 +381,15 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re doStartKeyAlg(aConvertedAttribs); else if (aConvertedName == gsEncryptionMethodElement) //loext:encryption-method doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute); -else if (aConvertedName == gsEncryptionMethodElement13) //manifest:encryption-method -doEncryptionMethod(aConvertedAttribs, gsAlgorithmAttribute13); else if (aConvertedName == gsKeyInfoElement)//loext:KeyInfo ; else if (aConvertedName == gsCipherDataElement) //loext:CipherData ; -else if (aConvertedName == gsCipherDataElement13) //manifest:CipherData -; else if (aConvertedName == gsPgpDataElement13) //manifest:PGPData ; +else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue +// ciphervalue action happens on endElement +aCurrentCharacters = ""; else aStack.back().m_bValid = false; break; @@ -402,9 +405,6 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re else if (aConvertedName == gsCipherValueElement) //loext:CipherValue // ciphervalue action happens on endElement aCurrentCharacters = ""; -else if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue -// ciphervalue action happens on endElement -aCurrentCharacters = ""; else if (aConvertedName == gsPgpKeyIDElement13) //manifest:PGPKeyID // ciphervalue action happens on endElement aCurrentCharacters = ""; @@ -482,11 +482,16 @@ void SAL_CALL ManifestImport::endElement( const OUString& aName ) // end element handling for elements with cdata switch (nLevel) { +case 4: { +if (aConvertedName == gsCipherValueElement13) //manifest:CipherValue +doEncryptedCipherValue(); +else +
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XUnbufferedStream.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit 902a0c52c4ce4a842228e21948a702c9a4e29d37 Author: Caolán McNamara AuthorDate: Thu Nov 28 14:44:16 2019 + Commit: Caolán McNamara CommitDate: Thu Nov 28 16:51:22 2019 +0100 check crcs when fuzzing after all I end up with something that fails in the fuzzing setup but which cannot be used as a testcase in a normal build Change-Id: I20c73aa009fdc289d95d34a8adf8ddd5882f6694 Reviewed-on: https://gerrit.libreoffice.org/84013 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index e5a965e26951..a6e9c2d8b783 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -34,8 +34,6 @@ #include #include -#include - using namespace ::com::sun::star; using namespace com::sun::star::packages::zip::ZipConstants; using namespace com::sun::star::io; @@ -65,7 +63,7 @@ XUnbufferedStream::XUnbufferedStream( , mnZipEnd ( 0 ) , mnZipSize ( 0 ) , mnMyCurrent ( 0 ) -, mbCheckCRC(!bRecoveryMode && !utl::ConfigManager::IsFuzzing()) +, mbCheckCRC(!bRecoveryMode) { mnZipCurrent = maEntry.nOffset; if ( mbRawStream ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sfx2/source
package/source/zippackage/ZipPackage.cxx | 20 +--- sfx2/source/dialog/filedlghelper.cxx |9 +++-- sfx2/source/doc/objserv.cxx |6 ++ sfx2/source/doc/objstor.cxx |8 +--- 4 files changed, 15 insertions(+), 28 deletions(-) New commits: commit e0cced9d4c94324e834e46d807469a0cd6c1f738 Author: Vasily Melenchuk AuthorDate: Mon Oct 14 00:01:52 2019 +0300 Commit: Thorsten Behrens CommitDate: Fri Nov 15 12:50:38 2019 +0100 do not clean up EncryptionData during SaveAs As the SID_ENCRYPTIONDATA and SID_PASSWORD are used for setting password together, EncryptionData should be removed only when Password was set (reset of Password protection for the document). Elsewhere EncryptionData should remain as is, while it could contain encryption data used for opened document. Change-Id: I46b757af81e68ad4781e83b1a0e0b6da3a5e13e1 Change-Id: I1213ec55d6dc42f062930467976de45c73152f0b Reviewed-on: https://gerrit.libreoffice.org/82616 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 7b2e705e45e5..63178c7fec24 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1748,27 +1748,9 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const // this property is only necessary to support raw passwords in storage API; // because of this support the storage has to operate with more than one key dependent on storage generation algorithm; // when this support is removed, the storage will get only one key from outside -uno::Sequence< beans::NamedValue > aKeys; -if ( !( aValue >>= aKeys ) ) +if ( !( aValue >>= m_aStorageEncryptionKeys ) ) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); -if ( aKeys.hasElements() ) -{ -bool bHasSHA256 = false; -bool bHasSHA1 = false; -for ( const auto& rKey : std::as_const(aKeys) ) -{ -if ( rKey.Name == PACKAGE_ENCRYPTIONDATA_SHA256UTF8 ) -bHasSHA256 = true; -if ( rKey.Name == PACKAGE_ENCRYPTIONDATA_SHA1UTF8 ) -bHasSHA1 = true; -} - -if ( !bHasSHA256 && !bHasSHA1 ) -throw IllegalArgumentException(THROW_WHERE "Expected keys are not provided!", uno::Reference< uno::XInterface >(), 2 ); -} - -m_aStorageEncryptionKeys = aKeys; m_aEncryptionKey.realloc( 0 ); } else if ( aPropertyName == ENCRYPTION_ALGORITHMS_PROPERTY ) diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index a6a9dc675054..e5fad08ec881 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1414,8 +1414,13 @@ ErrCode FileDialogHelper_Impl::execute( std::vector& rpURLList, // the password will be set in case user decide so rpSet->ClearItem( SID_PASSWORDINTERACTION ); -rpSet->ClearItem( SID_PASSWORD ); -rpSet->ClearItem( SID_ENCRYPTIONDATA ); +if (rpSet->HasItem( SID_PASSWORD )) +{ +// As the SID_ENCRYPTIONDATA and SID_PASSWORD are using for setting password together, we need to clear them both. +// Note: Do not remove SID_ENCRYPTIONDATA without SID_PASSWORD +rpSet->ClearItem( SID_PASSWORD ); +rpSet->ClearItem( SID_ENCRYPTIONDATA ); +} rpSet->ClearItem( SID_RECOMMENDREADONLY ); rpSet->ClearItem( SID_MODIFYPASSWORDINFO ); diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 24cfa8afd294..512fe81d6efd 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -809,11 +809,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest ) } -bool bPreselectPassword = false; -const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false); const SfxStringItem* pOldPasswordItem = SfxItemSet::GetItem(GetMedium()->GetItemSet(), SID_PASSWORD, false); -if ( pOldEncryptionDataItem || pOldPasswordItem ) -bPreselectPassword = true; +const SfxUnoAnyItem* pOldEncryptionDataItem = SfxItemSet::GetItem(GetMedium()->GetItemSet(), SID_ENCRYPTIONDATA, false); +bool bPreselectPassword = (pOldPasswordItem && pOldEncryptionDataItem); uno::Sequence< beans::PropertyValue > aDispatchArgs; if ( rReq.GetArgs() ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index f162bd5dfa92..174b06c761f3 100644 --- a/sfx2/source/doc/objstor.cxx +++
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestExport.cxx | 105 +++ package/source/xstor/ocompinstream.cxx | 109 +++ package/source/xstor/owriteablestream.cxx | 345 ++--- package/source/xstor/xfactory.cxx | 27 + package/source/xstor/xstorage.cxx | 277 package/source/zippackage/ZipPackage.cxx | 114 +++- package/source/zippackage/ZipPackageStream.cxx |6 package/source/zippackage/zipfileaccess.cxx|4 8 files changed, 441 insertions(+), 546 deletions(-) New commits: commit 38001018fa06f721cf87edae923b54ce9a5ab5a7 Author: Arkadiy Illarionov AuthorDate: Sat Aug 10 18:34:33 2019 +0300 Commit: Arkadiy Illarionov CommitDate: Thu Aug 22 18:03:16 2019 +0200 Simplify Sequence iterations in package Use range-based loops, STL and comphelper functions Change-Id: Ibd836b9b2df2f30b42f2d7a621188d78f5b53196 Reviewed-on: https://gerrit.libreoffice.org/77246 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-by: Arkadiy Illarionov diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index f8c2d0399d4f..4b4d57ce9294 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -111,33 +111,30 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con const OUString sPGP_Name( PGP_NAME ); ::comphelper::AttributeList * pRootAttrList = new ::comphelper::AttributeList; -const uno::Sequence < beans::PropertyValue > *pSequence = rManList.getConstArray(); -const sal_uInt32 nManLength = rManList.getLength(); // find the mediatype of the document if any OUString aDocMediaType; OUString aDocVersion; -sal_Int32 nRootFolderPropIndex=-1; -for (sal_uInt32 nInd = 0; nInd < nManLength ; nInd++ ) +const uno::Sequence* pRootFolderPropSeq = nullptr; +for (const uno::Sequence < beans::PropertyValue >& rSequence : rManList) { OUString aMediaType; OUString aPath; OUString aVersion; -const beans::PropertyValue *pValue = pSequence[nInd].getConstArray(); -for (sal_uInt32 j = 0, nNum = pSequence[nInd].getLength(); j < nNum; j++, pValue++) +for (const beans::PropertyValue& rValue : rSequence) { -if (pValue->Name == sMediaTypeProperty ) +if (rValue.Name == sMediaTypeProperty ) { -pValue->Value >>= aMediaType; +rValue.Value >>= aMediaType; } -else if (pValue->Name == sFullPathProperty ) +else if (rValue.Name == sFullPathProperty ) { -pValue->Value >>= aPath; +rValue.Value >>= aPath; } -else if (pValue->Name == sVersionProperty ) +else if (rValue.Name == sVersionProperty ) { -pValue->Value >>= aVersion; +rValue.Value >>= aVersion; } if ( !aPath.isEmpty() && !aMediaType.isEmpty() && !aVersion.isEmpty() ) @@ -148,7 +145,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con { aDocMediaType = aMediaType; aDocVersion = aVersion; -nRootFolderPropIndex = nInd; +pRootFolderPropSeq = break; } } @@ -217,15 +214,13 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->startElement( sManifestElement, xRootAttrList ); const uno::Any *pKeyInfoProperty = nullptr; -if ( nRootFolderPropIndex >= 0 ) +if ( pRootFolderPropSeq ) { // do we have package-wide encryption info? -const beans::PropertyValue *pValue = -pSequence[nRootFolderPropIndex].getConstArray(); -for (sal_uInt32 j = 0, nNum = pSequence[nRootFolderPropIndex].getLength(); j < nNum; j++, pValue++) +for (const beans::PropertyValue& rValue : *pRootFolderPropSeq) { -if (pValue->Name == sKeyInfo ) -pKeyInfoProperty = >Value; +if (rValue.Name == sKeyInfo ) +pKeyInfoProperty = } if ( pKeyInfoProperty ) @@ -242,22 +237,19 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con uno::Sequence< uno::Sequence < beans::NamedValue > > aKeyInfoSequence; *pKeyInfoProperty >>= aKeyInfoSequence; -const uno::Sequence < beans::NamedValue > *pKeyInfoSequence = aKeyInfoSequence.getConstArray(); -const sal_uInt32 nKeyInfoLength = aKeyInfoSequence.getLength(); -for (sal_uInt32 nInd = 0; nInd < nKeyInfoLength ; nInd++ ) +for (const uno::Sequence& rKeyInfoSequence : std::as_const(aKeyInfoSequence)) { uno::Sequence
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |9 - 1 file changed, 4 insertions(+), 5 deletions(-) New commits: commit 0ec0ba24f0f28deef7993e430682bf4a5d9f3271 Author: Ashod Nakashian AuthorDate: Mon Mar 25 10:29:38 2019 -0400 Commit: Ashod Nakashian CommitDate: Thu Aug 22 15:33:15 2019 +0200 oox: typos, comments, formatting Change-Id: I6bb138be2a8da91a85248e85d408f54a9b885f9b Reviewed-on: https://gerrit.libreoffice.org/77686 Tested-by: Jenkins Reviewed-by: Ashod Nakashian diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index f5d8ca351ba9..574b7a434f5c 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -713,9 +713,9 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments ) } else if ( aNamedValue.Value >>= nFormatID ) { -if ( nFormatID != embed::StorageFormats::PACKAGE - && nFormatID != embed::StorageFormats::ZIP - && nFormatID != embed::StorageFormats::OFOPXML ) +if (nFormatID != embed::StorageFormats::PACKAGE +&& nFormatID != embed::StorageFormats::ZIP +&& nFormatID != embed::StorageFormats::OFOPXML) throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); m_nFormat = nFormatID; @@ -1088,8 +1088,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: pEntry->nSize = pEntry->nCompressedSize = -1; pEntry->nTime = ZipOutputStream::getCurrentDosTime(); -// Convert vector into a uno::Sequence -// TODO/LATER: use Default entries in future +// Add default entries, the count must be updated manually when appending. uno::Sequence< beans::StringPair > aDefaultsSequence(4); // Add at least the standard default entries. aDefaultsSequence[0].First = "xml"; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx | 41 +++--- 1 file changed, 16 insertions(+), 25 deletions(-) New commits: commit 0d1490dbbdd6a4cbe2486f993517383cc8112003 Author: Mike Kaganski AuthorDate: Wed Aug 21 17:00:35 2019 +0200 Commit: Mike Kaganski CommitDate: Thu Aug 22 06:57:52 2019 +0200 Deduplicate some code Change-Id: I2cdc9f1416a9089e91f30cebe071a4855edc4536 Reviewed-on: https://gerrit.libreoffice.org/77892 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 041363cb5142..1c9332e9e845 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -930,43 +930,34 @@ uno::Sequence< beans::PropertyValue > OWriteStream_Impl::InsertOwnProps( bool bUseCommonEncryption ) { uno::Sequence< beans::PropertyValue > aResult( aProps ); -sal_Int32 nLen = aResult.getLength(); +beans::PropertyValue aPropVal; if ( m_nStorageType == embed::StorageFormats::PACKAGE ) { -for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) -if ( aResult[nInd].Name == "UseCommonStoragePasswordEncryption" ) -{ -aResult[nInd].Value <<= bUseCommonEncryption; -return aResult; -} - -aResult.realloc( ++nLen ); -aResult[nLen - 1].Name = "UseCommonStoragePasswordEncryption"; -aResult[nLen - 1].Value <<= bUseCommonEncryption; +aPropVal.Name = "UseCommonStoragePasswordEncryption"; +aPropVal.Value <<= bUseCommonEncryption; } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { ReadRelInfoIfNecessary(); -uno::Any aValue; +aPropVal.Name = "RelationsInfo"; if ( m_nRelInfoStatus == RELINFO_READ ) -aValue <<= m_aOrigRelInfo; +aPropVal.Value <<= m_aOrigRelInfo; else if ( m_nRelInfoStatus == RELINFO_CHANGED_STREAM_READ || m_nRelInfoStatus == RELINFO_CHANGED ) -aValue <<= m_aNewRelInfo; +aPropVal.Value <<= m_aNewRelInfo; else // m_nRelInfoStatus == RELINFO_CHANGED_BROKEN || m_nRelInfoStatus == RELINFO_BROKEN throw io::IOException( "Wrong relinfo stream!" ); - -for ( sal_Int32 nInd = 0; nInd < nLen; nInd++ ) -if ( aResult[nInd].Name == "RelationsInfo" ) -{ -aResult[nInd].Value = aValue; -return aResult; -} - -aResult.realloc( ++nLen ); -aResult[nLen - 1].Name = "RelationsInfo"; -aResult[nLen - 1].Value = aValue; +} +if (!aPropVal.Name.isEmpty()) +{ +sal_Int32 i = 0; +for (auto p = aResult.getConstArray(); i < aResult.getLength(); ++i) +if (p[i].Name == aPropVal.Name) +break; +if (i == aResult.getLength()) +aResult.realloc(i + 1); +aResult[i] = aPropVal; } return aResult; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sax/source sc/qa sc/source
package/source/xstor/xstorage.cxx | 16 sax/source/tools/fastattribs.cxx |2 +- sc/qa/unit/ucalc_formula.cxx |6 +++--- sc/source/core/data/bcaslot.cxx|2 +- sc/source/core/data/documen3.cxx |2 +- sc/source/core/data/documen7.cxx |2 +- sc/source/core/data/documen8.cxx |2 +- sc/source/core/data/document10.cxx |2 +- sc/source/core/data/formulacell.cxx|2 +- sc/source/core/data/table2.cxx |4 ++-- sc/source/core/data/table3.cxx |2 +- sc/source/core/opencl/op_math.cxx |2 +- sc/source/core/opencl/op_statistical.cxx |4 ++-- sc/source/core/tool/chgtrack.cxx |2 +- sc/source/core/tool/dbdata.cxx |2 +- sc/source/core/tool/jumpmatrix.cxx |2 +- sc/source/core/tool/parclass.cxx |2 +- sc/source/core/tool/rangelst.cxx | 10 +- sc/source/filter/excel/xestyle.cxx |6 +++--- sc/source/filter/html/htmlpars.cxx |2 +- sc/source/filter/oox/condformatbuffer.cxx |4 ++-- sc/source/filter/oox/formulaparser.cxx |2 +- sc/source/filter/rtf/eeimpars.cxx |4 ++-- sc/source/filter/rtf/rtfparse.cxx |2 +- sc/source/filter/xml/xmlexprt.cxx |2 +- sc/source/ui/dataprovider/csvdataprovider.cxx |2 +- sc/source/ui/dbgui/PivotLayoutTreeList.cxx |2 +- sc/source/ui/dbgui/PivotLayoutTreeListData.cxx |2 +- sc/source/ui/miscdlgs/conflictsdlg.cxx |6 +++--- sc/source/ui/miscdlgs/dataproviderdlg.cxx | 20 ++-- sc/source/ui/undo/undocell.cxx |6 +++--- sc/source/ui/unoobj/cellsuno.cxx |2 +- sc/source/ui/unoobj/chart2uno.cxx |2 +- sc/source/ui/unoobj/dapiuno.cxx|2 +- sc/source/ui/unoobj/unoreflist.cxx |2 +- sc/source/ui/vba/vbafiledialog.cxx |3 ++- sc/source/ui/view/viewfunc.cxx |2 +- 37 files changed, 70 insertions(+), 69 deletions(-) New commits: commit 316b07d0af06948c69c1375c67c01903b8eeb134 Author: Noel Grandin AuthorDate: Tue Aug 20 11:15:17 2019 +0200 Commit: Noel Grandin CommitDate: Tue Aug 20 13:59:25 2019 +0200 loplugin:constvars in package..sc Change-Id: Ibaa9ebd6440d9229ba313f4c130f5752d432b338 Reviewed-on: https://gerrit.libreoffice.org/77792 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index fb5ad128dd41..16ae4a9331e0 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -322,7 +322,7 @@ OStorage_Impl::~OStorage_Impl() m_pParent = nullptr; } -for (auto & pair : m_aChildrenMap) +for (const auto & pair : m_aChildrenMap) for (auto pElement : pair.second) delete pElement; m_aChildrenMap.clear(); @@ -654,7 +654,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes if ( !m_xPackageFolder.is() ) throw embed::InvalidStorageException( THROW_WHERE ); -for ( auto& pair : m_aChildrenMap ) +for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { if ( !pElement->m_bIsRemoved ) @@ -1054,7 +1054,7 @@ void OStorage_Impl::Commit() // there should be no more deleted elements -for ( auto& pair : m_aChildrenMap ) +for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { // if it is a 'duplicate commit' inserted elements must be really inserted to package later @@ -1127,7 +1127,7 @@ void OStorage_Impl::Commit() } } -for ( auto& pair : m_aChildrenMap ) +for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { // now inserted elements can be inserted to the package @@ -1228,7 +1228,7 @@ void OStorage_Impl::Revert() std::unordered_map> oldMap; std::swap(oldMap, m_aChildrenMap); -for (auto & rPair : oldMap) +for (const auto & rPair : oldMap) for (auto pElement : rPair.second) { if ( pElement->m_bIsInserted ) @@ -1855,7 +1855,7 @@ void OStorage::InternalDispose( bool bNotifyImpl ) // deregister m_pData->m_pSubElDispListener and dispose all of them if ( !m_pData->m_aOpenSubComponentsVector.empty() ) { -for ( auto& pComp : m_pData->m_aOpenSubComponentsVector ) +for ( const auto& pComp : m_pData->m_aOpenSubComponentsVector ) { uno::Reference< lang::XComponent > xTmp = pComp; if ( xTmp.is()
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ThreadedDeflater.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 7c2a072d91cad9a55c3a37a89518b4fe29461391 Author: Caolán McNamara AuthorDate: Tue Jul 16 10:30:20 2019 +0100 Commit: Caolán McNamara CommitDate: Tue Jul 16 16:02:38 2019 +0200 cid#1448443 Uninitialized pointer field Change-Id: I664c9c6e1479466bfe5a1af35a554aaa15fac2ea Reviewed-on: https://gerrit.libreoffice.org/75695 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/ThreadedDeflater.cxx b/package/source/zipapi/ThreadedDeflater.cxx index b136981b3bdb..930ab13ded71 100644 --- a/package/source/zipapi/ThreadedDeflater.cxx +++ b/package/source/zipapi/ThreadedDeflater.cxx @@ -48,6 +48,7 @@ class ThreadedDeflater::Task : public comphelper::ThreadTask public: Task(ThreadedDeflater* deflater_, int sequence_, int blockSize_) : comphelper::ThreadTask(deflater_->threadTaskTag) +, stream() , deflater(deflater_) , sequence(sequence_) , blockSize(blockSize_) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e6b9651ee37c3e51ed5085cc47c2d7fd6564820e Author: Andrea Gelmini AuthorDate: Wed Jun 19 22:42:22 2019 + Commit: Julien Nabet CommitDate: Thu Jun 20 07:53:41 2019 +0200 Fix typo Change-Id: Ib804fd330ffae4b0e6c33c1247265955a3be9f2e Reviewed-on: https://gerrit.libreoffice.org/74389 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 397bd6c798fa..1f0667e3bb78 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -2047,7 +2047,7 @@ void SAL_CALL OWriteStream::closeInput( ) if ( !m_bInitOnDemand && ( m_bInStreamDisconnected || !m_xInStream.is() ) ) throw io::NotConnectedException(); -// the input part of the stream stays open for internal purposes ( to allow reading during copiing ) +// the input part of the stream stays open for internal purposes (to allow reading during copying) // since it can not be reopened until output part is closed, it will be closed with output part. m_bInStreamDisconnected = true; // m_xInStream->closeInput(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackageFolder.cxx | 30 ++--- 1 file changed, 17 insertions(+), 13 deletions(-) New commits: commit aa809b35b487b594166d7aa7ecccf221ac1054e1 Author: Luboš Luňák AuthorDate: Fri Jun 7 10:55:24 2019 +0200 Commit: Luboš Luňák CommitDate: Mon Jun 10 11:16:13 2019 +0200 bail out immediately if saving part of a zip package fails There's no point in continuing to write other parts if the final result will be a failure anyway. Moreover this avoids an assert in ZipOutputStream::writeLOC() if writing of the previous part resulted in an error (e.g. ZipException because of broken zip CRC for the stream) that skipped calling ZipOutputStream::rawCloseEntry(). Change-Id: I5095b97a31cac9befcab5e82bd8cda2dfa53c7f7 Reviewed-on: https://gerrit.libreoffice.org/73646 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index 1aaaedcd3d89..bd7512a19fc8 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -287,8 +287,6 @@ void ZipPackageFolder::saveContents( sal_Int32 nPBKDF2IterationCount, const rtlRandomPool ) const { -bool bWritingFailed = false; - if ( maContents.empty() && !rPath.isEmpty() && m_nFormat != embed::StorageFormats::OFOPXML ) { // it is an empty subfolder, use workaround to store it @@ -305,11 +303,11 @@ void ZipPackageFolder::saveContents( } catch ( ZipException& ) { -bWritingFailed = true; +throw uno::RuntimeException( THROW_WHERE ); } catch ( IOException& ) { -bWritingFailed = true; +throw uno::RuntimeException( THROW_WHERE ); } } @@ -322,8 +320,11 @@ void ZipPackageFolder::saveContents( if ( aIter != maContents.end() && !(*aIter).second->bFolder ) { bMimeTypeStreamStored = true; -bWritingFailed = !aIter->second->pStream->saveChild( -rPath + aIter->first, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool ); +if( !aIter->second->pStream->saveChild( +rPath + aIter->first, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool )) +{ +throw uno::RuntimeException( THROW_WHERE ); +} } } @@ -335,19 +336,22 @@ void ZipPackageFolder::saveContents( { if (rInfo.bFolder) { -bWritingFailed = !rInfo.pFolder->saveChild( -rPath + rShortName, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool ); +if( !rInfo.pFolder->saveChild( +rPath + rShortName, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool )) +{ +throw uno::RuntimeException( THROW_WHERE ); +} } else { -bWritingFailed = !rInfo.pStream->saveChild( -rPath + rShortName, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool ); +if( !rInfo.pStream->saveChild( +rPath + rShortName, rManList, rZipOut, rEncryptionKey, nPBKDF2IterationCount, rRandomPool )) +{ +throw uno::RuntimeException( THROW_WHERE ); +} } } } - -if( bWritingFailed ) -throw uno::RuntimeException(THROW_WHERE ); } sal_Int64 SAL_CALL ZipPackageFolder::getSomething( const uno::Sequence< sal_Int8 >& aIdentifier ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 5143a5725ccc74209f0b5f2f903983622d328d0c Author: Andrea Gelmini AuthorDate: Mon Apr 8 10:52:49 2019 + Commit: Jens Carl CommitDate: Tue Apr 9 07:13:36 2019 +0200 Fix typos Change-Id: Idc6d5fcc91f74d1450ef44634274651074f768c0 Reviewed-on: https://gerrit.libreoffice.org/70437 Tested-by: Jenkins Reviewed-by: Jens Carl diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index c963820def7f..28e20c43703a 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1028,7 +1028,7 @@ void OStorage_Impl::Commit() while ( mapIter != m_aChildrenMap.end() ) { // renamed and inserted elements must be really inserted to package later -// since thay can conflict with removed elements +// since they can conflict with removed elements auto & pElement = mapIter->second; if ( pElement->m_bIsRemoved ) { @@ -1050,7 +1050,7 @@ void OStorage_Impl::Commit() for ( auto& pair : m_aChildrenMap ) { // if it is a 'duplicate commit' inserted elements must be really inserted to package later -// since thay can conflict with renamed elements +// since they can conflict with renamed elements auto & pElement = pair.second; if ( !pElement->m_bIsInserted ) { @@ -1570,7 +1570,7 @@ void OStorage_Impl::CloneStreamElement( const OUString& aStreamName, // the copy will be created internally // usual copying is not applicable here, only last flushed version of the -// child stream should be used for copiing. Probably the children m_xPackageStream +// child stream should be used for copying. Probably the children m_xPackageStream // can be used as a base of a new stream, that would be copied to result // storage. The only problem is that some package streams can be accessed from outside // at the same time (now solved by wrappers that remember own position). ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 10 +- package/source/xstor/xstorage.hxx |2 +- 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit 4fda02a8310dbb42b504f379e3f2f594391b16cb Author: Noel Grandin AuthorDate: Wed Mar 27 11:26:09 2019 +0200 Commit: Noel Grandin CommitDate: Thu Mar 28 09:21:26 2019 +0100 return unique_ptr from CreateNewStorageImpl Change-Id: I32fa9b9bf4067792a3ad968ba5f2ef9b311ef48a Reviewed-on: https://gerrit.libreoffice.org/69858 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 59fc6ac888c1..1130c344ce51 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1365,7 +1365,7 @@ void OStorage_Impl::InsertRawStream( const OUString& aName, const uno::Reference m_bBroadcastModified = true; } -OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode ) +std::unique_ptr OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode ) { SAL_WARN_IF( !m_xPackage.is(), "package.xstor", "Not possible to refer to package as to factory!" ); if ( !m_xPackage.is() ) @@ -1381,8 +1381,8 @@ OStorage_Impl* OStorage_Impl::CreateNewStorageImpl( sal_Int32 nStorageMode ) throw io::IOException( THROW_WHERE ); uno::Reference< container::XNameContainer > xPackageSubFolder( xNewElement, uno::UNO_QUERY_THROW ); -OStorage_Impl* pResult = -new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xContext, m_nStorageType ); +std::unique_ptr pResult( +new OStorage_Impl( this, nStorageMode, xPackageSubFolder, m_xPackage, m_xContext, m_nStorageType )); pResult->m_bIsModified = true; return pResult; @@ -1392,7 +1392,7 @@ SotElement_Impl* OStorage_Impl::InsertStorage( const OUString& aName, sal_Int32 { SotElement_Impl* pNewElement = InsertElement( aName, true ); -pNewElement->m_xStorage.reset(CreateNewStorageImpl(nStorageMode)); +pNewElement->m_xStorage = CreateNewStorageImpl(nStorageMode); m_aChildrenVector.push_back( pNewElement ); @@ -1593,7 +1593,7 @@ void OStorage_Impl::CreateRelStorage() if ( !m_pRelStorElement ) { m_pRelStorElement = new SotElement_Impl( "_rels", true, true ); - m_pRelStorElement->m_xStorage.reset(CreateNewStorageImpl(embed::ElementModes::WRITE)); +m_pRelStorElement->m_xStorage = CreateNewStorageImpl(embed::ElementModes::WRITE); if (m_pRelStorElement->m_xStorage) m_pRelStorElement->m_xStorage->m_pParent = nullptr; // the relation storage is completely controlled by parent } diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 23d116f7bd51..a365dfd0902e 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -233,7 +233,7 @@ struct OStorage_Impl SotElement_Impl* InsertStream( const OUString& aName, bool bEncr ); void InsertRawStream( const OUString& aName, const css::uno::Reference< css::io::XInputStream >& xInStream ); -OStorage_Impl* CreateNewStorageImpl( sal_Int32 nStorageMode ); +std::unique_ptr CreateNewStorageImpl( sal_Int32 nStorageMode ); SotElement_Impl* InsertStorage( const OUString& aName, sal_Int32 nStorageMode ); SotElement_Impl* InsertElement( const OUString& aName, bool bIsStorage ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/ohierarchyholder.cxx | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) New commits: commit 487ed7fdd6ea9687336112afcd80e7e8d723b8fc Author: Julien Nabet AuthorDate: Sat Nov 24 18:54:39 2018 +0100 Commit: Julien Nabet CommitDate: Sat Nov 24 21:37:24 2018 +0100 Use returned iterator by list::erase Change-Id: I42312f5cbd0de65cc8915e6833eff668d244f66b Reviewed-on: https://gerrit.libreoffice.org/63956 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 5f6cf2291b54..800cfdf7ce1f 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -267,9 +267,14 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source for ( OWeakStorRefList_Impl::iterator pStorageIter = m_aOpenStreams.begin(); pStorageIter != m_aOpenStreams.end(); ) { -OWeakStorRefList_Impl::iterator pTmp = pStorageIter++; -if ( !pTmp->get().is() || pTmp->get() == xStream ) -m_aOpenStreams.erase( pTmp ); +if ( !pStorageIter->get().is() || pStorageIter->get() == xStream ) +{ +pStorageIter = m_aOpenStreams.erase(pStorageIter); +} +else +{ +++pStorageIter; +} } aGuard.clear(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sal/textenc sc/source sw/sdi sw/source
package/source/zipapi/ZipOutputEntry.cxx |2 +- sal/textenc/tcvtarb1.tab | 12 ++-- sal/textenc/tcvteas1.tab |4 ++-- sal/textenc/textenc.cxx |6 +++--- sc/source/core/tool/autoform.cxx |4 ++-- sc/source/filter/excel/impop.cxx |2 +- sc/source/ui/view/gridwin.cxx|2 +- sw/sdi/_annotsh.sdi |2 +- sw/sdi/_tabsh.sdi|2 +- sw/sdi/_textsh.sdi |4 ++-- sw/source/filter/ww8/wrtww8.cxx |2 +- sw/source/filter/ww8/ww8scan.cxx |4 ++-- sw/source/filter/ww8/ww8struc.hxx|2 +- 13 files changed, 24 insertions(+), 24 deletions(-) New commits: commit 2a06d78483db77aab28eaa522791bb4d96a4094e Author: Johnny_M AuthorDate: Tue Oct 30 21:03:57 2018 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Wed Oct 31 14:26:51 2018 +0100 Translate German comments Change-Id: I94cdb753d01dfd0d5b8f78ede1819b281b840ab2 Reviewed-on: https://gerrit.libreoffice.org/62669 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx index 5aa16a0738a5..79f2bdbbd974 100644 --- a/package/source/zipapi/ZipOutputEntry.cxx +++ b/package/source/zipapi/ZipOutputEntry.cxx @@ -233,7 +233,7 @@ void ZipOutputEntry::doDeflate() { m_xOutStream->writeBytes( aEncryptionBuffer ); -// the sizes as well as checksum for encrypted streams is calculated hier +// the sizes as well as checksum for encrypted streams are calculated here m_pCurrentEntry->nCompressedSize += aEncryptionBuffer.getLength(); m_pCurrentEntry->nSize = m_pCurrentEntry->nCompressedSize; m_aCRC.update( aEncryptionBuffer ); diff --git a/sal/textenc/tcvtarb1.tab b/sal/textenc/tcvtarb1.tab index 86af2ae83ce6..f7b0ce945965 100644 --- a/sal/textenc/tcvtarb1.tab +++ b/sal/textenc/tcvtarb1.tab @@ -30,7 +30,7 @@ /* IBM-862 */ /* Dos Standard CharSet for Hebrew */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ +/* 1-Byte, 0x00-0x7F ASCII without exception */ /* Convert-Tables: mappings/vendors/micsft/pc/cp862.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ @@ -225,7 +225,7 @@ static ImplTextEncodingData const aImplIBM862TextEncodingData /* IBM-864 */ /* Dos Standard CharSet for Arabic */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ +/* 1-Byte, 0x00-0x7F ASCII without exception */ /* Convert-Tables: mappings/vendors/micsft/pc/cp864.txt from 04/24/96 Version 2.00 */ /* Last-Changes from us: */ @@ -383,7 +383,7 @@ static ImplTextEncodingData const aImplIBM864TextEncodingData /* MS-1255 */ /* Windows Standard CharSet for Hebrew */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ +/* 1-Byte, 0x00-0x7F ASCII without exception */ /* Convert-Tables: mappings/vendors/micsft/windows/cp1255.txt from 04/15/98 Version 2.01 */ /* Last-Changes from us: */ @@ -536,7 +536,7 @@ static ImplTextEncodingData const aImplMS1255TextEncodingData /* MS-1256 */ /* Windows Standard CharSet for Arabic */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ +/* 1-Byte, 0x00-0x7F ASCII without exception */ /* Convert-Tables: mappings/vendors/micsft/windows/cp1256.txt from 01/5/99 Version 2.01 */ /* --- */ @@ -714,7 +714,7 @@ static ImplTextEncodingData const aImplMS1256TextEncodingData /* ISO-8859-6 */ /* Unix Standard for Arabic */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme, 0x80-0x9F Control-Caracter wie in Unicode */ +/* 1-Byte, 0x00-0x7F ASCII without exception, 0x80-0x9F control character like in Unicode */ /* Convert-Tables: mappings/iso8859/8859-6.txt from 07/27/99 Version 1.0 (based on Unicode 3.0) */ /* Last-Changes from us: */ /* !!! 0x30-0x39 are Arabic numbers and should normally be mapped to 0x0660-0x0669 !!! */ @@ -815,7 +815,7 @@ static ImplTextEncodingData const aImplISO88596TextEncodingData /* ISO-8859-8 */ /* Unix Standard for Hebrew */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme, 0x80-0x9F Control-Caracter wie in Unicode */ +/* 1-Byte, 0x00-0x7F ASCII without exception, 0x80-0x9F control character like in Unicode */ /* Convert-Tables: mappings/iso8859/8859-8.txt from 2000-Jan-03 Version 1.1 (based on Unicode 3.0) */ #define ISO88598UNI_START 0xA0 diff --git a/sal/textenc/tcvteas1.tab b/sal/textenc/tcvteas1.tab index fd4ca1b2ada4..c65188a69009 100644 --- a/sal/textenc/tcvteas1.tab +++ b/sal/textenc/tcvteas1.tab @@ -30,7 +30,7 @@ /* MS-874 */ /* Windows/Dos Standard CharSet for Thai */ -/* 1-Byte, 0x00-0x7F ASCII ohne Ausnahme */ +/* 1-Byte, 0x00-0x7F ASCII without exception */ /* Convert-Tables: mappings/vendors/micsft/pc/cp874.txt from 04/15/98 Version 2.00 */ /* Last-Changes from us: */ @@ -191,7 +191,7 @@ static
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx |4 ++-- package/source/xstor/xstorage.cxx |4 ++-- package/source/xstor/xstorage.hxx |2 +- 3 files changed, 5 insertions(+), 5 deletions(-) New commits: commit a51c1829cb90303f28011428873ff9160fdd3152 Author: Andrea Gelmini AuthorDate: Thu Oct 18 11:20:47 2018 +0200 Commit: Julien Nabet CommitDate: Thu Oct 18 17:16:25 2018 +0200 Fix typo in code It passed "make check" on Linux Change-Id: I20e2ecce45ead161a3f95b511416044af4e04290 Reviewed-on: https://gerrit.libreoffice.org/61917 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 2810f9682302..c14e2f47cb5e 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -3113,7 +3113,7 @@ void OWriteStream::BroadcastTransaction( sal_Int8 nMessage ) case STOR_MESS_PRECOMMIT: static_cast( pIterator.next( ) )->preCommit( aSource ); break; -case STOR_MESS_COMMITED: +case STOR_MESS_COMMITTED: static_cast( pIterator.next( ) )->commited( aSource ); break; case STOR_MESS_PREREVERT: @@ -3179,7 +3179,7 @@ void SAL_CALL OWriteStream::commit() aCaught ); } -BroadcastTransaction( STOR_MESS_COMMITED ); +BroadcastTransaction( STOR_MESS_COMMITTED ); } void SAL_CALL OWriteStream::revert() diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 81e159fad77e..562d040febe5 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1985,7 +1985,7 @@ void OStorage::BroadcastTransaction( sal_Int8 nMessage ) case STOR_MESS_PRECOMMIT: static_cast( pIterator.next( ) )->preCommit( aSource ); break; -case STOR_MESS_COMMITED: +case STOR_MESS_COMMITTED: static_cast( pIterator.next( ) )->commited( aSource ); break; case STOR_MESS_PREREVERT: @@ -3608,7 +3608,7 @@ void SAL_CALL OStorage::commit() if ( xParentModif.is() ) xParentModif->setModified( true ); -BroadcastTransaction( STOR_MESS_COMMITED ); +BroadcastTransaction( STOR_MESS_COMMITTED ); } void SAL_CALL OStorage::revert() diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 8cf9d5ac5cfa..23d116f7bd51 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -68,7 +68,7 @@ namespace com { namespace sun { namespace star { namespace uno { #define RELINFO_CHANGED_BROKEN 7 #define STOR_MESS_PRECOMMIT 1 -#define STOR_MESS_COMMITED 2 +#define STOR_MESS_COMMITTED 2 #define STOR_MESS_PREREVERT 3 #define STOR_MESS_REVERTED 4 ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx | 75 +- 1 file changed, 34 insertions(+), 41 deletions(-) New commits: commit 3cc6d3611ac8cbbfb9803f3a084d02edde470ad3 Author: Stephan Bergmann AuthorDate: Thu Aug 23 16:55:40 2018 +0200 Commit: Stephan Bergmann CommitDate: Thu Aug 23 20:38:26 2018 +0200 Related rhbz#1618703: Properly handle failure encoding zip file ...when e.g. FIPS mode makes ZipFile::StaticGetCipher fail by throwing an exception which would be caught by ZipPackageStream::saveChild (in package/source/zippackage/ZipPackageStream.cxx) alright (and translated into bSuccess = false), if ZipFile::StaticGetCipher didn't unhelpfully swallow and ignore all exceptions in an outer try-catch. Change-Id: I14376128515df1dd4bdac921edd8ab94cc9b7617 Reviewed-on: https://gerrit.libreoffice.org/59514 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 27a89f27a1ba..270a2961b7c1 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -163,54 +163,47 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un { uno::Reference< xml::crypto::XCipherContext > xResult; -try +if (xEncryptionData->m_nDerivedKeySize < 0) { -if (xEncryptionData->m_nDerivedKeySize < 0) -{ -throw ZipIOException("Invalid derived key length!" ); -} +throw ZipIOException("Invalid derived key length!" ); +} -uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize ); -if ( !xEncryptionData->m_nIterationCount && - xEncryptionData->m_nDerivedKeySize == xEncryptionData->m_aKey.getLength() ) -{ -// gpg4libre: no need to derive key, m_aKey is already -// usable as symmetric session key -aDerivedKey = xEncryptionData->m_aKey; -} -else if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ), -aDerivedKey.getLength(), -reinterpret_cast< const sal_uInt8 * > (xEncryptionData->m_aKey.getConstArray() ), -xEncryptionData->m_aKey.getLength(), -reinterpret_cast< const sal_uInt8 * > ( xEncryptionData->m_aSalt.getConstArray() ), -xEncryptionData->m_aSalt.getLength(), -xEncryptionData->m_nIterationCount ) ) -{ -throw ZipIOException("Can not create derived key!" ); -} +uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize ); +if ( !xEncryptionData->m_nIterationCount && + xEncryptionData->m_nDerivedKeySize == xEncryptionData->m_aKey.getLength() ) +{ +// gpg4libre: no need to derive key, m_aKey is already +// usable as symmetric session key +aDerivedKey = xEncryptionData->m_aKey; +} +else if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ), +aDerivedKey.getLength(), +reinterpret_cast< const sal_uInt8 * > (xEncryptionData->m_aKey.getConstArray() ), +xEncryptionData->m_aKey.getLength(), +reinterpret_cast< const sal_uInt8 * > ( xEncryptionData->m_aSalt.getConstArray() ), +xEncryptionData->m_aSalt.getLength(), +xEncryptionData->m_nIterationCount ) ) +{ +throw ZipIOException("Can not create derived key!" ); +} -if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING ) -{ -uno::Reference< uno::XComponentContext > xContext = xArgContext; -if ( !xContext.is() ) -xContext = comphelper::getProcessComponentContext(); +if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING ) +{ +uno::Reference< uno::XComponentContext > xContext = xArgContext; +if ( !xContext.is() ) +xContext = comphelper::getProcessComponentContext(); -uno::Reference< xml::crypto::XNSSInitializer > xCipherContextSupplier = xml::crypto::NSSInitializer::create( xContext ); +uno::Reference< xml::crypto::XNSSInitializer > xCipherContextSupplier = xml::crypto::NSSInitializer::create( xContext ); -xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() ); -} -else if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::BLOWFISH_CFB_8 ) -{ -xResult = BlowfishCFB8CipherContext::Create( aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt ); -}
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |6 +++--- package/source/zipapi/XBufferedThreadedStream.hxx |4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) New commits: commit dacc1b40df67d154c96b256b0d920460f38c3d11 Author: Caolán McNamara AuthorDate: Sat Jul 28 16:33:22 2018 +0100 Commit: Stephan Bergmann CommitDate: Tue Jul 31 08:40:49 2018 +0200 ofz#9597 rethrown IOException not caught by catch IOException under google oss-fuzz, asan + clang version 6.0.0 (trunk 315613) when using our own exception thrower, but builtin C++11 support works also, ofz#9266, ofz#9591, ofz#9597, ofz#9622, etc Change-Id: I29c692da880b49268284de2f61be07fa94f33bc6 Reviewed-on: https://gerrit.libreoffice.org/58223 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index 24c68cfc1fe2..71683cfaf590 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -32,7 +32,7 @@ private: catch (const css::uno::Exception ) { SAL_WARN("package", "Unexpected " << e ); -mxStream.saveException(cppu::getCaughtException()); +mxStream.saveException(std::current_exception()); } mxStream.setTerminateThread(); @@ -107,8 +107,8 @@ const Buffer& XBufferedThreadedStream::getNextBlock() if( maPendingBuffers.empty() ) { maInUseBuffer = Buffer(); -if (maSavedException.hasValue()) -cppu::throwException(maSavedException); +if (maSavedException) +std::rethrow_exception(maSavedException); } else { diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx b/package/source/zipapi/XBufferedThreadedStream.hxx index b99864fbb268..5feb6e4252e0 100644 --- a/package/source/zipapi/XBufferedThreadedStream.hxx +++ b/package/source/zipapi/XBufferedThreadedStream.hxx @@ -37,7 +37,7 @@ private: std::condition_variable maBufferProduceResume; bool mbTerminateThread; /// indicates the failure of one of the threads -css::uno::Any maSavedException; /// exception caught during unzipping is saved to be thrown during reading +std::exception_ptr maSavedException;/// exception caught during unzipping is saved to be thrown during reading static const size_t nBufferLowWater = 2; static const size_t nBufferHighWater = 4; @@ -66,7 +66,7 @@ public: void produce(); void setTerminateThread(); -void saveException(const css::uno::Any ) { maSavedException = rAny; } +void saveException(std::exception_ptr exception) { maSavedException = exception; } // XInputStream virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source xmlsecurity/qa
package/source/manifest/ManifestDefines.hxx |9 +++ package/source/manifest/ManifestImport.cxx | 48 ++-- package/source/manifest/ManifestImport.hxx | 12 +++- xmlsecurity/qa/unit/signing/data/encryptedGPG_odf13.odt |binary xmlsecurity/qa/unit/signing/signing.cxx |8 ++ 5 files changed, 71 insertions(+), 6 deletions(-) New commits: commit a7bf6488ebb544e1efaed0a1e53073df9cc2064d Author: Thorsten Behrens Date: Thu Jun 28 15:17:40 2018 +0200 ODF1.3: import new OpenPGP encryption markup With OFFICE-3940 the loext markup got accepted for ODF1.3 (and the redundant KeyInfo element removed). Make sure manifest parser can import new markup. Change-Id: Id3c88654e8e6e0e256cd68fbb43f1ef670849cf7 Reviewed-on: https://gerrit.libreoffice.org/56597 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx index c68c241c7514..44c0cb4c5254 100644 --- a/package/source/manifest/ManifestDefines.hxx +++ b/package/source/manifest/ManifestDefines.hxx @@ -46,6 +46,15 @@ #define ATTRIBUTE_ALGORITHM "loext:PGPAlgorithm" #define ELEMENT_CIPHERDATA "loext:CipherData" #define ELEMENT_CIPHERVALUE "loext:CipherValue" +#define ELEMENT_MANIFEST13_KEYINFO "manifest:keyinfo" +#define ELEMENT_ENCRYPTEDKEY13 "manifest:encrypted-key" +#define ELEMENT_ENCRYPTIONMETHOD13 "manifest:encryption-method" +#define ELEMENT_PGPDATA13 "manifest:PGPData" +#define ELEMENT_PGPKEYID13 "manifest:PGPKeyID" +#define ELEMENT_PGPKEYPACKET13 "manifest:PGPKeyPacket" +#define ATTRIBUTE_ALGORITHM13 "manifest:PGPAlgorithm" +#define ELEMENT_CIPHERDATA13 "manifest:CipherData" +#define ELEMENT_CIPHERVALUE13 "manifest:CipherValue" #define ELEMENT_ENCRYPTION_DATA "manifest:encryption-data" #define ATTRIBUTE_CHECKSUM_TYPE "manifest:checksum-type" diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 916db4c3c694..cd0034a2e1df 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -70,6 +70,16 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV , sCipherDataElement( ELEMENT_CIPHERDATA ) , sCipherValueElement ( ELEMENT_CIPHERVALUE ) +, sManifestKeyInfoElement13 ( ELEMENT_MANIFEST13_KEYINFO ) +, sEncryptedKeyElement13 ( ELEMENT_ENCRYPTEDKEY13 ) +, sEncryptionMethodElement13 ( ELEMENT_ENCRYPTIONMETHOD13 ) +, sPgpDataElement13 ( ELEMENT_PGPDATA13 ) +, sPgpKeyIDElement13 ( ELEMENT_PGPKEYID13 ) +, sPGPKeyPacketElement13 ( ELEMENT_PGPKEYPACKET13 ) +, sAlgorithmAttribute13 ( ATTRIBUTE_ALGORITHM13 ) +, sCipherDataElement13( ELEMENT_CIPHERDATA13 ) +, sCipherValueElement13 ( ELEMENT_CIPHERVALUE13 ) + , sFullPathProperty ( "FullPath" ) , sMediaTypeProperty( "MediaType" ) , sVersionProperty ( "Version" ) @@ -149,9 +159,10 @@ void ManifestImport::doEncryptedKey(StringHashMap &) aKeyInfoSequence.resize(3); } -void ManifestImport::doEncryptionMethod(StringHashMap ) +void ManifestImport::doEncryptionMethod(StringHashMap , +const OUString& rAlgoAttrName) { -OUString aString = rConvertedAttribs[sAlgorithmAttribute]; +OUString aString = rConvertedAttribs[rAlgoAttrName]; if ( aKeyInfoSequence.size() != 3 || aString != "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ) { @@ -340,7 +351,9 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re case 2: { if (aConvertedName == sFileEntryElement) //manifest:file-entry doFileEntry(aConvertedAttribs); -else if (aConvertedName == sManifestKeyInfoElement) //loext:KeyInfo +else if (aConvertedName == sManifestKeyInfoElement) //loext:keyinfo +doKeyInfoEntry(aConvertedAttribs); +else if (aConvertedName == sManifestKeyInfoElement13) //manifest:keyinfo doKeyInfoEntry(aConvertedAttribs); else aStack.back().m_bValid = false; @@ -356,6 +369,8 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re doEncryptionData(aConvertedAttribs); else if (aConvertedName == sEncryptedKeyElement) //loext:encrypted-key doEncryptedKey(aConvertedAttribs); +else if (aConvertedName == sEncryptedKeyElement13) //manifest:encrypted-key +doEncryptedKey(aConvertedAttribs); else aStack.back().m_bValid = false; break; @@ -373,11 +388,17 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re else if (aConvertedName == sStartKeyAlgElement)
[Libreoffice-commits] core.git: package/source reportdesign/source sal/osl sal/qa
package/source/xstor/ohierarchyholder.cxx| 12 +++ package/source/xstor/ohierarchyholder.hxx| 11 +++--- package/source/xstor/xstorage.cxx|6 +-- reportdesign/source/filter/xml/xmlExport.cxx | 12 +++ reportdesign/source/filter/xml/xmlExport.hxx |5 +-- sal/osl/all/debugbase.cxx| 12 +++ sal/osl/w32/procimpl.cxx | 21 sal/qa/osl/process/osl_process.cxx | 44 --- 8 files changed, 56 insertions(+), 67 deletions(-) New commits: commit 51aa57cd8ed46d28262e0d315328231f0fa814f4 Author: Arkadiy Illarionov Date: Mon Jun 11 13:14:07 2018 +0300 tdf#96099 Remove some trivial std::vector typedefs Cleanup package, reportdesign, sal. Change-Id: I8622465886f7ec97700b00740ea37d40767ec98e Reviewed-on: https://gerrit.libreoffice.org/55616 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx index 508107ac7c53..5f6cf2291b54 100644 --- a/package/source/xstor/ohierarchyholder.cxx +++ b/package/source/xstor/ohierarchyholder.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star; // OHierarchyHolder_Impl -uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, std::vector& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -50,7 +50,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyHolder_Impl::GetStream return xResult; } -void OHierarchyHolder_Impl::RemoveStreamHierarchically( OStringList_Impl& aListPath ) +void OHierarchyHolder_Impl::RemoveStreamHierarchically( std::vector& aListPath ) { uno::Reference< embed::XStorage > xOwnStor( m_xWeakOwnStorage.get(), uno::UNO_QUERY_THROW ); @@ -58,9 +58,9 @@ void OHierarchyHolder_Impl::RemoveStreamHierarchically( OStringList_Impl& aListP } // static -OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const OUString& aPath ) +std::vector OHierarchyHolder_Impl::GetListPathFromString( const OUString& aPath ) { -OStringList_Impl aResult; +std::vector aResult; sal_Int32 nIndex = 0; do { @@ -77,7 +77,7 @@ OStringList_Impl OHierarchyHolder_Impl::GetListPathFromString( const OUString& a // OHierarchyElement_Impl -uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, OStringList_Impl& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) +uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStreamHierarchically( sal_Int32 nStorageMode, std::vector& aListPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -161,7 +161,7 @@ uno::Reference< embed::XExtendedStorageStream > OHierarchyElement_Impl::GetStrea return xResult; } -void OHierarchyElement_Impl::RemoveStreamHierarchically( OStringList_Impl& aListPath ) +void OHierarchyElement_Impl::RemoveStreamHierarchically( std::vector& aListPath ) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/package/source/xstor/ohierarchyholder.hxx b/package/source/xstor/ohierarchyholder.hxx index 3d18c8d407da..317a4d9b329c 100644 --- a/package/source/xstor/ohierarchyholder.hxx +++ b/package/source/xstor/ohierarchyholder.hxx @@ -38,7 +38,6 @@ struct OHierarchyElement_Impl; typedef std::unordered_map< OUString, ::rtl::Reference< OHierarchyElement_Impl > > OHierarchyElementList_Impl; -typedef ::std::vector< OUString > OStringList_Impl; typedef ::std::list< css::uno::WeakReference< css::embed::XExtendedStorageStream > > OWeakStorRefList_Impl; @@ -75,11 +74,11 @@ public: css::uno::Reference< css::embed::XExtendedStorageStream > GetStreamHierarchically( sal_Int32 nStorageMode, -OStringList_Impl& aPath, +std::vector& aPath, sal_Int32 nStreamMode, const ::comphelper::SequenceAsHashMap& aEncryptionData ); -void RemoveStreamHierarchically( OStringList_Impl& aListPath ); +void RemoveStreamHierarchically( std::vector& aListPath ); // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; @@ -102,15 +101,15 @@ public: , m_xChild( new OHierarchyElement_Impl( css::uno::WeakReference<
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestExport.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6e851bb1286da592bc180ed722f8c8ec5e1f18f0 Author: Thorsten Behrens Date: Tue Jun 5 11:42:12 2018 +0200 package: fix pretty-printing in manifest exporter Change-Id: If8c88994f68a8a644d1ce4e2386d3247140e824f Reviewed-on: https://gerrit.libreoffice.org/55322 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index abc346f9e4e9..2509c8caf30e 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -271,8 +271,8 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con pNewAttrList->AddAttribute ( sAlgorithmAttribute, sCdataAttribute, "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ); xHandler->startElement( sEncryptionMethodElement, xNewAttrList ); -xHandler->ignorableWhitespace ( sWhiteSpace ); xHandler->endElement( sEncryptionMethodElement ); +xHandler->ignorableWhitespace ( sWhiteSpace ); xHandler->startElement( sKeyInfoElement, nullptr ); xHandler->ignorableWhitespace ( sWhiteSpace ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sw/qa
package/source/xstor/xstorage.cxx |2 -- sw/qa/core/data/odt/fail/forcepoint-xstor-1.odt |binary 2 files changed, 2 deletions(-) New commits: commit 91bb474cc5342b32dab6c701a1bea6c49b87f498 Author: Caolán McNamaraDate: Sat Apr 7 20:24:40 2018 +0100 forcepoint#37 revert tdf#108572 let remove storage element reverts commit 26957fc325c27cf61e8efb380d627def4931 Date: Wed Sep 6 10:54:50 2017 +0200 tdf#108572 let remove storage element void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) expects that m_pAntiImpl will be nullptr, if not throws an exception. This caused that in case of deleting embedded database used for mail merge it wasn't fully removed and The problem is that by allowing the removal of the element, existing readonly accessors are left pointing to the deleted element which causes quite some problems as seen in this sample document Change-Id: Ie6ac36e6dea771b02637d77b78eb8026e3bb7ae8 Reviewed-on: https://gerrit.libreoffice.org/52563 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 67c2afa61fd2..0a43a07869f9 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -2822,8 +2822,6 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) if ( !pElement ) throw container::NoSuchElementException( THROW_WHERE ); //??? -if ( pElement->m_xStorage ) -pElement->m_xStorage->m_pAntiImpl = nullptr; m_pImpl->RemoveElement( pElement ); m_pImpl->m_bIsModified = true; diff --git a/sw/qa/core/data/odt/fail/forcepoint-xstor-1.odt b/sw/qa/core/data/odt/fail/forcepoint-xstor-1.odt new file mode 100755 index ..1844d7882ba9 Binary files /dev/null and b/sw/qa/core/data/odt/fail/forcepoint-xstor-1.odt differ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestExport.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 32f42d093d4408666151d03f04823e2bb39e46cd Author: himajin10Date: Mon Mar 12 04:52:30 2018 +0900 tdf#116351: fix re-use of AttributeList on PGP manifest multiple attributes of the same name on the same element, because AttributeList was wrongly re-used Change-Id: I29b2317ce3d836d7349fa0474709726bed2c5ad4 Reviewed-on: https://gerrit.libreoffice.org/51087 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 46ace993b581..2c819b346ff0 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -232,8 +232,6 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con { // yeah, so that goes directly below the manifest:manifest // element -::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; -uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList); OUStringBuffer aBuffer; xHandler->ignorableWhitespace ( sWhiteSpace ); @@ -268,6 +266,8 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con xHandler->startElement( sEncryptedKeyElement, nullptr ); xHandler->ignorableWhitespace ( sWhiteSpace ); +::comphelper::AttributeList * pNewAttrList = new ::comphelper::AttributeList; +uno::Reference < xml::sax::XAttributeList > xNewAttrList (pNewAttrList); // TODO: the algorithm should rather be configurable pNewAttrList->AddAttribute ( sAlgorithmAttribute, sCdataAttribute, "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit ff6def51db86ea2a516739f2dd67f24fa024af4e Author: Caolán McNamaraDate: Fri Feb 23 12:53:34 2018 + forcepoint #5 check for short read a zip file within a structured storage stream. underlying storage stream claims larger size that it can satisfy on read Change-Id: I8516b12df33ad78b2525192826f5e3aef2622eb8 Reviewed-on: https://gerrit.libreoffice.org/50238 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 6e9351c69f1a..1ef81bf582a5 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -838,11 +838,14 @@ sal_Int32 ZipFile::findEND() nEnd = nPos >= 0 ? nPos : 0 ; aGrabber.seek( nEnd ); -aGrabber.readBytes ( aBuffer, nLength - nEnd ); + +auto nSize = nLength - nEnd; +if (nSize != aGrabber.readBytes(aBuffer, nSize)) +throw ZipException("Zip END signature not found!" ); const sal_Int8 *pBuffer = aBuffer.getConstArray(); -nPos = nLength - nEnd - ENDHDR; +nPos = nSize - ENDHDR; while ( nPos >= 0 ) { if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 5 && pBuffer[nPos+3] == 6 ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sd/qa
package/source/zippackage/ZipPackage.cxx |2 +- sd/qa/unit/import-tests.cxx |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 2dda7cca6feb14b4c6f6f04065e23a8e70e05be6 Author: Andrea GelminiDate: Wed Feb 14 08:13:05 2018 +0100 Fix typos Change-Id: Icee735b303ca72bba7b2680676b0c0092d27e2ec Reviewed-on: https://gerrit.libreoffice.org/49699 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index a67c90108481..aea7d14048dd 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1110,7 +1110,7 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: { // only nonempty type makes sense here ( *aIter )[PKG_MNFST_FULLPATH].Value >>= aPath; -//FIXME: For now we have no way of deferentiating defaults from others. +//FIXME: For now we have no way of differentiating defaults from others. aOverridesSequence[nOverSeqLength].First = "/" + aPath; aOverridesSequence[nOverSeqLength].Second = aType; ++nOverSeqLength; diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 2ed7337438fd..02ab05d93b0d 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -2466,14 +2466,14 @@ void SdImportTest::testTdf51340() CPPUNIT_ASSERT_EQUAL( static_cast(css::style::LineSpacingMode::PROP), aSpacing.Mode ); CPPUNIT_ASSERT_EQUAL( static_cast(125), aSpacing.Height ); -// Third paragraph has a 70% line spacing set directly on normal slide (master slide property ir overriden) +// Third paragraph has a 70% line spacing set directly on normal slide (master slide property is overridden) xParagraph.set( getParagraphFromShape( 2, xShape ) ); xPropSet.set( xParagraph, uno::UNO_QUERY_THROW ); xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; CPPUNIT_ASSERT_EQUAL( static_cast(css::style::LineSpacingMode::PROP), aSpacing.Mode ); CPPUNIT_ASSERT_EQUAL( static_cast(70), aSpacing.Height ); -// Fourth paragraph has a 190% line spacing set directly on normal slide (slide layout property is overriden) +// Fourth paragraph has a 190% line spacing set directly on normal slide (slide layout property is overridden) xParagraph.set( getParagraphFromShape( 3, xShape ) ); xPropSet.set( xParagraph, uno::UNO_QUERY_THROW ); xPropSet->getPropertyValue( "ParaLineSpacing" ) >>= aSpacing; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) New commits: commit 00492aff753510bcb4fab81c5258584f3cda2d17 Author: Ashod NakashianDate: Tue Feb 6 17:42:36 2018 -0500 ofopxml: always generate default application/xml MS Office always sets the application/xml entry but LO doesn't preserve unknown entries. Since this is a standard and always-set entry LO should always stamp it as well. Change-Id: I28b47634f2aa1fec233c9184deb65fd43f2f3ae8 Reviewed-on: https://gerrit.libreoffice.org/48724 Tested-by: Jenkins Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 2a918c8df630..aa5ae86b27d8 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1088,9 +1088,14 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: // Convert vector into a uno::Sequence // TODO/LATER: use Default entries in future -uno::Sequence< beans::StringPair > aDefaultsSequence; -uno::Sequence< beans::StringPair > aOverridesSequence( aManList.size() ); -sal_Int32 nSeqLength = 0; +uno::Sequence< beans::StringPair > aDefaultsSequence(aManList.size()); +// Add at least the application/xml default entry. +aDefaultsSequence[0].First = "xml"; +aDefaultsSequence[0].Second= "application/xml"; +sal_Int32 nDefSeqLength = 1; + +uno::Sequence< beans::StringPair > aOverridesSequence(aManList.size()); +sal_Int32 nOverSeqLength = 0; for ( vector< uno::Sequence< beans::PropertyValue > >::const_iterator aIter = aManList.begin(), aEnd = aManList.end(); aIter != aEnd; @@ -1104,13 +1109,15 @@ void ZipPackage::WriteContentTypes( ZipOutputStream& aZipOut, const vector< uno: if ( !aType.isEmpty() ) { // only nonempty type makes sense here -nSeqLength++; ( *aIter )[PKG_MNFST_FULLPATH].Value >>= aPath; -aOverridesSequence[nSeqLength-1].First = "/" + aPath; -aOverridesSequence[nSeqLength-1].Second = aType; +//FIXME: For now we have no way of deferentiating defaults from others. +aOverridesSequence[nOverSeqLength].First = "/" + aPath; +aOverridesSequence[nOverSeqLength].Second = aType; +++nOverSeqLength; } } -aOverridesSequence.realloc( nSeqLength ); +aOverridesSequence.realloc(nOverSeqLength); +aDefaultsSequence.realloc(nDefSeqLength); ::comphelper::OFOPXMLHelper::WriteContentSequence( xConTypeOutStream, aDefaultsSequence, aOverridesSequence, m_xContext ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/MemoryByteGrabber.hxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 37413f569ad557cc08ea625ce18a6570eb00f075 Author: Stephan BergmannDate: Wed Feb 7 14:30:56 2018 +0100 Prevent MemoryByteGrabber from ever taking temporaries again ...after c99527385acf367c748b3dcf3e6a3bb8103f5eee "MemoryByteGrabber sequence has to exist for Grabber lifetime" Change-Id: Idcb7548aaa7741e8e535024ba36c7a171a6c2fb4 diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx index 7f3c42485876..9b1c096ae056 100644 --- a/package/source/zipapi/MemoryByteGrabber.hxx +++ b/package/source/zipapi/MemoryByteGrabber.hxx @@ -34,6 +34,8 @@ public: , mnEnd ( rBuffer.getLength() ) { } +MemoryByteGrabber(css::uno::Sequence &&) = delete; + const sal_Int8 * getCurrentPos () { return mpBuffer + mnCurrent; } sal_Int32 remainingSize() const { return mnEnd - mnCurrent; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit c99527385acf367c748b3dcf3e6a3bb8103f5eee Author: Caolán McNamaraDate: Tue Feb 6 21:21:30 2018 + MemoryByteGrabber sequence has to exist for Grabber lifetime it just takes a c++ ref, so a temp is an unsuitable arg Change-Id: I40490e94d977df91b985bc4ae458b68ee85d5dfe Reviewed-on: https://gerrit.libreoffice.org/49321 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 1d10a56aaf9c..6e9351c69f1a 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -902,7 +902,7 @@ sal_Int32 ZipFile::readCEN() if ( static_cast < sal_Int64 > ( nCenLen ) != nRead ) throw ZipException ("Error reading CEN into memory buffer!" ); -MemoryByteGrabber aMemGrabber ( aCENBuffer ); +MemoryByteGrabber aMemGrabber(aCENBuffer); ZipEntry aEntry; sal_Int16 nCommentLen; @@ -1015,7 +1015,8 @@ void ZipFile::recover() if ( nPos < nBufSize - 30 && pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 3 && pBuffer[nPos+3] == 4 ) { ZipEntry aEntry; -MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 26 ) ); +Sequence aTmpBuffer(&(pBuffer[nPos+4]), 26); +MemoryByteGrabber aMemGrabber(aTmpBuffer); aEntry.nVersion = aMemGrabber.ReadInt16(); if ( ( aEntry.nVersion & 1 ) != 1 ) @@ -1084,7 +1085,8 @@ void ZipFile::recover() else if (pBuffer[nPos] == 'P' && pBuffer[nPos+1] == 'K' && pBuffer[nPos+2] == 7 && pBuffer[nPos+3] == 8 ) { sal_Int64 nCompressedSize, nSize; -MemoryByteGrabber aMemGrabber ( Sequence< sal_Int8 >( &(pBuffer[nPos+4]), 12 ) ); +Sequence aTmpBuffer(&(pBuffer[nPos+4]), 12); +MemoryByteGrabber aMemGrabber(aTmpBuffer); sal_Int32 nCRC32 = aMemGrabber.ReadInt32(); sal_uInt32 nCompressedSize32 = aMemGrabber.ReadUInt32(); sal_uInt32 nSize32 = aMemGrabber.ReadUInt32(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/ocompinstream.cxx |4 +--- package/source/xstor/ocompinstream.hxx |3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) New commits: commit 4417f37dd88b9a899f070f030794594b97fe2da5 Author: Noel GrandinDate: Mon Jan 22 14:22:06 2018 +0200 loplugin:useuniqueptr in OInputCompStream Change-Id: I49fb71aa4319f6ac245885535e8afe855113e162 Reviewed-on: https://gerrit.libreoffice.org/48557 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 06076370ea92..dd564271ecd8 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -71,8 +71,6 @@ OInputCompStream::~OInputCompStream() m_refCount++; dispose(); } - -delete m_pInterfaceContainer; } uno::Any SAL_CALL OInputCompStream::queryInterface( const uno::Type& rType ) @@ -248,7 +246,7 @@ void SAL_CALL OInputCompStream::addEventListener( const uno::Reference< lang::XE } if ( !m_pInterfaceContainer ) -m_pInterfaceContainer = new ::comphelper::OInterfaceContainerHelper2( m_xMutex->GetMutex() ); +m_pInterfaceContainer.reset( new ::comphelper::OInterfaceContainerHelper2( m_xMutex->GetMutex() ) ); m_pInterfaceContainer->addInterface( xListener ); } diff --git a/package/source/xstor/ocompinstream.hxx b/package/source/xstor/ocompinstream.hxx index 68c2ce2262ae..c41c2c25f40a 100644 --- a/package/source/xstor/ocompinstream.hxx +++ b/package/source/xstor/ocompinstream.hxx @@ -31,6 +31,7 @@ #include #include #include +#include struct OWriteStream_Impl; @@ -44,7 +45,7 @@ protected: OWriteStream_Impl* m_pImpl; rtl::Reference m_xMutex; css::uno::Reference < css::io::XInputStream > m_xStream; -::comphelper::OInterfaceContainerHelper2* m_pInterfaceContainer; +std::unique_ptr<::comphelper::OInterfaceContainerHelper2> m_pInterfaceContainer; css::uno::Sequence < css::beans::PropertyValue > m_aProperties; bool m_bDisposed; sal_Int32 m_nStorageType; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XUnbufferedStream.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 713b261b59e3636890b6a5736c6a3fcc0be647a8 Author: Caolán McNamaraDate: Thu Jan 18 20:54:22 2018 + crashtesting: failure on import with bogus values regression from... commit 7d8e9d989d0ac4a4055b207726708e9ec0da Date: Thu Jan 11 08:47:15 2018 +0200 convert a Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 1f992ca14e58..0aedfac09402 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -210,7 +210,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa nRead = mxZipStream->readBytes ( aData, -std::min(nDiff, nRequestedBytes) ); +std::min(nDiff, nRequestedBytes) ); mnZipCurrent += nRead; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XUnbufferedStream.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 6df0c7bc230a424f5aefe583b591df70c6273b6f Author: Thorsten BehrensDate: Thu Jan 11 23:38:35 2018 +0100 tdf#114550 recognize sym key & init vec as valid f/ decrypt Otherwise package code would _only_ try to decrypt for salt and iteration count present, which does not make sense for gpg. Change-Id: Ie366f086a3c14d6b54b91b4edee8cfef1a42c44b Reviewed-on: https://gerrit.libreoffice.org/47782 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 162bab6d7580..d20b46195c3a 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -78,7 +78,10 @@ XUnbufferedStream::XUnbufferedStream( if (mnZipSize < 0) throw ZipIOException("The stream seems to be broken!"); -bool bHaveEncryptData = rData.is() && rData->m_aSalt.getLength() && rData->m_aInitVector.getLength() && rData->m_nIterationCount != 0; +bool bHaveEncryptData = rData.is() && rData->m_aInitVector.getLength() && +((rData->m_aSalt.getLength() && rData->m_nIterationCount != 0) + || + rData->m_aKey.getLength()); bool bMustDecrypt = nStreamMode == UNBUFF_STREAM_DATA && bHaveEncryptData && bIsEncrypted; if ( bMustDecrypt ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestImport.cxx | 172 - package/source/manifest/ManifestImport.hxx | 25 2 files changed, 196 insertions(+), 1 deletion(-) New commits: commit d17bff6e0324dfa013681efd7e0107d3cd5ad2be Author: Thorsten BehrensDate: Sun Dec 10 23:40:00 2017 +0100 gpg4libre: import PGP encryption manifest Change-Id: Iadd7f8f1194299cb50907d8594114c89c668ebd0 Reviewed-on: https://gerrit.libreoffice.org/46462 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 5ecd8c1cffcd..98a9d61128b5 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -34,6 +34,7 @@ using namespace std; ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector ) : bIgnoreEncryptData( false ) +, bPgpEncryption ( false ) , nDerivedKeySize( 0 ) , rManVector ( rNewManVector ) @@ -57,6 +58,17 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV , sChecksumAttribute( ATTRIBUTE_CHECKSUM ) , sChecksumTypeAttribute( ATTRIBUTE_CHECKSUM_TYPE ) +, sKeyInfoElement ( ELEMENT_ENCRYPTED_KEYINFO ) +, sManifestKeyInfoElement ( ELEMENT_MANIFEST_KEYINFO ) +, sEncryptedKeyElement ( ELEMENT_ENCRYPTEDKEY ) +, sEncryptionMethodElement ( ELEMENT_ENCRYPTIONMETHOD ) +, sPgpDataElement ( ELEMENT_PGPDATA ) +, sPgpKeyIDElement ( ELEMENT_PGPKEYID ) +, sPGPKeyPacketElement ( ELEMENT_PGPKEYPACKET ) +, sAlgorithmAttribute ( ATTRIBUTE_ALGORITHM ) +, sCipherDataElement( ELEMENT_CIPHERDATA ) +, sCipherValueElement ( ELEMENT_CIPHERVALUE ) + , sFullPathProperty ( "FullPath" ) , sMediaTypeProperty( "MediaType" ) , sVersionProperty ( "Version" ) @@ -126,6 +138,80 @@ void ManifestImport::doFileEntry(StringHashMap ) } } +void ManifestImport::doKeyInfoEntry(StringHashMap &) +{ +} + +void ManifestImport::doEncryptedKey(StringHashMap &) +{ +aKeyInfoSequence.clear(); +aKeyInfoSequence.resize(3); +} + +void ManifestImport::doEncryptionMethod(StringHashMap ) +{ +OUString aString = rConvertedAttribs[sAlgorithmAttribute]; +if ( aKeyInfoSequence.size() != 3 + || aString != "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p; ) +{ +bIgnoreEncryptData = true; +} +} + +void ManifestImport::doEncryptedKeyInfo(StringHashMap &) +{ +} + +void ManifestImport::doEncryptedCipherData(StringHashMap &) +{ +} + +void ManifestImport::doEncryptedPgpData(StringHashMap &) +{ +} + +void ManifestImport::doEncryptedCipherValue() +{ +if ( aKeyInfoSequence.size() == 3 ) +{ +aKeyInfoSequence[2].Name = "CipherValue"; +uno::Sequence < sal_Int8 > aDecodeBuffer; +::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters); +aKeyInfoSequence[2].Value <<= aDecodeBuffer; +aCurrentCharacters = ""; // consumed +} +else +bIgnoreEncryptData = true; +} + +void ManifestImport::doEncryptedKeyId() +{ +if ( aKeyInfoSequence.size() == 3 ) +{ +aKeyInfoSequence[0].Name = "KeyId"; +uno::Sequence < sal_Int8 > aDecodeBuffer; +::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters); +aKeyInfoSequence[0].Value <<= aDecodeBuffer; +aCurrentCharacters = ""; // consumed +} +else +bIgnoreEncryptData = true; +} + +void ManifestImport::doEncryptedKeyPacket() +{ +if ( aKeyInfoSequence.size() == 3 ) +{ +aKeyInfoSequence[1].Name = "KeyPacket"; +uno::Sequence < sal_Int8 > aDecodeBuffer; +::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters); +aKeyInfoSequence[1].Value <<= aDecodeBuffer; +aCurrentCharacters = ""; // consumed +} +else +bIgnoreEncryptData = true; +} + void ManifestImport::doEncryptionData(StringHashMap ) { // If this element exists, then this stream is encrypted and we need @@ -214,6 +300,9 @@ void ManifestImport::doKeyDerivation(StringHashMap ) aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty; aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize; +} else if ( bPgpEncryption ) { +if ( aString != "PGP" ) +bIgnoreEncryptData = true; } else bIgnoreEncryptData = true; } @@ -250,6 +339,8 @@ void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Re case 2: { if (aConvertedName == sFileEntryElement) //manifest:file-entry doFileEntry(aConvertedAttribs); +else if (aConvertedName ==
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XUnbufferedStream.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit dc885c071b71e6f6f76bedaecf7f0b1a81dd1d57 Author: Michael MeeksDate: Fri Jan 5 12:18:18 2018 + tdf#114819 - include the synthetic encrpytion header into the size. Change-Id: I090347046725a1ebb7a36f465654c29f7443d20d Reviewed-on: https://gerrit.libreoffice.org/47467 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index 1e219b698871..162bab6d7580 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -102,6 +102,7 @@ XUnbufferedStream::XUnbufferedStream( sal_Int8 * pHeader = maHeader.getArray(); ZipFile::StaticFillHeader( rData, rEntry.nSize, aMediaType, pHeader ); mnHeaderToRead = static_cast < sal_Int16 > ( maHeader.getLength() ); +mnZipSize += mnHeaderToRead; } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) New commits: commit 84d0b4fcfb74288a8ed22f7786db8368a9a0a807 Author: Caolán McNamaraDate: Wed Dec 27 18:38:42 2017 + ofz#4806 Infinite loop Change-Id: I89a24fa3ce4034ef207233b96c5e26a7b7787444 Reviewed-on: https://gerrit.libreoffice.org/47096 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 61f7ea1dacc1..de4c1a364acd 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -539,6 +539,7 @@ public: const sal_Int32 nBufSize = 8192; sal_Int32 nRemaining = xSrcStream->available(); +sal_Int32 nRead = 0; maBytes.reserve(nRemaining); uno::Sequence aBuf(nBufSize); @@ -552,10 +553,17 @@ public: }; while (nRemaining > nBufSize) -nRemaining -= readAndCopy(nBufSize); +{ +const auto nBytes = readAndCopy(nBufSize); +if (!nBytes) +break; +nRead += nBytes; +nRemaining -= nBytes; +} if (nRemaining) -readAndCopy(nRemaining); +nRead += readAndCopy(nRemaining); +maBytes.resize(nRead); } virtual sal_Int32 SAL_CALL readBytes( uno::Sequence& rData, sal_Int32 nBytesToRead ) override ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 28d9059ceef54532ef6790c43759364637f0e391 Author: Caolán McNamaraDate: Sat Dec 23 16:28:47 2017 + ofz#4734 Null-deref Change-Id: I9b0a5c1e14e95a686986975921f3adb769caad29 Reviewed-on: https://gerrit.libreoffice.org/47020 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index c2ec7800d96e..3ea75dc409d4 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -783,7 +783,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex ); sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); -if (sTemp == pFolder->getName()) +if (pFolder && sTemp == pFolder->getName()) return makeAny(uno::Reference(pFolder)); } else @@ -791,7 +791,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) // Determine the file name. sTemp = aName.copy ( nStreamIndex + 1 ); -if (pFolder->hasByName(sTemp)) +if (pFolder && pFolder->hasByName(sTemp)) return pFolder->getByName(sTemp); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) New commits: commit 8d0a90825aa01c95d9dacecad83cfc65d3a7c57c Author: Caolán McNamaraDate: Sat Dec 2 14:55:56 2017 + ofz#4502 Direct-leak Change-Id: I1323aa7033c68802384c9b984b52a6c6f1156094 Reviewed-on: https://gerrit.libreoffice.org/45714 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 27e578d51bda..021ad2ad6792 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -530,11 +530,15 @@ void ZipPackage::getZipFileContents() { nStreamIndex++; sTemp = rName.copy( nStreamIndex ); -ZipPackageStream *pPkgStream = new ZipPackageStream(*this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert); -pPkgStream->SetPackageMember( true ); -pPkgStream->setZipEntryOnLoading( rEntry ); -pPkgStream->setName( sTemp ); -pPkgStream->doSetParent( pCurrent ); + +if (!pCurrent->hasByName(sTemp)) +{ +ZipPackageStream *pPkgStream = new ZipPackageStream(*this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert); +pPkgStream->SetPackageMember(true); +pPkgStream->setZipEntryOnLoading(rEntry); +pPkgStream->setName(sTemp); +pPkgStream->doSetParent(pCurrent); +} } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) New commits: commit 1c53061bb93afffc07dee6781064021aea1d8911 Author: Caolán McNamaraDate: Sat Dec 2 14:46:17 2017 + improve scoping Change-Id: I4b42d1357e951acda8e7cdba416dc298f260a541 Reviewed-on: https://gerrit.libreoffice.org/45713 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 3823ed07ffb8..27e578d51bda 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -472,8 +472,6 @@ void ZipPackage::parseContentType() void ZipPackage::getZipFileContents() { std::unique_ptr xEnum = m_pZipFile->entries(); -ZipPackageStream *pPkgStream; -ZipPackageFolder *pPkgFolder, *pCurrent; OUString sTemp, sDirName; sal_Int32 nOldIndex, nStreamIndex; FolderHash::iterator aIter; @@ -481,7 +479,7 @@ void ZipPackage::getZipFileContents() while (xEnum->hasMoreElements()) { nOldIndex = 0; -pCurrent = m_xRootFolder.get(); +ZipPackageFolder* pCurrent = m_xRootFolder.get(); const ZipEntry & rEntry = *xEnum->nextElement(); OUString rName = rEntry.sPath; @@ -511,7 +509,7 @@ void ZipPackage::getZipFileContents() break; if ( !pCurrent->hasByName( sTemp ) ) { -pPkgFolder = new ZipPackageFolder( m_xContext, m_nFormat, m_bAllowRemoveOnInsert ); +ZipPackageFolder* pPkgFolder = new ZipPackageFolder(m_xContext, m_nFormat, m_bAllowRemoveOnInsert); pPkgFolder->setName( sTemp ); pPkgFolder->doSetParent( pCurrent ); pCurrent = pPkgFolder; @@ -532,7 +530,7 @@ void ZipPackage::getZipFileContents() { nStreamIndex++; sTemp = rName.copy( nStreamIndex ); -pPkgStream = new ZipPackageStream( *this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert ); +ZipPackageStream *pPkgStream = new ZipPackageStream(*this, m_xContext, m_nFormat, m_bAllowRemoveOnInsert); pPkgStream->SetPackageMember( true ); pPkgStream->setZipEntryOnLoading( rEntry ); pPkgStream->setName( sTemp ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) New commits: commit aeff59771431dd273159c767080b3db0a4f93565 Author: Caolán McNamaraDate: Fri Dec 1 13:16:46 2017 + ofz#4491 Bad-Cast Change-Id: Ibee0c3e51ecd2b976d67c3ab28cabf0acb10c6b8 Reviewed-on: https://gerrit.libreoffice.org/45659 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 9bdd03d7cfd1..3823ed07ffb8 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -517,7 +517,12 @@ void ZipPackage::getZipFileContents() pCurrent = pPkgFolder; } else -pCurrent = pCurrent->doGetByName( sTemp ).pFolder; +{ +ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); +if (!rInfo.bFolder) +throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); +pCurrent = rInfo.pFolder; +} nOldIndex = nIndex+1; } if ( nStreamIndex != -1 && !sDirName.isEmpty() ) @@ -813,7 +818,10 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) throw NoSuchElementException(THROW_WHERE ); pPrevious = pCurrent; -pCurrent = pCurrent->doGetByName( sTemp ).pFolder; +ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); +if (!rInfo.bFolder) +throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); +pCurrent = rInfo.pFolder; nOldIndex = nIndex+1; } @@ -893,7 +901,10 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) if ( pCurrent->hasByName( sTemp ) ) { pPrevious = pCurrent; -pCurrent = pCurrent->doGetByName( sTemp ).pFolder; +ZipContentInfo& rInfo = pCurrent->doGetByName(sTemp); +if (!rInfo.bFolder) +throw css::packages::zip::ZipIOException("Bad Zip File, stream as folder"); +pCurrent = rInfo.pFolder; } else return false; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit a426cf6034fa08108d5906991aaed47020be68d8 Author: Caolán McNamaraDate: Wed Nov 29 20:49:03 2017 + ofz: Direct-leak Change-Id: Id94586cc659a5e504c727c570dc9fc60c85c8820 diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 9291eb53cbc7..56bc3d48e3bd 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -592,13 +592,13 @@ void OStorage_Impl::ReadContents() uno::Reference< container::XNameContainer > xNameContainer( xNamed, uno::UNO_QUERY ); -SotElement_Impl* pNewElement = new SotElement_Impl( aName, xNameContainer.is(), false ); +std::unique_ptr xNewElement(new SotElement_Impl(aName, xNameContainer.is(), false)); if ( m_nStorageType == embed::StorageFormats::OFOPXML && aName == "_rels" ) { -if ( !pNewElement->m_bIsStorage ) +if (!xNewElement->m_bIsStorage) throw io::IOException( THROW_WHERE ); // TODO: Unexpected format -m_pRelStorElement = pNewElement; +m_pRelStorElement = xNewElement.release(); CreateRelStorage(); } else @@ -606,10 +606,10 @@ void OStorage_Impl::ReadContents() if ( ( m_nStorageMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE ) { // if a storage is truncated all of it elements are marked as deleted -pNewElement->m_bIsRemoved = true; +xNewElement->m_bIsRemoved = true; } -m_aChildrenVector.push_back( pNewElement ); +m_aChildrenVector.push_back(xNewElement.release()); } } catch( const container::NoSuchElementException& rNoSuchElementException ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/MemoryByteGrabber.hxx |2 ++ package/source/zipapi/ZipFile.cxx |3 +++ 2 files changed, 5 insertions(+) New commits: commit 0c4b1eae3437358f62bd9e98da0c29d41132204d Author: Caolán McNamaraDate: Mon Nov 27 16:29:37 2017 + keep track of available data Change-Id: Idc54cdef0f3a4355a7e26f25cdc5b50d65d9d583 Reviewed-on: https://gerrit.libreoffice.org/45351 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/MemoryByteGrabber.hxx b/package/source/zipapi/MemoryByteGrabber.hxx index 1366eea478b0..5417406db379 100644 --- a/package/source/zipapi/MemoryByteGrabber.hxx +++ b/package/source/zipapi/MemoryByteGrabber.hxx @@ -36,6 +36,8 @@ public: } const sal_Int8 * getCurrentPos () { return mpBuffer + mnCurrent; } +sal_Int32 remainingSize() const { return mnEnd - mnCurrent; } + // XInputStream chained /// @throws css::io::NotConnectedException diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index b7cdf7289d4c..61f7ea1dacc1 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -934,6 +934,9 @@ sal_Int32 ZipFile::readCEN() if ( aEntry.nExtraLen < 0 ) throw ZipException("unexpected extra header info length" ); +if (aEntry.nPathLen > aMemGrabber.remainingSize()) +throw ZipException("name too long"); + // read always in UTF8, some tools seem not to set UTF8 bit aEntry.sPath = OUString::intern ( reinterpret_cast(aMemGrabber.getCurrentPos()), aEntry.nPathLen, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx | 20 +--- package/source/zipapi/XBufferedThreadedStream.hxx |4 ++-- 2 files changed, 7 insertions(+), 17 deletions(-) New commits: commit 2a7fa39bc1fb3a81fdcc632853aef224f4793f8a Author: Caolán McNamaraDate: Fri Nov 24 14:05:58 2017 + fix attempt to save and rethrow exception Change-Id: Idff6ffef536d87d85f1092b3316d65da83527711 Reviewed-on: https://gerrit.libreoffice.org/45229 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index 82bb992f0128..2c36b73ea409 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -9,6 +9,7 @@ #include "XBufferedThreadedStream.hxx" #include +#include using namespace css::uno; using com::sun::star::packages::zip::ZipIOException; @@ -27,20 +28,10 @@ private: { mxStream.produce(); } -catch( const RuntimeException ) -{ -SAL_WARN("package", "RuntimeException from unbuffered Stream " << e ); -mxStream.saveException( new RuntimeException( e ) ); -} -catch( const ZipIOException ) -{ -SAL_WARN("package", "ZipIOException from unbuffered Stream " << e ); -mxStream.saveException( new ZipIOException( e ) ); -} -catch( const Exception ) +catch (const css::uno::Exception ) { SAL_WARN("package", "Unexpected " << e ); -mxStream.saveException( new Exception( e ) ); +mxStream.saveException(cppu::getCaughtException()); } mxStream.setTerminateThread(); @@ -58,7 +49,6 @@ XBufferedThreadedStream::XBufferedThreadedStream( , mnOffset( 0 ) , mxUnzippingThread( new UnzippingThread(*this) ) , mbTerminateThread( false ) -, maSavedException( nullptr ) { mxUnzippingThread->launch(); } @@ -116,8 +106,8 @@ const Buffer& XBufferedThreadedStream::getNextBlock() if( maPendingBuffers.empty() ) { maInUseBuffer = Buffer(); -if( maSavedException ) -throw *maSavedException; +if (maSavedException.hasValue()) +cppu::throwException(maSavedException); } else { diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx b/package/source/zipapi/XBufferedThreadedStream.hxx index 8bf3c5eb1283..b99864fbb268 100644 --- a/package/source/zipapi/XBufferedThreadedStream.hxx +++ b/package/source/zipapi/XBufferedThreadedStream.hxx @@ -37,7 +37,7 @@ private: std::condition_variable maBufferProduceResume; bool mbTerminateThread; /// indicates the failure of one of the threads -css::uno::Exception *maSavedException; /// exception caught during unzipping is saved to be thrown during reading +css::uno::Any maSavedException; /// exception caught during unzipping is saved to be thrown during reading static const size_t nBufferLowWater = 2; static const size_t nBufferHighWater = 4; @@ -66,7 +66,7 @@ public: void produce(); void setTerminateThread(); -void saveException( css::uno::Exception *e ) { maSavedException = e; } +void saveException(const css::uno::Any ) { maSavedException = rAny; } // XInputStream virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) override; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/owriteablestream.cxx | 16 package/source/xstor/owriteablestream.hxx |6 +++--- package/source/xstor/xstorage.cxx |4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) New commits: commit c95221f151fbaab5f181bb5f8a5428a380d4d1bf Author: Julien NabetDate: Mon Oct 9 21:19:43 2017 +0200 Replace list by vector InputStreamsList_Impl (package) Change-Id: I4f03ddff09b8b7bb92dd1a9d2aeec279835c81b4 Reviewed-on: https://gerrit.libreoffice.org/43294 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 8f03c20ff990..2f49e497dd47 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -478,10 +478,10 @@ void OWriteStream_Impl::DisposeWrappers() } m_pParent = nullptr; -if ( !m_aInputStreamsList.empty() ) +if ( !m_aInputStreamsVector.empty() ) { -for ( InputStreamsList_Impl::iterator pStreamIter = m_aInputStreamsList.begin(); - pStreamIter != m_aInputStreamsList.end(); ++pStreamIter ) +for ( InputStreamsVector_Impl::iterator pStreamIter = m_aInputStreamsVector.begin(); + pStreamIter != m_aInputStreamsVector.end(); ++pStreamIter ) { if ( *pStreamIter ) { @@ -490,7 +490,7 @@ void OWriteStream_Impl::DisposeWrappers() } } -m_aInputStreamsList.clear(); +m_aInputStreamsVector.clear(); } } @@ -1255,7 +1255,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::UNO_QUERY ); SAL_WARN_IF( !xCompStream.is(), "package.xstor", "OInputCompStream MUST provide XStream interfaces!" ); -m_aInputStreamsList.push_back( pStream ); +m_aInputStreamsVector.push_back( pStream ); return xCompStream; } else if ( ( nStreamMode & embed::ElementModes::READWRITE ) == embed::ElementModes::SEEKABLEREAD ) @@ -1279,12 +1279,12 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre uno::UNO_QUERY ); SAL_WARN_IF( !xSeekStream.is(), "package.xstor", "OInputSeekStream MUST provide XStream interfaces!" ); -m_aInputStreamsList.push_back( pStream ); +m_aInputStreamsVector.push_back( pStream ); return xSeekStream; } else if ( ( nStreamMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE ) { -if ( !m_aInputStreamsList.empty() ) +if ( !m_aInputStreamsVector.empty() ) throw io::IOException(); // TODO: uno::Reference< io::XStream > xStream; @@ -1384,7 +1384,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetRawInStream() void OWriteStream_Impl::InputStreamDisposed( OInputCompStream* pStream ) { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); -m_aInputStreamsList.remove( pStream ); +m_aInputStreamsVector.erase(std::remove(m_aInputStreamsVector.begin(), m_aInputStreamsVector.end(), pStream )); } void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io::XInputStream >& xDataToCopy, const uno::Sequence< beans::PropertyValue >& aProps, uno::Reference< io::XStream >& xTargetStream ) diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index a5c92fe6c3fa..e3eeaf09d4fd 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include "ocompinstream.hxx" @@ -60,7 +60,7 @@ namespace package { struct WSInternalData_Impl; -typedef ::std::list< OInputCompStream* > InputStreamsList_Impl; +typedef ::std::vector< OInputCompStream* > InputStreamsVector_Impl; struct OStorage_Impl; class OWriteStream; @@ -79,7 +79,7 @@ struct OWriteStream_Impl css::uno::Reference< css::io::XStream > m_xCacheStream; css::uno::Reference< css::io::XSeekable > m_xCacheSeek; -InputStreamsList_Impl m_aInputStreamsList; +InputStreamsVector_Impl m_aInputStreamsVector; boolm_bHasDataToFlush;// only modified elements will be sent to the original content boolm_bFlushed; // sending the streams is coordinated by the root storage of the package diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 5a58339077bd..9291eb53cbc7 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1516,7 +1516,7 @@ void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) return; if ( (pElement->m_xStorage && ( pElement->m_xStorage->m_pAntiImpl ||
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit 26957fc325c27cf61e8efb380d627def4931 Author: Szymon KÅosDate: Wed Sep 6 10:54:50 2017 +0200 tdf#108572 let remove storage element void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) expects that m_pAntiImpl will be nullptr, if not throws an exception. This caused that in case of deleting embedded database used for mail merge it wasn't fully removed and it was impossible to import the same datasource second time. Change-Id: I0310fde2ad819c96474a857f37ee42d052fad266 Reviewed-on: https://gerrit.libreoffice.org/42028 Tested-by: Jenkins Reviewed-by: Szymon KÅos diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 2edbfcbc1873..79b239588c77 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -2816,6 +2816,8 @@ void SAL_CALL OStorage::removeElement( const OUString& aElementName ) if ( !pElement ) throw container::NoSuchElementException( THROW_WHERE ); //??? +if ( pElement->m_xStorage ) +pElement->m_xStorage->m_pAntiImpl = nullptr; m_pImpl->RemoveElement( pElement ); m_pImpl->m_bIsModified = true; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 100 +- package/source/xstor/xstorage.hxx |8 +-- 2 files changed, 51 insertions(+), 57 deletions(-) New commits: commit 9245ce93b0c9a55bd84e8b448919db2d706e9b06 Author: Julien NabetDate: Thu Aug 24 23:27:57 2017 +0200 Replace some lists by vectors in xstorage (part2) Change-Id: Icb10605f9ac75aa5b00668a5088be8ef6e1414da Reviewed-on: https://gerrit.libreoffice.org/41543 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 38b501f0a3e9..2edbfcbc1873 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -321,11 +321,11 @@ OStorage_Impl::~OStorage_Impl() m_pParent = nullptr; } -std::for_each(m_aChildrenList.begin(), m_aChildrenList.end(), std::default_delete()); -m_aChildrenList.clear(); +std::for_each(m_aChildrenVector.begin(), m_aChildrenVector.end(), std::default_delete()); +m_aChildrenVector.clear(); -std::for_each(m_aDeletedList.begin(), m_aDeletedList.end(), std::default_delete()); -m_aDeletedList.clear(); +std::for_each(m_aDeletedVector.begin(), m_aDeletedVector.end(), std::default_delete()); +m_aDeletedVector.clear(); if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_pRelStorElement ) { @@ -482,12 +482,12 @@ void OStorage_Impl::OpenOwnPackage() throw embed::InvalidStorageException( THROW_WHERE ); } -SotElementList_Impl& OStorage_Impl::GetChildrenList() +SotElementVector_Impl& OStorage_Impl::GetChildrenVector() { ::osl::MutexGuard aGuard( m_xMutex->GetMutex() ); ReadContents(); -return m_aChildrenList; +return m_aChildrenVector; } void OStorage_Impl::GetStorageProperties() @@ -609,7 +609,7 @@ void OStorage_Impl::ReadContents() pNewElement->m_bIsRemoved = true; } -m_aChildrenList.push_back( pNewElement ); +m_aChildrenVector.push_back( pNewElement ); } } catch( const container::NoSuchElementException& rNoSuchElementException ) @@ -649,8 +649,8 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes if ( !m_xPackageFolder.is() ) throw embed::InvalidStorageException( THROW_WHERE ); -for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); ++pElementIter ) +for ( SotElementVector_Impl::iterator pElementIter = m_aChildrenVector.begin(); + pElementIter != m_aChildrenVector.end(); ++pElementIter ) { if ( !(*pElementIter)->m_bIsRemoved ) CopyStorageElement( *pElementIter, xDest, (*pElementIter)->m_aName, bDirect ); @@ -1003,8 +1003,8 @@ void OStorage_Impl::Commit() xNewPackageFolder = m_xPackageFolder; // remove replaced removed elements -for ( SotElementList_Impl::iterator pDeletedIter = m_aDeletedList.begin(); - pDeletedIter != m_aDeletedList.end(); +for ( SotElementVector_Impl::iterator pDeletedIter = m_aDeletedVector.begin(); + pDeletedIter != m_aDeletedVector.end(); ++pDeletedIter ) { @@ -1017,11 +1017,11 @@ void OStorage_Impl::Commit() delete *pDeletedIter; *pDeletedIter = nullptr; } -m_aDeletedList.clear(); +m_aDeletedVector.clear(); // remove removed elements -SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); -while ( pElementIter != m_aChildrenList.end() ) +SotElementVector_Impl::iterator pElementIter = m_aChildrenVector.begin(); +while ( pElementIter != m_aChildrenVector.end() ) { // renamed and inserted elements must be really inserted to package later // since thay can conflict with removed elements @@ -1035,19 +1035,15 @@ void OStorage_Impl::Commit() if ( m_bCommited || m_bIsRoot ) xNewPackageFolder->removeByName( (*pElementIter)->m_aOriginalName ); -SotElement_Impl* pToDelete = *pElementIter; - -++pElementIter; // to let the iterator be valid it should be increased before removing - -m_aChildrenList.remove( pToDelete ); -delete pToDelete; +delete *pElementIter; +pElementIter = m_aChildrenVector.erase(pElementIter); } else ++pElementIter; } // there should be no more deleted elements -for ( pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); ++pElementIter ) +for ( pElementIter = m_aChildrenVector.begin(); pElementIter != m_aChildrenVector.end(); ++pElementIter ) { // if it is a 'duplicate commit' inserted elements must be really inserted to package later // since
[Libreoffice-commits] core.git: package/source
package/source/xstor/xstorage.cxx | 52 +- package/source/xstor/xstorage.hxx |5 ++- 2 files changed, 27 insertions(+), 30 deletions(-) New commits: commit a4231a1e3f08323366f0698ec0a78aee010fd356 Author: Julien NabetDate: Wed Aug 23 22:15:38 2017 +0200 Replace some lists by vectors in xstorage (package module) Change-Id: I0093b87ff70d9ea31ca08f8df161899d5ff4bb9f Reviewed-on: https://gerrit.libreoffice.org/41478 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 9586bcbdc433..38b501f0a3e9 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -69,7 +69,7 @@ using namespace ::com::sun::star; #define THROW_WHERE "" #endif -typedef ::std::list< uno::WeakReference< lang::XComponent > > WeakComponentList; +typedef ::std::vector< uno::WeakReference< lang::XComponent > > WeakComponentVector; struct StorInternalData_Impl { @@ -82,7 +82,7 @@ struct StorInternalData_Impl ::rtl::Reference m_pSubElDispListener; -WeakComponentList m_aOpenSubComponentsList; +WeakComponentVector m_aOpenSubComponentsVector; ::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder; @@ -300,10 +300,10 @@ OStorage_Impl::~OStorage_Impl() } m_pAntiImpl = nullptr; } -else if ( !m_aReadOnlyWrapList.empty() ) +else if ( !m_aReadOnlyWrapVector.empty() ) { -for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapList.begin(); - pStorageIter != m_aReadOnlyWrapList.end(); ++pStorageIter ) +for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapVector.begin(); + pStorageIter != m_aReadOnlyWrapVector.end(); ++pStorageIter ) { uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef; if ( xTmp.is() ) @@ -315,7 +315,7 @@ OStorage_Impl::~OStorage_Impl() } } -m_aReadOnlyWrapList.clear(); +m_aReadOnlyWrapVector.clear(); } m_pParent = nullptr; @@ -375,13 +375,13 @@ void OStorage_Impl::SetReadOnlyWrap( OStorage& aStorage ) { // Weak reference is used inside the holder so the refcount must not be zero at this point OSL_ENSURE( aStorage.GetRefCount_Impl(), "There must be a reference alive to use this method!" ); -m_aReadOnlyWrapList.push_back( StorageHolder_Impl( ) ); +m_aReadOnlyWrapVector.push_back( StorageHolder_Impl( ) ); } void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage ) { -for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapList.begin(); - pStorageIter != m_aReadOnlyWrapList.end();) +for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapVector.begin(); + pStorageIter != m_aReadOnlyWrapVector.end();) { uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef; if ( !xTmp.is() || pStorageIter->m_pPointer == ) @@ -393,9 +393,7 @@ void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage ) SAL_INFO("package.xstor", "Quiet exception: " << rException.Message); } -StorageHoldersType::iterator pIterToDelete( pStorageIter ); -++pStorageIter; -m_aReadOnlyWrapList.erase( pIterToDelete ); +pStorageIter = m_aReadOnlyWrapVector.erase(pStorageIter); } else ++pStorageIter; @@ -1522,7 +1520,7 @@ void OStorage_Impl::RemoveElement( SotElement_Impl* pElement ) if ( !pElement ) return; -if ( (pElement->m_xStorage && ( pElement->m_xStorage->m_pAntiImpl || !pElement->m_xStorage->m_aReadOnlyWrapList.empty() )) +if ( (pElement->m_xStorage && ( pElement->m_xStorage->m_pAntiImpl || !pElement->m_xStorage->m_aReadOnlyWrapVector.empty() )) || (pElement->m_xStream && ( pElement->m_xStream->m_pAntiImpl || !pElement->m_xStream->m_aInputStreamsList.empty() )) ) throw io::IOException( THROW_WHERE ); // TODO: Access denied @@ -1842,19 +1840,19 @@ void SAL_CALL OStorage::InternalDispose( bool bNotifyImpl ) if ( m_pData->m_bReadOnlyWrap ) { -OSL_ENSURE( !m_pData->m_aOpenSubComponentsList.size() || m_pData->m_pSubElDispListener.get(), +OSL_ENSURE( !m_pData->m_aOpenSubComponentsVector.size() || m_pData->m_pSubElDispListener.get(), "If any subelements are open the listener must exist!" ); if (m_pData->m_pSubElDispListener.get()) { m_pData->m_pSubElDispListener->OwnerIsDisposed(); -// iterate through m_pData->m_aOpenSubComponentsList +// iterate through m_pData->m_aOpenSubComponentsVector // deregister
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit aff5951e7b4fa549882f4d4c4cfda99f3966a9d9 Author: Mohammed Abdul AzeemDate: Sun Aug 20 21:25:12 2017 +0530 Fixing threadedStream produce loop condition: hasBytes() is for the consuming thread, produce loop should be stopped as soon as we've read as much as size of the stream. Change-Id: I0d857cc9cbcc4dd7d4a43cddbc4c457e8280353f Reviewed-on: https://gerrit.libreoffice.org/41364 Tested-by: Jenkins Reviewed-by: Markus Mohrhard diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index c7fd3dbacd36..11428e076d44 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -76,6 +76,7 @@ XBufferedThreadedStream::~XBufferedThreadedStream() void XBufferedThreadedStream::produce() { Buffer pProducedBuffer; +sal_Int64 nTotalBytesRead(0); std::unique_lock aGuard( maBufferProtector ); do { @@ -86,7 +87,7 @@ void XBufferedThreadedStream::produce() } aGuard.unlock(); -mxSrcStream->readBytes( pProducedBuffer, nBufferSize ); +nTotalBytesRead += mxSrcStream->readBytes( pProducedBuffer, nBufferSize ); aGuard.lock(); maPendingBuffers.push( pProducedBuffer ); @@ -95,7 +96,7 @@ void XBufferedThreadedStream::produce() if (!mbTerminateThread) maBufferProduceResume.wait( aGuard, [&]{return canProduce(); } ); -} while( !mbTerminateThread && hasBytes() ); +} while( !mbTerminateThread && nTotalBytesRead < mnStreamSize ); } /** ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) New commits: commit 7a82caa8f7874f44f32c633140b015325454e570 Author: Thorsten BehrensDate: Sun Aug 20 03:18:09 2017 +0200 package: get rid of requirement for plain passwords Change-Id: I36d41d9166ae2b2ea287af82c87b5f2ea86bd564 Reviewed-on: https://gerrit.libreoffice.org/41344 Reviewed-by: Markus Mohrhard Tested-by: Markus Mohrhard diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 33ed9c1bc023..d91c0785304c 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1672,9 +1672,8 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const // this property is only necessary to support raw passwords in storage API; // because of this support the storage has to operate with more than one key dependent on storage generation algorithm; // when this support is removed, the storage will get only one key from outside -// TODO/LATER: Get rid of this property as well as of support of raw passwords in storages uno::Sequence< beans::NamedValue > aKeys; -if ( !( aValue >>= aKeys ) || ( aKeys.getLength() && aKeys.getLength() < 2 ) ) +if ( !( aValue >>= aKeys ) || ( aKeys.getLength() && aKeys.getLength() < 1 ) ) throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 2 ); if ( aKeys.getLength() ) @@ -1689,7 +1688,7 @@ void SAL_CALL ZipPackage::setPropertyValue( const OUString& aPropertyName, const bHasSHA1 = true; } -if ( !bHasSHA256 || !bHasSHA1 ) +if ( !bHasSHA256 && !bHasSHA1 ) throw IllegalArgumentException(THROW_WHERE "Expected keys are not provided!", uno::Reference< uno::XInterface >(), 2 ); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx |8 1 file changed, 8 insertions(+) New commits: commit 570d7f9c9f5befdb84e213916036a2b9c7321259 Author: Miklos VajnaDate: Tue Aug 8 12:08:49 2017 +0200 tdf#111481 package: seek to 0 before truncate() With this, the ZIP files created by the EPUB export don't trigger this warning on 'unzip -l': warning [test.epub]: 2546 extra bytes at beginning or within zipfile Change-Id: Ic9111d2c97b9337cf39a023def4afe4c64c4a3e5 Reviewed-on: https://gerrit.libreoffice.org/40873 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 66e40cb9d410..33ed9c1bc023 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -1395,6 +1395,14 @@ void SAL_CALL ZipPackage::commitChanges() try { xOutputStream = m_xStream->getOutputStream(); + +// Make sure we avoid a situation where the current position is +// not zero, but the underlying file is truncated in the +// meantime. +uno::Reference xSeekable(xOutputStream, uno::UNO_QUERY); +if (xSeekable.is()) +xSeekable->seek(0); + uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY_THROW ); // after successful truncation the original file contents are already lost ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |4 ++-- package/source/zipapi/XBufferedThreadedStream.hxx |2 +- package/source/zipapi/XUnbufferedStream.cxx |2 +- 3 files changed, 4 insertions(+), 4 deletions(-) New commits: commit a62507eb405961c27ebf79d6b9bdd7a106d06123 Author: Mohammed Abdul AzeemDate: Fri Jul 7 00:01:03 2017 +0530 tdf#108821 - fix for overflow of variables on opening huge files This should fix the issue, as well as restrict available to return only non-negative values. Change-Id: I198e226e945b9bd79dec32b1686c20e2a8dfaf3e Reviewed-on: https://gerrit.libreoffice.org/39665 Reviewed-by: Michael Meeks Tested-by: Jenkins diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index 87b7349cccba..c7fd3dbacd36 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -145,7 +145,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::readBytes( Sequence< sal_Int8 >& rDa if( !hasBytes() ) return 0; -const sal_Int32 nAvailableSize = std::min( nBytesToRead, remainingSize() ); +const sal_Int32 nAvailableSize = static_cast< sal_Int32 > ( std::min< sal_Int64 >( nBytesToRead, remainingSize() ) ); rData.realloc( nAvailableSize ); sal_Int32 i = 0, nPendingBytes = nAvailableSize; @@ -188,7 +188,7 @@ sal_Int32 SAL_CALL XBufferedThreadedStream::available() if( !hasBytes() ) return 0; -return remainingSize(); +return static_cast< sal_Int32 > ( std::min< sal_Int64 >( SAL_MAX_INT32, remainingSize() ) ); } void SAL_CALL XBufferedThreadedStream::closeInput() diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx b/package/source/zipapi/XBufferedThreadedStream.hxx index 9ba908e01f5e..c28bb049de16 100644 --- a/package/source/zipapi/XBufferedThreadedStream.hxx +++ b/package/source/zipapi/XBufferedThreadedStream.hxx @@ -44,7 +44,7 @@ private: static const size_t nBufferSize = 32 * 1024; const Buffer& getNextBlock(); -size_t remainingSize() const { return mnStreamSize - mnPos; } +sal_Int64 remainingSize() const { return mnStreamSize - mnPos; } bool hasBytes() const { return mnPos < mnStreamSize; } bool canProduce() const diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx index e82e720795d3..d1f65b29b7aa 100644 --- a/package/source/zipapi/XUnbufferedStream.cxx +++ b/package/source/zipapi/XUnbufferedStream.cxx @@ -310,7 +310,7 @@ void SAL_CALL XUnbufferedStream::skipBytes( sal_Int32 nBytesToSkip ) sal_Int32 SAL_CALL XUnbufferedStream::available( ) { //available size must include the prepended header in case of wrapped raw stream -return static_cast < sal_Int32 > ( mnZipSize + mnHeaderToRead - mnMyCurrent ); +return static_cast< sal_Int32 > ( std::min< sal_Int64 >( SAL_MAX_INT32, (mnZipSize + mnHeaderToRead - mnMyCurrent) ) ); } void SAL_CALL XUnbufferedStream::closeInput( ) ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |5 +++-- package/source/zipapi/XBufferedThreadedStream.hxx |7 --- package/source/zipapi/XUnbufferedStream.hxx |2 ++ package/source/zipapi/ZipFile.cxx |6 +++--- 4 files changed, 12 insertions(+), 8 deletions(-) New commits: commit 4a8f8c09edb06e4ff812d676bc7726a8b4f6ebe8 Author: Michael MeeksDate: Wed Jul 5 17:30:27 2017 +0100 tdf#108821 - fixed bad alloc on opening large file Workaround for streams with size > SAL_MAX_INT32. More complicated ways using available() and navigating cross-thread are possible, but probably harder to maintain. Change-Id: I721b1f38055dfcea03fef555b8a5fd93dfc1b886 Reviewed-on: https://gerrit.libreoffice.org/39374 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index 990844af0bd7..87b7349cccba 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -50,10 +50,11 @@ private: } XBufferedThreadedStream::XBufferedThreadedStream( -const Reference& xSrcStream ) +const Reference& xSrcStream, +sal_Int64 nStreamSize) : mxSrcStream( xSrcStream ) , mnPos(0) -, mnStreamSize( xSrcStream->available() ) +, mnStreamSize( nStreamSize ) , mnOffset( 0 ) , mxUnzippingThread( new UnzippingThread(*this) ) , mbTerminateThread( false ) diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx b/package/source/zipapi/XBufferedThreadedStream.hxx index b047b25fdf85..9ba908e01f5e 100644 --- a/package/source/zipapi/XBufferedThreadedStream.hxx +++ b/package/source/zipapi/XBufferedThreadedStream.hxx @@ -23,8 +23,8 @@ class XBufferedThreadedStream : public cppu::WeakImplHelper< css::io::XInputStre { private: const css::uno::Reference mxSrcStream; -size_t mnPos; /// position in stream -size_t mnStreamSize;/// available size of stream +sal_Int64 mnPos; /// position in stream +sal_Int64 mnStreamSize;/// available size of stream Buffer maInUseBuffer; /// Buffer block in use int mnOffset; /// position in maInUseBuffer @@ -59,7 +59,8 @@ private: public: XBufferedThreadedStream( - const css::uno::Reference& xSrcStream ); + const css::uno::Reference& xSrcStream, + sal_Int64 nStreamSize /* cf. sal_Int32 available(); */ ); virtual ~XBufferedThreadedStream() override; diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx index 4c05b9dad3d9..a463983b90b0 100644 --- a/package/source/zipapi/XUnbufferedStream.hxx +++ b/package/source/zipapi/XUnbufferedStream.hxx @@ -81,6 +81,8 @@ public: const css::uno::Reference < css::io::XInputStream >& xRawStream, const ::rtl::Reference< EncryptionData >& rData ); +sal_Int64 getSize() { return mnZipSize; } + virtual ~XUnbufferedStream() override; // XInputStream diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 2a45119f11d2..c331282f9c76 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -613,16 +613,16 @@ uno::Reference< XInputStream > ZipFile::createStreamForZipEntry( { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); -uno::Reference xSrcStream = new XUnbufferedStream( +rtl::Reference< XUnbufferedStream > xSrcStream = new XUnbufferedStream( m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode); uno::Reference xBufStream; static const sal_Int32 nThreadingThreshold = 1; if( xSrcStream->available() > nThreadingThreshold ) -xBufStream = new XBufferedThreadedStream(xSrcStream); +xBufStream = new XBufferedThreadedStream(xSrcStream.get(), xSrcStream->getSize()); else -xBufStream = new XBufferedStream(xSrcStream); +xBufStream = new XBufferedStream(xSrcStream.get()); return xBufStream; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zipapi/XBufferedThreadedStream.cxx |8 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit c573a10a6a873af11c25fef59a374a37fe76056f Author: Michael MeeksDate: Tue Jun 13 13:41:15 2017 +0100 Avoid race between mbTerminate check and wait. package2.dll!osl::Thread::join() Line 112 C++ package2.dll!XBufferedThreadedStream::~XBufferedThreadedStream() Line 68C++ package2.dll!XBufferedThreadedStream::`scalar deleting destructor'(unsigned int)C++ vs. package2.dll!std::condition_variable::wait(void) >... package2.dll!XBufferedThreadedStream::produce() Line 95 C++ package2.dll!`anonymous namespace'::UnzippingThread::execute() Line 29 C++ Change-Id: Iace86efc5e7fe00a5176380a8a21b2dc5e98d8a5 Reviewed-on: https://gerrit.libreoffice.org/38737 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/package/source/zipapi/XBufferedThreadedStream.cxx b/package/source/zipapi/XBufferedThreadedStream.cxx index b8ae6e644e25..990844af0bd7 100644 --- a/package/source/zipapi/XBufferedThreadedStream.cxx +++ b/package/source/zipapi/XBufferedThreadedStream.cxx @@ -90,12 +90,11 @@ void XBufferedThreadedStream::produce() aGuard.lock(); maPendingBuffers.push( pProducedBuffer ); maBufferConsumeResume.notify_one(); -maBufferProduceResume.wait( aGuard, [&]{return canProduce(); } ); -if( mbTerminateThread ) -break; +if (!mbTerminateThread) +maBufferProduceResume.wait( aGuard, [&]{return canProduce(); } ); -} while( hasBytes() ); +} while( !mbTerminateThread && hasBytes() ); } /** @@ -134,6 +133,7 @@ const Buffer& XBufferedThreadedStream::getNextBlock() void XBufferedThreadedStream::setTerminateThread() { +std::unique_lock aGuard( maBufferProtector ); mbTerminateThread = true; maBufferProduceResume.notify_one(); maBufferConsumeResume.notify_one(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackageStream.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f8fdc6417b4d023b7c75485754a0ab1b164a69d6 Author: Xisco FauliDate: Wed Apr 19 11:38:59 2017 +0200 tdf#105942 Don't hang when file is protected and compressed Change-Id: I762e6e6d457ea3f5a1f1fd706268b832a71ee550 Reviewed-on: https://gerrit.libreoffice.org/36672 Tested-by: Jenkins Reviewed-by: Xisco Faulà diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 15477a3a2099..14637f9f18ca 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -784,7 +784,7 @@ bool ZipPackageStream::saveChild( uno::Reference< io::XSeekable > xSeek(xStream, uno::UNO_QUERY); // It's not worth to deflate jpegs to save ~1% in a slow process // Unfortunately, does not work for streams protected by password -if (xSeek.is() && msMediaType.endsWith("/jpeg") && !m_bToBeEncrypted) +if (xSeek.is() && msMediaType.endsWith("/jpeg") && !m_bToBeEncrypted && !m_bToBeCompressed) { ImplSetStoredData(*pTempEntry, xStream); xSeek->seek(0); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source sc/inc sc/source
package/source/xstor/xstorage.cxx| 255 +--- package/source/xstor/xstorage.hxx|7 sc/inc/funcuno.hxx |7 sc/source/filter/inc/XclExpChangeTrack.hxx |2 sc/source/filter/xcl97/XclExpChangeTrack.cxx | 21 - sc/source/ui/inc/undoblk.hxx | 68 +-- sc/source/ui/inc/undodat.hxx | 178 sc/source/ui/inc/undotab.hxx |2 sc/source/ui/undo/undoblk.cxx| 60 +- sc/source/ui/undo/undoblk3.cxx | 114 ++--- sc/source/ui/undo/undodat.cxx| 545 +++ sc/source/ui/undo/undotab.cxx| 56 +- sc/source/ui/unoobj/funcuno.cxx | 18 13 files changed, 589 insertions(+), 744 deletions(-) New commits: commit 988ac73e57b7e7f171fb2543de90a9afc2aa3289 Author: Caolán McNamaraDate: Wed Feb 22 09:30:33 2017 + use std::unique_ptr Change-Id: I11a58aa38f931c7912e2e5ac6df46f98e6bb681e Reviewed-on: https://gerrit.libreoffice.org/34539 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 424f2c7..aa30074 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -158,23 +158,15 @@ uno::Reference< io::XInputStream > GetSeekableTempCopy( const uno::Reference< io return xTempIn; } -SotElement_Impl::SotElement_Impl( const OUString& rName, bool bStor, bool bNew ) -: m_aName( rName ) -, m_aOriginalName( rName ) -, m_bIsRemoved( false ) -, m_bIsInserted( bNew ) -, m_bIsStorage( bStor ) -, m_pStorage( nullptr ) -, m_pStream( nullptr ) +SotElement_Impl::SotElement_Impl(const OUString& rName, bool bStor, bool bNew) +: m_aName(rName) +, m_aOriginalName(rName) +, m_bIsRemoved(false) +, m_bIsInserted(bNew) +, m_bIsStorage(bStor) { } -SotElement_Impl::~SotElement_Impl() -{ -delete m_pStorage; -delete m_pStream; -} - // most of properties are holt by the storage but are not used OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > const & xInputStream, sal_Int32 nMode, @@ -779,31 +771,31 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, SAL_WARN_IF( !xSubDest.is(), "package.xstor", "No destination substorage!" ); -if ( !pElement->m_pStorage ) +if (!pElement->m_xStorage) { OpenSubStorage( pElement, embed::ElementModes::READ ); -if ( !pElement->m_pStorage ) +if (!pElement->m_xStorage) throw io::IOException( THROW_WHERE ); } -pElement->m_pStorage->CopyToStorage( xSubDest, bDirect ); +pElement->m_xStorage->CopyToStorage(xSubDest, bDirect); } else { -if ( !pElement->m_pStream ) +if (!pElement->m_xStream) { OpenSubStream( pElement ); -if ( !pElement->m_pStream ) +if (!pElement->m_xStream) throw io::IOException( THROW_WHERE ); } -if ( !pElement->m_pStream->IsEncrypted() ) +if (!pElement->m_xStream->IsEncrypted()) { if ( bDirect ) { // fill in the properties for the stream uno::Sequence< beans::PropertyValue > aStrProps(0); -uno::Sequence< beans::PropertyValue > aSrcPkgProps = pElement->m_pStream->GetStreamProperties(); +uno::Sequence< beans::PropertyValue > aSrcPkgProps = pElement->m_xStream->GetStreamProperties(); sal_Int32 nNum = 0; for ( int ind = 0; ind < aSrcPkgProps.getLength(); ind++ ) { @@ -819,7 +811,7 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, { aStrProps.realloc( ++nNum ); aStrProps[nNum-1].Name = "UseCommonStoragePasswordEncryption"; -aStrProps[nNum-1].Value <<= pElement->m_pStream->UsesCommonEncryption_Impl(); +aStrProps[nNum-1].Value <<= pElement->m_xStream->UsesCommonEncryption_Impl(); } else if ( m_nStorageType == embed::StorageFormats::OFOPXML ) { @@ -842,19 +834,19 @@ void OStorage_Impl::CopyStorageElement( SotElement_Impl* pElement, uno::Reference< embed::XOptimizedStorage > xOptDest( xDest, uno::UNO_QUERY_THROW ); uno::Reference < io::XInputStream > xInputToInsert; -if ( pElement->m_pStream->HasTempFile_Impl() || !pElement->m_pStream->m_xPackageStream.is() ) +if (pElement->m_xStream->HasTempFile_Impl() || !pElement->m_xStream->m_xPackageStream.is()) { -SAL_WARN_IF(
[Libreoffice-commits] core.git: package/source
package/source/zipapi/ZipFile.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 32c9876d51fe0357ba66eb6292f772728080510b Author: David OstrovskyDate: Sun Jan 15 11:05:03 2017 +0100 ZipFile: make it work on MSVC 14.0 Change-Id: I99a00c61634375a75e15a8c1530213f5aad25b51 diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 0f436ab..76eea85 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -35,6 +35,7 @@ #include #include +#include #include #include "blowfishcontext.hxx" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx | 52 --- 1 file changed, 34 insertions(+), 18 deletions(-) New commits: commit 7c117c508c1eaa5c930481fb82c21fee6d71af0c Author: Kohei YoshidaDate: Sat Jan 7 19:22:48 2017 -0500 Clean up and annotate the code a bit. Change-Id: I5f0c6130e5cf21f93bb1309f7bf148bd40b3821d Reviewed-on: https://gerrit.libreoffice.org/32827 Tested-by: Jenkins Reviewed-by: Kohei Yoshida diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 3c6eb48..c550321 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -777,49 +777,62 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) throw( NoSuchElementException, RuntimeException, std::exception ) { OUString sTemp, sDirName; -sal_Int32 nOldIndex, nIndex, nStreamIndex; +sal_Int32 nOldIndex, nStreamIndex; FolderHash::iterator aIter; -if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' ) +sal_Int32 nIndex = aName.getLength(); + +if (aName == "/") +// root directory. return makeAny ( uno::Reference < XUnoTunnel > ( m_pRootFolder ) ); nStreamIndex = aName.lastIndexOf ( '/' ); -bool bFolder = nStreamIndex == nIndex-1; +bool bFolder = nStreamIndex == nIndex-1; // last character is '/'. + if ( nStreamIndex != -1 ) { +// The name contains '/'. sDirName = aName.copy ( 0, nStreamIndex ); aIter = m_aRecent.find ( sDirName ); if ( aIter != m_aRecent.end() ) { +// There is a cached entry for this name. + +ZipPackageFolder* pFolder = aIter->second; + if ( bFolder ) { +// Determine the directory name. sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex ); sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); -if ( sTemp == ( *aIter ).second->getName() ) -return makeAny ( uno::Reference < XUnoTunnel > ( ( *aIter ).second ) ); -m_aRecent.erase ( aIter ); +if (sTemp == pFolder->getName()) +return makeAny(uno::Reference(pFolder)); } else { +// Determine the file name. sTemp = aName.copy ( nStreamIndex + 1 ); -if ( ( *aIter ).second->hasByName( sTemp ) ) -return ( *aIter ).second->getByName( sTemp ); -m_aRecent.erase( aIter ); +if (pFolder->hasByName(sTemp)) +return pFolder->getByName(sTemp); } + +m_aRecent.erase( aIter ); } } -else -{ -if ( m_pRootFolder->hasByName ( aName ) ) -return m_pRootFolder->getByName ( aName ); -} +else if ( m_pRootFolder->hasByName ( aName ) ) +// top-level element. +return m_pRootFolder->getByName ( aName ); + +// Not in the cache. Search normally. nOldIndex = 0; ZipPackageFolder * pCurrent = m_pRootFolder; ZipPackageFolder * pPrevious = nullptr; +// Find the right directory for the given path. + while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 ) { sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex ); @@ -838,7 +851,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) if ( bFolder ) { if ( nStreamIndex != -1 ) -m_aRecent[sDirName] = pPrevious; +m_aRecent[sDirName] = pPrevious; // cache it. return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) ); } @@ -847,7 +860,7 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) if ( pCurrent->hasByName ( sTemp ) ) { if ( nStreamIndex != -1 ) -m_aRecent[sDirName] = pCurrent; +m_aRecent[sDirName] = pCurrent; // cache it. return pCurrent->getByName( sTemp ); } @@ -858,10 +871,13 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) throw( RuntimeException, std::exception ) { OUString sTemp, sDirName; -sal_Int32 nOldIndex, nIndex, nStreamIndex; +sal_Int32 nOldIndex, nStreamIndex; FolderHash::iterator aIter; -if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' ) +sal_Int32 nIndex = aName.getLength(); + +if (aName == "/") +// root directory return true; try ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: package/source
package/source/zippackage/ZipPackage.cxx | 118 +++ 1 file changed, 59 insertions(+), 59 deletions(-) New commits: commit 63ddc8dc4ae1f3c3ee2f860c34886688b0ed2d57 Author: Kohei YoshidaDate: Sat Jan 7 16:47:58 2017 -0500 Reduce scope by removing unnecessary else clauses. This makes the code a bit easier to follow. Change-Id: Ia55d963c97b33dd8462e6084adc4820856e126bf Reviewed-on: https://gerrit.libreoffice.org/32825 Tested-by: Jenkins Reviewed-by: Kohei Yoshida diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index d17fee0..3c6eb48 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -782,76 +782,76 @@ Any SAL_CALL ZipPackage::getByHierarchicalName( const OUString& aName ) if ( ( nIndex = aName.getLength() ) == 1 && *aName.getStr() == '/' ) return makeAny ( uno::Reference < XUnoTunnel > ( m_pRootFolder ) ); -else + +nStreamIndex = aName.lastIndexOf ( '/' ); +bool bFolder = nStreamIndex == nIndex-1; +if ( nStreamIndex != -1 ) { -nStreamIndex = aName.lastIndexOf ( '/' ); -bool bFolder = nStreamIndex == nIndex-1; -if ( nStreamIndex != -1 ) +sDirName = aName.copy ( 0, nStreamIndex ); +aIter = m_aRecent.find ( sDirName ); +if ( aIter != m_aRecent.end() ) { -sDirName = aName.copy ( 0, nStreamIndex ); -aIter = m_aRecent.find ( sDirName ); -if ( aIter != m_aRecent.end() ) +if ( bFolder ) { -if ( bFolder ) -{ -sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex ); -sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); -if ( sTemp == ( *aIter ).second->getName() ) -return makeAny ( uno::Reference < XUnoTunnel > ( ( *aIter ).second ) ); -else -m_aRecent.erase ( aIter ); -} -else -{ -sTemp = aName.copy ( nStreamIndex + 1 ); -if ( ( *aIter ).second->hasByName( sTemp ) ) -return ( *aIter ).second->getByName( sTemp ); -else -m_aRecent.erase( aIter ); -} +sal_Int32 nDirIndex = aName.lastIndexOf ( '/', nStreamIndex ); +sTemp = aName.copy ( nDirIndex == -1 ? 0 : nDirIndex+1, nStreamIndex-nDirIndex-1 ); +if ( sTemp == ( *aIter ).second->getName() ) +return makeAny ( uno::Reference < XUnoTunnel > ( ( *aIter ).second ) ); + +m_aRecent.erase ( aIter ); } -} -else -{ -if ( m_pRootFolder->hasByName ( aName ) ) -return m_pRootFolder->getByName ( aName ); -} -nOldIndex = 0; -ZipPackageFolder * pCurrent = m_pRootFolder; -ZipPackageFolder * pPrevious = nullptr; -while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 ) -{ -sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex ); -if ( nIndex == nOldIndex ) -break; -if ( pCurrent->hasByName( sTemp ) ) +else { -pPrevious = pCurrent; -pCurrent = pCurrent->doGetByName( sTemp ).pFolder; +sTemp = aName.copy ( nStreamIndex + 1 ); +if ( ( *aIter ).second->hasByName( sTemp ) ) +return ( *aIter ).second->getByName( sTemp ); + +m_aRecent.erase( aIter ); } -else -throw NoSuchElementException(THROW_WHERE ); -nOldIndex = nIndex+1; } -if ( bFolder ) +} +else +{ +if ( m_pRootFolder->hasByName ( aName ) ) +return m_pRootFolder->getByName ( aName ); +} + +nOldIndex = 0; +ZipPackageFolder * pCurrent = m_pRootFolder; +ZipPackageFolder * pPrevious = nullptr; + +while ( ( nIndex = aName.indexOf( '/', nOldIndex )) != -1 ) +{ +sTemp = aName.copy ( nOldIndex, nIndex - nOldIndex ); +if ( nIndex == nOldIndex ) +break; +if ( pCurrent->hasByName( sTemp ) ) { -if ( nStreamIndex != -1 ) -m_aRecent[sDirName] = pPrevious; -return makeAny ( uno::Reference < XUnoTunnel > ( pCurrent ) ); +pPrevious = pCurrent; +pCurrent = pCurrent->doGetByName( sTemp ).pFolder; } else -{ -sTemp = aName.copy( nOldIndex, aName.getLength() - nOldIndex ); -if ( pCurrent->hasByName ( sTemp ) ) -{ -if (
[Libreoffice-commits] core.git: package/source
package/source/manifest/ManifestDefines.hxx |4 +++- package/source/manifest/ManifestExport.cxx |4 +++- package/source/manifest/ManifestImport.cxx |3 ++- package/source/manifest/ManifestImport.hxx |1 + 4 files changed, 9 insertions(+), 3 deletions(-) New commits: commit 1015d35f2362953f415804476037d4f162eb49b5 Author: Michael StahlDate: Mon Aug 8 15:03:54 2016 +0200 OFFICE-3708: package: recognize correct SHA256 URL ODF 1.2 uses an incorrect URL to refer to SHA256, add support for the correct W3C URL on import but continue to export the incorrect URL for now. Change-Id: I3135bcf989070d20f85f14702db07595f304e706 diff --git a/package/source/manifest/ManifestDefines.hxx b/package/source/manifest/ManifestDefines.hxx index 3db4a0b..968aed6 100644 --- a/package/source/manifest/ManifestDefines.hxx +++ b/package/source/manifest/ManifestDefines.hxx @@ -52,7 +52,9 @@ #define ATTRIBUTE_SALT "manifest:salt" #define ATTRIBUTE_ITERATION_COUNT "manifest:iteration-count" -#define SHA256_URL "http://www.w3.org/2000/09/xmldsig#sha256; +/// OFFICE-3708: wrong URL cited in ODF 1.2 and used since OOo 3.4 beta +#define SHA256_URL_ODF12 "http://www.w3.org/2000/09/xmldsig#sha256; +#define SHA256_URL "http://www.w3.org/2001/04/xmlenc#sha256; #define SHA1_NAME "SHA1" #define SHA1_URL "http://www.w3.org/2000/09/xmldsig#sha1; diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 10b30fb..60bcb8b 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -81,6 +81,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con const OUString sWhiteSpace ( " " ); +const OUString sSHA256_URL_ODF12 ( SHA256_URL_ODF12 ); const OUString sSHA256_URL ( SHA256_URL ); const OUString sSHA1_Name ( SHA1_NAME ); @@ -350,7 +351,8 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con *pStartKeyAlg >>= nStartKeyAlgID; if ( nStartKeyAlgID == xml::crypto::DigestID::SHA256 ) { -sStartKeyAlg = sSHA256_URL; +sStartKeyAlg = sSHA256_URL_ODF12; // TODO use sSHA256_URL +(void) sSHA256_URL; aBuffer.append( (sal_Int32)32 ); sStartKeySize = aBuffer.makeStringAndClear(); } diff --git a/package/source/manifest/ManifestImport.cxx b/package/source/manifest/ManifestImport.cxx index 69d5a33..1b171bc 100644 --- a/package/source/manifest/ManifestImport.cxx +++ b/package/source/manifest/ManifestImport.cxx @@ -70,6 +70,7 @@ ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManV , sStartKeyAlgProperty ( "StartKeyAlgorithm" ) , sDigestAlgProperty( "DigestAlgorithm" ) +, sSHA256_URL_ODF12 ( SHA256_URL_ODF12 ) , sSHA256_URL ( SHA256_URL ) , sSHA1_Name( SHA1_NAME ) , sSHA1_URL ( SHA1_URL ) @@ -228,7 +229,7 @@ void ManifestImport::doStartKeyAlg(StringHashMap ) throw( uno::RuntimeException ) { OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute]; -if ( aString.equals( sSHA256_URL ) ) { +if (aString.equals(sSHA256_URL) || aString.equals(sSHA256_URL_ODF12)) { aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty; aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256; } else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) ) { diff --git a/package/source/manifest/ManifestImport.hxx b/package/source/manifest/ManifestImport.hxx index 1948496..4e25499 100644 --- a/package/source/manifest/ManifestImport.hxx +++ b/package/source/manifest/ManifestImport.hxx @@ -93,6 +93,7 @@ protected: const OUString sStartKeyAlgProperty; const OUString sDigestAlgProperty; +const OUString sSHA256_URL_ODF12; const OUString sSHA256_URL; const OUString sSHA1_Name; const OUString sSHA1_URL; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits