summaryrefslogtreecommitdiff
path: root/sal/osl
AgeCommit message (Collapse)Author
2021-03-08The backtrace() etc API is available on macOS and iOS, tooTor Lillqvist
Change-Id: I9a62391c4d109cd2fd2ab60d92a9e3b631ee6773 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112157 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-11-15Make the C++/UNO bridge work to some extent on macOS on arm64Tor Lillqvist
Use the same code as for Linux on aarch64, with minor additional hacks. But that will not actually work in all cases, as there are slight differences in the ABI. See https://developer.apple.com/library/archive/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html Thus we can drop the use of the lo_mobile_throwException() hack that was very temporarily used. The run-time code generation requires use of a new API on macOS to work: See the use of pthread_jit_write_protect_np() in bridges/source/cpp_uno/shared/vtablefactory.cxx. For some reason, with the Xcode 12 betas, when compiling for arm64-apple-macos, the symbols for the type_infos for the UNO exception types (_ZTIN3com3sun4star3uno16RuntimeExceptionE etc) end up as "weak private external" in the object file, as displayed by "nm -f darwin". We try to look them up with dlsym(), but that then fails. So use a gross hack: Introduce separate real variables that point to these typeinfos, and look up and dereference them instead. If this hack ends up needing to be permanent, instead of having a manually edited set of such pointer variables, we should teach codemaker to generate corresponding functions, and look up and invoke them to get the std::type_info pointer. When compiling for x86_64-apple-macos, the type_info symbols end up as "weak external" which is fine. With this, LibreOffice starts and seems to work to some extent, and many unit tests succeed. Change-Id: I05f46a122a51ade1ac7dccd57cb90e594547740e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100408 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105880 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-05-13tdf#128101 android: fix documents with manual page breakChristian Lohmaier
code reads a .ui file to show a menu to edit/delete that pagebreak. That file was not packaged in the Android viewer and causes an exception that is not handled and ultimately results in a crash. Change-Id: Ie73d886daf9202ba12e1b5a241bc7b6d184ae770 Reviewed-on: https://gerrit.libreoffice.org/83104 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86165 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-09android: file-cache to improve performance.Michael Meeks
The transition to java - interestingly to free the passed buffer was showing on profiles. Change-Id: Id1f4f6e60896c3f42fcbf761e535b68318e0a0a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86164 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-06Fix problems when running a sandboxed LO as X.app/Contents/MacOS/sofficeTor Lillqvist
The argv[0] passed to osl_setCommandArgs will then be the relative path and osl::realpath() will fail. Instead, use bootstrap_getExecutableFile() which calls _NSGetExecutablePath() to get the executable's pathname for g_command_args. Change-Id: I1345afe158d7b64871f6340733fb5490d5ca6bd8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93438 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-12-03WIN accept single-backslash file URIsJan-Marek Glogowski
From all I could find, a single (back-)slash file URI is fine as a local file path. This includes the commit "WIN enable NoAuthority test" (cherry picked from commit f9fd9d4cd4f792cd4ec8e14df78f3193653dae67) Change-Id: I75e95c809894cdef88f708d0477cb98eb114a107 Reviewed-on: https://gerrit.libreoffice.org/83837 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> (cherry picked from commit 895cd72158fc8a455f705764ae4ae000b933eba4) Reviewed-on: https://gerrit.libreoffice.org/83952
2019-11-11simplify OUString constructionNoel Grandin
Change-Id: Ib91d77c578aa21af02beaf299d16b5d8c2942f00 Reviewed-on: https://gerrit.libreoffice.org/82447 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-23-Werror,-Wdeprecated-volatile (clang-cl)Stephan Bergmann
same as b89187aad86e2be000d2f4c9c380a95bf8430c2e "Simplify forced memory reads" in sal/osl/unx/file.cxx Change-Id: I31edbc72f88895e148609498d367a50e38723b11 Reviewed-on: https://gerrit.libreoffice.org/81408 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-21size some stringbuffer to prevent re-allocNoel Grandin
found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-18cid#1448512 silence Out-of-bounds accessCaolán McNamara
Change-Id: I3e5efb9be471814b5dabf501feb93a65e9b5bcd3 Reviewed-on: https://gerrit.libreoffice.org/81022 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-10-17Remove some memset callsMike Kaganski
Replace them with default initialization or calloc Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1 Reviewed-on: https://gerrit.libreoffice.org/80805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-14New loplugin:getstrStephan Bergmann
...to find matches of ... << s.getStr() (for the rtl string classes) that can be written as just ... << s Some notes: * The OUStringToOString(..., RTL_TEXTENCODING_UTF8) is left explicit in desktop/source/app/crashreport.cxx (even though that would also be done internally by the "<< OUString" operator) to clarify that these values are written out as UTF-8 (and not as what that operator << happens to use, which just also happens to be UTF-8). * OUSTRING_TO_CSTR (include/oox/helper/helper.hxx) is no longer used now. * Just don't bother to use osl_getThreadTextEncoding() in the SAL_WARN in lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx. * The toUtf8() in the SAL_DEBUG in pyuno/source/module/pyuno_module.cxx can just go, too. Change-Id: I4602f0379ef816bff310f1e51b57c56b7e3f0136 Reviewed-on: https://gerrit.libreoffice.org/80762 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-14loplugin:stringadd look for unnecessary temporariesNoel Grandin
which defeat the *StringConcat optimisation. Also make StringConcat conversions treat a nullptr as an empty string, to match the O*String(char*) constructors. Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b Reviewed-on: https://gerrit.libreoffice.org/80724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-10DestFileExists should be boolStephan Bergmann
Change-Id: I5803aa2498654c579f9fe6293e5204aa63edd589 Reviewed-on: https://gerrit.libreoffice.org/80607 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-09cid#1453854 silence Time of check time of useCaolán McNamara
Change-Id: Icfa358476db3166c29e893c09ec943aa3c38dba3 Reviewed-on: https://gerrit.libreoffice.org/80520 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-10-07cid#1448512 silence bogus Out-of-bounds accessCaolán McNamara
Change-Id: I6febe3d48fc9018b373a940d88d2afeefad7502c Reviewed-on: https://gerrit.libreoffice.org/80355 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-10-01loplugin:data (clang-cl)Stephan Bergmann
Change-Id: Ib8b2bc1c5f7b27a646036ce23cae2b6a06edd038 Reviewed-on: https://gerrit.libreoffice.org/79922 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01loplugin:simplifyconstruct (clang-cl)Stephan Bergmann
Change-Id: I08da288a88c2bce1d4250ec77f17bd483e6bc09c Reviewed-on: https://gerrit.libreoffice.org/79911 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-29constmethod for accessor-type methodsNoel Grandin
Apply the constmethod plugin, but only to accessor-type methods, e.g. IsFoo(), GetBar(), etc, where we can be sure of that constifying is a reasonable thing to do. Change-Id: Ibc97f5f359a0992dd1ce2d66f0189f8a0a43d98a Reviewed-on: https://gerrit.libreoffice.org/74269 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-17Better handling of non--UTF-8 filesystem pathnames in sal/osl/unx/Stephan Bergmann
The idea is to internally in sal/osl/unx/ use OString instead of OUString to represent pathnames, so that the OString carries the actual bytes that make up the pathname. At the boundary of translating between pathname OStrings and file URL OUStrings, translate sequences of bytes that are valid according to osl_getThreadTextEncoding() into UTF-8 and translate other bytes into individual (percent-encoded) bytes in the file URL. This change required duplicating some of the internal functionality in sal/osl/unx/ for both OString and OUString, and to make part of sal/rtl/uri.cxx accessible from sal/osl/unx/ via new sal/inc/uri_internal.hxx. Change-Id: Id1ebaebe9e7f2d21f350f6b1a07849edee54331f Reviewed-on: https://gerrit.libreoffice.org/78798 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-16Simplify forced memory readsStephan Bergmann
Change-Id: I68ea0a46bcaaadb455f2f2cc6e53950e2f26a763 Reviewed-on: https://gerrit.libreoffice.org/79003 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-16-Werror=volatile (GCC 10 trunk)Stephan Bergmann
"error: compound assignment with ‘volatile’-qualified left operand is deprecated" in C++20 mode Change-Id: I62825237a2f4caf359f5f116ab4097ae6b9376e6 Reviewed-on: https://gerrit.libreoffice.org/78975 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-10Fix typosAndrea Gelmini
Change-Id: I79f87f033eeb67d1750bb595d311d74ef3db6ce9 Reviewed-on: https://gerrit.libreoffice.org/78795 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2019-09-10tdf#127069 sal: preserve gid of files in the unx osl_replaceFile()Miklos Vajna
The w32 implementation preserves all attributes of the destination file, the unx one preserved none of them. Bring the unx osl_replaceFile() closer to the w32 by preserving the gid of the destination file as a start. [ No testcase, we support building on systems where the user is part of a single group only, and it's not possible to verify the effect of this change in such environments. ] Change-Id: I722d4802df34caf71a9dc0db1a3df8b76acb9de6 Reviewed-on: https://gerrit.libreoffice.org/78789 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-09-06Fixing "...."Andrea Gelmini
Change-Id: I3424e17cfdfb563fdc5882942031deafae8689fe Reviewed-on: https://gerrit.libreoffice.org/78678 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-05Clean up {osl_,osl::}systemPathEnsureSeparator comboStephan Bergmann
Change-Id: Iafa953725c1ca8e6f3032945dc0700ae989519b9 Reviewed-on: https://gerrit.libreoffice.org/78671 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05Clean up {osl_,osl::}systemPathMakeAbsolutePath comboStephan Bergmann
Change-Id: Iec4c2ff8c8239069f95fff195c49fac9f7c865d4 Reviewed-on: https://gerrit.libreoffice.org/78656 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05Use OUString in osl_getNextDirectoryItemStephan Bergmann
Change-Id: Ifa1491a1af1d3c74d84ec4d6bec79fcf7a5d6bf4 Reviewed-on: https://gerrit.libreoffice.org/78653 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05Fix osl_systemPathEnsureSeparator preconditionStephan Bergmann
Change-Id: I0165a14f159a6c2c7bce84d1ca646435146d1da0 Reviewed-on: https://gerrit.libreoffice.org/78643 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05Let osl_systemPathEnsureSeparator directly take an OUStringStephan Bergmann
Change-Id: Ia9505298fe92d62d716e2c28ac0a5098c4b61121 Reviewed-on: https://gerrit.libreoffice.org/78642 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-01Resolves: ofz#16898 Direct-leak in rtl_uString_ImplAllocCaolán McNamara
Change-Id: I7bc11108790f8d87396bad3a2c5c2280f8f7d59a Reviewed-on: https://gerrit.libreoffice.org/78369 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-30Extract common code from #if/#else blocksStephan Bergmann
Change-Id: I7d14fd76ec4e571d5971131b5ee16f4dfe648b23 Reviewed-on: https://gerrit.libreoffice.org/78316 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-30Replace is_soffice_Impl hack with a better(?) hackStephan Bergmann
...that involves adding a second, one-off special meaning to the existing sal_detail_initialize function. This at least gets rid of the "osl_getExecutableFile contains 'soffice' substring" guesswork (and of the osl_systemPathGetFileNameOrLastDirectoryPart call there, which is what I'm actually after, for a different change to come). Change-Id: I4dd6eef1fd0411bf66943ffea415876c92d08526 Reviewed-on: https://gerrit.libreoffice.org/78291 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-30Clean up some osl::X, X_u function combosStephan Bergmann
(adapting call sites where necessary) Change-Id: Ib9ad1122571b1c00ebbb4638f94eb5698b18a1a7 Reviewed-on: https://gerrit.libreoffice.org/78289 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-29Make oslDirectoryImpl a bit more C++yStephan Bergmann
Change-Id: Iff5e26369889345d1f907e52d86eff6b89c63e20 Reviewed-on: https://gerrit.libreoffice.org/78260 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-24loplugin:returnconstval in sal..scNoel Grandin
Change-Id: I300d14d580d450ec338129918955651b9d40d5d2 Reviewed-on: https://gerrit.libreoffice.org/78059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-20Fix typosAndrea Gelmini
Change-Id: I5db25074d42fa22f3e36969cb561ad64c1e96dc1 Reviewed-on: https://gerrit.libreoffice.org/77760 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-13Avoid non-async-signal-safe functionality after forkStephan Bergmann
Triggering those SAL_WARN sporadically caused deadlocks at least for <https://ci.libreoffice.org/job/lo_ubsan/>. Change-Id: I7b7037e411c29eea26e63f71a5679127b084f447 Reviewed-on: https://gerrit.libreoffice.org/77374 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-12Avoid non-async-signal-safe functionality between fork and execStephan Bergmann
This is a partial revert of 17642437fe0d68cf868ab430f04b4fdc12f1767f "reduce ifdef forest". The original code used unsetenv only for certain platforms, and putenv for others, but code a few lines further down uses unsetenv unconditionally, so assume that it is safe to use on all relevant platforms these days. unsetenv isn't listed as async-signal-safe at <http://pubs.opengroup.org/ onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03> "Signal Actions" (but is already used a few lines further down, also between fork and exec), but at least we get rid of the memory management involved in the OUString instance. Change-Id: Iac993db8819d40a0841c455ed04ff9ca2ee2e4eb Reviewed-on: https://gerrit.libreoffice.org/77368 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-10cid#1452268 Uninitialized scalar variableCaolán McNamara
Change-Id: I8b9d8f80bbf3d7d9c060d2da4675ae832966c085 Reviewed-on: https://gerrit.libreoffice.org/77242 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-10loplugin:stringconstant (macOS)Stephan Bergmann
Change-Id: Icb9d9e1cd21e2506e36fe40a3b93b6a2521a868c Reviewed-on: https://gerrit.libreoffice.org/77239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-10aTime.tm_wday gets overwritten anywayCaolán McNamara
so drop the first write in favor of the second Change-Id: Iac906d806a66e010e8352139b555aef6078bda02 Reviewed-on: https://gerrit.libreoffice.org/77235 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-02Fix typosAndrea Gelmini
Change-Id: Ie183c445bf8a545f59aac7b0e29f72ab679a6cf3 Reviewed-on: https://gerrit.libreoffice.org/76852 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-08-01Silence -Wunused-function on AndroidMike Kaganski
after commit bf6bde2da134dad60ecbf8f3e97674abadb7349e Change-Id: Iaf6f1457f95e5b821879b735c16a692cca7515db Reviewed-on: https://gerrit.libreoffice.org/76791 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-08-01Unify some code across platforms to use static initializersMike Kaganski
Static initializers were used for the environment strings since commit d19c40f45dc8e8bcd9db4c6b83bdcf6367f6fbe7 to workaround thread-unsafe getenv. The special case for Android was initially introduced in commit 60628799633ffde502cb105b98d3f254f93115aa, to allow modifying the environment in the code; then was fixed in commit 4fbf6df784529d48cf194a2d9c495ffb47933d59. That was relying on the functions being called each time their results were used. But commit 9f027559557cb132835d8a13cdc0281ad4e757ae changed that, making the results static, thus only calling the functions once on all platforms. This was effective more than a year already, so presumably the special-casing for Android isn't needed anymore. Thus, this patch unifies all platforms to use the same approach (calling getenv once, storing copies of result in static variables. Also this stores flags used in maybeOutputTimestamp to static variables, too, to avoid parsing strings each time the function is called. Change-Id: I84bdbfb900c15b407fb555296d2613bd3d62da7e Reviewed-on: https://gerrit.libreoffice.org/76573 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-08-01Sometimes static checks are enough.Mike Kaganski
Change-Id: I61e7a28c5beab8f0c619767545009cefae6ddcd9 Reviewed-on: https://gerrit.libreoffice.org/76772 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it): salStephan Bergmann
Change-Id: Id9d994343d10b5d5e852b10946c036dfbeb66d04 Reviewed-on: https://gerrit.libreoffice.org/76656 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-30Fix typosAndrea Gelmini
It passed "make check" Change-Id: I50c3639ec258c7fb6d73104f8e777f96995aa8e3 Reviewed-on: https://gerrit.libreoffice.org/76543 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-07-24Fix typoAndrea Gelmini
"an URI", to complete: https://gerrit.libreoffice.org/#/c/75985/ Change-Id: I57489b05117fd12ae6aa22544437ab5bc6b5154f Reviewed-on: https://gerrit.libreoffice.org/76037 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-07-19cid#1448293 Copy into fixed size bufferCaolán McNamara
Change-Id: I0ff36c58bf2448bdccc239582ba24b69c7431c6d Reviewed-on: https://gerrit.libreoffice.org/75921 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>