239 Commits
Author SHA1 Message Date
Andrea Gelmini 2f4c240fab Fix typos
Change-Id: I739007b9f8ce1d0fa654fe14c2d15cfb5678415d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210064
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-27 11:20:33 +02:00
Andrea Gelmini 48a8b4d2bb Fix typos
Change-Id: I4def0e2e77a75e09f5c8ba065b547334d5846e95

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209812
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 15:36:46 +02:00
Jonathan Clark b19cc5a5d1 comphelper: fix replaceAt string corruption, potential buffer overflow
comphelper::string::replaceAt contained pointer arithmetic errors. In
testing, this function only worked at all in the trivial append case.
Inserting a non-empty string anywhere else in the buffer would either
only insert part of the string, corrupt the string in the buffer, or
both.

In addition to replacing the implementation, this change adds unit tests
so we can be more confident that this function works in the future.

Change-Id: I97e109dc513b08528d6d20e7dbf6eedb3040670c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205222
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-05-15 23:28:19 +02:00
Xisco Fauli 6581f7ba78 comphelper: use ScopeGuard and osl_setEnvironment
Change-Id: Idbfc8773639bda5de3c542cdaa9d68012ce8e0f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201377
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-03-11 10:46:36 +01:00
Gabor Kelemen 2ceebbe548 tdf#146619 Run IWYU on comphelper/
Change-Id: If7c9691b5531d079e80ce3115409e60777bd75f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189789
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
2025-09-12 23:56:34 +02:00
Tomaž Vajngerl aab65460f5 comphelper: Update FlagRestorationGuard test with additional cases
So we test all possibilities.

Change-Id: If2f4712b0bac41d11d845c21a3917ed3fb0b41d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189816
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-08-18 15:34:06 +02:00
Mike Kaganski 35256f5b36 Let Hash take const void* instead of const unsigned char*
It makes no sense to insist on a random type, only to reinterpret_cast
it everywhere. An opaque void fits the case perfectly.

Change-Id: If945b1c59d98c5f561350db649f29fe8036e7cdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186982
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-06-26 06:38:59 +02:00
Arnaud VERSINI 234b42d449 comphelper : use more u16string_view instead of const OUString&
Change-Id: Ie571697e63a97e7a6d306ee6f551c4bcf9aa99fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184941
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
Tested-by: Jenkins
2025-06-09 16:26:55 +02:00
Julien Nabet a399c4fae0 tdf#166241: add AES_192_CBC/AES_192_EBC
+ improve SALT management by taking the max between encryptedHashInput.size()
and comphelper::roundUp(mInfo.saltSize, mInfo.blockSize)

+ add QA tests

Change-Id: I90dce73928e0b204500ac659eb80cd1499a4f065
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184407
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-04-23 17:22:07 +02:00
Tomaž Vajngerl 8f2bf78a55 comphelper: fix test - key should be 32 bytes, not 16 bytes
Issue spotted when trying encryption and decryption with OpenSSL,
which doesn't handle the shorter keys correctly.

Also can't use the same instance of Encrypt after an attempt that
failed  (0 bytes written) as the blocks are inter-dependent and
it looks like OpenSSL already changes the state.

Change-Id: I061764e6727c7fbe600e11c5a5a6b8889d15c4e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177305
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2024-11-26 03:54:55 +01:00
Tomaž Vajngerl 5e0c670e65 comphelper: add support for AES256_ECB encryption
Change-Id: I5e8ab2a2be6ea9cd5d1ed93b70780f1f6153f3fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176892
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-26 01:36:07 +01:00
Tomaž Vajngerl 626c184f77 crypto: add AES256 test, document Encrypt, Hash conv. function
This adds AES256 test of encryption and decryption - an example
on how the Encrypt and Decrypt classes are used.

Also add a convenience function for Hash, accepting vector of
bytes as this is used in a lot of places.

