Commit Graph
98 Commits
Author SHA1 Message Date
Andrea Gelmini 6e696502fc Fix typos
Change-Id: I3e012ec27be31748afd2486366ede02939ca3cf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210567
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 21:27:55 +02:00
Caolán McNamara cf45ff8f40 cid#563264 Unchecked return value
cwd is left empty when the conversion fails, and searching an empty
path is not a no-op, it looks for the file under / instead

so only search when we got a path back

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I915103cfd446ff87f0116d832b48e4432c0be862
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10099
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit e2552aaae8b103940e16b03cbb15a277afe74c0e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210287
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-31 17:33:11 +02:00
Stephan Bergmann 1ffc2b44e4 Actually use "..."_tstr
...after 6fce450b8a "Introduce "..."_tstr as a
companion to "..."_ostr/u"..."_ustr in template code" had introduced it for
exactly this piece of code

Change-Id: I767a9f39456d6c58c5ac0478110a0c66434b0e54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196626
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2026-01-07 08:06:21 +01:00
Caolán McNamara 228946f64c cid#1607774 silence Overflowed integer argument
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-09-02 21:14:19 +02:00
Noel Grandin 752ea376b0 loplugin:ostr in sal
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-26 21:41:38 +02:00
Gabor Kelemen 252132d975 tdf#146619 Remove unused includes from sal/osl/unx
Change-Id: Icc9cd3410cde2589ea51385c651243e11cc2f1d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155855
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-08-30 09:19:55 +02:00
Noel Grandin 27b98e9e3b loplugin:stringadd in registry..sal
after my patch to merge the bufferadd loplugin into stringadd

Change-Id: I1658b960d44780f7d9c447246b1178cb70be5e66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149581
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-25 19:03:28 +00:00
Noel Grandin 72582e9fb3 rename osl_getSystemPathFromFileURL_Ex->getSystemPathFromFileURL_Ex
so I can more readily distinguish between functions that are actually in
the OSL API and functions that are not

Change-Id: Ie113c30ea15d05457633396d56bca08057e38b60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134800
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-23 17:26:15 +02:00
Stephan Bergmann 6a9f342add Introduce rtl::createUriCharClass
...to make those char class array initializations more readable.  (Making the
corresponding variables constexpr is mostly done so that failures in the
provided `unencoded` arguments, like non-ASCII characters or duplicate
character typos, would lead to compile-time errors also for !HAVE_CPP_CONSTEVAL.
And assigning to a sal_Bool std::array needs another hack to avoid false
loplugin:implicitboolconversion warnings.)

Change-Id: Ieb8827f69f55f1212a9428817d5331fcb18ef1d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133058
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-15 08:39:21 +02:00
Stephan Bergmann 277554987f Simplify some code by using OUString instead of raw rtl_uString
Change-Id: I5a5dea23a466c0da12376f8b916b1a1b0eb0bd36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114340
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-20 17:37:41 +02:00
Stephan Bergmann b9f0060b94 Remove obsolete comment
...which was already obsolete at least back in
84c4489cb7 "#104563#moved parts of file.c into
separate files" (where the hack had already been commented out) and should have
been removed in e7982510d2 "osl: cleanup
file_url.cxx" (which removed the commented-out code)

Change-Id: I9fed1c594ff5180979bab7f3f8d7808c941a4ea8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114330
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-04-20 15:35:31 +02:00
Samuel Mehrbrodt eac00017e3 [API CHANGE] Do not call getaddrinfo if we just want the hostname
Similiar to afc41a467f ,
don't call getaddrinfo in getLocalHostname which calls DNS.

This causes a lag when creating the lockfile on opening a document
if the network is flaky/disabled.
See tdf#97931 and tdf#47179 for some problems caused by this.

For the one case where it is expected to call DNS, add a separate function
to restore the old behavior.

The (semantic) [API CHANGE] is in osl_getLocalHostname,
it does no longer return a FQDN.

