summaryrefslogtreecommitdiff
path: root/pyuno
AgeCommit message (Collapse)Author
2023-06-01WaE: Py_SetPythonHome is deprecated since python 3.11Caolán McNamara
not obvious how to replace it, so just accept for now Change-Id: Id3fc4c95a5cc60e078f06faaa024faa9c770de20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152504 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-04-17loplugin:stringaddStephan Bergmann
Change-Id: I04dad33cad121eba7189fc78cac762e31d7c4c2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150477 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-03-27loplugin:stringadd in oox..pyunoNoel Grandin
after my patch to merge the bufferadd loplugin into stringadd Change-Id: I5fdc0a33923fe00e7b588f4576607515a93e5c13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-13tdf#143148 Use pragma once instead of include guardsbuldi
Change-Id: I5a88b699425a37b914a71400e918965a9f6116eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146730 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-01-02Remove unused imports from pyuno/demo and pyuno/qaBogdan B
Change-Id: I777eb19059030d2c1ce870b5839b541cbc7e90d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142520 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-09-16tdf#150982: properly unquote (URL-decode) vnd.sun.star.expand payloadMike Kaganski
Similar to what is done in bootstrap_expandUri, expandUnoRcUrl, UrlReference::expand, JavaLoader.expand_url, and is documented in XVndSunStarExpandUrl interface. Change-Id: I92917adb38e42c3926494427e4df2451298033e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140042 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-09-05tdf#97361 replace getCellByPosition with access by subscriptChenxiong Qi
Signed-off-by: Chenxiong Qi <qcxhome@gmail.com> Change-Id: I50d6e29c34e3cf72cdf0afc9f118fafc3c144eaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139141 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-05tdf#97361 replace getCellRangeByPosition with slicesChenxiong Qi
Signed-off-by: Chenxiong Qi <qcxhome@gmail.com> Change-Id: I4368adca1e9500c6f926ea1f28b0790b06fae739 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139140 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-13clang-tidy modernize-pass-by-value in variousNoel Grandin
Change-Id: Ie091b22bd77d4e1fbff46545bc86c12f1dbafcfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138171 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-10loplugin:passstuffbyrefNoel Grandin
Change-Id: Ib2b2650da7abc9260897f9b5aad619a0ea6ae941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138052 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-09tdf#133123: fix crash when importing defusedxml.ElementTree after pyunoNiko Fink
Change-Id: I89ac6108c679504c81dd9a439a4fb02e9e1adc07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138007 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-07-22elide some makeStringAndClear() callsNoel Grandin
Change-Id: I3b80d0f5b6d39c071242bc6ccc1e4333886c835d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137309 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-16rhbz#2097411 Avoid obsolete PyThreadState_Delete crashing Python 3.11Stephan Bergmann
1fb53a637597f76bea86514b62ddfad34f60c889 "pyuno_loader::CreateInstance: delete the initial PyThreadState" had added the PyThreadState_Delete for claimed benefits but whose details appear lost to history (cf. the comment thread starting at <https://gerrit.libreoffice.org/c/core/+/3452/2#message-602ff52abdd1c95fd5c13cfe405b5fadd0048c5f> "pyuno_loader::CreateInstance: delete the initial PyThreadState"). And at least a recent master Linux --enable-python=fully-internal build with the bundled Python 3.8.12 appears to succeed `make check` just fine with the PyThreadState_Delete temporarily removed. But on the other hand, building against upcoming Python 3.11 now started to make CppunitTest_services fail with > Fatal Python error: init_threadstate: thread state already initialized > Python runtime state: initialized > Thread 0x0000ffff81c8b020 (most recent call first): > <no Python frame> > Fatal exception: Signal 6 > Stack: > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37c28)[0xffff81be7c28] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_sal.so.3(+0x37e40)[0xffff81be7e40] > linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff81ccb7ec] > /lib64/libc.so.6(+0x82878)[0xffff81742878] > /lib64/libc.so.6(raise+0x20)[0xffff816fae00] > /lib64/libc.so.6(abort+0xe8)[0xffff816e72b8] > /lib64/libpython3.11.so.1.0(+0x104e28)[0xfffee4de4e28] > /lib64/libpython3.11.so.1.0(+0x105200)[0xfffee4de5200] > /lib64/libpython3.11.so.1.0(PyThread_get_thread_native_id+0x0)[0xfffee4ed6764] > /lib64/libpython3.11.so.1.0(PyThreadState_New+0x14)[0xfffee4ed6628] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpyuno.so(_ZN5pyuno14PyThreadAttachC2EP3_is+0x78)[0xfffee4c8c52c] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libpythonloaderlo.so(pyuno_Loader_get_implementation+0x5c)[0xfffee5243060] > /builddir/build/BUILD/libreoffice-7.3.4.2/instdir/program/libuno_cppuhelpergcc3.so.3(+0x544b4)[0xffff815544b4] because of the PyThreadState_Delete. (The deleted PyThreadState, while not reused again directly, is still recorded in the state obtained from PyInterpreterState_Head() later.) So conservatively keep the PyThreadState_Delete of unclear benefit for older Python versions and only drop it for 3.11 where it is known to have negative effects now. Change-Id: I9b99f1e947f0b165ddc95c2bfbd764858dda39db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136006 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-04Just use Any ctor instead of makeAny in pyunoStephan Bergmann
Change-Id: I53eb836c64e8e4a354c5c895bc7f16b168bd4cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133793 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-17loplugin:stringviewparam convert methods using copy()Noel Grandin
which converts to std::string_view::substr() Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-01Don't make UNO calls from PyThreadAttached regions (i.e., with the GIL locked)Stephan Bergmann
...which caused e.g. UITest_writer_tests3 to occasionally hang with the python.bin process thread 1 at > File "sw/qa/uitest/writer_tests3/insertPageFooter.py", line 30, in delete_footer [...] i.e., > #4 ___pthread_cond_wait at /usr/src/debug/glibc-2.35-4.fc36.x86_64/nptl/pthread_cond_wait.c:618 > #5 0x00007ff9d6ad9c43 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:72 > #6 0x00007ff9d6ae8e79 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) at cppu/source/threadpool/threadpool.cxx:303 > #7 0x00007ff9d6ae9278 in uno_threadpool_enter(uno_ThreadPool, void**) at cppu/source/threadpool/threadpool.cxx:407 > #8 0x00007ff9c7d016eb 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> >*) at binaryurp/source/bridge.cxx:604 > #9 0x00007ff9c7d322fc in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:168 > #10 0x00007ff9c7d338cb in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:101 > #11 0x00007ff9d63222e0 in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, typelib_TypeDescription const*, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191 > #12 0x00007ff9d6322b59 in cpp_vtable_call(sal_Int32, sal_Int32, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389 > #13 0x00007ff9d63336ca in privateSnippetExecutor at instdir/program/libgcc3_uno.so > #14 0x00007ff9d6241f38 in (anonymous namespace)::ImplIntrospectionAccess::hasByName(rtl::OUString const&) at stoc/source/inspect/introspection.cxx:1114 > #15 0x00007ff9d6b856b2 in pyuno::PyUNO_getattr(PyObject*, char*) at pyuno/source/module/pyuno.cxx:1392 [...] doing a remote call to soffice.bin with GIL locked, and thread 4 at > #6 0x00007ff9e51efa28 in take_gil at workdir/UnpackedTarball/python3/Python/ceval_gil.h:207 > #7 0x00007ff9e51f00d3 in PyEval_AcquireThread at workdir/UnpackedTarball/python3/Python/ceval.c:316 > #8 0x00007ff9d6b9b1e8 in pyuno::Adapter::invoke(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) at pyuno/source/module/pyuno_adapter.cxx:181 > #9 0x00007ff9d632b3e4 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77 > #10 0x00007ff9d632a4f1 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233 > #11 0x00007ff9d632a9e6 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413 > #12 0x00007ff9d621384a in stoc_invadp::(anonymous namespace)::AdapterImpl::invoke at stoc/source/invocation_adapterfactory/iafactory.cxx:457 > #13 stoc_invadp::adapter_dispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at stoc/source/invocation_adapterfactory/iafactory.cxx:605 > #14 0x00007ff9c7d1a7db in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at include/typelib/typedescription.hxx:155 > #15 0x00007ff9c7d1d65f in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:78 > #16 0x00007ff9c7d33ad3 in binaryurp::(anonymous namespace)::request(void*) at ~/gcc/trunk/inst/include/c++/12.0.1/bits/unique_ptr.h:172 > #17 0x00007ff9d6ad9e1b in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100 > #18 0x00007ff9d6adbb80 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:164 [...] processing an unrelated incoming call from soffice.bin and blocked trying to lock the GIL. (The reason that thread 1 doesn't make progress is that the soffice.bin process is also blocking with thread 6 at > #8 osl::Guard<comphelper::SolarMutex>::Guard(comphelper::SolarMutex&) at include/osl/mutex.hxx:142 > #9 SolarMutexGuard::SolarMutexGuard() at include/vcl/svapp.hxx:1368 > #10 sw::(anonymous namespace)::XStyleFamily::hasByName(rtl::OUString const&) at sw/source/core/unocore/unostyle.cxx:923 > #11 0x00007f089d3d53e4 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77 > #12 0x00007f089d3d44f1 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233 > #13 0x00007f089d3d49e6 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413 > #14 0x00007f089c1be7db in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const at include/typelib/typedescription.hxx:155 > #15 0x00007f089c1c165f in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:78 > #16 0x00007f089c1d7ad3 in binaryurp::(anonymous namespace)::request(void*) at ~/gcc/trunk/inst/include/c++/12.0.1/bits/unique_ptr.h:172 > #17 0x00007f08a18ade1b in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100 > #18 0x00007f08a18afb80 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:164 [...] processing the incoming call from python.bin thread 1 and blocked trying to lock the SolarMutex, while thread 1 at > #4 ___pthread_cond_wait at /usr/src/debug/glibc-2.35-4.fc36.x86_64/nptl/pthread_cond_wait.c:618 > #5 0x00007f08a18adc43 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:72 > #6 0x00007f08a18bce79 in cppu_threadpool::ThreadPool::enter(rtl::ByteSequence const&, void const*) at cppu/source/threadpool/threadpool.cxx:303 > #7 0x00007f08a18bd278 in uno_threadpool_enter(uno_ThreadPool, void**) at cppu/source/threadpool/threadpool.cxx:407 > #8 0x00007f089c1a56eb 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> >*) at binaryurp/source/bridge.cxx:604 > #9 0x00007f089c1d62fc in binaryurp::Proxy::do_dispatch_throw(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:168 > #10 0x00007f089c1d78cb in binaryurp::Proxy::do_dispatch(_typelib_TypeDescription const*, void*, void**, _uno_Any**) const at binaryurp/source/proxy.cxx:101 > #11 0x00007f089d3cc2e0 in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, typelib_TypeDescription const*, typelib_TypeDescriptionReference*, sal_Int32, typelib_MethodParameter*, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:191 > #12 0x00007f089d3ccb59 in cpp_vtable_call(sal_Int32, sal_Int32, void**, void**, void**, sal_uInt64*) at bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx:389 > #13 0x00007f089d3dd6ca in privateSnippetExecutor at instdir/program/libgcc3_uno.so > #14 0x00007f08a6b5d170 in operator() at sfx2/source/notify/globalevents.cxx:491 > #15 comphelper::OInterfaceContainerHelper4<com::sun::star::document::XDocumentEventListener>::forEach<(anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyListener(const com::sun::star::document::DocumentEvent&)::<lambda(const com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener>&)> > at include/comphelper/interfacecontainer4.hxx:285 > #16 at sfx2/source/notify/globalevents.cxx:488 > #17 0x00007f08a6b04c8b in (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator() (listener=Python Exception <class 'gdb.error'>: Dwarf Error: Cannot find DIE at 0x0 referenced in module instdir/program/libmergedlo.so > #18 comphelper::OInterfaceContainerHelper2::forEach<com::sun::star::document::XDocumentEventListener, at include/comphelper/interfacecontainer2.hxx:271 > #19 SfxBaseModel::postEvent_Impl(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::frame::XController2> const&, com::sun::star::uno::Any const&) at sfx2/source/doc/sfxbasemodel.cxx:3253 > #20 0x00007f08a6b066fe in SfxBaseModel::Notify(SfxBroadcaster&, SfxHint const&) at sfx2/source/doc/sfxbasemodel.cxx:2902 > #21 0x00007f08a6f15def in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:39 > #22 0x00007f087d640650 in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) at sw/source/core/layout/layact.cxx:2389 > #23 0x00007f087dc0832b in SwViewShell::LayoutIdle() at sw/source/core/view/viewsh.cxx:821 > #24 0x00007f087d2ba194 in sw::DocumentTimerManager::DoIdleJobs(Timer*) at sw/source/core/inc/rootfrm.hxx:206 > #25 0x00007f08a89fbd26 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:472 > #26 0x00007f08a8ca8780 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54 > #27 SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:212 > #28 0x00007f08a8ca99bd in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:452 > #29 0x00007f08a8ca9db1 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:524 > #30 0x00007f08a8a27d4c in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:474 > #31 0x00007f08a8a28445 in Application::Execute() at vcl/source/app/svapp.cxx:452 [...] is doing the remote call to python.bin thread 4 with the SolarMutex erroneously locked. But lets concentrate on just fixing the python.bin deadlock in this commit.) The PyThreadDetach antiguard just covering the xInvocation->getValue call in the "or a property" case had been added with e0a1cd4dc7202795e4a60c73ea1608d86984add7 "fixed a deadlock", presumably without taking into account that the xInvocation->hasMethod/hasProperty calls are equally problematic. Change-Id: I2483949df8213c3397a674be190224ee58c95c02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132428 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-09change default Calc number of columns to 16384 (tdf#50916)Luboš Luňák
All tests pass now, and I've also handled all significant bugreports from tdf#133764. This commit is mainly meant to test this more in practice and collect feedback. Depending on how this turns out, there may be a backwards compatibility option or something similar, but so far I see no significant need for it. Change-Id: I1a946f4e0b51be5acf4e25dc773e7694c2b17b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131180 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-01-30Recheck modules [o-r]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I6b4b05a5e59b256653c4caf5297fffd601b45083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128845 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-01-07tdf#146621: handle an exception that may hang process at ExitProcess timeMike Kaganski
Change-Id: I3ffc2303ae1851ab909612ae9bb7f70a077b24fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128097 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-22loplugin:flatten in package..reportdesignNoel Grandin
Change-Id: I2da242fcb59709ebdd0819ec04d051d794da71e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127277 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-10-30Prepare for removal of non-const operator[] from Sequence in pyunoMike Kaganski
Change-Id: Ifea4a6baa5fd3878e807ffde6b3fd2e2794312f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124379 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-20loplugin:indentation check for indent inside blockNoel Grandin
look for places where the statements inside a block are not indented Change-Id: I0cbfa7e0b6fb194b2aff6fa7e070fb907d70ca2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123885 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-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-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 3 [API CHANGE]Mike Kaganski
- Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> OImplementationId uses broken double checked locking; additionally, it uses it at the first call to getImplementationId, not when the object is constructed. This implementation can't be changed, cince it's part of published API; it can't rely on C++11, which would be required for use of thread-safe statics and move the initialization to ctor. The class has obsolete _bUseEthernetAddress member, that is unused and ignored since 4e9fa7e339a1cd6cb2fec643715991bcf5057cec. No need to implement it when replacing its uses to UnoIdInit. The deprecation is the API CHANGE. No published API is introduced to replace it; 3rd-party code should seek alternative solutions, or just keep using the deprecated functionality. TODO (in separate commits): - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: I8b6e684e5389bc0d5bb3b7f21f72a4c8f684107d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122077 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-15Use <comphelper/servicehelper.hxx> implementing XUnoTunnel part 1Mike Kaganski
The header got some changes: 1. Move UnoTunnelIdInit and isUnoTunnelId into 'comphelper' namespace 2. Rename UnoTunnelIdInit to UnoIdInit, as a precondition to replace of uses of OImplementationId with it, including in XTypeProvider 3. Introduce convenience functions 'getSomething_cast' to cast between sal_Int64 and object pointers uniformly. 4. Rename getUnoTunnelImplementation to getFromUnoTunnel, both to make it a bit shorter, and to reflect its function better. Templatize it to take also css::uno::Any for convenience. 5. Introduce getSomethingImpl, inspired by sw::UnoTunnelImpl; allow it handle cases both with and without fallback to parent. 6. Adjust UNO3_GETIMPLEMENTATION_* macros TODO (in separate commits): - Drop sw::UnoTunnelImpl and sw::UnoTunnelGetImplementation - Replace all uses of OImplementationId in core with UnoIdInit - Deprecate OImplementationId in <cppuhelper/typeprovider.hxx> - Change implementations of getSomething to use getSomethingImpl - Revise uses of getSomething to use getFromUnoTunnel Change-Id: If4a3cb024130f1f552f988f0479589da1cd066e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122022 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-12Make this instance of cppu::OImplementationId function-localMike Kaganski
Change-Id: I1feaaec9906fd06ae86226c35820072d8b19cf17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121891 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-01clang-tidy:readability-redundant-member-initNoel Grandin
Change-Id: Ic5abfe2d047750d8dfd3ae8cc733fa15d34ea505 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121432 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-21loplugin:stringadd replace OUStringLiteral temporaries with OUString::ConcatNoel Grandin
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377 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>
2021-03-24Using .md extension/Markdown syntax for modules READMEHossein
Renaming all README files for all top level modules to README.md, applying no content change at this stage to be able to track history of the files. These files should be edited to use correct Markdown syntax later. Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-03-22cid#1473905 Dereference after null checkCaolán McNamara
Change-Id: I949971374a68156ba78dce3b8d058774b1bef816 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112872 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-02-21loplugin:refcounting in package..saxNoel
Change-Id: I83618f54a4117cd81d8626307716129a761e14c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111274 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-05tdf#138987 Python 3.12 preparationsdante
Change-Id: I8ea476bfbaf27f8ab2daf4a370efc9917a5f9f8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110346 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-06pyuno: uno.Char is UTF-16 code unit, not UCS-4Michael Stahl
Check for that in ctor. Change-Id: Ia69b3d87ac4ccb5b6cc13169d7022c04607c609f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108803 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-05tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9David Ostrovsky
Change-Id: I220eecfa6aaf4d5cb12e3b4eacadf25843b41452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108403 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2021-01-04mbstowcs failure check is only relevant for non-_WIN32 nowStephan Bergmann
...after cbe9a0a815e4a73bf8db425a7c5c651e67b2ed65 "Use Unicode paths on Windows for pyuno" Change-Id: I898ee8ebbc1dfb215c55940c6336756ae7b5ccc5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108658 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-01Use Unicode paths on Windows for pyunoMike Kaganski
No need to convert to 8-byte string only to convert back to UTF-16. No idea if this has some logic on Linux, so only changing Windows. Change-Id: I87b7f25e5b1a2dd07ac3354f8f065485949ef229 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108480 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-01-01UTF8 is not ASCIIMike Kaganski
Change-Id: Idb31b3d00f35e0f90a4420f250f7a04535f5fe0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108476 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-19tdf#138987 pyuno: PyEval_InitThreads is a no-op in Python 3.9David Ostrovsky
Change-Id: I7cf95ab1f237e315e8bd80b47758839bca34f970 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107946 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-07Wrap "open" into "with"Mike Kaganski
Change-Id: I1ecc16ddf565ac1f7306289fd51b673ed928cc20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107329 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-04Fix ResourceWarning in pythonloader.pyJulien Nabet
trace: /home/julien/lo/libreoffice/instdir/program/pythonloader.py:146: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/julien/lo/libreoffice/instdir/share/extensions/numbertext/reg.uno.py' mode='r' encoding='utf_8'> mod = self.getModuleFromUrl( locationUrl ) ResourceWarning: Enable tracemalloc to get the object allocation traceback Change-Id: I106ab6c3c9024a8c1a4624a3b64958dc205e30e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107232 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10tdf#42949 Fix new IWYU warnings in directories [h-r]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I886b6f446293d3b1cfbf4ae05e8dbd7fabab9f20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105510 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-06Revert "loplugin:stringbuffer"Noel Grandin
This reverts commit f0356b6128bb4e78041d53025ad7c2e0b8e0c299. Reason for revert: There is a OUStringConcat overload for OUStringBuffer which would have kicked in here, so this is unnecessary Change-Id: I3bafb6c30bd3a2c1912daf227554889f1e09c78a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105354 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-06loplugin:stringbufferNoel
Change-Id: Id6f7268f12eb728dbb255aa19cd590b6813c4f01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105377 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05loplugin:reducevarscope in pyunoNoel
Change-Id: I49157f373b0d5919492a0ba4ccdcd545c58730a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105333 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-23PyLong_AsLongAndOverflow returns long, and that's fine to use hereStephan Bergmann
...where the goal is to check for a value in the range [SAL_MIN_INT32 .. SAL_MAX_INT32], i.e., [-2^31 .. 2^31 - 1]: While C++17 (via C LONG_MIN, LONG_MAX) only guarantees a range of [-(2^31 - 1) .. 2^31 - 1] for long, C++20 now requires two's complement and a fitting range of at least [-2^31 .. 2^31 - 1]. No need for 0d79d216886a71436e705c93829ed66a33270a9c "long->tools::Long in pyuno..sd" here. Change-Id: I6be60b50acfe5ed798cc8e9e1183c336c8d72059 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104712 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>