Change-Id: I9b395c7afb8fac45cae8d7d8bd983f5daaafd64b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176887
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-22 07:19:30 +01:00
Mike Kaganski 1180b3473a com::sun::star -> css
Change-Id: I890ec73e30d3cc6b210903ecee29431f3cb5f635
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175979
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-10 10:50:15 +01:00
Mike Kaganski 56f3dbffdf Simplify a bit
Change-Id: I618b0f8bcb2e8032ee12367c73e1136685f66b3e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176183
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-11-08 05:34:20 +01:00
Miklos Vajna ad3f929a73 comphelper: test uno::Any parsing from JSON
Fails with commit cccbf8608f3b76651993bc8576c672367c228fa2 (feat(json):
Allow serializing any, 2024-10-16) reverted.

Change-Id: Ifd59f9921f89cc4f52a21a597f433684c715f186
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176044
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-11-05 14:19:10 +01:00
Tomaž Vajngerl c8cba8ae30 move CryptTools from oox to comphelper so we can reuse it
Also move the relevant tests and clean-up the names a bit to make
it mroe consistent.

Change-Id: I929ef9c13b954fd6a506471231d1bc41e4ef9980
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176027
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-04 21:51:32 +01:00
Tomaž Vajngerl c749c21c5a comphelper: move tostring to hash.hxx so it can be reused
tostring to convert a vector of bytes into a hex string is useful
in other tests and implementation, so move it into common hash.hxx

Change-Id: Iebc71919c6209222eb01b78c307420afddc8caca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176020
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-04 21:19:51 +01:00
Mike Kaganski 7b2ea917ce Optimize JsonToPropertyValues a bit
1. Make it take string view: helps to avoid extra string allocation
e.g. in desktop::jsonToPropertyValuesVector, and will help more,
when C++26 stringstream ctor taking string view is available.

2. Factor out a function taking boost::property_tree::ptree, making
implementation simpler for [][]com.sun.star.beans.PropertyValue and
[]com.sun.star.beans.PropertyValue, without writing a child node to
a JSON string, and parsing it again.

Change-Id: I16ac2641633ea67a7c9c054c9df09a790500e6fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175361
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-10-21 20:28:43 +02:00
Ilmari Lauhakangas 558b20d1ac comphelper, msicreator, odk: fix issues found by Ruff linter
Change-Id: I5ef65baeb0100b9d70b5c59c1d5f6f43ab951a22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171092
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2024-07-27 15:42:26 +02:00
Andrea Gelmini 061d55f8b0 Fix typo
Change-Id: I0db9bdf1d16baf52ad12591634a236e1aeab4e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167115
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-05-04 13:45:39 +02:00
Noel Grandin 86d2d8e037 try to work around clang compiler crash on macos
clang::CodeGen::CodeGenFunction::EmitAggregateStore(llvm::Value*,
clang::CodeGen::Address, bool)
(anonymous
namespace)::AggExprEmitter::VisitConstantExpr(clang::ConstantExpr*)
(anonymous namespace)::AggExprEmitter::VisitCastExpr(clang::CastExpr*)
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot)
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*)
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*,
llvm::ArrayRef<clang::Attr const*>)
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*)

Change-Id: I96ef1d95a46542d2dfa85f5c6dbfa2ec05b41302
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167045
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-03 18:32:39 +02:00
Noel Grandin 10d2f2ebf1 loplugin:ostr in comphelper
Change-Id: Ide07689bf1a68973cb176554e44e9a809d633def
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166851
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-30 10:40:14 +02:00
RMZeroFour 804caab067 tdf#146266 Move WeakBag test to gbuild system
As part of the efforts in tdf#146266 to move parts of the codebase from
the older makefile.mk build system to the newer gbuild system, this
commit migrates the WeakBag test, and cleans it up a little.

The test can now be invoked using this command:

$ make CppunitTest_comphelper_weakbag

Change-Id: I4ac3771fa23e28abd38a2dab84cacd1ae57fb70f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165591
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
2024-04-12 16:50:31 +02:00
Noel Grandin 7840effb1d use more string_view
found by tweaking the stringview loplugin

Change-Id: I92203ba99642bef7951ffa146184c5562cb31d09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163744
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-08 07:06:13 +01:00
Stephan Bergmann 79e8833305 Extended loplugin:ostr: comphelper
Change-Id: I43baf9248f607b13720da4295eb2827b3f58b3f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160126
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-29 23:23:45 +01:00
Stephan Bergmann 5ac4adaf02 Extended loplugin:ostr: comphelper
Change-Id: I338c3c263e940bbe6071827b2e19763b7dadc2e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159723
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-20 08:31:47 +01:00
Noel Grandin 41d9584179 'new Double' is deprecated in Java
replace with Double.valueOf

