summaryrefslogtreecommitdiff
path: root/comphelper
AgeCommit message (Collapse)Author
2022-09-02[API CHANGE] tdf#150683 a11y: Switch a11y child index to 64 bitMichael Weghorn
With 16k column support in Calc enabled by default in commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58 Date: Tue Mar 8 12:44:49 2022 +0100 change default Calc number of columns to 16384 (tdf#50916) , the number of Calc cells in a spreadsheet is larger than SAL_MAX_INT32, meaning that a 32-bit a11y child index is no more enough and using it resulted in integer overflows in methods handling corresponding Calc cells in the a11y layer. This e.g. had the effect of the Orca and NVDA screen readers not announcing focused or selected cells properly when their a11y child index was out of the 32-bit integer range. Switch the internal a11y child indices to 64 bit to be able to handle this properly internally. Since the platform APIs (at least AT-SPI on Linux and IAccessible2 on Windows; from what I can see LO's macOS a11y bridge doesn't directly expose the child index) are still restricted to 32 bit, larger child indices still cannot be exposed via the platform APIs. As a consequence, use of the the IAccessible2 and AT-SPI methods that use the child index remains problematic in those cases where the child index is larger. However, as an alternative to using the AT-SPI Table interface and the IAccessibleTable/ IAccessibleTable2 interfaces with the child index to retrieve information about a specific cell, both AT-SPI and IAccessible2 also provide interfaces to retrieve that information directly from the cell object (TableCell interface for AT-SPI, IAccessibleTableCell for IAccessible2). Those interfaces are already implemented/exposed for winaccessibility (s. `CAccTable`) and the qt5/qt6/kf5 VCL plugins (s. the `QAccessibleTableCellInterface` methods implemented in `QtAccessibleInterface`). With the switch to 64-bit internal a11y child indices, these now behave correctly for cells with a child index that doesn't fit into 32 bit as well. NVDA on Windows already uses the IAccessibleTableCell interface and thus announcing focused cells works fine with this change in place. Orca on Linux currently doesn't make use of the AT-SPI TableCell interface yet, but with a suggested change to do so [1], announcement of selected cells works with the qt6 VCL plugin with a current qtbase dev branch as well - when combined with the suggested changes to implement support for the AT-SPI TableCell interface in Qt [2] [3] and the LO change based on that [4] and a fix for a nullptr dereference [5]. The gtk3 VCL plugin doesn't expose the AT-SPI TableCell interface yet, but once it does so (via `AtkTableCell`), it also works with the suggested Orca change [1] in place. (Adding that is planned for an upcoming change, works with a local WIP patch.) For handling return values that are larger than what platform APIs support, the following approach has been chosen for now: 1) When the return value is for the count of (selected) children, the maximum value N supported by the platform API is returned. (This is what `ScAccessibleTableBase::getAccessibleChildCount` did previously.) The first N elements can be accessed by their actual (selection) indices. 2) When the return value is the child/cell index, -2 is returned for objects whose index is greater than the maximum value supported by the platform API. Using a non-negative value would mean that the index would refer to *another* actually existing child. A child index of -1 on the other hand tends to be interpreted as "child is invalid" or "object isn't actually a child of its (previous) parent any more)". For the Orca case, this would result in objects with a child index of -1 not being announced, as they are considered "zombies" [6]. What's still somewhat problematic is the case where more than 2^31 children are *selected*, since access to those children still happens by the index into the selection in the platform APIs, and not all selected items are accessible this way. (Screen readers usually just retrieve the first and last element from the selection and announce those.) Orca already seems to apply different handling for the case for fully selected rows and columns, so "All cells selected" or "Columns ... to ... selected" is announced just fine even if more than 2^31 cells are selected. (Side note: While Microsoft User Interface Automation - UIA - also uses 32-bit indices, it also has specific methods in the ISelectionProvider2 interface that allow to explicitly retrieve the first and last selected item, `ISelectionProvider2::get_FirstSelectedItem` and `ISelectionProvider2::get_LastSelectedItem`, but we currently don't support UIA on Windows.) Bound checks at the beginning of the methods from the `XAccessibleContext`, `XAccessibleSelection` and `XAccessibleTable` interfaces that take a child index (or in helper methods called by those) should generally already prevent too large indices from being passed to the methods in the lower layer code that take smaller integer types. Such bound checking has been been added in various places where it wasn't present yet. If there any remaining issues of this kind that show after this commit, they can probably be solved in a similar way (s.e.g. the change to `AccessibleBrowseBox::getAccessibleChild` in this commit). A few asserts were also added at places where my understanding is that values shouldn't be larger than what is supported by a called method anyway. A test case will be added in a following change. [1] https://gitlab.gnome.org/GNOME/orca/-/merge_requests/131 [2] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [3] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [4] https://gerrit.libreoffice.org/c/core/+/138750 [5] https://codereview.qt-project.org/c/qt/qtbase/+/430157 [6] https://gitlab.gnome.org/GNOME/orca/-/blob/82c8542002e36e0d3d918088d583162d25136143/src/orca/script_utilities.py#L5155 Change-Id: I3af590c988b0e6754fc72545918412f39e8fea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-08-24tdf#150575: REPORTBUILDER: Crash when closing report when used report navigatorJulien Nabet
0 0x00007fe062bdda64 in comphelper::OSelectionChangeMultiplexer::disposing(com::sun::star::lang::EventObject const&) (this=0x55fe72b7b680, _rSource=...) at comphelper/source/misc/SelectionMultiplex.cxx:82 1 0x00007fdf90a97a6b in comphelper::OInterfaceContainerHelper3<com::sun::star::view::XSelectionChangeListener>::disposeAndClear(com::sun::star::lang::EventObject const&) (this=0x55fe6c94b6d0, rEvt=...) at include/comphelper/interfacecontainer3.hxx:362 2 0x00007fdf90a6ace4 in rptui::OReportController::disposing() (this=0x55fe6c94b200) at reportdesign/source/ui/report/ReportController.cxx:341 3 0x00007fe062539b5d in cppu::WeakComponentImplHelperBase::dispose() (this=0x55fe6c94b200) at cppuhelper/source/implbase.cxx:104 4 0x00007fe0393b76e5 in cppu::PartialWeakComponentImplHelper<com::sun::star::frame::XDispatch, com::sun::star::frame::XDispatchProviderInterceptor, com::sun::star::util::XModifyListener, com::sun::star::frame::XFrameActionListener, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo, com::sun::star::frame::XDispatchInformationProvider, com::sun::star::frame::XController2, com::sun::star::frame::XTitle, com::sun::star::frame::XTitleChangeBroadcaster, com::sun::star::awt::XUserInputInterception>::dispose() (this=0x55fe6c94b200) at include/cppuhelper/compbase.hxx:90 5 0x00007fe0393af9d3 in dbaui::OGenericUnoController::dispose() (this=0x55fe6c94b200) at dbaccess/source/ui/browser/genericcontroller.cxx:1207 See full bt here: https://bugs.documentfoundation.org/attachment.cgi?id=181994 "addSelectionChangeListener" is called when "OSelectionChangeMultiplexer" is instantiated in "NavigatorTree" ctr 225 m_pSelectionListener = new OSelectionChangeMultiplexer(this,&m_rController); but "removeSelectionChangeListener" was never called so add the mechanism to call it. Change-Id: I157b147f7a17244dbbfa7d12743fc7d48e7d5f7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138773 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-08-22Optimize and deduplicate Base64::encode a bitMike Kaganski
Change-Id: Ic549c8bf938ae363f9d1b83b8e3f4e6ee10603d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138657 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-08-19Some more use of TOOLS_WARN_EXCEPTIONStephan Bergmann
CppunitTest_dbaccess_tdf126268 had oddly failed once for me with > [_RUN_____] Tdf126268Test::testNumbers > Fontconfig error: Cannot load default config file: No such file: (null) > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:dbaccess/source/core/dataaccess/ModelImpl.cxx:765: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from! > warn:legacy.osl:4121315:4121315:comphelper/source/misc/logging.cxx:63: EventLogger_Impl::impl_createLogger_nothrow: caught an exception! > > > Fatal exception: Signal 6 > Stack: > workdir/LinkTarget/Executable/cppunittester(__interceptor_backtrace+0x5b)[0x5589724dcd5b] > instdir/program/libuno_sal.so.3(+0x62188d)[0x7fb0bba3888d] > instdir/program/libuno_sal.so.3(+0x6210a9)[0x7fb0bba380a9] > instdir/program/libuno_sal.so.3(+0x61eba6)[0x7fb0bba35ba6] > /lib64/libc.so.6(+0x3ea70)[0x7fb0baefea70] > /lib64/libc.so.6(+0x8ec4c)[0x7fb0baf4ec4c] > /lib64/libc.so.6(raise+0x16)[0x7fb0baefe9c6] > /lib64/libc.so.6(abort+0xcf)[0x7fb0baee87f4] > instdir/program/libEngine12.so(+0x3075ac9)[0x7fb029552ac9] > instdir/program/libEngine12.so(+0x3075c32)[0x7fb029552c32] > instdir/program/libEngine12.so(+0x318e53c)[0x7fb02966b53c] [...] and it might have been interesting to learn what that caught exception was. Change-Id: I3597ed22b4f02a8fa08f1cd36aa64d210e48356d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138509 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-19Consolidate writeBytes functionsStephan Bergmann
Change-Id: I44db198967a37f8b11f1b185a8b093b0de2d500d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18Drop leftover commentStephan Bergmann
...introduced by d203e3f35dc4547bb46151637ba6054d13025d01 "use comphelper::ByteWriter in UNOMemoryStream", made obsolete by 3ca1a169e571a829598a00a2ffef6e1018d2cb18 "Use boost::noinit_adaptor", forgotten to be removed in 3c7378d54b7a04e3f6dfc75a994744bdd953af7b "Fix mid-air collision" Change-Id: I0c98e2e5a9eaf5fcc6def605d6d068080de55c9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137194 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18nNewSize is guaranteed to be non-negative hereStephan Bergmann
Change-Id: Idb427a0bd3bae94f056d3253682a024169b5288f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137172 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-18comphelper::ByteWriter::writeSomeBytes always writes all bytesStephan Bergmann
...so rename it to writeBytes for clarity, and drop the redundant return value. Also clarify that it has a narrow interface and requires nBytesToWrite to be non-negative. Change-Id: I76dee83fecd6350f473f55dcffb950c16aa22d93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137169 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-08[API CHANGE] Drop css::accessibility::XAccessibleStateSetNoel Grandin
which is internal API, unused (as far as I can tell) by external users. This state is purely a bitset (as implemented by utl::AccessibleStateSetHelper) so we can just return it as a 64-bit value. This shaves significant time off the performance profiles of code that loads very complex shapes, because this state is frequently used, and we no longer need to allocate a return value on the heap for every call. Change-Id: Icf1b3bd367c256646ae9015f9127025f59459c2c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136786 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-08comphelper: replace tools::Long with size_tChris Sherlock
Change-Id: I1eba8e05bdc92fd689e368dd4fe0e79bc1f2b46f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135716 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-04tdf#137544 reduce cost of SolarMutex checkingNoel Grandin
the std::thread::id facilities are cheaper than the sal versions Change-Id: I5ccb7e54f3a1e4d715338faa1e9c0aae9449e46d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-15elide temporary string in comphelper::stripNoel Grandin
Change-Id: I093768c617490679d295cce37cc3ffe67c8e940a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135871 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-08Fix typoIlmari Lauhakangas
Change-Id: I56b36663a460eb6840968bc02e61371ace558fa7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135490 Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-06-02Use more appropriate type for LocationAccess::nOwnClassVectorIndexStephan Bergmann
Change-Id: Iba1709b60a27c331dcc6cf4e6f0966d94130a66c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135320 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02Use o3tl::make_unsigned, location is already checked to be non-negative hereStephan Bergmann
Change-Id: Id052b9628e8df6d0e8b61b66f6ddc64d925427ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02Reuse o3tl::getTokenStephan Bergmann
Change-Id: Ib8d3b3d02febc03922104a954531db6057d06783 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135318 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02Use more appropriate return type for ThreadPool::getPreferredConcurrencyStephan Bergmann
All call sites already effectively asked for an unsigned return type, including: * The ThreadPool ctor took an nWorkers argument of type sal_Int32, but internally stores that as std::size_t mnMaxWorkers. * ZipOutputStream::reduceScheduledThreadTasksToGivenNumberOrLess apparently benefits from an unsigned nThreadTasks parameter, getting rid of various casts in its implementation that were necessary to silence signed vs. unsigned comparison warnings. The only drawback is that comphelper::ThreadPool::getPreferredConcurrency() * 4 in package/source/zippackage/ZipPackageStream.cxx would now silently wrap around instead of causing UB on overflow (which could be detected with appropriate tools). Ideally, it would use some o3tl::saturating_mul if we had that, so add a TODO comment for now. While std::thread::hardware_concurrency returns unsigned, it looked more natural to go with std::size_t here, as some call sites already used that (see above), so the implementation of ThreadPool::getPreferredConcurrency is a natural place to hide clamping std::thread::hardware_concurrency() to std::size_t (in the unlikely case that std::size_t is of smaller rank than unsigned). This required addition of o3tl::clamp_to_unsigned in o3tl/safeint.hxx. Change-Id: I0a04a8b32e63ebfeb39f924c4b38520455a6fb38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135309 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-02There should be no need for a cast hereStephan Bergmann
...presumably added back in the day to avoid warnings about signed vs. unsigned comparisons with old compiler versions Change-Id: Id95e272949e48adf0e75883368cbcd421e289b33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135292 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-01fix buildRene Engelhard
add #include <optional>, since: [build CXX] comphelper/source/property/ChainablePropertySetInfo.cxx /home/rene/LibreOffice/git/master/comphelper/source/property/ChainablePropertySet.cxx: In member function 'virtual void comphelper::ChainablePropertySet::setPropertyValue(const rtl::OUString&, const com::sun::star::uno::Any&)': /home/rene/LibreOffice/git/master/comphelper/source/property/ChainablePropertySet.cxx:54:10: error: 'optional' is not a member of 'std' 54 | std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard; | ^~~~~~~~ /home/rene/LibreOffice/git/master/comphelper/source/property/ChainablePropertySet.cxx:23:1: note: 'std::optional' is defined in header '<optional>'; did you forget to '#include <optional>'? 22 | #include <comphelper/solarmutex.hxx> +++ |+#include <optional> 23 | happens since 49b9401465730b1151917bffcbc0ad1f0622fcee Change-Id: I643e7811f1ec7588ccde5453303cd57675c6165e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135252 Tested-by: Jenkins Tested-by: René Engelhard <rene@debian.org> Reviewed-by: René Engelhard <rene@debian.org>
2022-06-01no need to allocate guards on the heapNoel Grandin
Change-Id: I66491a057f082a970158504474b678dbb4decf50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135228 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-31Use more appropriate type for comphelper::internal::OPropertyAccessor::nPosStephan Bergmann
Change-Id: Ia7055dcc3832002fd10ae23a35fd08df5a98ae40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135177 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-30Use o3tl::make_unsigned, nCount is already asserted non-negative hereStephan Bergmann
Change-Id: I7213e9f2e3a5a4a785d44932900496a791b1964a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135146 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-30cid#1504574 Resource leakCaolán McNamara
make an owner for the PropertyMapEntries Change-Id: Ie915a8a312f2b24488566814ad67fdeef89b5941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135123 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-29Drop now-redundant castStephan Bergmann
...that 3ca1a169e571a829598a00a2ffef6e1018d2cb18 "Use boost::noinit_adaptor" forgot to remove Change-Id: I82818c72e9178cda7b9698d8a30e1b8f3c3d87c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135099 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-29Fix mid-air collisionStephan Bergmann
...between d203e3f35dc4547bb46151637ba6054d13025d01 "use comphelper::ByteWriter in UNOMemoryStream" and 3ca1a169e571a829598a00a2ffef6e1018d2cb18 "Use boost::noinit_adaptor" Change-Id: Ie890288485f499505184a12b0797d5fc9b877922 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135098 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-29Use boost::noinit_adaptorStephan Bergmann
Change-Id: Ide5f0394172548ed6a1ef4a6277ebf4752e685bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135094 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-26clang-tidy modernize-pass-by-value in comphelperNoel Grandin
Change-Id: I29074d801eaef57f160ce14b943b21831b327ecf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134979 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-25directly instantiate IndexedPropertyValuesContainerNoel Grandin
without the overhead of the UNO service engine Change-Id: I4a02fda2b3c92a897634374bf72cfffee4f531f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134923 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-25use comphelper::ByteWriter in UNOMemoryStreamNoel Grandin
to avoid a temporary buffer Change-Id: Ibe1d4ffb240993e14eaaddb219f9cde328f9afbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134919 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-25allow comphelper::OEnumerationByName to use a vector too for namesNoel Grandin
so we can skip some allocation. Use a std::variant to preserve existing functionality Change-Id: If01ebb04f7895fd52fa3f5d90648868fd38dc39e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134929 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-24modernize and improve PropertySetInfoNoel Grandin
(*) use o3tl::span for the array param, which means we don't need a null entry to terminate the array (*) use std::unordered_map to speed things up (*) mark the array as static at a few more call sites Change-Id: I05b6cae7552f44459e183ec05cb94e60edb3bfe0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134832 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-23comphelper: -Werror=class-memaccessMichael Stahl
Change-Id: Ia38274fac70618902f562fec657ad9cccfcf8cb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134735 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-05-22cid#1504544 deliberately Uninitialized scalar fieldCaolán McNamara
Change-Id: Idbc44ac01787f93fa5af1e5358a70590fa4cc64d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134722 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-05-20don't waste time on memset when we're just going to overwrite itNoel Grandin
Change-Id: Id01b056a28e23c55757b0b4e08a5901c76821b6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134677 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20elide temporary OUStringBuffer in INetURLObjectNoel Grandin
which requires a version of replaceAt for OUStringBuffer, which I'll put in comphelper::string:: for now Change-Id: I70b319b018e29a7dac26965dd92f6c4f9ea470ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20comphelper: fix natural string compare function + reorganize testsTomaž Vajngerl
Natural string compare function doesn't take into account that the string can start with a number and in this case it treats it like a conventional string compare. This change takes this case into account. This change also refactores the tests for NaturalStringSorter class. The previous tet used a mock XBreakIterator and XCollator implementations to test the functionallity. This is not needed as we can just use a real one instead, which makes the test more real as it actually uses a real implementation instead of a mock implementation, which could differ. This change removes the mock XCollator and XBreakIterator implementations and moves the test into a new file - NaturalStringSortTest.cxx The test is also extended with the new use case where the string starts with a number. Change-Id: I32ea055f914c2947e4d979093b32f56170a61102 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134540 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-19optimise NumberedCollection::impl_searchFreeNumber some moreNoel Grandin
Change-Id: I3740bb4f425020eb420fa6217b7c1373befa7e04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-19add ByteWriter to reduce memory copying when writing dataNoel Grandin
similarly to ByteReader move both of them down to comphelper, since we want to use it from comphelper, and comphelper is "below" unotools in the module dependency graph Change-Id: Ic98fa2268e125fd8e4378fb899ad5f97de721713 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134645 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-15don't construct SequenceAsHashMap just to extract a couple of propertiesNoel Grandin
because construcing SequenceAsHashMap requires allocating a bunch of heap objects Change-Id: I2bb1d05b23613d8c8f8a475e006b313578c18c5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134343 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-14tdf#121740 cache hashcode in SequenceAsHashMapNoel Grandin
shaves 2% off load time Change-Id: I5bd4eabf61205df21a27d2822acd2676a7732a3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134315 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-14use std::mutex in LocalProcessFactoryNoel Grandin
which much faster than osl_Mutex, and especially for this simple case Change-Id: I4e8ba221649587af76c7f7cac5f308821490980a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134300 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-14simplify constructionNoel Grandin
Change-Id: Ib8a28575fe813a909ce5429732a60ae77f92b6ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13Remove need for two typedefsStephan Bergmann
Change-Id: I8e576f0b2b417ed78e6f38b745e51cbf8b666c68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134262 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-12speed up simple use of NamedValueCollectionNoel Grandin
where instantiating and allocating a whole map just to extract a single key is way inefficient Change-Id: I55248bc71a9e8826cab9b76fa6916bfa888efa0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134226 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-12reserve space in vectorNoel Grandin
Change-Id: Ibdc882eff13b767076fc26f4c7cd7882bcb7f68d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134222 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11use better default size for UNOMemoryStreamNoel Grandin
which means we don't need to re-allocate the buffer as often Change-Id: I81678af2ed4146b94eb200324459eef7016afd06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134196 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11reserve space for bulk operations in SequenceAsHashMapNoel Grandin
reduces the number of allocations we do Change-Id: If8e61c8b0dd1942278d7adc1fa87580734aeeb99 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11cache the Sequence we return in comphelper::PropertySetInfo::getPropertiesNoel Grandin
Change-Id: If4e6e43be5d7380665e56bf95c446ff14e6a7213 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134155 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11avoid some OUString construction on some hot pathsNoel Grandin
Change-Id: I098b017d22b7a4502998a0901ddcfca08a57ee43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134115 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>