Change-Id: I43455715a474ff6770351d1ce007c28aeb08f32e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107554
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2021-04-19 09:22:57 +02:00
Noel 9430608363 simplify code, use more subView()
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-28 17:32:18 +01:00
Noel Grandin b480819dc4 Revert "loplugin:constfields in reportdesign,sal,sax"
This reverts commit d4d37662b0.

Now that we know that making fields has negative side effects
like disabling assignment operator generation.

Change-Id: Idef4937b89a83d2efbfaf0ab87d059a0143c0164
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90364
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-12 09:22:20 +01:00
Noel Grandin c82efb610b clang-tidy modernize-concat-nested-namespace
Change-Id: Iab35a8b85b3ba1df791c774f40b037f9420a071a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-31 18:36:09 +01:00
Stephan Bergmann aef7feb3e6 New loplugin:unsignedcompare
"Find explicit casts from signed to unsigned integer in comparison against
unsigned integer, where the cast is presumably used to avoid warnings about
signed vs. unsigned comparisons, and could thus be replaced with
o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx)

o3tl::make_unsigned requires its argument to be non-negative, and there is a
chance that some original code like

  static_cast<sal_uInt32>(n) >= c

used the explicit cast to actually force a (potentially negative) value of
sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the
cast to avoid a false "signed vs. unsigned comparison" warning in a case where
n is known to be non-negative.  It appears that restricting this plugin to non-
equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=)
is a useful heuristic to avoid such false positives.  The only remainging false
positive I found was 0288c8ffec "Rephrase cast
from sal_Int32 to sal_uInt32".

But which of course does not mean that there were no further false positivies
that I missed.  So this commit may accidentally introduce some false hits of the
assert in o3tl::make_unsigned.  At least, it passed a full (Linux ASan+UBSan
--enable-dbgutil) `make check && make screenshot`.

It is by design that o3tl::make_unsigned only accepts signed integer parameter
types (and is not defined as a nop for unsigned ones), to avoid unnecessary uses
which would in general be suspicious.  But the STATIC_ARRAY_SELECT macro in
include/oox/helper/helper.hxx is used with both signed and unsigned types, so
needs a little oox::detail::make_unsigned helper function for now.  (The
ultimate fix being to get rid of the macro in the first place.)

Change-Id: Ia4adc9f44c70ad1dfd608784cac39ee922c32175
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87556
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-28 07:42:15 +01:00
Julien Nabet a2f768f417 cppcheck: shadowFunction in sal/file_url
Change-Id: I7454640278f4af0f71f429b45c9f1e40f7be0545
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87433
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2020-01-26 12:54:55 +01:00
Noel Grandin e994b3fc3b sal_Char->char in remotebridges..sax
Change-Id: I6d32942960a5e997f16eb1301c45495661cd4cea
Reviewed-on: https://gerrit.libreoffice.org/85514
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-19 19:17:57 +01:00
Noel Grandin 0f874472c6 size some stringbuffer to prevent re-alloc
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-21 08:36:01 +02:00
Stephan Bergmann caa211b620 Better handling of non--UTF-8 filesystem pathnames in sal/osl/unx/
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-17 15:05:11 +02:00
Andrea Gelmini 0c234a60ae Fix typos
Change-Id: I79f87f033eeb67d1750bb595d311d74ef3db6ce9
Reviewed-on: https://gerrit.libreoffice.org/78795
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2019-09-10 14:18:04 +02:00
Stephan Bergmann 001f739f1b Clean up {osl_,osl::}systemPathMakeAbsolutePath combo
Change-Id: Iec4c2ff8c8239069f95fff195c49fac9f7c865d4
Reviewed-on: https://gerrit.libreoffice.org/78656
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05 21:18:38 +02:00
Andrea Gelmini 6131288f2a Fix typo
"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-24 23:36:21 +02:00
Noel Grandin 4188ae6a09 loplugin:indentation in registry..sax
Change-Id: I4b877751818febaec8e64018335dca691a476a43
Reviewed-on: https://gerrit.libreoffice.org/67561
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-09 17:08:00 +01:00
Stephan Bergmann f90e26b631 tdf#107461: For Unix-like OS, support file://<hostname>/... URLs
...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-06 11:18:27 +01:00
Noel Grandin 6f50961e69 remove more rtl::OUString and OString prefixes
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-24 14:43:34 +02:00
Noel Grandin d4d37662b0 loplugin:constfields in reportdesign,sal,sax
and improve the rewriter so I spend less time fixing formatting

