Commit Graph
288 Commits
Author SHA1 Message Date
VaibhavMalik4187 40bab1e31c tdf#145614 Convert #define to enum or constexpr
Change-Id: Ib6694ec77c275c9a604abfa7d87df6ab262449b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128250
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
2022-01-19 06:55:12 +01:00
Noel Grandin 3152f5a33e use more cppu::BaseMutex
Change-Id: Iddd7438161ead93b27cf8e8058ca5b1eae3d8001
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127075
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-19 11:19:12 +01:00
Noel Grandin 6da12ca82d loplugin:stringliteraldefine in various
Change-Id: Ib482e3982128dc47d88a79478d80eef43745d1b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126086
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-30 14:07:26 +01:00
Mike Kaganski 2484de6728 Remove non-const Sequence::begin()/end() in internal code
... to avoid hidden cost of multiple COW checks, because they
call getArray() internally.
This obsoletes [loplugin:sequenceloop].

Also rename toNonConstRange to asNonConstRange, to reflect that
the result is a view of the sequence, not an independent object.

TODO: also drop non-const operator[], but introduce operator[]
in SequenceRange.

Change-Id: Idd5fd7a3400fe65274d2a6343025e2ef8911635d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123518
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-15 10:36:36 +02:00
Noel Grandin 3a1a448ac4 loplugin:constvars
Change-Id: I9b35d6333afa6b305bf73fc55a7e60c8365674e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122134
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15 12:43:21 +02:00
Noel Grandin 86abf3a682 create comphelper::OMultiTypeInterfaceContainerHelper2 and use it
based on OInterfaceContainerHelper2 which is considerably
faster than the original OInterfaceContainerHelper

Change-Id: I9c8b6d0e5382018824bf7188a26343703abf2d51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120161
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-07 21:34:33 +02:00
Noel Grandin 1597cc5b3e convert #defines to OUStringLiteral
mostly by doing

$ git grep -l '#define.*\"' -- *.cxx
    | xargs perl -pi -e
's/^#define\s+(\w+)\s+(\".*\")/constexpr OUStringLiteral \1 =
u\2;/g'

Change-Id: Idface893449b0ef2a3c5254865a300585d752fbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119669
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-02 14:43:58 +02:00
Noel Grandin 1296ded169 fix the mutex locking in impl_searchTopic
you cannot take a pointer to something inside a guard and then use that
data outside the guard.

So remove the broken locking here, and make sure the call sites hold the
lock.

Change-Id: I37cc363ff937243d7965844e8bcda0018085c656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119370
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-22 18:50:49 +02:00
Noel Grandin d1de326b0b no need to use unique_ptr here
for such a small object

Change-Id: Idbcad7469b3871c05226e90b8d46223fe746cce2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119369
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-22 14:06:02 +02:00
Noel Grandin 159b8fb14f flatten vector in BaseContainerControl
no need to allocate the entries separately

Change-Id: I00c4abe75701685689eb7d09a97c349cb0271f1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119304
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-21 13:39:14 +02:00
Stephan Bergmann 10d29c390d throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewrite
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-02 17:02:28 +02:00
Noel Grandin c7c6f0af6c loplugin:stringadd convert chained append to +
which can use the more efficient *StringConcat

Also fix a crash in stringview plugin which
started happening while I working on this.

Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-27 14:07:56 +02:00
Noel b624b13b3d loplugin:flatten
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-26 18:02:19 +01:00
Noel 9bd8272706 loplugin:referencecasting in UnoControls..unoxml
Change-Id: I42f216b6115be693a4e57d70f6cbbf11b62ec185
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110998
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-16 20:17:39 +01:00
Stephan Bergmann 4b55847b81 Improve loplugin:doubleconvert
(The use of isa_and_nonnull<> instead of isa<> is necessary for cases like

  return (i_styleSettings.*i_getDefaultColor)();

in lcl_getEffectiveColor, svtools/source/table/gridtablerenderer.cxx.)

Change-Id: Iffc59b1146dd4ce13bbd3c8a6f46bd3c78a39344
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109663
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-20 11:27:33 +01:00
Noel bca1b74c07 improve some IllegalArgumentException messages
Change-Id: Id88f2a82bf2651e8b5895aa330f32b71ff5b0e48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109546
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-20 09:03:45 +01:00
Noel 63a68064bb make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place,
and add a clang plugin to detect when the value passed to the
existing constructor may contain transparency/alpha data.

i.e. we leave expressions like Color(0xffffff) alone, but
warn about any non-constant expression, and any expression
like Color(0xff000000)

Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-16 10:07:07 +01:00
Noel bb06f51308 loplugin:stringviewparam extend to comparison operators
which means that some call sites have to change to use
unicode string literals i.e. u"foo" instead of "foo"

Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24 09:45:04 +01:00
Noel 8ef6067596 loplugin:stringviewparam check methods too
not just functions

