summaryrefslogtreecommitdiff
path: root/xmlhelp/source/cxxhelp
AgeCommit message (Collapse)Author
2023-11-29Extended loplugin:ostr: xmlhelpStephan Bergmann
Change-Id: Ic8247396b1cd2152cdac6e3728d1828bea6f452c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160094 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-19Extended loplugin:ostr: xmlhelpStephan Bergmann
Change-Id: I8be963a7a2befe95ce30027c3298e1a41b217d0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159663 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-26Use std::from_charsStephan Bergmann
(which also makes readInt32 report failure, instead of running into UB, when the read value is out of range) Change-Id: I8449e4fe696c9b0ab5b868127ef517dc080c31ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158489 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann
...in include files. This is a mix of automatic rewriting in include files and manual fixups (mostly addressing loplugin:redundantfcast) in source files that include those. Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-04-18xmlhelp: fix lots of deadlocksMichael Stahl
Not sure if any of this makes sense but it doesn't deadlock immediatly. (regression from comit 2c37a0ca31095165d05740a2ff4969f625b4a75b) Change-Id: I4a5e01acb06b56a78453900a143d36cad1156f21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150431 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2023-04-12loplugin:stringview whitelist getLength and isEmptyNoel Grandin
Change-Id: I38f3410c0b25ff579879b9de1f266af4d8fd51e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150256 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-10fix calls to OStringToOUStringNoel Grandin
after commit d7910847fba1694c83dc57a1f27b8eaabb2a7d85. Thanks to mike kaganski for spotting this. Change-Id: Ie7272b6f97e3b292439aedb3a163bf00ca26f852 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150181 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-09new loplugin:unnecessarygetstrNoel Grandin
which prevents constructing unnecessary temporaries via getStr() Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-09use more OStringToOUStringNoel Grandin
both because it is more obvious to read, and it takes a string_view, which is handy Change-Id: Ic201cfa0434446f51436d23c33d3f1a919ed65be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150167 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-09use more OUStringToOStringNoel Grandin
which makes it easier to pass around string_view in a few places. Change-Id: Icbbb7f56494986582f1c3272404775bd98031240 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150129 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-22fix deadlock in xmlhelper::DatabasesNoel Grandin
after commit 2c37a0ca31095165d05740a2ff4969f625b4a75b Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Tue Feb 21 15:35:20 2023 +0200 osl::Mutex->std::mutex in xmlhelp::Databases Change-Id: I3cce9bcd9c6c9d55c5162fdfd351048d16574477 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147459 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-22osl::Mutex->std::mutex in xmlhelp::DatabasesNoel Grandin
Change-Id: Icaf279275c35abbfd6408807729030f82fc5d753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147419 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-22osl::Mutex->std::mutex in ResultSetBaseNoel Grandin
Change-Id: I6f0afa46ad84782c3f7219bcb1b28d5627063bcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147418 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-12-20loplugin:implinheritancehelper in xmlhelpNoel Grandin
use more ImplInheritanceHelper to reduce boilerplate Change-Id: Ie8104d40dd13b02f19bcaf1806255446d17b25a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144443 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-29cid#1507489 Big parameter passed by valueCaolán McNamara
and cid#1507490 Big parameter passed by value Change-Id: I53a8ee3fd0312de6fecd39238eff90cfff5b3261 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137588 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-07-28clang-tidy modernize-pass-by-value in xml*Noel Grandin
Change-Id: I9bd5f6adfd138c391d76aebfe08ba01e6b3ab3bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137550 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-15use more string_view in xml*Noel Grandin
Change-Id: Ie219cb3feb98660463858d00f82f882881946ad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133072 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-03-07do not pass XComponentContext to officecfg::...::get() callsLuboš Luňák
It's used only for the ConfigurationWrapper singleton, so it's used only the first time and then ignored. It also causes calls to comphelper::getProcessComponentContext() for every single invocation despite the value not being needed, and the calls may not be cheap (it's ~5% CPU during ODS save because relatively frequent calls to officecfg::Office::Common::Save::ODF::DefaultVersion::get()). Change-Id: I02c17a1a9cb498aeef220ddd5a0bde5523cb0ffb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131056 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-11-30loplugin:stringliteraldefine in variousNoel Grandin
Change-Id: Ib482e3982128dc47d88a79478d80eef43745d1b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126086 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-30use more OInterfaceContainerHelper3 in xmlhelpNoel Grandin
Change-Id: I6271459b655d09cff595e7e6eb604d5e16a8ccc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126064 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-01Prepare for removal of non-const operator[] from Sequence in xmlhelpMike Kaganski
Change-Id: I58c6fd9abf53a9ce3b16a31e7452bb5cb895e669 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124415 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-05drop 'using namespace std' in o* r* x*Julien Nabet
Change-Id: I15d56d133cf464a3cb6483be785b1259c7f35b43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123120 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-08-03Consolidate on C++17 std::scoped_lock instead of std::lock_guardNoel Grandin
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-31osl::Mutex->std::mutex in InputStreamTransformerNoel Grandin
Change-Id: I64344b890c35d35b3d1b481436eb624183febec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119754 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-31osl::Mutex->std::mutex in TreeFileIteratorNoel Grandin
Change-Id: Ie4e102c03aef8ded29561359c58e6c78cfebbdc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119755 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-23Avoid strtol on non-NUL-terminated inputStephan Bergmann
...as could be observed with ASan and ASAN_OPTIONS=strict_string_checks=1 during e.g. UITest_conditional_format. strtol supports leading spaces, sign, and "0x", but none of that appears to be relevant here, so readInt32 doesn't support that. Hdf::m_pItData was redundant and always pointed at m_aItData.data(), and has been elided to make it more obvious that the places that used it, which now also need to use m_aItData.size(), actually use m_aItData. Change-Id: I3d4f625cd5836438271d7c1a8d2ae06f0a45a37c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119403 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-28loplugin:indentation improve checks for brace alignmentNoel Grandin
Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-24error: unknown type name 'OStringBuffer'Caolán McNamara
Change-Id: I28a4a2581e6afb02aeb137932fbf884b109e4b5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117748 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-11Simplify Sequences initializations (writerfilter/writerperfect/x*)Julien Nabet
Change-Id: I1bd31fe6cf0f8aaf4f2cfe1d3d49e61a0633f361 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117057 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-22no need makeStringAndClear() when appending to bufferNoel Grandin
it just creates an unnecessary temporary Change-Id: Ide3cd99b2ac4f2a621e5d55ce4bdc95d05430709 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114467 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-23tdf#124176 Use pragma once in x*Vincent LE GARREC
xmlhelp, xmloff, xmlsecurity Change-Id: I80c6fa806387f3dcba8be7f93fe2fef146b033e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112050 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2021-03-18tdf#88205: Use initializer_list ctor in css::uno::SequenceMani Kumar
Change-Id: I95aaefa11c733f5c020600cf13510af1bc9c0de7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112652 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-02loplugin:refcounting in xmlhelpNoel
Change-Id: I0b045ab762e946db16632637f24b06d20e294bc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111768 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-19loplugin:refcounting in xmlhelpNoel
Change-Id: Ida82bee18d0828f299db0e87ecb2faf67432dc4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-18loplugin:referencecasting add check for new rtl::Reference operatorNoel
rtl::Reference now has a conversion operator to uno::Reference, so look for places where we can simplify the code and use that. Change-Id: Ic81db50d670bed5e875300577d4bf5f3599cc2c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110798 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-11loplugin:refcounting generalise type checkingNoel
Change-Id: Ia013878ac9c2918d8eaf9aab16b291d8211e708f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110700 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-05Revert "Fix typo in code"Stephan Bergmann
This reverts commit 3ed9bba283a6a67864c0928186e277240be0d9ba. osl_Pos_Absolut (include/osl/file.h) is part of the stable URE interface; it must not be changed. Change-Id: I1f49923a9351e4be5aee39b10720d38b424feb9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110435 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-02-04Fix typo in codeAndrea Gelmini
Change-Id: Ib8b306a27d25a34e784aeeb72708b0d5d1511f3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110394 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
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-11-24loplugin:stringviewparam extend to comparison operatorsNoel
which means that some call sites have to change to use unicode string literals i.e. u"foo" instead of "foo" Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-18tdf#123936 Formatting files in module xmlhelp with clang-formatPhilipp Hofer
Change-Id: Iea20b06c8268ac67c1ae2a99fa27f5aab7ee95e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105731 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-11loplugin:stringviewNoel
Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10new loplugin:reducevarscopeNoel Grandin
Change-Id: Iefe922c2e0d605114d54673d63eccc5e4abd545d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102143 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>