Change-Id: Ic2a6e5e31a5a202d2d02a47d77c484a57a5ec514
Reviewed-on: https://gerrit.libreoffice.org/61676
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-12 12:46:45 +02:00
Noel Grandin 0b413caadf loplugin:constantparam in sal,sax
Change-Id: I7ca2fd05d1cf61f9038c529a853e72fedb1c9ed0
Reviewed-on: https://gerrit.libreoffice.org/44087
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-31 08:43:18 +01:00
Stephan Bergmann c30f3ea3dd loplugin:includeform: sal
Change-Id: I539ca8b9dee5edc5fc2282a2b9b0ffd78bad8b11
2017-10-23 22:45:58 +02:00
Chris Sherlock 9af8964dd2 RTL_UNICODETOTEXT_INFO_{DEST|SCR}BUFFERTOSMALL should use TOO, not TO
I have kept the old mispelled constant for backwards compatibility

Change-Id: I128a2eec76d00cc5ef058cd6a0c35a7474d2411e
Reviewed-on: https://gerrit.libreoffice.org/39995
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-07-17 21:47:38 +02:00
Stephan Bergmann 56b27025d5 -Werror=catch-value= (GCC 8)
("error: catching polymorphic type ‘class std::length_error’ by value")

Change-Id: I56398642709f5f14c17b0b2928ae06d8fea0a13b
2017-06-27 17:34:43 +02:00
Chris Sherlock 0a72b79971 tdf#107968 - double slash handling misleading; add unit test
Change-Id: Ide52926eff56065e7368615338ea33dcb2f87c62
Reviewed-on: https://gerrit.libreoffice.org/37850
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-05-20 13:09:06 +02:00
Stephan Bergmann 189c3a098e Extend loplugin:comparisonwithconstant beyond integral types
Change-Id: Id3a8fd5d8b9975d3ae49af0648b39454310495fa
2017-05-16 17:19:11 +02:00
Caolán McNamara 514ccf7306 coverity#1408971 Mixing enum types
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-15 12:36:20 +02:00
Chris Sherlock e7982510d2 osl: cleanup file_url.cxx
Change-Id: I636b0a7765be8e6e96e90ff5a004dc452048541a
2017-05-14 17:39:51 +10:00
Noel Grandin 992a333130 clang-tidy: readability-else-after-return
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-12 10:11:34 +02:00
Noel Grandin d15b4e2045 teach sallogareas plugin to catch inconsistencies
Change-Id: I8bcea5ffc74d48148bea78da8c17744e288c069a
Reviewed-on: https://gerrit.libreoffice.org/32004
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-15 06:45:14 +00:00
Noel Grandin 2e293a731c new loplugin/rewriter comparisonwithconstant
As per sberg' suggestion

Limit it to == and !=, because some people like the flow of inequalities
like: "0 < a && a < 42"

The changes to sal/ were made using the rewriter.

The rewriter still has one bug, in pipe.cxx, it managed to pick up
some random piece of macro. No idea why.