Change-Id: Icca295dd159002b428b73f2c95d40725434f04d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105789
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-17 09:57:35 +01:00
Noel Grandin 33abb535a7 loplugin:flatten in UnoControls
Change-Id: I0702283083297fc956eb8bd5132a1144286e1fcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99968
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-02 22:45:48 +02:00
Noel Grandin 78639945da UnoControl: create instances with uno constructors
See tdf#74608 for motivation.

Change-Id: I3df173e3c7064d3d925d3abe5c652b8cbe6c8ea5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97892
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-04 08:32:56 +02:00
Noel Grandin d6c32cffb5 loplugin:simplifybool extend to expression like !(a < b || c > d)
mostly to catch stuff from the flatten work, but I think this looks good
in general

Change-Id: I7be5b7bcf1f3d9f980c748ba20793965cef957e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-30 10:49:51 +02:00
Gabor Kelemen e12fa18c69 tdf#42949 Simplify use of rtl::math::approxEqual in include/basegfx/
Turns out we can save about 500Mb of preprocessor input if we use
rtl_math_approxEqual from rtl/math.h instead of its C++ wrapper
rtl::math::approxEqual from rtl/math.hxx

and manage the fallout accordingly.

Before:
bin/includebloat.awk | head
sum total bytes included (excluding system headers): 19017296671

After:
$ bin/includebloat.awk | head
sum total bytes included (excluding system headers): 18535432672

Change-Id: I1691171f3a309405a7099882ad9989d147f59118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92508
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-04-22 15:36:50 +02:00
Noel Grandin d9e4783302 loplugin:finalclasses in xmlsecurity..UnoControls
Change-Id: I8e942bf37c9173a01bef6e1403ca21f579e7f608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91612
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-03 11:37:53 +02:00
Gabor Kelemen d3e1ada454 Remove unused using declarations in oox...xmlsecurity
Found by:
run-clang-tidy-10 -checks=-*,misc-unused-using-decls

Change-Id: I3e95791e223ef01e140a6217e29a9efae428a784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90876
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-25 09:13:27 +01:00
Noel Grandin 12a8fa0d65 Revert "loplugin:constfields in ucbhelper"
This reverts commit 64035391eb.

Change-Id: Icfde3e984f9ebf93a423d101aee385182f65dea5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90518
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-15 16:28:14 +01:00
nienzu d8fe52d759 tdf#42982 add detail exception reason for UnoControls
Change-Id: Ia62a0015d68fe819113322e27b93054d38d98aea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88996
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-02-19 12:31:30 +01:00
Andrea Gelmini 0104c28cea tdf#124176: Use "pragma once" on UnoControls/*
It passed "make check" on Linux

Change-Id: I4b0427e86063de0d4b1fd916ab4dfb1505db5a04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85888
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-12-28 10:31:38 +01:00
Stephan Bergmann 314f15bff0 Extend loplugin:external to warn about enums
To mitigate the dangers of silently breaking ADL when moving enums into unnamed
namespaces (see the commit message of 206b5b2661
"New loplugin:external"), note all functions that are affected.  (The plan is to
extend loplugin:external further to also warn about classes and class templates,
and the code to identify affected functions already takes that into account, so
some parts of that code are not actually relevant for enums.)

But it appears that none of the functions that are actually affected by the
changes in this commit relied on being found through ADL, so no adaptions were
necessary for them.

(clang::DeclContext::collectAllContexts is non-const, which recursively means
that External's Visit... functions must take non-const Decl*.  Which required
compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support
such Visit... functions with non-const Decl* parameters.)

Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd
Reviewed-on: https://gerrit.libreoffice.org/83001
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-17 00:28:17 +01:00
Noel Grandin 8e2e03b1c3 loplugin:duplicate-defines in UnoControls
these are only used by internal code, so move inside the relevant .cxx
file

Change-Id: If7cdf17a49ff3089ad2100961092dd2747523a8d
Reviewed-on: https://gerrit.libreoffice.org/79830
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-30 13:12:43 +02:00
Noel Grandin 0bb521f4f9 loplugin:returnconstval in UnoControls
Change-Id: I6e855ee6dc2075334e92803d87e660f389b54d53
Reviewed-on: https://gerrit.libreoffice.org/78055
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-24 16:12:11 +02:00
Noel Grandin fe00a724a9 loplugin:sequenceloop in basic..cui
Change-Id: I15d825de3201808d188b461415f78a4d81b64127
Reviewed-on: https://gerrit.libreoffice.org/77494
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15 11:59:02 +02:00
Stephan Bergmann 40c250cae0 Improved loplugin:stringconstant (now that GCC 7 supports it): UnoControls
Change-Id: I4f24cb6e5c44b27dc0fc85ddadedb7a93b4e5eb4
Reviewed-on: https://gerrit.libreoffice.org/76701
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-31 13:01:42 +02:00
Noel Grandin 01782ecd9f loplugin:referencecasting in various
Change-Id: Id4e3d9d1bbfd47181299568afec45e996eb1eed5
Reviewed-on: https://gerrit.libreoffice.org/76071
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-21 16:04:20 +02:00
Gabor Kelemen 55961e110f tdf#42949 Fix IWYU warnings in UnoControls/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Id088a2c8a91c2fe7c8ff9e05d910d5b5e9383b7c
Reviewed-on: https://gerrit.libreoffice.org/72095
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-17 09:21:49 +02:00
Arkadiy Illarionov a11572dc2e Simplify Sequence iterations in UnoControls
Use range-based loops

