summaryrefslogtreecommitdiff
path: root/sal/osl
AgeCommit message (Collapse)Author
2017-05-16Extend loplugin:comparisonwithconstant beyond integral typesStephan Bergmann
Change-Id: Id3a8fd5d8b9975d3ae49af0648b39454310495fa
2017-05-16Try to fix loplugin:comparisonwithconstant's rewrite-with-macros issueStephan Bergmann
...that had plagued 2e293a731c1559c9869dfcb32491bc600fc18e4e "new loplugin/rewriter comparisonwithconstant" (in sal/osl/unx/pipe.cxx), and auto-rewrite the remaining occurrences in sal (that the mentioned commit had failed to address, for whatever reason) Change-Id: I3dc3bae8dd92ba8bf576f6e06e7c9ee21f883661
2017-05-15coverity#1408971 Mixing enum typesCaolán McNamara
Change-Id: I30c46f2bd8a0ae059722f60a3103e5c7883d6a2d Reviewed-on: https://gerrit.libreoffice.org/37630 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-05-14osl: cleanup file_url.cxxChris Sherlock
Change-Id: I636b0a7765be8e6e96e90ff5a004dc452048541a
2017-05-09cleanup osl/diagnose.h includesJochen Nitschke
with command > git grep -l osl/diagnose.h *.cxx | xargs grep -L -w 'OSL_\w*' | xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d' headers need more work Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab Reviewed-on: https://gerrit.libreoffice.org/37350 Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-07osl: remove comment cruft, whitespace cleanup of thread.cxxChris Sherlock
Change-Id: I4941e02b011b8e630b00d8a14703651d1f956563
2017-05-07osl: remove comment cruft, whitespace cleanup of process.cxxChris Sherlock
Change-Id: I9609306dfe70595e67ee6100ce236e849e7a3eca
2017-04-26loplugin:useuniqueptr (clang-cl)Stephan Bergmann
Change-Id: I491fb1fdcc3f5f64e4adb7276217bbdc13a1fa19
2017-04-26-Werror,-Wunused-macros (clang-cl)Stephan Bergmann
Change-Id: I64fa44caecd3f86bd23dc625e72c134659610b1a
2017-04-24clang-tidy readability-simplify-boolean-expr in oox..salNoel Grandin
Change-Id: I1e14e5b15d2dd9e35477f8189cbecf0b443b9381 Reviewed-on: https://gerrit.libreoffice.org/36875 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-21Make HASHID work whenever there is std::hash<pthread_t>Stephan Bergmann
Change-Id: I78aecfc7c0ea4ad4467417015bf41b809dbcda83
2017-04-20Simplify PTHREAD_VALUEStephan Bergmann
The distinction between MACOSX and other had been introduced with ed8110e101db5a8ea4dde43a3ec38fe40e6fe7e2 "Avoid reinterpret_cast to same type" to work around a GCC 4.6 bug that is fixed since GCC 4.7. Change-Id: I7948721d311de2622c1e08e2ee17b5ccc304b51b
2017-04-20Avoid loplugin:redundantcast on macOSStephan Bergmann
Change-Id: I5e9f2552f83e72d1f6eb1a12df19c0fdfa012e31
2017-04-12clang-tidy: readability-else-after-returnNoel Grandin
run it against sal,cppu,cppuhelper I had to run this multiple times to catch all the cases in each module, and it requires some hand-tweaking of the resulting output - clang-tidy is not very good about cleaning up trailing spaces, and aligning things nicely. Change-Id: I00336345f5f036e12422b98d66526509380c497a Reviewed-on: https://gerrit.libreoffice.org/36194 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-04Finally switch MSVC to sal_Unicode = char16_t, tooStephan Bergmann
There is lots of (Windows-only) code that relied on sal_Unicode being the same as wchar_t, and the best change may be different in each case (and doing the changes may be somewhat error prone). So for now add SAL_U/SAL_W scaffolding functions to sal/types.h, remove their uses one by one again, and finally drop those functions again. Change-Id: I2cc791bd941d089901abb5f6fc2f05fbc49e65ea Reviewed-on: https://gerrit.libreoffice.org/36077 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-30remove type decorations on char literalsJochen Nitschke
they are only needed where type deduction fails. left them in defines for now. Change-Id: I7f002dd6bc7acc083c73b6c64076de6dd28d0b09 Reviewed-on: https://gerrit.libreoffice.org/35893 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-30loplugin:loopvartoosmallStephan Bergmann
Change-Id: If714cafd9f2786610a03b1f5f6466a9ea06e46e6
2017-03-30loplugin:redundantcastStephan Bergmann
(only triggers on macOS, as on Linux unistd.h declares lseek with a return type of intermediary __off_t/__off64_t typedefs) Change-Id: I967e472a050ad624a6411947b10c962ac8f66bed
2017-03-25Fix typosAndrea Gelmini
Change-Id: I5fc62060e7d01c6b492a0e91323f753cc676bf71 Reviewed-on: https://gerrit.libreoffice.org/35639 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2017-03-24Various loplugin warnings (clang-cl)Stephan Bergmann
Change-Id: I7969250f330d2df02c4ea909115b3028fdc36223
2017-03-24Handle "POSIX" in parse_locale, 2nd attemptStephan Bergmann
...with the silly errors fixed past 61ecebe0d0febe8429d965355356a9f0f34b323b "Revert 'Handle 'POSIX' in parse_locale'" Change-Id: I0b8e4de0377b92b8cb96efa13e4b39316ffbf707
2017-03-23Remove unused #include <ctype.h>Stephan Bergmann
Change-Id: I8bf3e30687e20151a9e1936e69362abfe9b3a99d
2017-03-23Revert "Handle "POSIX" in parse_locale"Stephan Bergmann
This reverts commit 646cbbfbc67b07d5f58166228bca1ac710175cd0 for now. Appears that it made CppunitTest_sal_osl fail at least on some macOS builds, for reasons not yet clear to me
2017-03-23Handle "POSIX" in parse_localeStephan Bergmann
Change-Id: Ib3ce9efd2933170777689db152d35f586f5afe2d
2017-03-22Don't actually change OS-level locale with (unused) osl_setSystemLocaleStephan Bergmann
osl_setSystemLocale was introduced with af2938348bb539ccb27c92fe286b768d4143f662 "#88460# added osl_getProcessLocale and osl_setProcessLocale" but never actually used. So mark it as deprecated and, in the sal/osl/unx/ case, don't make it set the OS-level locale via imp_setProcessLocale (calling setlocale or setting the LC_ALL/LC_CTYPE/LANG env vars), same as in the sal/osl/w32/ case. Change-Id: I33348dba5de8ca80ca6fca210043286c0cfa9145
2017-03-22Comment clean-up that was inadvertently missing from previous commitStephan Bergmann
Change-Id: I5eb0758f84495a8410260f61ff645a086efb1ca7
2017-03-22Use nl_langinfo_l instead of setlocale+nl_langinfoStephan Bergmann
...as the former is less of an MT nightmare (nl_langinfo_l can only conflict with calls to nl_langinfo in other threads, not with calls to nl_langinfo_l in other threads, so since this was the last remaining use of nl_langinfo in LO itself after a7cdba3a0e48360e2ed549e9d8996fe41460df70 "Use nl_langinfo_l with an explicitly created locale" things should be safer now; also, setlocale was an MT problem, of course, inadequately atempted to be addressed with that aLocaleMutex). Hopefully, all relevant platforms that support nl_langinfo also support nl_langinfo_l (where both are POSIX). Change-Id: I28a18bc4ffa930e3f2e949634dae161377e2911c
2017-03-21Argument to parse_locale is never nullStephan Bergmann
Change-Id: I610d3637f4a4520ef4eefed29851727f519de02c
2017-03-21On Linux etc., obtain locale value from env vars instead of setlocaleStephan Bergmann
setlocale has the drawbacks that it is racy and that it sets global state, so better avoid it. The way LC_ALL, LC_CTYPE, LANG are honoured is as suggested by SUSv4, then falling back to "C". Change-Id: I606ecc01d37a0a9067a90e6dcce098009094493c
2017-03-17cleanup double includes and declarationsJochen Nitschke
Change-Id: I770e09f48b1a3e8299f59a8e475ba3c18d436d7b Reviewed-on: https://gerrit.libreoffice.org/35312 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-03-15improve the breakpad signal handler in dbgutil buildsMarkus Mohrhard
Change-Id: I253058dbfc9e156bc778c23d491b642c538606f2 Reviewed-on: https://gerrit.libreoffice.org/35227 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2017-03-15workaround for breakpad signal handler on linuxMarkus Mohrhard
The breakpad signal handler is overwritten by our own signal handler during startup. As a workaround we use the same approach as in the windows code and add call the old signal handler if a crash was registered. Change-Id: I1179fd9cba851734aa1686168f231cf68de57c1a Reviewed-on: https://gerrit.libreoffice.org/35226 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2017-03-15tdf#106489 - Win32 version of osl_terminateProcess not "safe"Chris Sherlock
The current Win32 implementation of osl_terminateProcess calls directly upon the Win32 TerminateProcess() API function. When I looked up this function on MSDN I was a bit surprised to note that this is an asynchronous function that returns immediately before the process actually fully terminates, and does not necessarily succeed cleanly. As we are not checking that the process actually fully terminates, this is a bit of a problem, albeit one I think may well be somewhat obscure and non-obvious. In fact, it is better that we call on TerminateProcess() and use WaitForSingleObject() until the process actually fully terminates. If the termination ends abnormally, then we should pass a more appropriate exit status. Dr Dobbs magazine, bless its ancient archive, details a "safe" version of TerminateProcess(), which has been implemented it seems in dozens of projects already so it's basically at this point a pattern. The article can be found here: http://www.drdobbs.com/a-safer-alternative-to-terminateprocess/184416547 Thankfully, the flaws they point out are only valid due to the age of the article as the Windows 9x line of operating systems was still a thing way back then :-) Changes that are made: 1. If the PID is 0x0 then this can't be ended, so return an invalid status 2. We need to elevate access to the process handle to allow it to create a new thread in a potentially remote process, so we use DuplicateHandle to do so 3. The core change is to change from TerminateProcess() to ExitProcess(), I'm letting it timeout forever and the end user can kill off the process via a Windows process management tool if they need it killed entirely, hence WaitForSingleObject() has an infinite timeout. This way, the termination handler is now called and the attached dlls are notified that they are being detached from the process. Change-Id: Icfa7c60c35a088b8f9834351bc7953a910247fb8 Reviewed-on: https://gerrit.libreoffice.org/35071 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-03-06drop various _MSC_VER < 1900 conditionalsCaolán McNamara
Change-Id: I68d93b260db1f542bb3b44858b61b2d30ae93530 Reviewed-on: https://gerrit.libreoffice.org/34856 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-03-04Change sal/osl/w32/*.h -> *.hxxStephan Bergmann
...which are now only ever included from C++ code. Drop extern "C" where appropriate (i.e., generally everywhere) and fix the occasional ensuing loplugin warning. (But no further C++'ification for now.) Change-Id: I78830692888ee0ae0cac49878042effad2d6707f Reviewed-on: https://gerrit.libreoffice.org/34865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-04Change sal/osl/w32/dllentry.c -> .cxxStephan Bergmann
Change-Id: I55f8bedd9b578053413b5e3404010301d01b7961 Reviewed-on: https://gerrit.libreoffice.org/34861 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-03-04Change sal/osl/w32/*.c -> *.cxxStephan Bergmann
...and fix any ensuing errors/warnings, but no further C++'ification. Not sure whether any parts of dllentry.c would need to be extern "C", so leaving that one alone for now. TODO: Put definition of _CRT_RAND_S into bin/update_pch, so it doesn't get removed again from sal/inc/pch/precompiled_sal.hxx. (For the surrounding #ifndef see 244d22a3d27b303d44f59296a19dc4cb31fd429d "Work around -Werror,-Wunused-macros with clang-cl".) Change-Id: I2ada3717845eb0be0c559465d68e00e3a7720156 Reviewed-on: https://gerrit.libreoffice.org/34860 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-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>
2017-02-23There's no way to create an oslVolumeDeviceHandle for unxStephan Bergmann
...so the functions operating on them can all just return osl_File_E_INVAL. (The way to create an oslVolumeDeviceHandle is via osl_getVolumeInformation storing it into oslVolumeInfo.pDeviceHandle. But the unx implementation of osl_getVolumeInformation never sets that, so it'll stay at the null value that callers must initialize it to.) Change-Id: Ibabd89e8f9de0892a0e815d30b6397f869e7df70
2017-02-23Silence -Werror=format-overflowStephan Bergmann
Change-Id: I09abf54d67d0033ff3f8d61498ab094745c2081b
2017-02-23-Werror=format-truncationStephan Bergmann
Change-Id: I1b27289724389018bd4048573e8c8e4cf28eb983
2017-02-21Kill bitrot Emscripten experimentKhaled Hosny
Change-Id: I1cd5331157e684afb01e6555168ce646194c6ff2 Reviewed-on: https://gerrit.libreoffice.org/34493 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2017-02-10Remove MinGW supportStephan Bergmann
In OOo times, there'd originally been efforts to allow building on Windows with MinGW. Later, in LO times, this has been shifted to an attempt of cross- compiling for Windows on Linux. That attempt can be considered abandoned, and the relevant code rotting. Due to this heritage, there are now three kinds of MinGW-specific code in LO: * Code from the original OOo native Windows effort that is no longer relevant for the LO cross-compilation effort, but has never been removed properly. * Code from the original OOo native Windows effort that is re-purposed for the LO cross-compilation effort. * Code that has been added specifially for the LO cross-compilation effort. All three kinds of code are removed. (An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing --with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.) Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568 Reviewed-on: https://gerrit.libreoffice.org/34127 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-10-Werror=unused-parameterStephan Bergmann
Change-Id: I63e466f8a1e2fbbf1b1bd84f491b37026909b1eb
2017-02-09-Werror,-Wunused-macrosStephan Bergmann
Change-Id: I06a6b6fa51fe437661610a4a678cd2d410bb1e4c
2017-02-09Some clean upStephan Bergmann
No more need to call sal_detail_log_report from sal_detail_log, now that it is called from SAL_DETAIL_LOG_STREAM since b3a11c8f4f307bbbb597c9c6e7e61ee93e794873 "tdf#91872: Make SAL_INFO and friends more efficient". Change-Id: Idb6cf7a4814abe29d5ba68591f39b4279267bc9b
2017-02-09Fold sal_detail_log_backtrace into sal_detail_logStephan Bergmann
...the latter is LO-privately exported from sal, so it should be OK to add one more parameter to it. Change-Id: If6bf3458433aac2cc8b4e0cbd1602306051a777b Reviewed-on: https://gerrit.libreoffice.org/34080 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-02-09Dummy implementations of backtrace/backtrace_symbols on Android, tooStephan Bergmann
Change-Id: Ibbab23a9332c3475ab6ce5654999f040e936acfb
2017-02-09Proper -Werror,-Wunused-parameter fix for C codeStephan Bergmann
Change-Id: I2ebd350c3c39f848f5a39fa120154dc449173434
2017-02-09-Werror,-Wunused-parameterStephan Bergmann
Change-Id: I1a52e05994d6a31aa5e65bc3357f48258fb6f049