summaryrefslogtreecommitdiff
path: root/sal/osl/unx/uunxapi.cxx
AgeCommit message (Collapse)Author
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-04-06Nah, let's revert that shiteTor Lillqvist
This reverts commit 533f0094df9a591116b73dca63bc34ddab683bdd. This reverts commit 96ae6bc47414194a477bf95a1f5a360b555884b3. This reverts commit 0050759cb9cf8ac337c0ecec48c009501de9fb0f. This reverts commit 70de006670880df7931fb1c39966d181e2893a61.
2020-04-04Let's put some verbosity in #if 0, thoughTor Lillqvist
Change-Id: I862c6277b4ef8d80bd6352fe27fed96a262cd02e
2020-04-04Show what pathname a fd was opened from in the SAL_INFO("sal.file") callsTor Lillqvist
The pathname is logged in abbreviated form. This, like the two preceding commits, is not claimed to be perfect, MT-safe, etc. It is for debugging output, for SAL_LOG=+INFO.sal.file. If you don't like it, don't use it. Or improve it. Or revert it, I promise not to bother again. Just don't start bike-shedding. Change-Id: Ie8fcea5f5f2373671eebf9ee54d32143e7ed68e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91679 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-04Show flags and modes symbolically in the SAL_INFO() for open() and access()Tor Lillqvist
Change-Id: I0d3f7f7216d35bb6f636797894832a4714bcc388 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91677 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2019-12-19sal_Char->char in remotebridges..saxNoel Grandin
Change-Id: I6d32942960a5e997f16eb1301c45495661cd4cea Reviewed-on: https://gerrit.libreoffice.org/85514 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-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-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-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-04-15improve loplugin simplifyconstructNoel Grandin
to find stuff like OUString s = OUString("xxx") Change-Id: Ie7ed074c1ae012734c67a2a89c564c1900a4ab04 Reviewed-on: https://gerrit.libreoffice.org/70697 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-29Rename Mac OS X to official name macOS in comments and documentationBartosz Kosiorek
Change-Id: I651b7f202fa52ff5f5357a11aa72c43eb7dc7f95 Reviewed-on: https://gerrit.libreoffice.org/64102 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2018-11-01Fix build on HaikuKacper Kasper
Change-Id: I4a21258c2405bd6e5c539ec0206e28a316c6ce13 Reviewed-on: https://gerrit.libreoffice.org/60835 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-24remove more rtl::OUString and OString prefixesNoel Grandin
which seem to have snuck back in since the great rounds of removals. Change-Id: I85f7f5f4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19Introduce UnixErrnoString() and use it in sal/osl/unxTor Lillqvist
The UnixErrnoString() function returns the symbolic name of an errno value, like "ENOENT". For now this is local to sal/osl/unx. If it can't figure out the symbolic name, it returns it as a number followed by the cleartext description (as from strerror()) in parentheses. Rationale why to use this and not strerror(): This is intended to be used in SAL_INFO() and SAL_WARN(). Such messages are intended to be read by developers, not end-users. Developers are (or should be) familiar with symbolic errno names in code anyway. The symbolic names of errno values are (or should be) instantly recognizable as such, they all start with E and are in UPPERCASE. strerror() can be localised although in LibreOffice it apparently isn't as there allegedly aren't setlocale() calls. But, anyway, the error strings might be less familiar to a developer than the symbolc errno names that one uses when coding. When encountering an unfamiliar error string the developer might want to add special handling for that error case in the code. They would need a reverse mapping from error string to errno value, by manually searching <errno.h>, looking at the comments there, hoping the match what strerror() produces, to find the corresponding symbolic errno value. Change-Id: Idc11595d528e8432a32bf474e6791f4ea7262a1e Reviewed-on: https://gerrit.libreoffice.org/61931 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-10-12More SAL_INFO("sal.file", ...) tweaksTor Lillqvist
Change-Id: I999d641b54a53c5a737e82d67a0a1ffa769afd24 Reviewed-on: https://gerrit.libreoffice.org/61700 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-10-11Further SAL_INFO("sal.file",...) tweaksTor Lillqvist
Now it should be fairly close to the (IMHO) ideal: One SAL_INFO("sal.file") per file system system call. (Not read() and write().) Sure, on Linux one could just use strace, but my interest at the moment is debugging what goes on on iOS. Change-Id: I19ec0404c0c15a957de96d98376b4338b48a8cbd Reviewed-on: https://gerrit.libreoffice.org/61687 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17New loplugin:externalStephan Bergmann
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-03Fix typosAndrea Gelmini
Change-Id: Iedca07be5300c68e180e0c71d2d6eb0052f5cced Reviewed-on: https://gerrit.libreoffice.org/34801 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2015-11-10loplugin:nullptr (automatic rewrite)Stephan Bergmann
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
2015-03-03TyposJulien Nabet
Change-Id: I0aef0c185457687aa0e40a4a1e8024d9e691093f
2014-11-19system.h -> system.hxxStephan Bergmann
Change-Id: I39a60d0b775bfe40fa89e8b5d5f7466d0db5d36e
2014-11-19Fold uunxapi.h into uunxapi.hxxStephan Bergmann
Change-Id: Ic16758e436da13684320e7e3bf07b80d8d8c7c5d
2014-10-16MAC_OS_X_VERSION_MIN_REQUIRED is always >= 1080 nowTor Lillqvist
Change-Id: I40d03ab9acb67ab72b9047017452f069ce88fd4b
2014-08-15Don't do the security scope bookmark dance if not in a sandboxed processTor Lillqvist
No point in doing it in build-time tools like cppumaker which don't run as sandboxed processes. Just slows them down a lot, while cfprefsd consumes lots of CPU doing user preference lookups in vain for every file accessed through the uunxapi functions. Change-Id: I83e55a8e8d0c4f2c60c60ecad2c831e42c9e5bfd
2014-03-19loplugin:passstringbyrefStephan Bergmann
Change-Id: I461db4b173dcdc812d3ccc5e3eef8a3dad93b0b0
2013-12-19Fix crash on AndroidTor Lillqvist
Fallout from 0e6a2601b39cbadaff7f7506ba9e804f108060db ("Convert code that calls OUString::getStr()[] to use the [] operator"). The code was a bit silly and "hand-optimized" in the first place so no wonder a bug was introduced accidentally in that commit. Make it simpler and more obvious. Change-Id: Idafb1c0741289e915dfbaa108383a926321764d2
2013-11-04Convert code that calls OUString::getStr()[] to use the [] operatorNoel Grandin
This also means that this code now gets bounds checked in debug builds. Change-Id: Id777f85eaee6a737bbcb84625e6e110abe0e0f27
2013-09-03Don't compile all of the sal library as Objective-C++ on OS X after allTor Lillqvist
I doubt it affects ABI, but let's not take the risk. Instead, just compile the uunxapi.cxx file (which has no public API) as Objective-C++, as that is now the only one where Objective-C API is used. This reverts part of d22c94dbf16d18bce39f060aa21f3083169426ca Change-Id: I240dbb36529c419b81b062f6fe860a9e621c2400
2013-08-26Use strncmp()Tor Lillqvist
Change-Id: I593ce24ce83cd3034d23297adc3de5f6de18f3a9
2013-08-26Be careful not to access a string out of boundsTor Lillqvist
Change-Id: Ibc43ffa0c535e0baf1bb6d8b213320da345a3d65
2013-08-25Fix "Save As" when sandboxed on OS XTor Lillqvist
Change-Id: Ibe2ea21265a0bb9c4fedcef137626df2a8019116
2013-08-25More work on a sandboxed LibreOffice on OS XTor Lillqvist
In particular, surround also the ftruncate() operation that osl_setFileSize() does with access through a security scope bookmark for the file, if available. This fixes file saving in a sandboxed LibreOffice. (But oh boy, does simply saving an ODT document go though a weird dance of file operations.) Luckily the C++ oslFileHandle abstraction keeps the pathname that the file was opened with, so even if ftruncate() as such takes only the file descriptor, we can get at the pathname to retrieve our security scope bookmark. Change-Id: I8acb1b2f3fb3ec0cea833697b7f1d4a1912ed551
2013-08-25Do more syscalls using a security scope bookmark on OS X when sandboxedTor Lillqvist
Move the handling of the bookmarks to the wrappers in uunxapi.cxx, and add wrappers for open() and utime(). Change-Id: I92f9941152b567545eea60f2aaae6a3b8d35e792
2013-08-24Cleanup some weird or inconsistent indentaion and bin some pointless commentsTor Lillqvist
Sometimes one just can't resist. Change-Id: I3550f30cc206e2efe361a669b4f8e740d9c3c339
2012-11-21re-base on ALv2 code. Includes:Michael Meeks
Patch contributed by Herbert Duerr: #i118662# remove berkeleyDB from module xmlhelp (author=orwitt) http://svn.apache.org/viewvc?view=revision&revision=1213188 #i119141# remove ISCII converter for now http://svn.apache.org/viewvc?view=revision&revision=1306246 make exceptions for cppunittester verbose http://svn.apache.org/viewvc?view=revision&revision=1174831 Patches contributed by Pedro Giffuni: Avoid some uses of non portable #!/bin/bash in shell scripts. http://svn.apache.org/viewvc?view=revision&revision=1235297 Patch contributed by Oliver-Rainer Wittmann 88652: applied patch, remove unicows deps http://svn.apache.org/viewvc?view=revision&revision=1177585 drop OS/2 code, remove in-line assembler ARM atomics, and obsolete armarch header.
2012-06-29Remove include guardsThomas Arnhold
Change-Id: Ib4ba76d0083e5bd75cc589a55318089c004f591f
2012-01-26android: move lo-bootstrap to osl/detail, Attach threads as createdMichael Meeks
2012-01-18Add some non-public API to be used by SvFileStreamTor Lillqvist
Having SvFileStream call the file opening etc functions here, instead of calling open() directly itself, means we won't have to duplicate the Android .apk hooks there, too.
2012-01-04Handle /assets paths also in realpath_u()Tor Lillqvist
2012-01-04Probably using a local rtl::OString is betterTor Lillqvist
2012-01-04Use the lo_apk_* functions for files under /assetsTor Lillqvist
2011-11-27remove include of pch header from salNorbert Thiebaud
2011-07-04fix indentCaolán McNamara
2010-10-14Add vim/emacs modelines to all source filesSebastian Spaeth
Fixes #fdo30794 Based on bin/add-modelines script (originally posted in mail 1286706307.1871.1399280959@webmail.messagingengine.com) Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2010-02-12changefileheader2: #i109125#: change source file copyright notice from Sun ↵Jens-Heiner Rechtien
Microsystems to Oracle; remove CVS style keywords (RCSfile, Revision)
2008-04-10INTEGRATION: CWS changefileheader (1.6.234); FILE MERGEDRüdiger Timm
2008/03/31 13:23:45 rt 1.6.234.1: #i87441# Change license header to LPGL v3.
2006-09-17INTEGRATION: CWS pchfix02 (1.5.62); FILE MERGEDOliver Bolte
2006/09/01 17:34:01 kaib 1.5.62.1: #i68856# Added header markers and pch files
2006-04-07INTEGRATION: CWS pj51 (1.4.78); FILE MERGEDVladimir Glazounov
2006/03/18 16:29:29 obr 1.4.78.1: #i61959# patch applied