summaryrefslogtreecommitdiff
path: root/comphelper
AgeCommit message (Collapse)Author
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>
2022-05-10tdf#147590 update OLE object after document refreshJuergen Funk
Regression from b099da78a6f0b3e120f706714003b05d84d11e70 we didn't update linked OLE document after document reload Change-Id: I8e52f6430f454b276cb43449c6f7a3b0e07e909f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130692 Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> Tested-by: Jenkins
2022-05-09tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroPragat Pandya
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027 Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> Tested-by: Jenkins
2022-05-07remove dead item cleanup from NumberedCollection::impl_searchFreeNumberNoel Grandin
which speeds it up a little, because WeakReferences are a little slow Change-Id: I76226b180ae4e11c4beb9e2f4ae12b05f980dcad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-07osl::Mutex->std::mutex in comphelper::GenericPropertySetNoel Grandin
Change-Id: Ifbb8e2f7e8923d7bdc333097d6f415f10670e0df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133970 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-06Only dereference iterators after checking themMike Kaganski
Was this way since commit edf11d28fafac50b6380c9372d0e6cf07a355616 Author Vladimir Glazounov <vg@openoffice.org> Date Thu Apr 24 16:27:52 2003 +0000 INTEGRATION: CWS uaa02 (1.3.44); FILE MERGED Surfaced after commit b1148c31ed2786396f0b018a988fce8288f1797d Author Noel Grandin <noel.grandin@collabora.co.uk> Date Wed Apr 27 16:47:53 2022 +0200 use more string_view in comphelper where the pointers were changed to iterators, which are checked in debug builds, failing an assertion. Change-Id: I87fce562aef8f50b94fb52ad6c2a79d2e84d6424 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133934 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-05-06tdf#128744 sw DOCX: unprotect change tracking with verificationLászló Németh
Unprotect change tracking only by password verification instead of 1) unprotecting without the password or 2) rejecting the correct password. I.e. now 1) clicking on Record changes icon of Track Changes toolbar or Edit->Track Changes->Record asks for a password, and 2) Unprotect Record changes on Security page of File->Properties... accepts the correct password with disabling record changes. Show also "Invalid password!" dialog disabling Record Changes by its icon or menu option, like Properties... dialog window does, if the password is invalid. Note: Still allow to unprotect OpenDocument export of a protected OOXML import document, because that doesn't contain the original password info, only a dummy RedlinePassword. (OpenDocument exports protect Track Changes with the simple RedlineProtectionKey configuration setting, so it's not possible to map the OOXML password info to OpenDocument without extending this.) Follow-up to commit d416250f4f1766e2d596ea3feef6a94b7adf29f4 "tdf#106843 DOCX: forbid disabling protected Record Changes". See also commit bfd7730f4cf002a79dc9c02c23286850fee3f12a "tdf#89383 DOCX import: fix permission for editing". Change-Id: Iafcf4a6b551a7e8485d4311aee889c2522526d71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133894 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
2022-05-06comphelper: cleanup test_guards, add test for ValueRestorationGuardTomaž Vajngerl
Move each test case into its own test function. Also add the missing test for ValueRestorationGuard. Change-Id: I588ab67f82ba82ef67939dac3d22438e8799ce11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133917 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-06Remove duplicated includesAndrea Gelmini
Change-Id: I137707aaad44ffe42bb4b234a59ff69e4b2ecaa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133884 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2022-05-05use more o3tl::getTokenNoel Grandin
found by inspecting call sites of OUString::getToken Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-05use more string_viewNoel Grandin
found by examining the call sites of OString::getToken which means I needed to add a new o3tl::equalsAscii function Change-Id: I7dc0ea1cf5ce8090a708d44f2cf7c938fa200c5f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in comphelperStephan Bergmann
Change-Id: Ib3edbef27c2d25dae8bac07e0199af071131170e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133839 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-03Adapt Base64::decodeSomeChars to change from OUString to std::u16string_viewStephan Bergmann
...in 9c95415de877af1430ab5b7123e11dedd0ea622c "Let comphelper::Base64::decode* take std::u16string_view" Change-Id: I42b1552fba80568b422cb60ccc99a7ab8664f2d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133711 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-30split comphelper::string::strip functions into String and view versionNoel Grandin
which is more obvious, from the perspective of the caller, and lets us avoid creating a new String if nothing needs to be stripped Change-Id: I66a980eaf4aa818251bec49bdb16c2dddb0745e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29Check iterator before dereferenceMike Kaganski
... since commit b1148c31ed2786396f0b018a988fce8288f1797d Author Noel Grandin <noel.grandin@collabora.co.uk> Date Wed Apr 27 16:47:53 2022 +0200 use more string_view in comphelper Change-Id: I182bc507b5693048350d6e54bb7b6176389e2241 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133596 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-28use more string_view in comphelperNoel Grandin
Change-Id: I1544da756d8da074787bc19a98d2740058e36479 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133520 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26add o3tl::toUInt32Noel Grandin
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26Use o3tl::make_unsigned in some placesStephan Bergmann
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I9665e6c2c4c5557f2d4cf1bb646f9fffc7bd7d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-22use more string_view in comphelperNoel Grandin
Change-Id: Ib186d2c9aa8458ddbdd14dd44e2d3938f0f26ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-20loplugin:passstuffbyrefNoel Grandin
Change-Id: I336fd329b577b6fa141265d8bc7ce67784bd7306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133210 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-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-12Remove need for OPropertyAccessor default ctorStephan Bergmann
Change-Id: Ia5ae4e28aa880600ce80bd284cde5183c49e4b40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132929 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-11loplugin:stringview add check for getToken().toInt32Noel Grandin
where we can convert that to o3tl::toInt32(o3tl::getToken( and avoid the heap allocation of a temporary string Change-Id: Ib11c19c6e6cdc0de3e551affd3578d181e292de4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132810 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-08loplugin:stringviewparam convert methods using trimNoel Grandin
for which we add a new o3tl::trim method Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-05add tools::Guid class to generate, parse GUID valuesTomaž Vajngerl
Change-Id: Ie4d8fad4d8f22c8277c22c21b7a9eb3e7c9e4f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132513 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>