Change-Id: I4d3be75bb83c74267b9dec6f1dcdc105c292be9d
Reviewed-on: https://gerrit.libreoffice.org/72011
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-09 08:48:32 +02:00
Mike Kaganski f3fc127dc0 Use osl_atomic_increment/osl_atomic_decrement to change m_refCount
Change-Id: Ia24441d3671102fdeeb797547396c25ee2a6ffd3
Reviewed-on: https://gerrit.libreoffice.org/70382
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-04-08 05:32:56 +02:00
Mike Kaganski 5a824268df Don't use resettable/clearable guard where plain guard is enough
Also use scope where possible. This allows to limit guard scope at
language level; visualises the scope clearly; and helps avoiding
errors like fixed in commit 61e4437c85.

Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41
Reviewed-on: https://gerrit.libreoffice.org/70376
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-04-07 17:53:04 +02:00
Andrea Gelmini 0317835baf Fix typo
Change-Id: I49ffb2fff63a8818c4e84a26923fca1484bf1e36
Reviewed-on: https://gerrit.libreoffice.org/70284
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-05 09:56:29 +02:00
Andrea Gelmini fd33e13d75 Fix typo
Change-Id: I42090a462b15fbc537b0fdb5eaf66f60a213e5ff
Reviewed-on: https://gerrit.libreoffice.org/70103
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 08:52:02 +02:00
Andrea Gelmini d1496ca658 Fix typo
Change-Id: I7831896b8898f0cb20589fbd241b97fcc21db366
Reviewed-on: https://gerrit.libreoffice.org/70108
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 07:51:12 +02:00
Andrea Gelmini 94ac464dd5 Fix typo
Change-Id: I546735f427a47d9ada1589e1861d0cf696788b05
Reviewed-on: https://gerrit.libreoffice.org/70107
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 07:49:47 +02:00
Andrea Gelmini 78f2aa9f5e Fix typo
Change-Id: I0e8f761768c7faf3da1d11d6fe02ee24e1180cf2
Reviewed-on: https://gerrit.libreoffice.org/70104
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 07:49:02 +02:00
Andrea Gelmini 11c40f5b75 Fix typo
Change-Id: I907b28c98133162a31835ebaeae6244dc8735752
Reviewed-on: https://gerrit.libreoffice.org/70106
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 07:47:44 +02:00
Andrea Gelmini 4852ca0f86 Fix typo
Change-Id: I794be89bed433e813feaecffce9464d087ddde61
Reviewed-on: https://gerrit.libreoffice.org/70105
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-03 07:07:13 +02:00
Noel Grandin 74ed61e793 loplugin:indentation in UnoControls..accessibility
Change-Id: Ib58ac1c7171331eac543eba7b5f7bae8fa04ae4d
Reviewed-on: https://gerrit.libreoffice.org/67524
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-08 10:02:05 +01:00
Andrea Gelmini 93a14053ad Fix typos
Change-Id: I4beaec7bf6b023a73be464a8c38b0701ff3ae1b1
Reviewed-on: https://gerrit.libreoffice.org/63116
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-11-09 07:05:30 +01:00
Noel Grandin b3c449b74f loplugin:useuniqueptr in impl_getWindowDescriptor
return by value, the usual C++ optimisations will make this efficient

Change-Id: I7f9634b9663605504c69e0381a6ebc9c76061048
Reviewed-on: https://gerrit.libreoffice.org/62645
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-31 07:30:39 +01:00
Noel Grandin 64035391eb loplugin:constfields in ucbhelper
Change-Id: Ic9d59b352dcb771191de963c0f6e90c74647c8b8
Reviewed-on: https://gerrit.libreoffice.org/60983
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-27 08:29:41 +02:00
Noel Grandin da0a588b64 m_xTabControllerList is dead
ever since
    commit af4b38d6e7
    Date:   Mon Mar 24 15:59:06 2014 +0100
    Remove dead code

Change-Id: Ia7848f469d91666f13130132ebe5766c4fedcebb
Reviewed-on: https://gerrit.libreoffice.org/60621
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-18 20:53:38 +02:00