Change-Id: If5be8e500e31ebf9d5fb20ea7dd474677d7c74ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158785
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-11-02 12:00:34 +01:00
Stephan Bergmann e0c33ec15f loplugin:ostr: automatic rewrite
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2023-10-07 00:47:20 +02:00
Stephan Bergmann 4f3a5acac5 Remove unused comphelper::adjustIndexToStartOfSurrogate
...introduced in 28cc0bff10 "Break
comphelper::adjustIndexToStartOfSurrogate out of o3tl::iterateCodePoints" in
preparation for bd5c358258 "a11y: Fix returning
unpaired surrogates when retrieving characters", but which never picked it up

Change-Id: I5a10a3053d2f51333e27b74a808a41df7c1912ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152183
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-24 11:05:47 +02:00
Stephan Bergmann 28cc0bff10 Break comphelper::adjustIndexToStartOfSurrogate out of o3tl::iterateCodePoints
...as what they do is orthogonal (and it turned out that the use case that
motivated the addition of o3tl::iterateCodePoints in the first place needs them
independently, anyway)

Change-Id: Id33901a2f7ac627253654ee6d883305dcf5a456f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151415
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-05-05 11:30:12 +02:00
Chenxiong Qi 6f112bd40f tdf#97362 Convert comphelper SequenceOutputStreamUnitTest to Python
Signed-off-by: Chenxiong Qi <qcxhome@gmail.com>
Change-Id: I72826fc8180fcb147ff84b10b88c16a4084799ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145690
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-31 12:18:47 +00:00
Miklos Vajna 1e83197fdd comphelper: support property values arrays in JsonToPropertyValues()
Needed for an uncoming .uno:TextFormFields uno command where one of the
parameters has the []com.sun.star.beans.PropertyValues type at an UNO
level, and we can't provide JSON at the moment that would express that.

Change-Id: I288a540b2fcac0e5a4a82bca235199c559ba2d0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143302
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2022-11-25 17:52:36 +01:00
Stephan Bergmann 50d73574b6 Related tdf#104597, tdf#151546: Introduce comphelper::string::reverseCodePoints
69e9925ded "sdext.pdfimport: resolves tdf#104597:
RTL script text runs are reversed" and f6004e1c45
"tdf#151546: RTL text is reversed (Writer pdfimport)" had introduced two calls
to comphelper::string::reverseString into sdext.  That function reverts on the
basis of individual UTF-16 code units, not on the basis of Unicode code points.
And while at least some pre-existing callers of that function want the former
semantics (see below), these two new callers in sdext apparently want the latter
semantics.  Therefore, introduce an additional function
comphelper::string::reverseCodePoints with the latter semantics.

I identified three other places that call comphelper::string::reverseString:
* SbRtl_StrReverse in basic/source/runtime/methods1.cxx apparently implements
  some StrReverse Basic function, where a (presumably non-existing) Basic spec
  would need to decide which of the two semantics is called for.  So leave it
  alone for now.
* SvtFileDialog::IsolateFilterFromPath_Impl in fpicker/source/office/iodlg.cxx
  reverts a string, operates on it, then reverts (parts of) it back.  Whether or
  not that is the most elegant code, using the latter semantics here would
  apparently be wrong, as double invocation of
  comphelper::string::reverseCodePoints is not idempotent when the input is a
  malformed sequence of UTF-16 code units containing a low surrogate followed by
  a high surrogate.
* AccessibleCell::getCellName in svx/source/table/accessiblecell.cxx apparently
  always operates on a string consisting only of Latin uppercase letters A--Z,
  for which both semantics are equivalent.  (So we can just as well stick with
  the simpler comphelper::string::reverseString here.)

(Extending the tests in comphelper/qa/string/test_string.cxx ran into an issue
where loplugin:stringliteralvar warns about deliberate uses of sal_Unicode
arrays rather than UTF-16 string literals wrapped in OUStringLiteral, as those
arrays deliberately contain malformed UTF-16 code unit sequences and thus
converting them into UTF-16 string literals might be considered inappropriate,
see the newly added comment at
StringLiteralVar::isPotentiallyInitializedWithMalformedUtf16 in
compilerplugins/clang/stringliteralvar.cxx for details.  So that loplugin had to
be improved here, too.)

