summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)Author
2021-11-23O[U]String::replaceAt overloads that take string_viewNoel Grandin
which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-17Use C++17 hex-exponent floating point literalsMike Kaganski
... instead of some calculated/hardcoded decimal literals. The new syntax represents the power of 2 exponent directly. Change-Id: I826bda6e06ec77f0706bb48abe2934f7289fddc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125359 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-14rtl::Static->thread-safe static in salNoel Grandin
Change-Id: I04f8a05aaa078642ee5e55c777b9b259c089695b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125197 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-11Drop the OUString vs. OUStringLiteral comparison operator overloadsStephan Bergmann
...which can be subsumed by their OUString vs. OUString counterparts now that conversion from OUStringLiteral to OUString is cheap since e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString". (The only place that needed adaption was the dubious use of temporary OUStringLiteral instances in sal/qa/rtl/strings/test_oustring_stringliterals.cxx, which now caused "error: conversion function from 'rtlunittest::OUStringLiteral<6>' to 'const rtlunittest::OUString' invokes a deleted function".) Change-Id: I4f0f96efa2d5331ed5cbc9a29bdfdf3c0f4148a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125020 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-23move access inside mutex guardLuboš Luňák
Change-Id: I784fbc3b39a645c7984aa836cc32980343ddd1f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124095 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22fix std::unique_lock unlockingLuboš Luňák
std: :unique_lock::release() does not unlock. Change-Id: Ida5a28a8b1c275a0a702121bf00faeaf76a57426 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124063 Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org> Tested-by: Jenkins
2021-10-22prefer llvm-addr2line to addr2line for backtraces if possibleLuboš Luňák
It's faster, and at least when compiling with Clang it should work fine. Change-Id: I474857c2a54b8032b74202ccd5c67d25f6062790 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124055 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22revert part of "Simplify vector initialization in sal"Luboš Luňák
This first allocates space based on the two items, and only afterwards it reserves space for all items, possibly allocating again. This partially reverts commit 8546cdb2ad25b03ac152615357cab00 . Change-Id: I8668cb03881766fc5078ab5e411efe56e6f3009e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124054 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22cache negative addr2line hitsLuboš Luňák
Otherwise we'd be trying to resolve unknown symbols repeatedly. Change-Id: I1c1eb9f97a1f64436ad0858ceff75fa29343979a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124053 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-22Optimize assignment from OUStringLiteral to OUStringStephan Bergmann
...by making the OUString's pData point to the OUStringLiteral, instead of copying the contained characters. This is one of the improvements that had not been done as part of e6dfaf9f44f9939abc338c83b3024108431d0f69 "Turn OUStringLiteral into a consteval'ed, static-refcound rtl_uString": "To keep individual commits reasonably manageable, some consumers of OUStringLiteral in rtl/ustrbuf.hxx and rtl/ustring.hxx are left in a somewhat odd state for now, where they don't take advantage of OUStringLiteral's equivalence to rtl_uString, but just keep extracting its contents and copy it elsewhere. In follow-up commits, those consumers should be changed appropriately, making them treat OUStringLiteral like an rtl_uString or dropping the OUStringLiteral overload in favor of an existing (and cheap to use now) OUString overload, etc." (Simply dropping the OUStringLiteral overload was not possible in this case, though, as that would have lead to ambiguities among the various OUString and std::u16string_view overloads.) The now-deleted OUStringLiteral rvalue reference overload means that some existing assignments from ternary-operator OUStringLiteral<N> to OUString no longer compile and had to be replaced with uses of std::u16string_view. Those had not already been replaced in e6dfaf9f44f9939abc338c83b3024108431d0f69 because they happened to use OUStringLiteral instances of identical length N in both arms of the ternary operator, so did not already start to fail to compile back then. Change-Id: I328e25b8324d045774e811d20a639f40d6a9a960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124040 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-18Noop unify style for branchesEmanuel Schorsch
Change-Id: Ifa96b7f273f7c154fdd267efba7271765ff7ae45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123728 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-16Simplify vector initialization in salJulien Nabet
Change-Id: Ia3e4dd8cad79b156d44eb03f1ae3d308204df2e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123691 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-10-15NoOp refactor to make elif clearerEmanuel Schorsch
Change-Id: I05be42fde3f2b66d20c337583d8f8f92143bcb58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123032 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-10OSL : remove useless rtl::Static in debugbaseArnaud Versini
Change-Id: I54ef4d1b492409265496c7f2b852568274bcf073 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-10OSL : use std::mutex in backtraceapiArnaud Versini
Change-Id: I2df73d7959dd24882f75130f0fd03ff096dce8d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123322 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-05Optimize the whole range of getN10Exp over IEEE 754 doublesMike Kaganski
Needs 5056 bytes of pre-calculated data. Change-Id: I138d9dc80c176f675a6854fe906e235c98efcbc0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122947 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-04Use isRepresentableInteger hereMike Kaganski
Change-Id: I8ba202232fa42765a8b04113639fdac4b5724aa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122941 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-03A more lightweight O[U]StringConcatenationStephan Bergmann
...compared to a full-blown O[U]String, for temporary objects holding an O[U]StringConcat result that can then be used as a std::[u16]string_view. It's instructive to see how some invocations of operator ==, operator !=, and O[U]StringBuffer::insert with an O[U]StringConcat argument required implicit materialization of an O[U]String temporary, and how that expensive operation has now been made explicit with the explicit O[U]StringConcatenation ctor. (The additional operator == and operator != overloads are necessary because the overloads taking two std::[u16]string_view parameters wouldn't even be found here with ADL. And the OUString-related ones would cause ambiguities in at least sal/qa/rtl/strings/test_oustring_stringliterals.cxx built with RTL_STRING_UNITTEST, so have simply been disabled for that special test-code case.) Change-Id: Id29799fa8da21a09ff9794cbc7cc9b366e6803b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-02Some corner case unit testsMike Kaganski
Change-Id: I43474265a9b3e1d07394c5f7e429e081d67f2eda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122935 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Simplify the code a bit to clarify the logicMike Kaganski
Change-Id: I80201148684f6e297ff0c880c0dbbc346129a557 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122864 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Add unit test to catch eae24a9488814e77254d175c11fc4a138c1dbd30Mike Kaganski
Change-Id: I18b98f4be3212199004a1bb8fd8725fe71254ec4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122870 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Calculate buffer size correctlyMike Kaganski
A mistake in eae24a9488814e77254d175c11fc4a138c1dbd30 Change-Id: I0da64366e4c39b3f5559e8a1c757a94d811f041f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122869 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Consider leading minusMike Kaganski
An overlook from commit be8da97976658ff19b4dd010bff328cd3f424c1b Change-Id: I2f639a9d865b43b38e19ad35a0a9e6b5bc1c1c8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122863 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Use std::memmove instead of loopMike Kaganski
Change-Id: Ia88ceaaad700bf3c2c8db9bb19146b75146dad3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122861 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Drop static_cast syntactic noiseMike Kaganski
Change-Id: I699f22aac871fdcef9ee9326ac30091239fa02be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122862 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01Always use buffer on stackMike Kaganski
Change-Id: I39ed2485a67ec7a8b24ab90ea0d69a5982374334 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122860 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-01loplugin:nullptr (clang-cl)Stephan Bergmann
Change-Id: I47ac4ff7d82eb5732ad54e3b42c18c3665c83b82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122845 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30-Werror,-Wformat (clang-cl)Stephan Bergmann
> sal/cppunittester/cppunittester.cxx(553,115): error: format specifies type 'unsigned int' but the argument has type 'ULONG64' (aka 'unsigned long long') [-Werror,-Wformat] > printf("\tat %s in %s: line: %lu: address: 0x%0X\n", pSymbol->Name, line->FileName, line->LineNumber, pSymbol->Address); > ~~~ ^~~~~~~~~~~~~~~~ > %0llX > sal/cppunittester/cppunittester.cxx(558,64): error: format specifies type 'unsigned int' but the argument has type 'ULONG64' (aka 'unsigned long long') [-Werror,-Wformat] > printf("\tat %s, address 0x%0X.\n", pSymbol->Name, pSymbol->Address); > ~~~ ^~~~~~~~~~~~~~~~ > %0llX > sal/cppunittester/cppunittester.cxx(576,50): error: format specifies type 'unsigned int' but the argument has type 'DWORD' (aka 'unsigned long') [-Werror,-Wformat] > printf("*** Exception 0x%x occurred ***\n\n",ex->ExceptionRecord->ExceptionCode); > ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > %lx ...but where SYMBOL_INFO::Address is documented to be of type ULONG64, which in turn is documented to be a typedef for unsigned __int64, for which there is the MSVC-extension I64 format specifier Change-Id: Ibed1d3fa49ac6fd988174c6041071292fc66dd3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122872 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:sallogareas (clang-cl)Stephan Bergmann
Change-Id: I6a529d2eb737d284bf1e9c1857680c33581f5e0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122846 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:external (clang-cl)Stephan Bergmann
Change-Id: I71be097d5051d39295f9f85d3e2329564388b4c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122851 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:cstylecast (clang-cl)Stephan Bergmann
Change-Id: I2c68832a23d80dbe208212ce36b14b21b5312f5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122850 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:unusedcapturedefault (clang-cl)Stephan Bergmann
Change-Id: Ib7b3bfb7a3162e032cf6c9bf7f19576434592a00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122849 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:includeform (clang-cl)Stephan Bergmann
Change-Id: Ia374fe0a7a0392e91821fecd1e6ee5917864d59c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122848 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30loplugin:fakebool (clang-cl)Stephan Bergmann
Change-Id: I48ee1c1906ab06a487059128eb1eba0d6adb068f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122847 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-30Simplify comparisons in the loopMike Kaganski
Change-Id: I9963a527d2323f4df8c3b46c13f5b7993e22f163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122855 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-30Add a test for a negative integerMike Kaganski
Change-Id: I368123ce4ffdfb0e5c47e80cf4fece0c6ddc5f9d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122854 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-30Avoid reversing the bufferMike Kaganski
Fill it in the correct order, starting from the middle Change-Id: Id35475e391d771d6c23252124a92825b24b55e0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122853 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-29Use std::reverse instead of swapping in a loopMike Kaganski
Change-Id: Iee8966eeeaea461e34b5d22b80cb612dfaa57fe4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122750 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-29Simplify integer roundingMike Kaganski
Change-Id: I09ab406a8b7279801ce79b2f9c0a0011f6db05be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122749 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-20use clang-cl's -Zc:dllexportInlines- for clang-cl buildsLuboš Luňák
This is clang-cl's equivalent of -fvisibility-inlines-hidden, and it seems to be also sort of the equivalent of MSVC's -Zc:inline. So it saves build time and disk space. Clang docs say that this is binary compatible in only one direction, so our public C++ code shouldn't be using this, as external C++ code could try to use exported inlines that are no longer there. Change-Id: Ie6217808f8ee4a15344183abfc65038e1558d1b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122352 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-17Drop this unneeded indirectionMike Kaganski
Change-Id: I6b40642c7574a1863658854d206ed849517dbd0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122130 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-13loplugin:simplifypointertoboolStephan Bergmann
Change-Id: I0186e8f1566ec2e4cec768cc18bdeba0bae182b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122033 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-09-10clang:optin.performance.Padding in salNoel Grandin
warning: Excessive padding in 'struct ImplTextEncodingData' (8 padding bytes, where 0 is optimal). warning: Excessive padding in 'struct ImplByteConvertData' (10 padding bytes, where 2 is optimal). warning: Excessive padding in 'struct ImplDBCSConvertData' (10 padding bytes, where 2 is optimal). warning: Excessive padding in 'struct DirectoryItem_Impl' (11 padding bytes, where 3 is optimal). Change-Id: Ia19f192099c305734256103c7cdc0f64e398b6af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121902 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-07prepend #<num> to frames in unx backtracesLuboš Luňák
To make complex backtraces readable. Change-Id: I3a95d03d97c8e6d1aa7aeab37957d3b8441c3c90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121724 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-06also cache addr2line resultsLuboš Luňák
Change-Id: Ib4351ba7a585ada3887f1cbeb5d676733250598b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121585 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-06group addr2line calls per binary for better performanceLuboš Luňák
Change-Id: Ifc655e4d5e2f3eb934b407e146ee564e3db0146b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121584 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-06improve sal::backtrace_get() by using addr2line in debug buildsLuboš Luňák
The backtrace_symbols() function provides backtraces that often miss many function names, try harder to resolve them, using addr2line is the best (only?) working solution I've found. Change-Id: Ieda06fc52735596e499fb7f9443cae13d134da5c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121539 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-03log PATH length and content when complaining about itCaolán McNamara
Change-Id: I54495044f2bd487eb9315c7a974b9859b26235a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121588 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-09-01use a dummy clipboard when running unit testsNoel Grandin
so the multiple unit tests don't stomp on each other. This fixes a couple of things in my earlier attempt (*) actually set the env variable on Windows (*) don't use a global variable to test the env var, because that variable might be initialised BEFORE the env var is actually set Change-Id: Id43a1dd2fbd324691e0b6578c9026b8a523012e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121436 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-27Fix this FIXMEMike Kaganski
Change-Id: I4449d3c87adbcb94c721799aa6de1d615eb7041f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121070 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>