summaryrefslogtreecommitdiff
path: root/stoc
AgeCommit message (Collapse)Author
2022-05-13officecfg,stoc: allow running JVM UNO components out-of-processMichael Stahl
The problem is that 32-bit Win32 applications have very little VM, and soffice.bin can run out, so try to move the JVM to a separate process (uno.bin) and connect to it via pipe. Add a new config to enable this: "org.openoffice.Office.Java/VirtualMachine/RunUnoComponentsOutOfProcess" If enabled, ServiceManager instantiates *all* JVM components out-of-process, by instantiating "com.sun.star.java.theJavaVirtualMachine" out-of-process. To ensure that the remote connection is disconnected at shutdown (and thereby prevent crashes with remote calls during late shutdown), JavaComponentLoader is now a "single-instance" service; this change should be harmless for the default in-process configuration case. Tested with these extensions: Wiki Publisher smoketest TestExtension.oxt odk CalcAddins.oxt Inspector.oxt ToDo.oxt Also passed "make check" on Linux when enabled, if the variable URE_BIN_DIR is set properly for CppunitTest_services. Change-Id: I76bf17a9512414b67dbd20daee25a6d29c05f9d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133218 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-05-09URE Library_boostrap should not depend on Library_comphelperStephan Bergmann
...and apparently doesn't need to, even though that dependency got added with 6ffdc88e79904882e319bdd0b901e7491abae0b3 "Simplify Sequence iterations in shell..svgio" Change-Id: I7cb67dc48d11e426d5d5f7912eca13e25a32dbc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134079 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-06remove unnecessary sequenceToContainerNoel Grandin
If we are not going to manipulate the resulting vector, then it is actually slower, since we have to allocate more storage for the vector Change-Id: I65677007d105f4783603df74113ebed6db0b551b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133963 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-03Just use Any ctor instead of makeAny in stocStephan Bergmann
Change-Id: I3345444f356dd3df9069773eba2bab1b46a08c46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133772 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-01use more string_view in variousNoel Grandin
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26Two more uses of rtl::createUriCharClassStephan Bergmann
...that 6a9f342addf8b1c766163575c7b63e7fcc1f714e "Introduce rtl::createUriCharClass" had missed Change-Id: Id37399cb88df25aff22d42e889aea12c1ca90797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133423 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-12loplugin:stringview more o3tl conversionNoel Grandin
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-10use more string_viewNoel Grandin
found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic15d3703d1fb07658e99e1db1c89e2fa5bc70c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132771 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-09use more subView when converting to Int32Noel Grandin
Change-Id: Ia1be48050cca386a6e765aa2229de1bc9e64ffff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-18tdf#148063: Avoid dereferencing potentially bad user-supplied TypeDescriptionStephan Bergmann
...from Basic script > sub foo > a = Array() > oUnoValue = CreateUnoValue( "[]", a ) > end sub at > Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault. > 0x00007fffc413b2db in stoc_tcv::(anonymous namespace)::TypeConverter_Impl::convertTo (this=0x3269200, rVal=uno::Any("[]any": empty uno::Sequence), aDestType=invalid uno::Type) at stoc/source/typeconv/convert.cxx:537 > 537 reinterpret_cast<typelib_IndirectTypeDescription *>(aDestTD.get())->pType ); > (gdb) bt > #0 0x00007fffc413b2db in stoc_tcv::(anonymous namespace)::TypeConverter_Impl::convertTo(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&) (this=0x3269200, rVal=uno::Any("[]any": empty uno::Sequence), aDestType=invalid uno::Type) at stoc/source/typeconv/convert.cxx:537 > #1 0x00007fffc413d144 in non-virtual thunk to stoc_tcv::(anonymous namespace)::TypeConverter_Impl::convertTo(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&) () at instdir/program/libstocserviceslo.so > #2 0x00007ffff4fe0264 in convertAny(com::sun::star::uno::Any const&, com::sun::star::uno::Type const&) (rVal=uno::Any("[]any": empty uno::Sequence), aDestType=invalid uno::Type) at basic/source/classes/sbunoobj.cxx:324 > #3 0x00007ffff4fdfe79 in RTL_Impl_CreateUnoValue(SbxArray&) (rPar=...) at basic/source/classes/sbunoobj.cxx:4157 > #4 0x00007ffff513b1b0 in SbRtl_CreateUnoValue(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods1.cxx:1403 > #5 0x00007ffff50ea80e in SbiStdObject::Notify(SfxBroadcaster&, SfxHint const&) (this=0x2003400, rBC=..., rHint=...) at basic/source/runtime/stdobj.cxx:1059 > #6 0x00007ffff3decfae in SfxBroadcaster::Broadcast(SfxHint const&) (this=0x3329e90, rHint=...) at svl/source/notify/SfxBroadcaster.cxx:39 > #7 0x00007ffff518e772 in SbxVariable::Broadcast(SfxHintId) (this=0x31e8f60, nHintId=SfxHintId::BasicDataWanted) at basic/source/sbx/sbxvar.cxx:151 > #8 0x00007ffff5186d4f in SbxValue::SbxValue(SbxValue const&) (this=0x31ff450, vtt=0x7ffff51ae718 <VTT for SbxMethod+16>, r=...) at basic/source/sbx/sbxvalue.cxx:66 > #9 0x00007ffff518d291 in SbxVariable::SbxVariable(SbxVariable const&) (this=0x31ff450, vtt=0x7ffff51ae710 <VTT for SbxMethod+8>, r=...) at basic/source/sbx/sbxvar.cxx:45 > #10 0x00007ffff517d44a in SbxMethod::SbxMethod(SbxMethod const&) (this=0x31ff450, r=...) at basic/source/sbx/sbxobj.cxx:838 > #11 0x00007ffff510386b in SbiRuntime::FindElement(SbxObject*, unsigned int, unsigned int, ErrCode, bool, bool) (this=0x2d6f400, pObj=0x2003400, nOp1=32773, nOp2=9, nNotFound=..., bLocal=false, bStatic=false) at basic/source/runtime/runtime.cxx:3709 > #12 0x00007ffff50f5a91 in SbiRuntime::StepRTL(unsigned int, unsigned int) (this=0x2d6f400, nOp1=32773, nOp2=9) at basic/source/runtime/runtime.cxx:4131 > #13 0x00007ffff50faef8 in SbiRuntime::Step() (this=0x2d6f400) at basic/source/runtime/runtime.cxx:830 [...] Change-Id: I552f0360aaf3f9aa6a499aa5ea6eca9ae37e4614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131739 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-01Recheck modules s[f-t]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I1f520aad1b1c942ad5616d96851016fc366ac58f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130203 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2022-02-25Don't use Library_tl in URE librariesStephan Bergmann
This partly reverts 8b5e23eac31cafbd442a3acab5fbcf98bfd0af11 "log nice exception messages whereever possible", e1eb7cb04a4c30cec238ab0f54d41a6cdc3299c1 "loplugin:logexceptionnicely in starmath..svgio", d6d80c4e1783b4459bd4a8fbcbdfeebe416c1cb5 "OSL_FAIL.*exception -> TOOLS_WARN_EXCEPTION", and 877f40ac3f2add2b6dc37bae280d4d98dd102286 "tdf#42949 Fix new IWYU warnings in directories [h-r]*", and adapts loplugin:logexceptionnicely accordingly. Change-Id: I792b853b988c7c5f77179ca0672c30cb4223b5a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130502 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-02-15tdf#145759 Use symbolic constants instead of magic numerical constantsKunal Pawar
1.4142... -> M_SQRT2 0.4142... -> M_SQRT2 - 1 3.1415... -> M_PI 2.7182... -> M_E Change-Id: If5b19aa38d9902b1a4b717f89f18bdf2f73a47cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129745 Tested-by: Hossein <hossein@libreoffice.org> Reviewed-by: Hossein <hossein@libreoffice.org>
2022-01-15Let loplugin:nullptr look into template instantiationsStephan Bergmann
It missed some occurrences of 0 when only looking into uninstantiated template code, as Clang doesn't model them with an ImplicitCastExpr, even if the target is known to be a (dependent) pointer type. Looking into all template instantiations of course carries the risk that a given use of 0 is meant to be interpreted as a pointer in some and as an integer in other instantiations. But the only case where that happened in the current code base is RegistryValueList::getElement (include/registry/registry.hxx), where {} is arguably a better choice anyway. (And which would presumably also hold for any future such cases.) Change-Id: I708bcfc8bedc0a49c9282d7814eb325afa29905c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128462 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-03osl::Mutex->std::mutex in ImplIntrospectionAccessNoel Grandin
Change-Id: I311762ccaac48161c8ce38f8ce081bf01e27ab09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127904 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-26can use OUStringLiteral hereNoel Grandin
Change-Id: I1e71a35c2ce6bc7ef3081054e51494411d9a29ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127491 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-24Use rtl functions instead of own surrogate checking/combiningMike Kaganski
Change-Id: I3eb05d8f5b0761bc3b672d4c855eb469f8cc1a29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127375 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-19use more cppu::BaseMutexNoel Grandin
Change-Id: I1374d615e8e72286a23407c50b5fe5f52017926a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127084 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-18use more cppu::BaseMutexNoel Grandin
Change-Id: I1ee9aff2774a673666c332c116aa5b0ba0d8b585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127077 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-10Generally determine Rdb content from gb_*_set_componentfile callsStephan Bergmann
...instead of by listing the content somewhat redundantly in the Rdb_*.mk files, to avoid duplication of logic for components that are only built conditionally (and thus should only be included conditionally in the corresponding Rdb). To achieve that, add an "rdb" parameter to gb_ComponentTarget_ComponentTarget (and to the gb_*_set_componentfile macros that internally call gb_ComponentTarget_ComponentTarget), which is used to make the appropriate gb_Rdb_add_component call internally from within gb_ComponentTarget_ComponentTarget. (As a special case, gb_CppunitTest_set_componentfile shall not call gb_Rdb_add_component, as that has already been done by the corresponding gb_Library_set_componentfile call, so allow the gb_ComponentTarget_ComponentTarget "rdb" parameter to be empty to support that special case.) Most Rdb_*.mk files are thus mostly empty now. One exception is i18npool/Rdb_saxparser.mk, which duplicates some of the Rdb_services content as needed during the build in CustomTarget_i18npool/localedata. 1c9a40299d328c78c035ca63ccdf22c5c669a03b "gbuild: create services.rdb from built components" had already tried to do something similar (in addition to other things) under a new --enable-services-rdb-from-build option. However, that approach had four drawbacks that this approach here addresses (and which thus partly reverts 1c9a40299d328c78c035ca63ccdf22c5c669a03b): 1 Rdb_services shall not contain the component files of all libraries that are built. While that commit filtered out the component files that go into Rdb_ure/services (ure/Rdb_ure.mk), it failed to filter out the component files that go into others like Rdb_postgresql-sdbc (connectivity/Rdb_postgresql-sdbc.mk). 2 The code added by that commit to Makefile.gbuild codified the knowledge that there is an Rdb_services, which is brittle. 3 The code added by that commit to solenv/gbuild/Rdb.mk codified the knowledge (for gb_Rdb__URECOMPONENTS) that there is an Rdb_ure/services, which is brittle. 4 Introducing an --enable-services-rdb-from-build option needlessly provided two different ways how the content of Rdb_services is assembled. The changes done here would leave --enable-services-rdb-from-build as a misnomer, as it no longer controls how Rdb_services is assembled. I thus renamed it to --enable-customtarget-components, as that is apparently what it still does now. Change-Id: Ia5e8df4b640146c77421fcec6daa11a9cd260265 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126577 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-26loplugin:stringliteraldefine in stoc,svtoolsNoel Grandin
Change-Id: Ifd583582fa7bf7366a1f8d482eefd64b30228ca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125867 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-15test_corefl: Fix OSL_ENSURE bracketingDr. David Alan Gilbert
cppcheck spotted a couple of misplaced brackets where the error text was ,'d after the end of OSL_ENSURE Change-Id: I5ab2c79b2438b764956e8064df95e713997ad2c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125018 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-10-31Prepare for removal of non-const operator[] from Sequence in stocMike Kaganski
Change-Id: I2aabd9a1c764ae69a933bdb4df635ebb0c91f0cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124393 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-15Remove non-const Sequence::begin()/end() in internal codeMike Kaganski
... to avoid hidden cost of multiple COW checks, because they call getArray() internally. This obsoletes [loplugin:sequenceloop]. Also rename toNonConstRange to asNonConstRange, to reflect that the result is a view of the sequence, not an independent object. TODO: also drop non-const operator[], but introduce operator[] in SequenceRange. Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14Avoid COW overhead using css::uno::SequenceMike Kaganski
The scenarios are: 1. Calling sequence's begin() and end() in pairs to pass to algorithms (both calls use getArray(), which does the COW checks) 2. In addition to #1, calling end() again when checking result of find algorithms, and/or begin() to calculate result's distance 3. Using non-const sequences in range-based for loops, which internally do #1 4. Assigning sequence to another sequence variable, and then modifying one of them In many cases, the sequences could be made const, or treated as const for the purposes of the algorithms (using std::as_const, std::cbegin, and std::cend). Where algorithm modifies the sequence, it was changed to only call getArray() once. For that, css::uno::toNonConstRange was introduced, which returns a struct (sublclass of std::pair) with two iterators [begin, end], that are calculated using one call to begin() and one call to getLength(). To handle #4, css::uno::Sequence::swap was introduced, that swaps the internal pointer to uno_Sequence. So when a local Sequence variable should be assigned to another variable, and the latter will be modified further, it's now possible to use swap instead, so the two sequences are kept independent. The modified places were found by temporarily removing non-const end(). Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-11In O[U]StringBuffer, make string_view params replacements for OUString onesStephan Bergmann
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-05drop 'using namespace std' in s* + toolkitJulien Nabet
Change-Id: Ibd0b983d46a5683df64b4de79cd444427705e9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123118 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 4Mike Kaganski
- Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in <comphelper/servicehelper.hxx>. TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-02clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: I39b9ac81d65f4a269293824642c1b2ec593c0584 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121490 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-19Fix locking of public UriReference members againStephan Bergmann
...after 074790ad6f4e02e7aed3f9c954f0b4005b40fa21 "remove some locking from UriReference" (and its follow-up 0f44815ce7b2925189cd603853ce55d8363549dd "loplugin:constmethods"): The m_path member is modified by UrlReference::setName in stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx. Also make the non-mutated members (for which locking is thus indeed not needed) private for now. (The original intention was that there can be further parsers for other URI schemes, which might need to modify further UriReference members. If such further parsers are ever implemented, the relevant members can be made public again, and the locking be restored where necessary.) Change-Id: I80b437fe14f43294a52e465a7e1f31ddf2ab0482 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120749 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-08-19loplugin:constmethodsNoel Grandin
Change-Id: I786096b989daa6004a6527aafbe825b6f0a22d90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120710 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-19remove some locking from UriReferenceNoel Grandin
we write these fields in the constructor and then never modify them again, so safe to skip locking Change-Id: I5cb5ea085ee8c2f6e4ce6417c2648265aa5a06d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120704 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-03osl::Mutex->std::mutex in UriReferenceNoel Grandin
Change-Id: Ic5fb97774821be582af62e74bd2e00fca503b8f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119889 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-03Consolidate on C++17 std::scoped_lock instead of std::lock_guardNoel Grandin
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-02convert #defines to OUStringLiteralNoel Grandin
mostly by doing $ git grep -l '#define.*\"' -- *.cxx | xargs perl -pi -e 's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 = u\2;/g' Change-Id: Idface893449b0ef2a3c5254865a300585d752fbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119669 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-02osl::Mutex->std::mutex in SimpleRegistryNoel Grandin
Change-Id: I92d76187ec9f487aaf43cbf19f3911110ddd8d82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119833 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-02osl::Mutex->std::mutex in LRU_CacheNoel Grandin
Change-Id: Ia84cef550412540aa511f917198712add32fc7ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119831 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-01osl::Mutex->std::mutex in InteractionRequest::RetryContinuationNoel Grandin
Change-Id: I36a238f9b61471266b8fbc81c8e159a0e36182da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119832 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-19osl::Mutex->std::mutex in ImplementationEnumeration_ImplNoel Grandin
Change-Id: I4bb9c6dc7efd76b730e2c8acf824b1e29bca8df5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119134 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-18osl::Mutex->std::mutex in ServiceEnumeration_ImplNoel Grandin
Change-Id: I3d754006c7c2766281d924253f2caa0ff4963fea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119133 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-18osl::Mutex->std::mutex in NamingService_ImplNoel Grandin
Change-Id: Ief6cf9df4caafcf72e31394488c407acb5d545fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119132 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-29Drop old MSVC workaroundStephan Bergmann
Change-Id: Ifbbbad0bf837533d36fdeddcb0184baa5b789ca3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118118 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-29Fix JavaVirtualMachine::disposeStephan Bergmann
...which must call derived-from JavaVirtualMachine_Impl::dispose (explicitly, when overriding it), but which got lost with 951a9342631129832e647bd8a303a959308bad65 "use single-use attribute for JavaVirtualMachine" Change-Id: I0ca581ae10400f430c24a04b056afbb45a5c1445 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118121 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-29Missing acquire in UNO constructor functionStephan Bergmann
...that was lost in 951a9342631129832e647bd8a303a959308bad65 "use single-use attribute for JavaVirtualMachine". (Noticed with `SDK_HOME=.../instdir/sdk URE_HOME=.../instdir make -f Makefile.pln test-javatest` in ure/source/uretest failing at [...] > warn:legacy.osl:1255514:1255514:cppuhelper/source/implbase.cxx:84: OSL_ASSERT: rBHelper.bDisposed > ================================================================= > ==1255514==ERROR: AddressSanitizer: heap-use-after-free on address 0x610000001740 at pc 0x7f14cbe32a2a bp 0x7fff46636a70 sp 0x7fff46636a68 > READ of size 8 at 0x610000001740 thread T0 > #0 in com::sun::star::uno::cpp_release(void*) at include/com/sun/star/uno/genfunc.hxx:52:43 > #1 in cppu::_release(void*, void (*)(void*)) at cppu/source/uno/prim.hxx:85:13 > #2 in cppu::_destructAny(_uno_Any*, void (*)(void*)) at cppu/source/uno/destr.hxx:129:9 > #3 in uno_any_destruct at cppu/source/uno/any.cxx:131:5 > #4 in com::sun::star::uno::Any::~Any() at include/com/sun/star/uno/Any.hxx:115:5 > #5 in cppu::(anonymous namespace)::ComponentContext::ContextEntry::~ContextEntry() at cppuhelper/source/component_context.cxx:131:12 > #6 in std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>::~pair() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_iterator.h:2368:12 > #7 in void std::destroy_at<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >(std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_construct.h:88:15 > #8 in void std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::destroy<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >(std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> >&, std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/alloc_traits.h:533:4 > #9 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable_policy.h:1932:7 > #10 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable_policy.h:1954:4 > #11 in std::_Hashtable<rtl::OUString, std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >, std::__detail::_Select1st, std::equal_to<rtl::OUString>, std::hash<rtl::OUString>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable.h:2332:13 > #12 in std::__cxx1998::unordered_map<rtl::OUString, cppu::(anonymous namespace)::ComponentContext::ContextEntry, std::hash<rtl::OUString>, std::equal_to<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> > >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/unordered_map.h:791:14 > #13 in std::__debug::unordered_map<rtl::OUString, cppu::(anonymous namespace)::ComponentContext::ContextEntry, std::hash<rtl::OUString>, std::equal_to<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> > >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/debug/unordered_map:223:9 > #14 in cppu::(anonymous namespace)::ComponentContext::disposing() at cppuhelper/source/component_context.cxx:444:11 > #15 in cppu::WeakComponentImplHelperBase::dispose() at cppuhelper/source/implbase.cxx:104:13 > #16 in cppu::PartialWeakComponentImplHelper<com::sun::star::uno::XComponentContext, com::sun::star::container::XNameContainer>::dispose() at include/cppuhelper/compbase.hxx:90:36 > #17 in sal_main() at cpputools/source/unoexe/unoexe.cxx:540:16 > #18 in main at cpputools/source/unoexe/unoexe.cxx:358:1 > > 0x610000001740 is located 0 bytes inside of 192-byte region [0x610000001740,0x610000001800) > freed by thread T0 here: > #0 in free at ~/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:111:3 > #1 in rtl_freeMemory at sal/rtl/alloc_global.cxx:51:5 > #2 in cppu::WeakComponentImplHelperBase::operator delete(void*) at include/cppuhelper/compbase_ex.hxx:70:11 > #3 in stoc_javavm::JavaVirtualMachine::~JavaVirtualMachine() at stoc/source/javavm/javavm.cxx:1122:1 > #4 in cppu::OWeakObject::release() at cppuhelper/source/weak.cxx:242:9 > #5 in cppu::WeakComponentImplHelperBase::release() at cppuhelper/source/implbase.cxx:86:18 > #6 in cppu::PartialWeakComponentImplHelper<com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo, com::sun::star::java::XJavaVM, com::sun::star::java::XJavaThreadRegister_11, com::sun::star::container::XContainerListener>::release() at include/cppuhelper/compbase.hxx:86:36 > #7 in com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::~Reference() at include/com/sun/star/uno/Reference.hxx:114:22 > #8 in cppuhelper::ServiceManager::Data::Implementation::~Implementation() at cppuhelper/source/servicemanager.hxx:72:16 > #9 in void std::destroy_at<cppuhelper::ServiceManager::Data::Implementation>(cppuhelper::ServiceManager::Data::Implementation*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_construct.h:88:15 > #10 in void std::allocator_traits<std::allocator<cppuhelper::ServiceManager::Data::Implementation> >::destroy<cppuhelper::ServiceManager::Data::Implementation>(std::allocator<cppuhelper::ServiceManager::Data::Implementation>&, cppuhelper::ServiceManager::Data::Implementation*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/alloc_traits.h:533:4 > #11 in std::_Sp_counted_ptr_inplace<cppuhelper::ServiceManager::Data::Implementation, std::allocator<cppuhelper::ServiceManager::Data::Implementation>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:528:2 > #12 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:168:6 > #13 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:705:11 > #14 in std::__shared_ptr<cppuhelper::ServiceManager::Data::Implementation, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr_base.h:1154:31 > #15 in std::shared_ptr<cppuhelper::ServiceManager::Data::Implementation>::~shared_ptr() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/shared_ptr.h:122:11 > #16 in (anonymous namespace)::SingletonFactory::~SingletonFactory() at cppuhelper/source/servicemanager.cxx:510:43 > #17 in (anonymous namespace)::SingletonFactory::~SingletonFactory() at cppuhelper/source/servicemanager.cxx:510:42 > #18 in cppu::OWeakObject::release() at cppuhelper/source/weak.cxx:242:9 > #19 in cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory>::release() at include/cppuhelper/implbase.hxx:115:66 > #20 in com::sun::star::uno::cpp_release(void*) at include/com/sun/star/uno/genfunc.hxx:52:43 > #21 in cppu::_release(void*, void (*)(void*)) at cppu/source/uno/prim.hxx:85:13 > #22 in cppu::_destructAny(_uno_Any*, void (*)(void*)) at cppu/source/uno/destr.hxx:129:9 > #23 in uno_any_destruct at cppu/source/uno/any.cxx:131:5 > #24 in com::sun::star::uno::Any::~Any() at include/com/sun/star/uno/Any.hxx:115:5 > #25 in cppu::(anonymous namespace)::ComponentContext::ContextEntry::~ContextEntry() at cppuhelper/source/component_context.cxx:131:12 > #26 in std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>::~pair() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_iterator.h:2368:12 > #27 in void std::destroy_at<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >(std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/stl_construct.h:88:15 > #28 in void std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::destroy<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >(std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> >&, std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/alloc_traits.h:533:4 > #29 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable_policy.h:1932:7 > #30 in std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, true>*) at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable_policy.h:1954:4 > #31 in std::_Hashtable<rtl::OUString, std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> >, std::__detail::_Select1st, std::equal_to<rtl::OUString>, std::hash<rtl::OUString>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/hashtable.h:2332:13 > #32 in std::__cxx1998::unordered_map<rtl::OUString, cppu::(anonymous namespace)::ComponentContext::ContextEntry, std::hash<rtl::OUString>, std::equal_to<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> > >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/bits/unordered_map.h:791:14 > #33 in std::__debug::unordered_map<rtl::OUString, cppu::(anonymous namespace)::ComponentContext::ContextEntry, std::hash<rtl::OUString>, std::equal_to<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, cppu::(anonymous namespace)::ComponentContext::ContextEntry> > >::clear() at ~/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../include/c++/12.0.0/debug/unordered_map:223:9 > #34 in cppu::(anonymous namespace)::ComponentContext::disposing() at cppuhelper/source/component_context.cxx:444:11 > #35 in cppu::WeakComponentImplHelperBase::dispose() at cppuhelper/source/implbase.cxx:104:13 > #36 in cppu::PartialWeakComponentImplHelper<com::sun::star::uno::XComponentContext, com::sun::star::container::XNameContainer>::dispose() at include/cppuhelper/compbase.hxx:90:36 > #37 in sal_main() at cpputools/source/unoexe/unoexe.cxx:540:16 > #38 in main at cpputools/source/unoexe/unoexe.cxx:358:1 when presumably removing first /singletons/com.sun.star.java.theJavaVirtualMachine/service and then /singletons/com.sun.star.java.theJavaVirtualMachine from ComponentContext::m_map.) Change-Id: If1563e463becb4d22b754e173ebcb60386e1d828 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118049 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-10Simplify Sequences initializations (sot/stock/svl/svtools/svx)Julien Nabet
Change-Id: Iec21851d69f4a8d5f557e9ed2d30e5f680cd62c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116943 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-05-29std::unique->std::optionalNoel Grandin
rather than having a pointer to a pointer (which is what Sequence is) Change-Id: Ieb7b9995f6a25022fe2401adc3c38124edb83506 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116376 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-29loplugin:stringadd simplify some *StringBuffer operationsNoel Grandin
pulled from a larger patch which I created with a more permissive variant of this plugin Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>