Commit Graph

2903 Commits

Author SHA1 Message Date
Stephan Bergmann
7ceee0f1ec Extend loplugin:redundantinline to catch inline functions w/o external linkage
...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-10-09 14:47:17 +02:00
Gabor Kelemen
2a962cb122 tdf#42949 Fix IWYU warnings in include/comphelper/[m-z]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I04c5ba277d5b3398c07de6ae66713d977636088d
Reviewed-on: https://gerrit.libreoffice.org/61347
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-08 12:16:44 +02:00
Caolán McNamara
0e257f8c07 weld ImpSWFDialog
Change-Id: I0650ab2b95eddde0337b1d65e957a58083d993bf
Reviewed-on: https://gerrit.libreoffice.org/61477
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-06 21:58:26 +02:00
Gabor Kelemen
8df9935dcb tdf#42949 Fix IWYU warnings in include/comphelper/[a-l]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I22ba2c8aec235e34cd7835b8a0a716bf3057db7a
Reviewed-on: https://gerrit.libreoffice.org/60837
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-24 23:23:20 +02:00
Stephan Bergmann
cc2fe8c763 Replace SAL_OVERRIDE with override in internal code
Change-Id: Ifa446647b11fd1f1b0dc6a991b752480545634db
Reviewed-on: https://gerrit.libreoffice.org/60788
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-20 08:37:20 +02:00
Stephan Bergmann
206b5b2661 New loplugin:external
...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>
2018-09-17 09:05:38 +02:00
Noel Grandin
867cfc57d8 loplugin:useuniqueptr in ODatabaseForm::GetDataMultiPartEncoded
Change-Id: Ica70b20b84a8ada5b37cb6d23ce67096bd9ced2d
Reviewed-on: https://gerrit.libreoffice.org/60352
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-12 09:00:07 +02:00
Gabor Kelemen
cc7280efdb tdf#42949 Fix IWYU warnings in include/cppuhelper/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Ib420e9216b8313f5ed7634ec375e39ceb741fd45
Reviewed-on: https://gerrit.libreoffice.org/59297
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-10 09:58:12 +02:00
Noel Grandin
8dc6c96a80 loplugin:simplifyconstruct in filter..framework
Change-Id: Ida4307a92dfb1dbd14da5a30b6ee1f0fd6a9455e
Reviewed-on: https://gerrit.libreoffice.org/60194
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-08 19:28:19 +02:00
Arkadiy Illarionov
97b6fd8e9e Replace find_if with proper quantifier algorithms
Missed in 085269d25a

Change-Id: I3cfab57232908b48d090658e0fbc948d62b3fc6f
Reviewed-on: https://gerrit.libreoffice.org/60180
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-08 14:46:08 +02:00
Noel Grandin
5ff20b1c72 no need to allocate a new string in parseDuration
just parse the incoming string in-place with boost::lexical_cast

Change-Id: Ie165a80ea3cd10ca883afdff1ad1289edda3e9ab
Reviewed-on: https://gerrit.libreoffice.org/59770
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-30 09:40:36 +02:00
Arkadiy Illarionov
085269d25a Replace find_if with proper quantifier algorithms
Change-Id: Icc820a47ac891c358883f9c01224f676c58fdd11
Reviewed-on: https://gerrit.libreoffice.org/59744
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29 11:40:29 +02:00
Noel Grandin
37f9fdc11c replace rtl_allocateMemory with std::malloc
where used directly, since rtl_allocateMemory now just calls into std::malloc

Change-Id: I59f85bdb7efdf6baa30e8fcd2370c0f8e9c999ad
Reviewed-on: https://gerrit.libreoffice.org/59685
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29 09:05:39 +02:00
Noel Grandin
4c91b89d8c new loplugin:oustringbuffer
look for places where we are appending the temporary result of adding
strings together, to an OUStringBuffer, where we could rather call
append repeatedly and avoid the temporary creation

Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82
Reviewed-on: https://gerrit.libreoffice.org/59708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29 09:05:18 +02:00
Noel Grandin
cd66852f6d create appendCopy method in OUStringBuffer
so we can avoid temporary copies when appending a substring of an
OUString to the buffer. I would have preferred to call the method just
"append" but that results in ambiguous method errors when the callsite
is something like
   sal_Int32 n;
   OUStringBuffer s;
   s.append(n, 10);
