summaryrefslogtreecommitdiff
path: root/stoc
AgeCommit message (Collapse)Author
2023-06-18Use getXWeak in stocMike Kaganski
Change-Id: Icd694eeae002ab28cbd06ba3097e9039e299de3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150871 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-05-25merge some stringaddsNoel Grandin
found with a lightly tweaked version of the loplugin:stringadd and some hand-holding. Change-Id: I146aadcaf665e98fea89a9cad2df4dc3935622f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152275 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-06tdf#145538 Use range based for loopsektagoel12
Change-Id: Ib74318a36898270c7b6e45e5e064ddd696a91be8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145905 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-03-30loplugin:stringadd in starmath..svlNoel Grandin
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: Id8f229c3a5223dee8d2710caf15d4612594fc763 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149748 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-22Remove unused fileStephan Bergmann
...that 9111536f1bbaed489ed3ed36315e05d4b3940f5b "Introduce css.reflection.Dump singleton" had added by mistake Change-Id: I15e273c3186312c45b7d435f983f17eb2f93a56e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149292 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-22Introduce css.reflection.Dump singletonStephan Bergmann
...and revert e1c6f36d8bcc0799281e3a7e244175f682d97cb2 "Add a to_string() function to the code generated for UNO IDL constant groups". (But keep the constants groups the latter had added to cppu/qa/cppumaker/types.idl, and use them in the newly added CppunitTest_stoc_dump, for better or worse.) Change-Id: I56e9eaeb1e45b83a72a25eceef13e719dc6f3a1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149281 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Jenkins
2023-02-16Drop 'using namespace ::std' in dirs s*Gabor Kelemen
Change-Id: If3119a1f2274aac0bf70576458e3adb4505a2a45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147076 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-02-02osl::Mutex->std::mutex in JavaComponentLoader::getJavaLoaderNoel Grandin
Change-Id: Iecde82fcd1c637d4447b2bca491308a2becc38cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146467 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-20Related: rhbz#2136459 use a value which is exactly representable as a floatCaolán McNamara
20 builds in a row with the old value all succeeded for me on F38 anyway, so if the problem still exists this almost certainly doesn't do anything. But it's nice for debugging to use something that is printed the same by a debugger as seen in the source. also see: tdf#125978 Change-Id: I42dc5f18c22acc006bffb57578bacb65dbc16013 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143116 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-19Base IdlReflectionServiceImpl on WeakComponentImplHelperStephan Bergmann
...rather than on the deprecated OComponentHelper Change-Id: Icb83d3cc0a0588a703a9041c00730b2a8d8bb90b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145789 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-09use std::this_thread::sleep_for instead of osl equivalentArnaud VERSINI
Change-Id: I5b4edc5417e5bb5e082688df616e1d5735717d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142357 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-12-19loplugin:implinheritancehelper in stocNoel Grandin
use more ImplInheritanceHelper to reduce boilerplate Change-Id: I2b4937ebee2e8cc16759df0eacdeb160343a7001 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144440 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-11-14Destruction of Registry and RegitsryKey isn't MT-safeStephan Bergmann
...as the underlying ORegistry and ORegKey modify their ref counts outside any locked mutexes. For example, <https://ci.libreoffice.org/job/lo_ubsan/2572/> had failed during CustomTarget_odk/build-examples_java with > ==402==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d00035d920 at pc 0x7f379ce963d9 bp 0x7ffe74b1ac60 sp 0x7ffe74b1ac58 > READ of size 4 at 0x60d00035d920 thread T0 > #0 0x7f379ce963d8 in ORegistry::acquire() /registry/source/regimpl.hxx:49:18 > #1 0x7f379ce947a3 in acquire(void*) /registry/source/registry.cxx:38:15 > #2 0x7f375ee9287e in Registry::operator=(Registry const&) /include/registry/registry.hxx:961:9 > #3 0x7f375ee92654 in RegistryKey::setRegistry(Registry const&) /include/registry/registry.hxx:647:20 > #4 0x7f375ee91d66 in Registry::openRootKey(RegistryKey&) /include/registry/registry.hxx:979:18 > #5 0x7f375ee725da in (anonymous namespace)::SimpleRegistry::getRootKey() /stoc/source/simpleregistry/simpleregistry.cxx:889:30 > #6 0x7f375ee73a56 in non-virtual thunk to (anonymous namespace)::SimpleRegistry::getRootKey() /stoc/source/simpleregistry/simpleregistry.cxx > #7 0x7f37828e142c in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) /bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5 > #8 0x7f37828db812 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13 > #9 0x7f37828d8668 in unoInterfaceProxyDispatch /bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13 > #10 0x7f375cfebc05 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:236:13 > #11 0x7f375cfe5a46 in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:79:26 > #12 0x7f375d0ae662 in request /binaryurp/source/reader.cxx:86:9 > #13 0x7f37b5cf5a2b in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17 > #14 0x7f37b5d44637 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) /cppu/source/threadpool/threadpool.cxx:304:33 > #15 0x7f37b5d468d4 in uno_threadpool_enter /cppu/source/threadpool/threadpool.cxx:408:33 > #16 0x7f375cf144fa in binaryurp::Bridge::makeCall(rtl::OUString const&, com::sun::star::uno::TypeDescription const&, bool, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >&&, binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) /binaryurp/source/bridge.cxx:606:9 > #17 0x7f375d0aa130 in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const /binaryurp/source/proxy.cxx:169:18 > #18 0x7f375d0a82f4 in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const /binaryurp/source/proxy.cxx:102:13 > #19 0x7f375d0a80cf in proxy_dispatchInterface /binaryurp/source/proxy.cxx:61:36 > #20 0x7f3782881fff in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, _typelib_TypeDescription const*, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void**, void**, void**, unsigned long*) /bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191:5 > #21 0x7f378287ef40 in cpp_vtable_call /bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389:28 > #22 0x7f378292d60d in privateSnippetExecutor (/instdir/program/libgcc3_uno.so+0x13960d) > #23 0x7f3774fd11c7 in dp_registry::backend::component::(anonymous namespace)::BackendImpl::ComponentPackageImpl::processPackage_(osl::ResettableGuard<osl::Mutex>&, bool, bool, rtl::Reference<dp_misc::AbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/component/dp_component.cxx:1376:17 > #24 0x7f37750f1c11 in dp_registry::backend::Package::processPackage_impl(bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:631:17 > #25 0x7f37750f3f4b in dp_registry::backend::Package::registerPackage(unsigned char, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:688:5 > #26 0x7f3775206b47 in dp_registry::backend::bundle::(anonymous namespace)::BackendImpl::PackageImpl::processPackage_(osl::ResettableGuard<osl::Mutex>&, bool, bool, rtl::Reference<dp_misc::AbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/package/dp_package.cxx:805:27 > #27 0x7f37750f1c11 in dp_registry::backend::Package::processPackage_impl(bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:631:17 > #28 0x7f37750f3f4b in dp_registry::backend::Package::registerPackage(unsigned char, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/registry/dp_backend.cxx:688:5 > #29 0x7f3774e55b17 in dp_manager::ExtensionManager::activateExtension(com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::deployment::XPackage> > const&, bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:473:23 > #30 0x7f3774e54ab4 in dp_manager::ExtensionManager::activateExtension(rtl::OUString const&, rtl::OUString const&, bool, bool, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:423:5 > #31 0x7f3774e5fa40 in dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx:723:21 > #32 0x7f3774e62b64 in non-virtual thunk to dp_manager::ExtensionManager::addExtension(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::NamedValue> const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::task::XAbortChannel> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) /desktop/source/deployment/manager/dp_extensionmanager.cxx > #33 0x7f37ba706dcf in unopkg_main /desktop/source/pkgchk/unopkg/unopkg_app.cxx:429:40 > #34 0x501298 in sal_main /desktop/source/pkgchk/unopkg/unopkg_main.c:24:31 > #35 0x501276 in main /desktop/source/pkgchk/unopkg/unopkg_main.c:24:1 > > 0x60d00035d920 is located 0 bytes inside of 136-byte region [0x60d00035d920,0x60d00035d9a8) > freed by thread T6 (cppu_threadpool) here: > #0 0x4fe928 in operator delete(void*, unsigned long) /home/tdf/lode/packages/llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172 > #1 0x7f379ce94875 in release(void*) /registry/source/registry.cxx:47:9 > #2 0x7f375ee8e6b5 in Registry::~Registry() /include/registry/registry.hxx:955:13 > #3 0x7f375ee92582 in RegistryKey::~RegistryKey() /include/registry/registry.hxx:655:5 > #4 0x7f375ee744e6 in (anonymous namespace)::Key::~Key() /stoc/source/simpleregistry/simpleregistry.cxx:101:7 > #5 0x7f375ee74558 in (anonymous namespace)::Key::~Key() /stoc/source/simpleregistry/simpleregistry.cxx:101:7 > #6 0x7f37b53a682a in cppu::OWeakObject::release() /cppuhelper/source/weak.cxx:230:9 > #7 0x7f375ec5c009 in cppu::WeakImplHelper<com::sun::star::registry::XRegistryKey>::release() /include/cppuhelper/implbase.hxx:115:66 > #8 0x7f37828f0054 in freeUnoInterfaceProxy /bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42:19 > #9 0x7f37b5ee924d in (anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1]) /cppu/source/uno/lbenv.cxx:372:17 > #10 0x7f37b5e8fcbc in s_environment_invoke_v(_uno_Environment*, _uno_Environment*, void (*)(__va_list_tag (*) [1]), __va_list_tag (*) [1]) /cppu/source/uno/EnvStack.cxx:293:9 > #11 0x7f37b5e8fa04 in uno_Environment_invoke_v /cppu/source/uno/EnvStack.cxx:312:5 > #12 0x7f37b5e9016a in uno_Environment_invoke /cppu/source/uno/EnvStack.cxx:321:5 > #13 0x7f37b5ec2dc5 in (anonymous namespace)::defenv_revokeInterface(_uno_ExtEnvironment*, void*) /cppu/source/uno/lbenv.cxx:426:5 > #14 0x7f37828f0f08 in releaseProxy /bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:78:9 > #15 0x7f375cf305c5 in com::sun::star::uno::UnoInterfaceReference::~UnoInterfaceReference() /include/uno/dispatcher.hxx:107:9 > #16 0x7f375cf0f387 in binaryurp::Bridge::releaseStub(rtl::OUString const&, com::sun::star::uno::TypeDescription const&) /binaryurp/source/bridge.cxx:514:1 > #17 0x7f375cfe8b9b in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const /binaryurp/source/incomingrequest.cxx:138:18 > #18 0x7f375cfe5a46 in binaryurp::IncomingRequest::execute() const /binaryurp/source/incomingrequest.cxx:79:26 > #19 0x7f375d0ae662 in request /binaryurp/source/reader.cxx:86:9 > #20 0x7f37b5cf5a2b in cppu_threadpool::JobQueue::enter(void const*, bool) /cppu/source/threadpool/jobqueue.cxx:100:17 > #21 0x7f37b5d161c4 in cppu_threadpool::ORequestThread::run() /cppu/source/threadpool/thread.cxx:165:31 > #22 0x7f37b5d20fc4 in threadFunc /include/osl/thread.hxx:189:15 > #23 0x7f37bb9d9f0f in osl_thread_start_Impl(void*) /sal/osl/unx/thread.cxx:265:9 > #24 0x7f37b9e35ea4 in start_thread /usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:307 The SimpleRegistry UNO implementation appears to be the only one of the few remaining uses of the legacy registry functionality that suffers from this issue, so address things there and keep the registry functionality itself non- MT-safe. Change-Id: I5a87f1c66d838603672f6dfd19e6d1b617fbe691 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142713 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-02Use o3tl::to_underlying() instead of static_cast<int>()Tor Lillqvist
sberg says it is better, and I trust him. Change-Id: I32b343cd899f807c0eb803e74e856b0eb9610074 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142132 Tested-by: Tor Lillqvist <tml@collabora.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
2022-11-01Make exception message a bit more informativeTor Lillqvist
Change-Id: I61141eab37f07d012ff2c5033efdfa1e0126786f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142075 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2022-10-25tdf#145759 Use symbolic constants instead of magic numerical constantsOmkarAcharekar
Change-Id: I68f9dd0bbe5a98de35253220dc33382139b4950e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141657 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-11revert pessimizationNoel Grandin
revert part of commit 113d9bba057b2fd634fcfcebb83a4d92cf41d69f Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Fri Sep 30 09:06:51 2022 +0200 use more string_view in stoc <sberg> This is another case of a potential pessimization, for no gain: The passed in schemeSpecificPart will always be an OUString, and path may be a view of its full content (if there is neither authority nor query part). Change-Id: Ibc60fb1f5f351668ef924e25ee3aeb1d80f6f710 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141205 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-11Deduplicate O(U)StringConcatenationMike Kaganski
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-30use more string_view in stocNoel Grandin
Change-Id: I6552f3daee7b18dbd311ac7e80ebf1e84e36704d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140787 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-27clang-tidy modernize-pass-by-value in stocNoel Grandin
Change-Id: Ia628b2af646e576d52b6c72352255710a885c23f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136452 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-13Drop obsolete preprocessor directives from UNOIDL filesStephan Bergmann
...which were used by ildc, which is gone since a8485d558fab53291e2530fd9a1be581c1628deb "[API CHANGE] Remove deprecated idlc and regmerge from the SDK", and have always been ignored as legacy by its unoidl-write replacement. This change has been carried out (making use of GNU sed extensions) with > for i in $(git ls-files \*.idl); do sed -i -z -E -e 's/\n\n((#[^\n]*\n)+\n)*(#[^\n]*\n)+\n?/\n\n/g' -e 's/\n(#[^\n]*\n)+/\n/g' "$i"; done && git checkout extensions/source/activex/so_activex.idl odk/examples/OLE/activex/so_activex.idl which apparently happened to do the work. (The final two files are not UNOIDL source files.) Change-Id: Ic9369e05d46e8f7e8a304ab01740b171b92335cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135683 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-11[API CHANGE] Deprecate css.registry.XSimpleRegistry::mergeKeyStephan Bergmann
...and let its implementations just throw a RuntimeException, now that regmerge has been removed in "[API CHANGE] Remove deprecated idlc and regmerge from the SDK". Deprecate css.registry.MergeConflictException along with it (though stoc/source/implementationregistration/ still uses it internally). And remove the previously unused include/registry/writer.hxx along with the newly unused include/registry/writer.h, RegistryTypeWriter, and RegistryTypeReader. Change-Id: I10fd286617975dc0ef9f74460a3a3eab8060939d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123615 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-03Use more appropriate index variable typesStephan Bergmann
Change-Id: I3c8985862aeccb350c4e8e04d3f71f9dc7018e43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135334 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
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>