Change-Id: I641cc32c76b0c5f6339ae44d8aa85df0022ffb05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142949
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-18 19:50:28 +01:00
Stephan Bergmann 6d2a9697c9 Remove unused comphelper::string::reverseString overload
Change-Id: Ic1c56c7be9804685fd37b8f6a13aaab039e07afa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141361
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-14 14:22:55 +02:00
Stephan Bergmann b4163877e7 Use more appropriate return type for ThreadPool::getPreferredConcurrency
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-02 17:13:17 +02:00
Stephan Bergmann beb19b0a60 There should be no need for a cast here
...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-02 11:22:41 +02:00
Tomaž Vajngerl 09822cf77c comphelper: fix natural string compare function + reorganize tests
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-20 01:19:41 +02:00
Tomaž Vajngerl 1ad2fe6830 comphelper: cleanup test_guards, add test for ValueRestorationGuard
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-06 10:50:25 +02:00
Stephan Bergmann eae2e1d6d6 Just use Any ctor instead of makeAny in comphelper
Change-Id: Ib3edbef27c2d25dae8bac07e0199af071131170e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133839
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-04 22:30:38 +02:00
Noel Grandin b1148c31ed use more string_view in comphelper
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-28 13:40:36 +02:00
Noel Grandin 5de2437551 use string_view in comphelper::string::split
Change-Id: I4afe8aee85905ee35ba195b00b454aefa0ba38af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132486
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-04 13:48:11 +02:00
Mike Kaganski 9c95415de8 Let comphelper::Base64::decode* take std::u16string_view
Change-Id: I5b04f7adf11c61f52b7bfb0f52c8c075f838f0f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127480
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-26 23:09:20 +01:00
Noel Grandin 9366a40b7e add unit tests for OInterfaceContainerHelper3
Change-Id: I2baf512a3b5edd3ce29e302e444dfa5e65724613
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127007
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-18 20:50:34 +01:00
Noel Grandin a214369f14 loplugin:unusedvariablecheck improve
to find unused smart pointer variables

Change-Id: I200bdd8949032a0e061de61f7903a156651793e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127006
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-17 15:02:00 +01:00
Stephan Bergmann 5e8479a38f Remove a std::remove_reference_t
...which is unnecessary (short of dubious explicit invocations like
`makePropertyValue<int const &>(i)`) as T can never be deduced to be a reference
type there.  And add some test code (that also tests the bit-field scenario
mentioned in the commit message of 23cded985b
"Specialize comphelper::makePropertyValue for arithmetic types").

Change-Id: If41ce20ab643041dd9721d05373eeb32fd099ead
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123805
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-19 15:12:35 +02:00
Mike Kaganski 8a017d25a6 Avoid COW overhead using css::uno::Sequence
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-14 06:00:49 +02:00
Noel Grandin 8618707dd9 tsan:data race in ThreadPoolTest::testWorkerUsage
Change-Id: Id63b9f1dd7ed163236837258e8dbad2feb9f1c5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119695
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-30 11:33:31 +02:00
Tor Lillqvist 90df123cd9 The Chrome Trace Event viewer doesn't support nested async events
Instead of nestable b(egin) and e(nd) events, generate the allegedly
deprecated S(tart)' and F(inish) events.

Makes the code simpler. (And AsyncEvent is still unused. Unclear
whether adding it was based on a misunderstanding.)

Change-Id: Ic029b67e0951dda775c0d0af009f2e431ae55e53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117700
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-06-23 13:34:50 +02:00
Tor Lillqvist f0a8d47aec Fix syntax error in the "arguments" of a TraceEvent
Change-Id: I68f94311d3e0527955b6ad8d5b49e4e564329e1e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116054
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116848
Tested-by: Tor Lillqvist <tml@collabora.com>
2021-06-09 13:53:49 +02:00
Tor Lillqvist 6038c9125b Add the possibility to include a set of arguments in Trace Events
Change-Id: I55720baf64bd9b719026c94e4373b6368a1a7106
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116847
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-06-09 13:49:31 +02:00