I'm not sure why

Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f
Reviewed-on: https://gerrit.libreoffice.org/58666
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-14 08:35:00 +02:00
Noel Grandin
ff4d6a7e5b loplugin:returnconstant in forms..fpicker
Change-Id: I3f0bead636632682488cbe677fd7fee60350f04d
Reviewed-on: https://gerrit.libreoffice.org/58876
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-13 08:34:21 +02:00
Noel Grandin
d5415561e3 loplugin:stringloop in various
Change-Id: Ia400e67108e622ae63a8d59667eae96c858f22dc
Reviewed-on: https://gerrit.libreoffice.org/58463
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-02 10:13:12 +02:00
Gabor Kelemen
bdb0775a26 Add missing sal/log.hxx headers
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it.
This is a continuation of commit 6ff2d84ade to be able to remove those unneeded includes.

This commit adds missing headers to every file found by:
grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG')
to directories from filter to jvmfwk

Change-Id: I2a73d63f2aaef5f26d7d08957daaa8a30b412ac5
Reviewed-on: https://gerrit.libreoffice.org/58204
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-30 09:28:40 +02:00
Andrea Gelmini
133da6ed83 Fix typos
Change-Id: Ia3e6f17217b837517faa588ea7f2e72dc5aff6aa
Reviewed-on: https://gerrit.libreoffice.org/57767
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-07-20 18:55:16 +02:00
Noel Grandin
65e41592a6 pass SvStream around by std::unique_ptr
and give utl::OStreamWrapper a new constructor so that it knows it is
taking ownership of  the SvStream, which appears to fix several leaks

Change-Id: Idcbcca9b81a4f0345fd8b8c8a2f4e84213686a6b
Reviewed-on: https://gerrit.libreoffice.org/57187
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-10 08:30:21 +02:00
Stephan Bergmann
1d27776504 Improved loplugin:redundantcast (const-qualified typedefs): forms
Change-Id: Iaf50a40576e0fc1dde1e221a791bda6e183e5072
Reviewed-on: https://gerrit.libreoffice.org/56696
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-29 22:46:50 +02:00
Andrea Gelmini
9abc8884a7 Fix typo
Change-Id: I73aa1fe0f37b9cb5f44042850c952d3f9e425f79
Reviewed-on: https://gerrit.libreoffice.org/56231
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2018-06-21 13:01:50 +02:00
Noel Grandin
46d9abb1f1 loplugin:useuniqueptr in OClickableImageBaseModel
Change-Id: Ia262bb241d26197f93023f47a7164d0231cc8b70
Reviewed-on: https://gerrit.libreoffice.org/56188
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-21 09:38:50 +02:00
Noel Grandin
e1b922a2b3 loplugin:useuniqueptr in frm::ODatabaseForm
Change-Id: I55a0ee19476d1e656cd9ff82d44666d43ba4ca58
Reviewed-on: https://gerrit.libreoffice.org/56189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-21 08:24:55 +02:00
Noel Grandin
10433ad91f loplugin:useuniqueptr in PropertySetBase
Change-Id: I82af72050329bd206c4e796334a3ac9bc1177768
Reviewed-on: https://gerrit.libreoffice.org/56187
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-21 08:21:13 +02:00
Noel Grandin
9375d1bb04 loplugin:useuniqueptr in StandardFormatsSupplier
Change-Id: I54e0b958f4b6e6b6d99b7e82c327817cf2967e3d
Reviewed-on: https://gerrit.libreoffice.org/56186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-21 08:20:49 +02:00
Noel Grandin
517c070d06 loplugin:useuniqueptr in frm::AttributeState
Change-Id: I48e8285a1c3a029e69371e5ba9f936e4517b6db3
Reviewed-on: https://gerrit.libreoffice.org/56185
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-21 08:20:26 +02:00
Noel Grandin
1f08bff312 new loplugin:shouldreturnbool
look for methods returning only 1 and/or 0, which (most of the time)
should be returning bool.

