summaryrefslogtreecommitdiff
path: root/sal
AgeCommit message (Collapse)Author
2019-03-04Fix various clang-cl warningsStephan Bergmann
...in Windows-only code that has recently been brought back to life with db8a2a567087cb65ca420bfd582ea2c8c24fcd7b "tdf#39625 make sal/qa/systools/test_comtools.cxx work with CppUnit" Change-Id: Ia93e84f5719c2320789aec5f711067f9174acb55 Reviewed-on: https://gerrit.libreoffice.org/68682 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-04Revert "new loplugin typedefparam"Noel Grandin
This reverts commit 9865440d217d975206a3f91612f0666312bc8fd8. This is not ready to land yet, seems like the latest update of the logic reveals a bunch more places I need to fix before it can land.
2019-03-04new loplugin typedefparamNoel Grandin
verify that parameters use the exact same typedef-names (if any) in definition and declaration Change-Id: I55d2817f599b0253904dce2d35a1a93967e15a77 Reviewed-on: https://gerrit.libreoffice.org/68439 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-01make SAL_DEBUG add newline in Windows debug console tooLuboš Luňák
Change-Id: I7485ab11e4bb60420153ac53784057e5cc905c39 Reviewed-on: https://gerrit.libreoffice.org/68499 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-02-26loplugin:indentation (clang-cl)Stephan Bergmann
Change-Id: I94689e4eed290b4505d2caba2d9802ef7fb6cffd Reviewed-on: https://gerrit.libreoffice.org/68378 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-26loplugin:simplifybool (clang-cl)Stephan Bergmann
Change-Id: Ia10e08c04fb6dfc18597fcfba3fe52cf0ba7184c Reviewed-on: https://gerrit.libreoffice.org/68377 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-22tdf#39625 make sal/qa/systools/test_comtools.cxx work with CppUnitAndrés Maldonado
Change-Id: If467a13b03303656e51474b3ebd384db8782ed9b Reviewed-on: https://gerrit.libreoffice.org/68156 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-22-Werror,-Wsign-compare (clang-cl)Stephan Bergmann
Change-Id: I7e9a709fe36b38ee8842dd34ab06f9608f498ec8 Reviewed-on: https://gerrit.libreoffice.org/68197 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-22error: expected parentheses around type name in sizeof expression (clang-cl)Stephan Bergmann
Change-Id: Ia4814242cc20fbfe35eaff95ddd64dd94e6d69af Reviewed-on: https://gerrit.libreoffice.org/68196 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-21loplugin:indentation (macOS)Stephan Bergmann
* Some .m/.mm files that still contained tabs instead of spaces have been cleaned up with Emacs' untabify (and apple_remote/source/HIDRemoteControlDevice.m needed further manual adaptions): apple_remote/source/GlobalKeyboardDevice.m apple_remote/source/HIDRemoteControlDevice.m apple_remote/source/KeyspanFrontRowControl.m apple_remote/source/RemoteControl.m vcl/osx/a11yrolehelper.mm * Some of the changes predate 0626e66d761de18f62e4d00d427903032da9d517 "Avoid loplugin:indentation after preproc conditional inclusion lines" and would likely have no longer been flagged since. Change-Id: Ibf5faffa743c7f79b36109d9879eb79d63c8c40f Reviewed-on: https://gerrit.libreoffice.org/68090 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-12Simplify containers iterations in reportdesign, sal, saxArkadiy Illarionov
Use range-based loop or replace with STL functions Change-Id: If6b734dab12a7298fce16003d3d175305fbe798d Reviewed-on: https://gerrit.libreoffice.org/67701 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-11tdf#120703 PVS: V560 A part of conditional expression is always true/falseMike Kaganski
Change-Id: I67462369d93e9d9ff3c056800947c4b75f71ba5f Reviewed-on: https://gerrit.libreoffice.org/67486 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-02-10tdf#39593 use existing find() to reduce copypasteArkadiy Illarionov
Change-Id: Id6280424627a3bbcb484d61cee2f2003aa1ca9b6 Reviewed-on: https://gerrit.libreoffice.org/67604 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-09loplugin:indentation in registry..saxNoel Grandin
Change-Id: I4b877751818febaec8e64018335dca691a476a43 Reviewed-on: https://gerrit.libreoffice.org/67561 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-07Make osl_getLocalHostname thread-safeStephan Bergmann
Change-Id: I82b8c49fcbbec161bf968573e28992fa5737b45b Reviewed-on: https://gerrit.libreoffice.org/67508 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-07Make osl_getLocalHostname thread-safeStephan Bergmann
Change-Id: I19b0cc48b18ddda5bd09c88f03565e9b73ed776a Reviewed-on: https://gerrit.libreoffice.org/67495 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-06tdf#107461: For Unix-like OS, support file://<hostname>/... URLsStephan Bergmann
...where <hostname> matches whatever osl_getLocalHostname reports. (And, for simplicity, don't support variations where e.g. one of the two FQDNs has an optional final dot while the other has not.) (It is not clear to me whether a similar change should also be done for the Windows-specific code in sal/osl/w32/file_url.cxx. On Windows, file URLs with a host component are generally interpreted as UNC pathnames, and in some local test on a Windows 8 machine whose hostname is reported as "win8", passing a URL like <file://win8/Users/me/Documents/...> (i.e., without a C: drive letter) to LO already worked to access files on the default drive C: at least.) Change-Id: I7a69b6d4ca76a71223def7b90d7c3b8b731ee86d Reviewed-on: https://gerrit.libreoffice.org/67437 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-02-05Improve osl_getLocalHostname on WindowsStephan Bergmann
...returning a non-dotted result obtained from gethostname in case trying via osl_createHostAddrByName doesn't work either. The code had been like this ever since its introduction with 74f3ed51f1e3fa7a199210fd6ffc69d78a535c08 "made socket and pipe refcounted, added blocking read write methods, added direct access methods for struct sockaddr", but there appears to be no good reason not to return the non-dotted gethostname value as a fallback (and it may just have been an oversight not to do so; and on e.g. Linux we simply return whatever a successful call to gethostname provides, be it dotted or not, ever since at least ebd00f5c46707e0dfcdd074f581ae86c0576e69b "socket.cxx -> socket.c", too). (Calls to osl_getLocalHostname are few across the code base, so this change in behavior is unlikely to cause any regressions. I came across this wile looking into <https://bugs.documentfoundation.org/show_bug.cgi?id=107461> "Does not support 'file://' scheme with actual hostname", but this change is unrelated to any potential fix for that issue. It just felt right to get this fixed in passing.) Change-Id: I78e59140579b9d37ee435a8f121e58544d2235eb Reviewed-on: https://gerrit.libreoffice.org/67390 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-31loplugin:unnecessaryparen (clang-cl)Stephan Bergmann
Change-Id: I0cd14e0ace9c9d2fcd880477b0485295e3010b71 Reviewed-on: https://gerrit.libreoffice.org/67138 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-30loplugin:redundantinline (clang-cl)Stephan Bergmann
Change-Id: Ib6320ddc049e93cca4c5931ad28d1873d34bd8b4 Reviewed-on: https://gerrit.libreoffice.org/67137 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-23rhbz#1667364 Open doc as R/O for which open(...,O_RDWR) returns EOPNOTSUPPStephan Bergmann
Map that EOPNOTSUPP to osl_File_E_NOSYS (and intercept it in StillReadWriteInteraction, as used by MediaDescriptor::impl_openStreamWithURL in unotools/source/misc/mediadescriptor.cxx, which will retry opening it read-only then), instead of to osl_File_E_invalidError (which lead to the "General input/output error" box). Instead of "silently" opening the doc as read-only, this still pops up a box claiming that the doc is locked by somebody else, asking whether to open it read-only or to open a copy. That's probably because of the rDescriptor.erase( utl::MediaDescriptor::PROP_READONLY() ); in TypeDetection::impl_openStream (filter/source/config/cache/typedetection.cxx) where the comment already hints at the confusion among the different read-only and locking concepts. Changing that looks like it would easily cause regressions, so is left for a follow-up commit. (And ultimately LO wouldn't need to treat the doc as read-only at all; it would just need to not attempt to open it O_RDWR upfront, and save it via copy+rename, like other apps appear to commonly do.) Change-Id: I56e18f1864084ba222acaf0e38a604082edaf4c6 Reviewed-on: https://gerrit.libreoffice.org/66805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-17Fix rtl_DoubleLocking::getValue_002 testStephan Bergmann
At least <https://ci.libreoffice.org//job/lo_tb_master_win/20394/> once failed with > Value in Thread #1 is 0 > Value in Thread #2 is 5 > C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win/sal/qa/rtl/doublelock/rtl_doublelocking.cxx:202:rtl_DoubleLocking::getValue::getValue_002 > assertion failed > - Expression: nValueOK != 0 > - getValue() failed, wrong value expected. and there is indeed no guarantee that either of the OGetThreads has already been through its while loop by the time the main thread calls terminate(). So make execution of the threads deterministic (and take out the sleeps that are no longer necessary, and use the now-deterministic expected values in the result checks). Change-Id: I61726906f646ffae7a21b1e08b1d973a4e51265b Reviewed-on: https://gerrit.libreoffice.org/66494 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Avoid unnecessary string copying in osl_getDottedInetAddrOfSocketAddrStephan Bergmann
Change-Id: I57aea80f0489c4176990d7233a4c218e5199a993 Reviewed-on: https://gerrit.libreoffice.org/66467 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Use OString for memory management of osl_psz_createPipeStephan Bergmann
...and make sure that the generated name is actually short enough to be stored in a sockaddr_un::sun_path. (oslPipeImpl::m_Name is only used to store such a name, to be used in osl_closePipe, so just make it of the same size to guarantee that copying between the two with strcpy will always work.) Change-Id: I6d1d0c5518e6d09eff129d682a1a334d12201e90 Reviewed-on: https://gerrit.libreoffice.org/66469 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Avoid unnecessary string copying in osl_getUserNameStephan Bergmann
Change-Id: I00a4b6aef307621b1607abbe75b3a64e6f8fb40a Reviewed-on: https://gerrit.libreoffice.org/66464 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Use OString for memory management of getBootstrapSocketPathStephan Bergmann
Change-Id: If1187cbb428d329fa10070662282d7fc3aeaf9de Reviewed-on: https://gerrit.libreoffice.org/66441 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16New loplugin:emptyStephan Bergmann
Change-Id: I8729db064573ac21dfe6b203c5ae244d79ecc4fe Reviewed-on: https://gerrit.libreoffice.org/66430 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Use OString for memory management of osl_psz_getConfigDirStephan Bergmann
Change-Id: I034a0ee66266d33e294271fdcf1ab13341e51b2e Reviewed-on: https://gerrit.libreoffice.org/66426 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-16Use OString for memory management of osl_psz_getHomeDirStephan Bergmann
Change-Id: I9062c953d5fbebf323d01b05902f6cd0d0239d03 Reviewed-on: https://gerrit.libreoffice.org/66425 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-15simplify duplicate codeStephan Bergmann
Change-Id: Id3b2c0de16d2b6f7fd12dcdf6fc7354541ee0b61 Reviewed-on: https://gerrit.libreoffice.org/66396 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-15Use C++ OString/OUString classes hereStephan Bergmann
...instead of underlying C structs Change-Id: I25f1de9a902e5d8ed459c9b1bfc8a8c855eefb2d Reviewed-on: https://gerrit.libreoffice.org/66394 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-15Avoid unnecessary string copying in osl_getUserNameStephan Bergmann
...while being careful to keep initializing *ustrName to an empty string when returning false (whether or not client code relies on that detail) Change-Id: Idd079a0b5a31b844287048dce57bf0fafcc32d1d Reviewed-on: https://gerrit.libreoffice.org/66388 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-15tdf#98343 follow-up: don't fail on UNC prefixesMike Kaganski
Previously, it used to use FindFirstFile on initial parts of UNC paths, and failed, failing the whole path. Change-Id: Ibc4442e28da17625676695070ed7ddba619f9082 Reviewed-on: https://gerrit.libreoffice.org/65191 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-12-14tdf#98343: ensure PathRemoveFileSpec does not remove UNC's "\\"Mike Kaganski
PathRemoveFileSpec is used exclusively in GetCaseCorrectPathName(Ex). The GetCaseCorrectPathName function is only called for absolute or relative paths, not some arbitrary that chunks. So initial double backslashes are only possible for UNC paths. This change fixes handling of UNC paths by the functions. Previously, the UNC path was recursively shortened until it only consisted of a single "\"; then, if bCheckExistence was requested, testing this path failed, which resulted in the whole recursion to return empty result; else when returning from the recursion, original path components were appended, but initial double backslashes were never restored. This led to transformation "\\SERVER\Path\file.ext" to "\SERVER\Path\file.ext". The GetCaseCorrectPathName itself is only used in two places: osl_getSystemPathFromFileURL_() and osl_getFileStatus(). osl_getSystemPathFromFileURL_ only calls GetCaseCorrectPathName for paths longer than 248 characters; bCheckExistence is false. In that case, the resulting wrong path (missing one initial backslash) was then processed in /* it should be an UNC path, use the according prefix */ branch, where two initial characters of it were stripped, one of which being the first character of SERVER name. So, all the following manipulations with resulting path were incorrect. This code path was the reason for the bug. osl_getFileStatus calls GetCaseCorrectPathName always; it requires to check existence. This led to 0 returned from GetCaseCorrectPathName, then osl_getFileStatus continued with copying the original string, thus ignoring the error. Change-Id: If7409afa2c0dd6dd001c79e719acbfd271a6ab72 Reviewed-on: https://gerrit.libreoffice.org/65158 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-12-08Remove obsolete SAL_FALLTHROUGH completelyStephan Bergmann
...after 7ffdd830d5fb52f2ca25aa80277d22ea6d89970b "HAVE_CPP_ATTRIBUTE_FALLTHROUGH is always true now" Change-Id: I54e5ff4e036a6bb3e5774d1c0524158aae18e937 Reviewed-on: https://gerrit.libreoffice.org/64800 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-12-05loplugin:unnecessaryparen include more assignmentsNoel Grandin
Change-Id: I9fb8366634b31230b732dd38a98f800075529714 Reviewed-on: https://gerrit.libreoffice.org/64510 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-04tdf#34171: check foreign lockfiles to tell who has locked documentMike Kaganski
MS Office (Word/Excel/PowerPoint) lockfiles are supported now. Note that Excel does *not* create lockfiles for pre-OOXML files. This changes osl_openFile implementation on Windows, to treat osl_File_OpenFlag_NoLock to also include FILE_SHARE_DELETE flag for CreateFileW. This is required to allow opening files created with FILE_FLAG_DELETE_ON_CLOSE flag, such as Excel's owner files. The shange should be consistent with the overall meaning of the osl_File_OpenFlag_NoLock to not impose any locking constraints to the file being opened. Change-Id: I7b99012f4bd60ab3821fb91d5166a286031b7e93 Reviewed-on: https://gerrit.libreoffice.org/64496 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-12-02-Werror,-Wc++98-compat-extra-semiStephan Bergmann
Change-Id: I15d67108b4a80a4788982ad6bea65e32fd941a35
2018-12-01tdf#39468 Translate German commentsJens Carl
Change-Id: I27e5e4604cd999d778eb84976b3bea0ef35122ee Reviewed-on: https://gerrit.libreoffice.org/64353 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-12-01Unit test for leading and trailing group separator charactersEike Rathke
Change-Id: I10ff8b59ba707d5795338ff5e9037473d31337bc Reviewed-on: https://gerrit.libreoffice.org/64361 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-12-01A leading or trailing group separator character is not a group separatorEike Rathke
Also a group separator character followed by a non-digit is not. Change-Id: Id57e43fe7692706c5532fb05ad394224265c2750 Reviewed-on: https://gerrit.libreoffice.org/64358 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
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-29loplugin:stringconstant look for unnecessary OString constructor useNoel Grandin
and tweak the methods in check.hxx to make them more flexible when called with dc.Class(xxx ? "foo" : "bar") Change-Id: I881fe628f22121ced4d8849715d6b1c92b092da1 Reviewed-on: https://gerrit.libreoffice.org/64207 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-22improve function-local statics in salNoel Grandin
Change-Id: I0853cf13162bae44cf8a5c44a4546a73f05772d9 Reviewed-on: https://gerrit.libreoffice.org/63780 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-19Fix typosAndrea Gelmini
Change-Id: I6d51e4eb4a49a30193b904b2c7d62df1e16ea3d9 Reviewed-on: https://gerrit.libreoffice.org/63475 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-11-17Adapt to C++2a char_tStephan Bergmann
u8 literals incompatibly change their type (as implemented by recent Clang trunk) Change-Id: Ia4f7b91f5d86656a056303d2754981ab2093a739 Reviewed-on: https://gerrit.libreoffice.org/63494 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-16loplugin:buriedassign in sd..writerfilterNoel Grandin
Change-Id: I954c12d9e1c493be6ac8c7b15076077b5bff5b74 Reviewed-on: https://gerrit.libreoffice.org/62811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-13Fix race in test codeStephan Bergmann
seen it fail at <https://ci.libreoffice.org/job/lo_tb_master_win/19591/> > Value in Thread #1 is 0 > Value in Thread #2 is 0 > C:/cygwin/home/tdf/lode/jenkins/workspace/lo_tb_master_win/sal/qa/rtl/doublelock/rtl_doublelocking.cxx:199:rtl_DoubleLocking::getValue::getValue_002 > assertion failed > - Expression: nValueOK != 0 > - getValue() failed, wrong value expected. > > rtl_DoubleLocking::getValue::getValue_002 finished in: 1267ms Change-Id: I6ac85a9ff4da8c046412add40c9447ee53ef8d7e Reviewed-on: https://gerrit.libreoffice.org/63320 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-11Fix typoAndrea Gelmini
Change-Id: Id2478ac637140b604cb0f7e3aa4267f02aa859c4 Reviewed-on: https://gerrit.libreoffice.org/63255 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-11-10clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2Tamás Zolnai
Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d Reviewed-on: https://gerrit.libreoffice.org/63241 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>