summaryrefslogtreecommitdiff
path: root/sal/osl
AgeCommit message (Collapse)Author
2024-09-07lok: add SAL_DISABLE_FSYNC environment to disable fsync.Michael Meeks
For state-less containers there is no benefit in fsync'ing, file data is safe when it is up-loaded back to storage - but profiling shows latency from stray fsyncs. Change-Id: I9f03d5866dec05e5507deb56b0dca93b6876225e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167490 Tested-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit 90bd45d7a96c8c7084db13e4b6f86753db67655a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172947 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2024-09-02cid#1607774 silence Overflowed integer argumentCaolán McNamara
Change-Id: Iebe15d0323253ebb06b26fc42e78993be5fa92d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172771 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-31assign immediatelyCaolán McNamara
Change-Id: I2e92313a2428252422b68dd5fd353425add21025 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172696 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-30cid#1606819 silence Overflowed array index writeCaolán McNamara
Change-Id: I349ee3b02d25b43571c66ae9dcfcaa1e7dbea8e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172638 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-08-16cid#1607030 silence Overflowed integer argumentCaolán McNamara
Change-Id: I90676cf47d7eef441cfabe5a77dfaf81986a1f89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171924 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-31Reintroduce OUString::replaceAt taking an OUString to LIBO_INTERNAL_ONLYMike Kaganski
This allows optimizations when 'this' is empty, avoiding allocations, and making it possible to not special-case it in other places, as was done in ContentNode::Insert in commit 8ab44b114c6706ab2e3d8a19884daeb544d3c2e1 (tdf#161846 avoid allocation in ContentNode::Insert, 2024-07-30). A couple of disambiguation templated overloads was introduced. Change-Id: I2b5e94c2175379b2696c34e600393d32731f0ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171271 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-07-20Remove now unneeded osl/diagnose.hGabor Kelemen
followup to commit 57c228803e55ed343c6693de7d0857ad7d3cd9e3 Change-Id: Iebfb23bb65e2bf898bf27f367cc9641f47a14cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167998 Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Tested-by: Jenkins
2024-07-19Fix "lets" -> "let's"Andrea Gelmini
Change-Id: Ie9b6961a2786a518876db7b26258e67e8afee848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169760 Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net> Tested-by: Jenkins
2024-04-30we dereference pProfile->m_Lines on the next line anywayCaolán McNamara
Change-Id: I8ab203baa6276cb950e5a6168af32cb4a9fa24d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166915 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
2024-04-30WaE: C6011 Dereferencing NULL pointer warnings from unchecked mallocCaolán McNamara
upgrade OSL_ASSERT to assert and add a few more Change-Id: Ib52ca573d9e0878fef94dec40410f71bc94dea04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166914 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-30convert HeapAlloc to make_uniqueNoel Grandin
which means we don't have to explicitly handle OOM, and the resulting code is much cleaner Change-Id: I958d6678bb2d6878dda9de6bf82c5314f168db17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-29WaE: C6054: String 'baseDrive' might not be zero-terminatedCaolán McNamara
Change-Id: I0d3192dbac5ca73cd93051bcdf812bbe34a77c8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166828 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-04-26loplugin:ostr in salNoel Grandin
Change-Id: I7732a77fc5ac8d1f5c53052e0f4b6c7e7d70f054 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166739 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-04-15lok: provide global random symbol to find random device.Michael Meeks
This is vital for lok when used in a jail with no random device, but with an inherited file-handle to /dev/urandom. Use 'dup' to avoid changing code that wants to 'close' the handle after use. Change-Id: I15f40fb251f180a2394af030f56e47f2bf9651d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166113 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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-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-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-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-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-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-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-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-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-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-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-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>
2023-10-01Fix iOS build breakages when building on macOS SonomaPatrick Luby
Change-Id: I347e48e9da69c8c9b15581a5afa5c61cdd1d380d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157411 Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Patrick Luby <plubius@neooffice.org>
2023-09-28cid#1546363 Unused valueCaolán McNamara
Change-Id: I416db8a528b4db3f4d4449ec371c0935b29568ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157350 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-09-26tdf#157448: ignore FILE_ATTRIBUTE_READONLY when FILE_ATTRIBUTE_DIRECTORY is setMike Kaganski
Change-Id: I3fbcf15924b30e2c7fe5501e706cdaf32921e103 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157263 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-09-19tdf#146619 Remove unused includes from sal/ [cpp files]Gabor Kelemen
Change-Id: I11a54c1ddf73c16ce46a0d1c375bf43157870db7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155856 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-30tdf#146619 Remove unused includes from sal/osl/unxGabor Kelemen
Change-Id: Icc9cd3410cde2589ea51385c651243e11cc2f1d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155855 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-14tdf#146619 Remove unused includes from sal/ [headers]Gabor Kelemen
Change-Id: I8fae71e5053950441a2e0920590264c2cb858924 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155546 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>