Off by default, because some of this is a matter of taste

Change-Id: Ib17782e629888255196e89d4a178618a9612a0de
Reviewed-on: https://gerrit.libreoffice.org/54379
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-11 11:38:15 +02:00
Noel Grandin
5708534b94 look for unnecessary calls to Reference::is() after an UNO_QUERY_THROW
Since the previous call would throw if there was nothing to be assigned
to the value.

Idea from tml.

Used the following script to find places:

    git grep -A3 -n UNO_QUERY_THROW | grep -B3 -F 'is()'

Change-Id: I36ba7b00bcd014bdf16c0455ab91056f82194969
Reviewed-on: https://gerrit.libreoffice.org/55417
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-08 01:29:32 +02:00
Noel Grandin
1c4cd77bee forms - move the Bitmap accessing code inside BitmapEx
Change-Id: I58d5200332c133146adb6bb99b4b88697f03990a
Reviewed-on: https://gerrit.libreoffice.org/55313
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-05 14:44:28 +02:00
Jochen Nitschke
8ddca0648a tdf#42949 remove unused compheler includes ..
and fix the fallout

Change-Id: I15bc5d626f4d157cbc69a87392078b41e621d14e
Reviewed-on: https://gerrit.libreoffice.org/54882
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-05 10:56:36 +02:00
Arkadiy Illarionov
62667aac83 tdf#96099 Remove some trivial std::vector typedefs
Change-Id: I21171bd90b5e19fe8e5b8f2d125b6dfcb9a8b766
Reviewed-on: https://gerrit.libreoffice.org/55198
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2018-06-03 09:38:42 +02:00
Noel Grandin
3a51daeace Improve re-throwing of UNO exceptions
(*) if we are already throwing a Wrapped*Exception, get the
exception using cppu::getCaughtexception.

(*) when catching and then immediately throwing UNO exceptions,
use cppu::getCaughtException to prevent exception slicing

(*) if we are going to catch an exception and then
immediately throw a RuntimeException, rather throw a
WrappedTargetRuntimeException and preserve the original exception information.

Change-Id: Ia7a501a50ae0e6f4d05186333c8517fdcb17d558
Reviewed-on: https://gerrit.libreoffice.org/54692
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-25 21:46:49 +02:00
Noel Grandin
0e384e1080 loplugin:unnecessaryvirtual improvements
look for virtual methods where all of the overrides of the method are
empty

Change-Id: I87d99a0b647700a8d53498e0ab5f0437d3508553
Reviewed-on: https://gerrit.libreoffice.org/54060
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-10 11:34:18 +02:00
Andrea Gelmini
f6fb5a17da Fix typos
Change-Id: I92078fdece135754744d85424956dbb071f3899e
Reviewed-on: https://gerrit.libreoffice.org/53638
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-05-05 09:24:40 +02:00
Jochen Nitschke
af94177d64 improve AttributeState compare operator
guess this was the original intention, else the nullptr checks
would be pointless

Change-Id: Ifb41b125c6d297c76c1d1b5c06c8f9f127b8e613
Reviewed-on: https://gerrit.libreoffice.org/53644
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-01 09:16:13 +02:00
Stephan Bergmann
6325d571ca Revert "work around clang-cl ABI bug PR25641"
This reverts commit 81ce629c9e, now that
<https://bugs.llvm.org/show_bug.cgi?id=25641> "clang-cl: vtordisp thunks not
emitted for functions with class template specializations in their signatures"
is fixed.
2018-04-24 07:52:48 +02:00
Noel Grandin
9a831a6c19 remove no longer necessary operator new/delete overrides
and use "using" statements for the places where the overrides were
resolving ambiguities

Change-Id: Icb1d1a41f19e00f28a19947aa2c40bd5778fff94
Reviewed-on: https://gerrit.libreoffice.org/52993
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-17 09:09:33 +02:00
Jochen Nitschke
b4d36b5dcf remove some unused comphelper includes
and fix the fallout

