summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)Author
2024-04-03Allow custom "eye catcher" from LO_TESTNAME in tempfiles on WindowsMike Kaganski
Change-Id: Id8d94af9e03d0c8553d0a7949e4a9259159481cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165732 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-26No need to define ETIMEStephan Bergmann
(which is an obsolescent XSI-STREAMS Posix extension). It's only use is in the big switch in UnixErrnoString in sal/osl/unx/uunxapi.cxx, so if any platform should actually lack it, we should rather #ifdef its use there than introduce it here. (This started to cause > sal/osl/unx/system.hxx:190:12: error: macro 'ETIME' has been marked as deprecated: ETIME is deprecated in ISO C++ [-Werror,-Wdeprecated-pragma] > 190 | # ifndef ETIME > | ^ > ~/llvm/inst/bin/../include/c++/v1/cerrno:51:67: note: macro marked 'deprecated' here > 51 | # pragma clang deprecated(ETIME, "ETIME is deprecated in ISO C++") > | ^ with recent LLVM 19 trunk on macOS now.) Change-Id: I01a586f08a4d9e4643c797fce5ce53c5f3ce8b81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165303 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-26Silence -Wdeprecated-pragmaStephan Bergmann
...as seen with recent LLVM 19 trunk on macOS now, > In file included from sal/osl/unx/uunxapi.mm:1: > sal/osl/unx/uunxapi.cxx:612:14: error: macro 'ENOSTR' has been marked as deprecated: ENOSTR is deprecated in ISO C++ [-Werror,-Wdeprecated-pragma] > 612 | case ENOSTR: > | ^ > ~/llvm/inst/bin/../include/c++/v1/cerrno:48:69: note: macro marked 'deprecated' here > 48 | # pragma clang deprecated(ENOSTR, "ENOSTR is deprecated in ISO C++") > | ^ etc. (And -Wdeprecated-pragma was only added towards Clang 14 with <https://github.com/llvm/llvm-project/commit/26c695b7893071d5e69afbaa70c4850ab2e468be> "Support macro deprecation #pragma clang deprecated", so wrap it in __has_warning.) Change-Id: I8db1f00a48bb647573d287c3410137182570f82b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165304 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-25Best effort to create directories of SAL_LOG_FILEStephan Bergmann
Change-Id: Ia86ac0e022579d155e92de3b853d57860b5b97e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165272 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-25Avoid -Werror,-Wcast-function-type-mismatchStephan Bergmann
Change-Id: I93a69c57856169aeff613e34d5c0bf7fa08a0de7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165251 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-21Use consistent conditions in code and makefileStephan Bergmann
24b06b9c6bdb777dff385b0fbfc81d55d3d013a1 "log access violation on windows tinderboxen" introduced C++ code into sal/cppunittester/cppunittester.cxx that is conditional on "#if defined(_DEBUG)" (which is defined iff $(MSVC_USE_DEBUG_RUNTIME) is TRUE, see the setting of -D_DEBUG in solenv/gbuild/gbuild.mk), and it introduced this corresponding makefile code which should thus use the same condition. Change-Id: I62fca71e31ed9215984572dc6a2e05be41651b15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165080 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-18use our internal backtrace API for signal faultsNoel Grandin
so we get nice stacktraces with function names and line numbers on jenkins Change-Id: Id1bfee014d713ead501e5164e5206d9189ec72a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-13Support environment variable expansion in logging.iniStephan Bergmann
The syntax is a stripped-down subset of what is available for variable expansion in bootstrap ini-files: It only supports "${name}", to be replaced with the contents of an environment variable of that name (which itself is not expanded further). If no such environment variable exists, it is replaced with the empty string. If the name contains a NUL character, or if there is a syntax error (i.e., missing opening or closing curly brace), the corresponding text is left unchanged. Also, backslash quoting is supported to allow for verbatim, uninterpreted "${name}" content. But logging.ini is typically used to specify Windows-style LogFilePath=C:\log.txt pathnames containing backslashes, so restrict backslash quoting to just "\$" (replaced with "$") and "\\" (replaced with "\"), and leave all other backslashes alone. (It is not possible to reuse the bootstrap macro expansion code here, as that would cause recursive dependencies. Therefore, this only implements this stripped-down subset.) Change-Id: I8c949a1637a7f14e0672a9cc1c79014edfa336bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164759 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Avoid mentioning Glibc-internal type __fsword_tStephan Bergmann
...and clean up the use of macros here Change-Id: Iede9ff705992d5e229b44b48cd88f5b495f6cee4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164571 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08Blind fix for Linux 32-bit buildsStephan Bergmann
...which, according to <https://lists.freedesktop.org/archives/libreoffice/2024-March/091666.html> "32 bit build failure (smb, narrowing)", started to fail with > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx: In function ‘void osl_file_adjustLockFlags(const rtl::OString&, int*, sal_uInt32*)’: > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:71:26: error: narrowing conversion of ‘4283649346’ from ‘unsigned int’ to ‘int’ [-Wnarrowing] > 71 | #define CIFS_SUPER_MAGIC 0xFF534D42 > | ^~~~~~~~~~ > /<<PKGBUILDDIR>>/sal/osl/unx/file.cxx:795:14: note: in expansion of macro ‘CIFS_SUPER_MAGIC’ > 795 | case CIFS_SUPER_MAGIC: > | ^~~~~~~~~~~~~~~~ etc. My Fedora 39 "Linux man-pages 6.05" statfs(2) man page explains about the struct statfs f_type field of __fsword_t type: "The __fsword_t type used for various fields in the statfs structure definition is a glibc internal type, not intended for public use. This leaves the programmer in a bit of a conundrum when trying to copy or compare these fields to local variables in a program. Using unsigned int for such variables suffices on most systems." But the underlying __FSWORD_T_TYPE looks like it is actually defined as a signed type in /usr/include/bits/typesizes.h. Change-Id: Ida3ae84031c4e48b0d6e69d76b66b4e4facfa1ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164561 Tested-by: René Engelhard <rene@debian.org> Reviewed-by: René Engelhard <rene@debian.org> Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-05Missing include (for free)Stephan Bergmann
Change-Id: I2dbf6d8894368d93bbed8c2bdf09f978196c6aa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164427 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-29Simplify a bitMike Kaganski
Change-Id: I90e26030cb7a002bfd76cbc7aa73a5d3ea7a7f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164132 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29Use <bit> instead of platform-specific intrinsicsMike Kaganski
Change-Id: I79636ff9c3b2fe601b0b3c94a111b36af0011775 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164131 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29Drop redundant code: this is handled belowMike Kaganski
And use standard functions in the rtl_math_RoundingMode_HalfEven handler. Change-Id: If9f29aa63423db9457a02ed003cfc27cf3df5585 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164104 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-27tdf#158190 Fix Calc ROUND in floating-point calculate result very close to X.5Po-Yen Huang
Location: if (nDecPlaces == 0) { switch (eMode) { case rtl_math_RoundingMode_Corrected: return std::round(fValue); Because the functions are the same as the following related codes, they are respectively: if (nDecPlaces >= 0 && (fValue >= 0x1p52 || isRepresentableInteger(fValue))) return fOrigValue; as well as: if (fValue < 0x1p52) { switch(eMode) { case rtl_math_RoundingMode_Corrected: fValue = rtl::math::approxFloor(fValue + 0.5); break; : : : Because some double-precision floating point numbers cause std::round(fValue) and rtl::math::approxFloor(fValue + 0.5) to produce different results. For example, enter 10614.4999999999876 in Calc's A1 cell (or any operation that will produce a long decimal number such as .499999999999xyz after the decimal point). We expected it to be 10614.4999999999876, but it was automatically rounded to 10614.5 (note: this result is also the result of ubiquitous handheld computers, OpenOffice.org and Excel) Then, entering =ROUND(A1,0) in B1, we will see 10614, A1 and B1 clearly don't meet expectations. (My boss or tax collector might be unhappy :-p) Although A1's 10614.4999999999876 is still faithfully recorded, the rendering of 10614.5 is confusing. Now, there are two views: 1. According to the established convention, B2 displays the expected answer 10615. or 2. True to the laws of mathematics, A1 displays 10614.4999999999876 or at least 10614.49 Although the second point of view is correct (and I completely agree with it), when opening spreadsheets generated by other software (such as OpenOffice.org or Excel), the results will be different, which people do not like to see. So when nDecPlaces == 0 is removed, use std::round(fValue) and let the existing code below it do the rounding: if (fValue < 0x1p52) { switch(eMode) { case rtl_math_RoundingMode_Corrected: fValue = rtl::math::approxFloor(fValue + 0.5); This is consistent with the first point. By the way, in nDecPlaces == 0 case rtl_math_RoundingMode_HalfEven: This piece of code can be checked to see if it is really necessary, because rtl_math_round() also has the same purpose code. If it is not needed, the entire nDecPlaces == 0 can be removed. Co-authored-by: Firefly <firefly@ossii.com.tw> Co-authored-by: Franklin Weng <franklin@goodhorse.idv.tw> Change-Id: If32cdb18c70ec0025c83ba25a99e5d135d66aec9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159193 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Simplify a bitMike Kaganski
Change-Id: I660631d43230d9fcc58c405be5138e7d0b7605fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163928 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Define a name for the extended path buffer size, instead of a literalMike Kaganski
Change-Id: If6d40c818e021b3241d6b6b33aceca07c6393511 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163926 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-26Use filesystem::path to avoid MAX_PATH limitationMike Kaganski
And use a buffer of 32767 characters, which is the approximate maximum of Windows API, as documented in https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation Change-Id: I7b5329d48c936ce0090f0c7908a9d08b56b5a734 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163918 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Simplify a bitMike Kaganski
Change-Id: Icc7589bdf5d2e3d061dfa3d34761316d9e9323be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163653 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-20Move some stuff from path_helper to file_dirvol, and simplifyMike Kaganski
Change-Id: Ic9dcff74c16e5f9c107ca060a3d22866f552c398 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163632 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-19Drop obsolete commentsMike Kaganski
They seem to have never been useful, ever since commits 4e093f7f3404d09ee302b119190a968f4f109427 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03) and 0318a882ecfa17030bcccbc05d6c34e3293b0ef2 (INTEGRATION: CWS sal05 (1.1.2); FILE ADDED, 2004-02-03). Change-Id: Ia68ee2f6facd9b64a098c630c3fed0d227e92e2b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163587 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-18tdf#55004 Fix backup copy creation for files on mounted samba sharesKevin Ottens
There is an unfortunate interaction between file locking and backup creation at save time. openFilePath has logic to lock a file when opening. This goes through fcntl to set a write lock on the file. Later on, when the user wants to save changes, a backup copy might be created (very likely now since this is the defaults in the settings). To create this backup, the file is opened again for reading. Unfortunately this open call fails due to the lock (even though it is a write lock). This commit changes the behavior. osl_file_adjustLockFlags now checks if the file is on a mounted samba share. If that's the case we force the osl_File_OpenFlag_NoLock flag. No issue is then exhibited at backup creation, allowing the save to proceed properly. Change-Id: Ieab252f9f68598834e13339fc5fcea440f0a4c2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162935 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-13Fix mis-merge from 8b53fa726e0d496f18228b0ca9ce2f61196f6a57Stephan Bergmann
"Introduce a fundamental.override.ini for bootstrap variables" Change-Id: I88f11e422d98100bafd6fd9a7ab5e892dcc3fb46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163292 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-12Log uses of fundamental.override.iniStephan Bergmann
Change-Id: I36fa44b063a439edf5411a89f76ec342b1388351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162601 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> (cherry picked from commit 6d553405101090ef7a7ff5270e5ef32aa41bd9b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163254 Tested-by: Jenkins
2024-02-12Introduce a fundamental.override.ini for bootstrap variablesStephan Bergmann
...that is looked for next to the application and, when present, overrides all the other ways of setting bootstrap variables. LibreOffice itself does not bring along such a fundamental.override.ini, but it can be convenient for an administrator to place one in the installation (which can then not be modified or overridden by end users). (For convenience, the naming of this ini-file starts to deviate from the old and rather pointless tradition of naming our ini-files *rc vs. *.ini on different platforms.) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162187 Tested-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> (cherry picked from commit f4d376e9a10a8c66f7f6ecfe6a1f4763c1927b52) Conflicts: sal/rtl/bootstrap.cxx Change-Id: I057cc67b1af1d806587c3a4dc0bc31c28e79d22b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163251 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-11tdf#155710 handle conversion failures due to non-UTF8 stringsPatrick Luby
Windows and Linux paths can be passed as parameters to this function and those paths may not always be UTF8 encoded like macOS paths. Change-Id: I83f5ab491d3c0ddd938e512fbab3213af9ea16fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163223 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com>
2024-02-11osl_get_system_random_data should return boolStephan Bergmann
Change-Id: I29535d3562fe1b8d05b8df1d6c9ab83e4ead0f74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163227 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-07sal: rtlRandomPool: require OS random device, abort if not presentMichael Stahl
Both rtl_random_createPool() and rtl_random_getBytes() first try to get random data from the OS, via /dev/urandom or rand_s() (documented to call RtlGenRandom(), see [1]). In case this does not succeed, there is a fallback to a custom implementation of a PRNG of unknown design that has never been substantially changed since initial CVS import, and is presumably not what would be considered state of the art today, particularly if there's no actual entropy available to seed it. Except for a few miscellaneous usages in URE (presumably to avoid dependencies on non-URE libs), rtlRandomPool is almost always used to generate material for encryption of documents, which is demanding and probably beyond what a pure user-space PRNG implementation without entropy from the OS can provide. So remove the custom PRNG and instead abort() if reading from the OS random device fails for whatever reason. rtl_random_addBytes() becomes a no-op and is therefore deprecated. Presumably the only kind of environment where random device would be unavailable in practice is running in some sort of chroot or container that is missing the device or has incorrect permissions on it; better to fail hard than to produce encrypted documents of questionable security. [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/rand-s?view=msvc-170 Change-Id: I3f020c2d11570f8351381d70188ce59bfec9f720 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163056 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-02-05sal: Re-add missing includesHeiko Becker
They were removed as unused in [1], but it turn out that's not entirely accurate, at least if LIBO_CIPHER_OPENSSL_BACKEND is defined. assert(), o3tl::..., std::numeric_limits<T> and std::memcpy are all used inside that block. [1] 2e71c439057c8d31b6af191ef38607600cb996f0 Change-Id: I2805dc4edf1d05bec5ec203772af73dd93da12bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162967 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2024-01-28cool#8016 open files using O_CLOEXECNoel Grandin
which is useful to speed up exec'ing/spawning subprograms, and avoids various leakage issues. Change-Id: Ie06ceb6b377e9d5cca8c017c5666564f6bed482f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162647 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2024-01-19Make osl_execProc_test_batch run the new process hiddenMike Kaganski
This prevents a console window flashing briefly on Windows, when runnung the test. Was this way since commit d011896d755252105c740f23f31ed43de64f7c98 (INTEGRATION: CWS sal04 (1.1.2); FILE ADDED, 2003-09-29). Change-Id: I7fb7bb067786d3ad33f9ba831e3b454c91a35e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162296 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-18-Werror,-Wunused-variable (Emscripten)Stephan Bergmann
Change-Id: Id931281ff716ed0fd26fda1972eb6f5defde7422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162249 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24Silence new GCC 14 trunk -Werror=alloc-sizeStephan Bergmann
> sal/rtl/byteseq.cxx: In function ‘void rtl_byte_sequence_reference2One(sal_Sequence**)’: > sal/rtl/byteseq.cxx:63:20: error: allocation of insufficient size ‘8’ for type ‘sal_Sequence’ {aka ‘_sal_Sequence’} with size ‘12’ [-Werror=alloc-size] > 63 | pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE )); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I9d4081ed2938fffdf282c852250a3eed5f0d9e25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161269 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24-Werror=calloc-transposed-argsStephan Bergmann
Change-Id: I7b8b020bdbcd5b4db4cb478cc5fe1225f19ae0cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161268 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-24Remove unused headers found by bin/find-unusedheaders.shGabor Kelemen
Change-Id: I859138dee575ef7fd76db28b619c673782914782 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161235 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-12-19Fix typoAndrea Gelmini
Change-Id: Ie9848c31ee4969d61470dfb5b570e45848f0914d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160992 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-12-11Step 3 of removing cargo-cult pragma pack around rtl_[u]StringStephan Bergmann
see 8ae3ae4bf75fdd0aaa132c956d9da029baa3adc6 "Step 1 of removing cargo-cult pragma pack around rtl_[u]String" Change-Id: If6c2ea0ab2e7e61cdbc880d7b27d2af7f816e66d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158568 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-12-06loplugin:ostr (macOS)Stephan Bergmann
Change-Id: I85ecdf188dc394d6175a2dd7338147a057fa7766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160392 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-29Extended loplugin:ostr: salStephan Bergmann
Change-Id: Ieca8096e2af9615fa4c34557a47bc13ee5c23936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160105 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-19Extended loplugin:ostr: salStephan Bergmann
Change-Id: Ic8a02784acb9f8981249689541bb6cba1b7fbfb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159682 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-18c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 7)Julien Nabet
Change-Id: I2a72422a6c8185d17876daac41a86137048b034c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159627 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-11-09loplugin:unnecessarygetstr (clang-cl)Stephan Bergmann
Change-Id: I79a1902fb1241f95fd4fa963918207154ae2347b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159134 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-08loplugin:stringstatic, lopluign:ostr (clang-cl)Stephan Bergmann
Change-Id: I7a928a2385286f6d1ab3887c8d315af3f47c052d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159135 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-08-Werror,-Wmissing-field-initializers (clang-cl)Stephan Bergmann
Change-Id: I14c0d223b5f92456c9f160933e3f1eb99bfc6cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159133 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-03Make ExternalReferenceUriTranslator more robust against broken UTF-8Stephan Bergmann
<https://lists.freedesktop.org/archives/libreoffice/2023-November/091151.html> "CppunitTest_stoc_uriproc failed on Windows" reports that translateToExternal("file:///abc/%feef") produces an empty string (indicating failure) instead of "file:///abc/%FEef" (as expected in stoc/test/uriproc/test_uriproc.cxx) when osl_getThreadTextEncoding() is Shift JIS. This was due to how the call to rtl::Uri::encode in Translator::translateToExternal (in stoc/source/uriproc/ExternalUriReferenceTranslator.cxx) behaved: It internally interpreted its input "%FE" as the single-byte Shift JIS character 0xFE. Which gets mapped to U+2122 as an extension (see "APPLE additions over SJIS, we convert this like Apple, because I think, this gives better result, then [sic] we take a replacement char" in sal/textenc/tcvtjp6.tab) in readUcs4, but which in turn doesn't get mapped back to any Shift JIS character in writeEscapeChar. Translator::translateToExternal is the only user of rtl_UriEncodeStrictKeepEscapes, as introduced by 6ff5d3341dbc5df3f0cb5368ccb0e1089338916c "INTEGRATION: CWS c07v013_SRC680 (1.4.40); FILE MERGED: 2007/06/21 13:00:56 sb 1.4.40.1: #b6550116# Made XExternalUriReferenceTranslator.translateToExternal more robust when the input URL contains spurious non--UTF-8 octets like %FE (which are now copied verbatim, instead of signalling error)." To make the claim true that such "spurious non--UTF-8 octets like %FE" are always "copied verbatim", regardless of text encoding being used, repurpose rtl_UriEncodeStrictKeepEscapes to always treat any escape sequences that are present as (potentially broken) UTF-8. Change-Id: I0fa0b14d3e3d44e4b5514e1b73c84c407a947ce9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158888 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-24Use requires-clausesStephan Bergmann
Change-Id: I27c990f27023aba5e77c6b406d7dbdcc898054ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158405 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-21clang-format sal/rtl/math.cxxMike Kaganski
Change-Id: I0e807118e6a2196d2f2858ed195782a90572a2e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158303 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: salStephan Bergmann
Change-Id: If4a7951fd3f9f7f2e081e6b8ba482566260c3235 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158209 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15Repurpose loplugin:stringstatic for O[U]String vars that can be constexprStephan Bergmann
...now that warning about O[U]String vars that could be O[U]StringLiteral is no longer useful Change-Id: I389e72038171f28482049b41f6224257dd11f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-12split up the backtrace implementations into separate filesNoel Grandin
Because I cannot keep what is inside what #ifdef straight in my head Change-Id: Ie986a6928df179fc0e30ca12c6d2a6866ed82078 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157861 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>