Change-Id: I01305f9c5396a4b6c7421d6e92f1b4b529388e82
Reviewed-on: https://gerrit.libreoffice.org/30962
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-06 05:38:14 +00:00
Stephan Bergmann 82da3d95c1 loplugin:salbool: Implicit conversions from non-Boolean fundamental types
Change-Id: I67eac95686678e6f5a2d60798535b2c65a9ba5d7
2016-06-19 21:29:43 +02:00
Michael Meeks 017a864caf handle failure to expand ~ in path elements.
This can occur in some online corner-cases.

Change-Id: Id8b419179d775a21110d682ba76d8a02f45eb828
Reviewed-on: https://gerrit.libreoffice.org/23577
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2016-03-29 10:04:52 +00:00
Stephan Bergmann 963612613a Work around Coverity warnings about std::length_error
...escaping from main or being unexpected, in various places, which started when
62dbe2e6eb "Clean up osl_getSystemPathFromFileURL
implementation" made osl_getSystemPathFromFileURL (indirectly) call
rtl_uString_newConcatAsciiL, which can throw std::length_error.

There is no ideal fix for this.  "The distinguishing characteristic of logic
errors [i.e., incl. std::length_error] is that they are due to errors in the
internal logic of the program.  In theory, they are preventable."
([std.exceptions])  That means that throwing a logic error is more akin to
raising an assert than to throwing some other kind or exception that is intended
to be handled by the program.  Which in turn means that it would generally be
more useful to cause such errors to cause calls to std::abort (and produce a
core/backtrace), than to catch and try to somehow handle them.  But there
appears to be no way to tell Coverity not to emit warnings about uncaught logic
errors, and it tends to emit quite a number of them for each signle "root
cause," so be pragmatic for now and catch it close to the root.

Change-Id: Iee71f50e3304954e9e88f326e0fa2167b6051ca2
2015-11-12 13:40:18 +01:00
Stephan Bergmann 26f05d59bc loplugin:nullptr (automatic rewrite)
Change-Id: I1bc6c87fcd6e5e96362623be94c59be216a3b2b8
2015-11-10 10:31:35 +01:00
Stephan Bergmann 62dbe2e6eb Clean up osl_getSystemPathFromFileURL implementation
Change-Id: I2daa355c4a46c4edc73c30185f2b31852351c45f
2015-11-04 08:06:00 +01:00
Stephan Bergmann 3e7afe0037 Clean up osl_getSystemPathFromFileURL handling of relative //... URLs
(i.e., starting with an authority component); treating input starting with a
single slash (i.e., starting with an absolute path component) as a relative URL
instead of as an absolute pathname would cause e.g. CppunitTest_sal_osl_file to
fail

Change-Id: Ie340881974c5e9451ab7e0a9bfb21176b8f5666d
2015-11-02 16:41:29 +01:00
Noel Grandin 2530812476 loplugin:stringconstant
Change-Id: Id051dd984c24fb34dcc89060ed11955fed61fd48
2015-11-02 12:41:26 +02:00
Stephan Bergmann 2b5ce52cdd Fix osl_getSystemPathFromFileURL URL scheme check
Change-Id: If7737b9eaf11333facd9ae3faf58e36ba76c3b05
2015-10-30 17:28:28 +01:00
Tor Lillqvist da1d01a432 Minor simplification
Change-Id: Idcf9158d0446107ec783fd8691078791d7b25e31
2015-03-29 23:03:26 +03:00
Stephan Bergmann af66914c11 system.h -> system.hxx
Change-Id: I39a60d0b775bfe40fa89e8b5d5f7466d0db5d36e
2014-11-19 17:12:03 +01:00
Stephan Bergmann bb05f1128f Remove obsolete osl_searchPath_impl
(obsoleting cid#983584)

Change-Id: Icbf25bd364fdabb208abe201ddc146daa60f9b62
2014-11-19 16:33:14 +01:00
Stephan Bergmann 69770c9791 file_url.h -> file_url.hxx
Change-Id: I2494779521d56edcab41f66a7c64e7dc5a9205ad
2014-11-19 13:01:36 +01:00