Change-Id: I5d0c2040f57a3ac354a7e277592da31d09a5f359
Reviewed-on: https://gerrit.libreoffice.org/52894
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2018-04-15 11:17:24 +02:00
Noel Grandin
61dd9cafab make SvxEditSource::Clone return std::unique_ptr
Change-Id: If0d93024a642cc80a2a84d0c15525af1c0596546
Reviewed-on: https://gerrit.libreoffice.org/52715
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-12 13:04:37 +02:00
Caolán McNamara
8ed2fb306f weld linkeditdialog
which enables changing FileDialogHelper over to welded

Change-Id: I988342a6574cb7ed09b2724929e8c7117474a56c
Reviewed-on: https://gerrit.libreoffice.org/52388
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-04-06 16:48:12 +02:00
Noel Grandin
0e493cae40 new loplugin:dbgunhandledexception
enforce that DBG_UNHANDLED_EXCEPTION is called first in a catch block,
otherwise it cannot do it's job properly

Change-Id: I906436c6861212c44f8f21552ccbceb54f15c6e1
Reviewed-on: https://gerrit.libreoffice.org/52303
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-03 14:54:55 +02:00
Mike Kaganski
b9955b2083 tdf#93173: Remove arbitrary line spacing limit
OASIS Open Document Format for Office Applications (OpenDocument) v.1.2
doesn't limit the value of fo:line-height. But we have arbitrary limits
in proportional mode for both minimal (50%) and maximal (200%) values.

The implementation uses sal_uInt16 to store the value, so fix places
where sal_uInt8 was unreasonably used to set it, change the upper limit
to max sal_uInt16 value, and set lower limit to 6% (to match Word's
minimal factor of 0.06).

Change-Id: I4c2ac5f0acf65d7573328e71bcf36ac9abb5ffd5
Reviewed-on: https://gerrit.libreoffice.org/52252
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-04-03 09:43:56 +02:00
Noel Grandin
4450b2a166 pass area param to DBG_UNHANDLED_EXCEPTION
and update sallogareas plugin to enforce this

Change-Id: Id0782c8a1f619372e10d931aec3c6a4743a4c86a
Reviewed-on: https://gerrit.libreoffice.org/52249
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-03 08:38:50 +02:00
Jochen Nitschke
9401c7c28a remove unused processfactory.hxx includes
and fix fallout

Change-Id: Id06bf31f2075111e426ba40c84c885ae70697bee
Reviewed-on: https://gerrit.libreoffice.org/52206
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2018-04-01 12:11:26 +02:00
Noel Grandin
98e991c0be loplugin:useuniqueptr in RichTextControlImpl
Change-Id: I3fcf9a4edf6dbed496bcc9160847e627777f04f1
Reviewed-on: https://gerrit.libreoffice.org/51740
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-23 07:25:29 +01:00
Caolán McNamara
4b785097f1 drop unnecessary includes
Change-Id: I1a817d5575bbd57ecaa874a27158b9218e4210cc
Reviewed-on: https://gerrit.libreoffice.org/51603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-20 13:08:20 +01:00
Julien Nabet
070dbae6b4 Use for-range loops in forms
Change-Id: I23f63f2a98ce64513f5cb4b06e373b5ec9509d62
Reviewed-on: https://gerrit.libreoffice.org/51445
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-03-17 08:23:33 +01:00
Tomaž Vajngerl
6c6b2c886e forms: Don't create a GraphicObject URL if we have xGraphic anyway
Change-Id: Ia80df77372ed08abc4ff816515c216c26d8330b4
Reviewed-on: https://gerrit.libreoffice.org/51326
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-03-15 23:15:40 +01:00
Noel Grandin
a498b12dc1 use more Color in editeng..forms
Change-Id: If6c862e7bb61cd78c3379afde11b528a74162900
Reviewed-on: https://gerrit.libreoffice.org/50860
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-07 08:35:04 +01:00