Commit Graph

4019 Commits

Author SHA1 Message Date
6256797dac tdf#42949 Fix IWYU warnings in include/vcl/[v-x]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I98f49765c6b74808dcbd692e0f375dd2848fcfd4
Reviewed-on: https://gerrit.libreoffice.org/65614
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-07 09:13:14 +01:00
854b6a5f00 Remove unneeded cast, constify OUString
Change-Id: I4a92779f86104cdad420069620eec50cea85b29c
Reviewed-on: https://gerrit.libreoffice.org/65662
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
2018-12-28 16:46:11 +01:00
538ed5f348 basic: Spare temporary variable
Change-Id: I6c39061e04537c01c87f6cb2f40a35dd0a551a08
Reviewed-on: https://gerrit.libreoffice.org/65597
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-26 08:13:42 +01:00
bd26a8efd5 use unique_ptr in SbiExpression
Change-Id: I8b44215c438b749afce4ad056cab2c2ac66d4bda
Reviewed-on: https://gerrit.libreoffice.org/65534
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-21 18:52:05 +01:00
30eb0839c5 loplugin:useuniqueptr in basic and framework
Change-Id: I409c9c572eb8f3d68c8a387844b43988b4ab5c32
Reviewed-on: https://gerrit.libreoffice.org/64949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-12 07:28:49 +01:00
00b49f9ff9 tdf#42949 Fix IWYU warnings in include/vcl/s*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Ie87d27dd2c385a63349e0b322fd067ba03d2d152
Reviewed-on: https://gerrit.libreoffice.org/64479
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-12-10 14:19:50 +01:00
a35bfce31f Fix typo
Change-Id: I9de253ee55e662b0356f1fe305cd0acb050474da
Reviewed-on: https://gerrit.libreoffice.org/64826
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-12-09 09:12:25 +01:00
ab9b67bbb0 Remove obsolete SAL_FALLTHROUGH completely
...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-08 13:28:16 +01:00
38187ec15b loplugin:singlevalfields extend to all static vars
Change-Id: Ic238bb5291539fd1b7e98cb4afc9b25f37e7d528
Reviewed-on: https://gerrit.libreoffice.org/64710
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-07 07:38:24 +01:00
f4e5cdcc28 Fix typo
Change-Id: I0345811912003e308054df426e533ac7c3866284
Reviewed-on: https://gerrit.libreoffice.org/64416
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-12-05 08:41:11 +01:00
e4472d3c13 loplugin:unnecessaryparen include more assignments
Change-Id: I9fb8366634b31230b732dd38a98f800075529714
Reviewed-on: https://gerrit.libreoffice.org/64510
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-05 07:49:30 +01:00
1f2d3b3f09 tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: Ia9c496ec93bedb13764969bf21c3f21d84caacef
Reviewed-on: https://gerrit.libreoffice.org/64413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-12-02 05:31:10 +01:00
ee8cba8591 Fix typos
Change-Id: Ie85b3a61ded8c6fd7a1f8c463912062669b3719b
Reviewed-on: https://gerrit.libreoffice.org/64357
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-12-01 02:13:11 +01:00
597aeaf7a9 Fix typo
Change-Id: I028e5462e9785bac77a98d09f0bf91b4da67e477
Reviewed-on: https://gerrit.libreoffice.org/64263
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2018-11-30 07:51:17 +01:00
21de55596c remove unnecessary "if (!empty()" checks before loops
found with
   git grep -n -A4 'if.*!.*empty' | grep -B3 -P
'(\bfor)|(\bwhile)|(\bdo)'

Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334
Reviewed-on: https://gerrit.libreoffice.org/64169
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-29 07:17:37 +01:00
00caf3994c Fix typo
Change-Id: I8e340cc5bbf5131939446291177c3532911237ab
Reviewed-on: https://gerrit.libreoffice.org/64183
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-11-29 00:08:52 +01:00
48314f2524 improve function-local statics in basic..cui
Change-Id: If737e8478f6f1c8fffb060ce132d80e0f07ef8ee
Reviewed-on: https://gerrit.libreoffice.org/63701
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-21 12:28:23 +01:00
0a060db0c2 Fix a copypaste error
Has been like this since commit 2d1ef8aa2493f044fa543c72b40bd8c8394d8d71

Change-Id: Idf0e05246f625befb4872e743b490a5594d24f8f
Reviewed-on: https://gerrit.libreoffice.org/63548
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-20 21:15:58 +01:00
12e460d999 loplugin:buriedassign in avmedia..cui
Change-Id: Id44f1e98a3aac2c417f8030de603175bf68f0dfe
Reviewed-on: https://gerrit.libreoffice.org/63467
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-16 14:03:25 +01:00
9950e50a0f Set error also in non-UNO/UCB case file date failures, tdf#121337 follow-up
And do not attempt to format an odd date in case of failure.

Change-Id: I82e93f9e473f42735b6a7e7b634b14ee7f09941d
Reviewed-on: https://gerrit.libreoffice.org/63331
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
2018-11-13 21:51:25 +01:00
a6a48eeef1 tdf#121325: Replace all of given length, even if replacement is shorter
Both LO and MS Basic restrict the amount of replacement text ("If the Length
parameter in the <emph>Mid statement</emph> is less than the length of the text
that you want to replace, the text is reduced to the specified length." in
helpcontent2/source/text/sbasic/shared/03120306.xhp, resp. "The number of
characters replaced is always less than or equal to the number of characters in
Target." at <https://docs.microsoft.com/en-us/dotnet/visual-basic/
language-reference/statements/mid-statement>).

But cc20344010e94eda22fee662aab966d395a0796a "tdf#111313: Honor bWriteNoLenParam
in !bCompatibility, too" had introduced a regression (in the non--compatibility-
mode case), restricting the amount of replaced text to be no more than the
amount of replacement text, even if the given length argument was larger.
(Which had already regressed in the past, see
<https://bugs.documentfoundation.org/show_bug.cgi?id=62090> "Mid statement
doesn't work as expected".)

Added test cases now.

Change-Id: I21d4409f49a2437eb0e1a1e200561d803c42a24c
Reviewed-on: https://gerrit.libreoffice.org/63328
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-13 15:26:09 +01:00
b05470083a Don't call Date's ImpYearToDays with zero year argument
...on which it asserts since 6d4f2dcc7cbba771e9d9b00de50368db4a88ef1b "Resolves:
tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar".

The assert fired when executing the Basic code from attachment 146529 to
<https://bugs.documentfoundation.org/show_bug.cgi?id=121337>
"FileDateTime("\\nonexistent\smb\path") returns bogus result rather than
throwing error":

> #4  0x00007ffff1d1c830 in (anonymous namespace)::ImpYearToDays(short) (nYear=0) at tools/source/datetime/tdate.cxx:55
> #5  0x00007ffff1d1c449 in Date::DateToDays(unsigned short, unsigned short, short) (nDay=0, nMonth=0, nYear=0) at tools/source/datetime/tdate.cxx:149
> #6  0x00007ffff1d1c3e5 in Date::GetAsNormalizedDays() const (this=0x7fffffff7268) at tools/source/datetime/tdate.cxx:142
> #7  0x00007ffff1d1dae5 in operator-(Date const&, Date const&) (rDate1=1900-1-1, rDate2=0-0-0) at tools/source/datetime/tdate.cxx:581
> #8  0x00007ffff5f87347 in GetDayDiff(Date const&) (rDate=0-0-0) at basic/source/runtime/methods.cxx:4653
> #9  0x00007ffff5f8aebb in SbRtl_FileDateTime(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods.cxx:3054

Change-Id: I6468eeafc3daf325d3da3dfeacd08c7df1d1a8f4
Reviewed-on: https://gerrit.libreoffice.org/63318
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
2018-11-13 14:14:56 +01:00
94f79b3bf1 Remove unneeded cast
Change-Id: I04279faaf11bd1249bcea0d07d60facefb5186d8
2018-11-10 22:04:08 +01:00
065edb4c8e tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643
Reviewed-on: https://gerrit.libreoffice.org/63235
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-10 12:23:42 +01:00
e3560f4770 Replace deprecated boost::optional::reset(val) with operator =
Change-Id: I7340a561e0df0c781fd834388deb4b9f83800f9b
Reviewed-on: https://gerrit.libreoffice.org/63221
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-10 09:16:53 +01:00
6311f7ffce move SvTreeListBox to vcl
Change-Id: I04a146d3d8a428ac1678827dc883525c40240a44
Reviewed-on: https://gerrit.libreoffice.org/62787
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-11-07 22:01:02 +01:00
819149fb1f loplugin:collapseif in accessibility..cui
Change-Id: I1437b493f3289b4ac97d061bd71973580571e792
Reviewed-on: https://gerrit.libreoffice.org/62933
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-06 10:28:47 +01:00
00055d49f3 remove with_sprintf_ define
it has been this way since

    commit f333ee4564f7786f5f4ca501d71e660b5c366b93
    Date:   Wed Apr 11 11:54:30 2007 +0000
    INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED

Change-Id: I317efd9538436480a9fc3d37e748b0a51052ef80
Reviewed-on: https://gerrit.libreoffice.org/62932
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-06 10:18:16 +01:00
cb9d192f18 tdf#120703 PVS: V547 Expression '!pRTLData' is always false
Let SbiInstance::GetRTLData() return reference

Change-Id: Iafe7e64f6f296b478003ce66ea66936a65ba9edc
Reviewed-on: https://gerrit.libreoffice.org/62855
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-05 09:43:24 +01:00
2226d69ae3 Make SbiProcDef::Match more readable
This reverts commit 02caaef29d60 ("loplugin:useuniqueptr in
SbiProcDef") and is hopefully easier to follow.

Change-Id: I46be2b3c7a933743795d89fe17a2c499c6983382
Reviewed-on: https://gerrit.libreoffice.org/62548
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-30 21:40:26 +01:00
51b6a52e1c tdf#120703 PVS: V724
V724 Converting type 'int' to type 'sal_Bool' can lead to a loss of
     high-order bits. Non-zero value can become 'FALSE'.

Change-Id: I26540aa9fa9390e1990e95d81665567cd0a248b5
Reviewed-on: https://gerrit.libreoffice.org/62426
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27 18:39:13 +02:00
db7e454bf7 tdf#120703 PVS: V668
V668 There is no sense in testing the 'pProc' pointer against null, as the
     memory was allocated using the 'new' operator. The exception will be
     generated in the case of memory allocation error.

Change-Id: Iec65fd44fa947a2402da33510c29730a46c2e1a4
Reviewed-on: https://gerrit.libreoffice.org/62424
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27 18:00:01 +02:00
6a12a9e941 tdf#120703 PVS: V530 The return value of function is required to be utilized
Change-Id: Ifc170a45e25b3fd5b7f561cc50afb6452bb359bd
Reviewed-on: https://gerrit.libreoffice.org/62420
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27 15:30:59 +02:00
33623f3117 tdf#42949 Fix IWYU warnings in include/unotools/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I444c43b9d549977039f25bec2b5bf666c3e15e0e
Reviewed-on: https://gerrit.libreoffice.org/62041
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-26 15:08:18 +02:00
c0cc59adca loplugin:singlevalfields improvement
look for any kind of types, not just POD types, helps to find
smart pointer fields that are only assigned nullptr

Change-Id: I2d887e98db012f03b646e1023985bcc196285abc
Reviewed-on: https://gerrit.libreoffice.org/62382
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-26 11:20:07 +02:00
d90ec5d26f tdf#42949 Fix IWYU warnings in include/xmlscript/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Iacc5b98b947a26ca920cb9c49e579bc61d69b0c9
Reviewed-on: https://gerrit.libreoffice.org/62119
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-25 09:09:35 +02:00
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
44688e498c clang-tidy performance-unnecessary-copy-initialization in
basctl..basic

Change-Id: I4009282869cd8a2f269093564bd4fafccab80ec3
Reviewed-on: https://gerrit.libreoffice.org/62212
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-23 08:39:10 +02:00
e5e0cc68f7 pvs-studio: V794 The assignment operator should be protected
Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669
Reviewed-on: https://gerrit.libreoffice.org/62166
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-22 12:54:08 +02:00
58abc74248 tdf#120703 (PVS): redundant nullptr checks
V668 There is no sense in testing the 'm_pScriptSubPackageIterator' pointer
     against null, as the memory was allocated using the 'new' operator. The
     exception will be generated in the case of memory allocation error.

Change-Id: I15e635a6c9420ff444c5998dc0dbbf6f74ca6644
Reviewed-on: https://gerrit.libreoffice.org/62126
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-21 12:29:53 +02:00
3d0559e4b8 tdf#120703 (PVS): redundant nullptr check
V668 There is no sense in testing the 'pChan' pointer against null, as the
     memory was allocated using the 'new' operator. The exception will be
     generated in the case of memory allocation error.

Change-Id: I1cb78c27da753525f05de2d3a0b74c894b07528e
Reviewed-on: https://gerrit.libreoffice.org/62124
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-21 12:26:39 +02:00
76a2563947 tdf#120703 (PVS): redundant check
V547 Expression 'aData.eType == SbxDECIMAL' is always true

Change-Id: I37bf367221ced7bf1c53bcd5138ae7bac656da52
Reviewed-on: https://gerrit.libreoffice.org/62030
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-20 08:49:13 +02:00
35e80e9726 when calling std::lower_bound
it's not enough to compare != end(), you also need to compare the key
against the iterator result

Change-Id: Ide5f151ba2297a35e5546f47fbc3c53cbe5ab533
Reviewed-on: https://gerrit.libreoffice.org/62014
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-20 08:00:32 +02:00
49d304c4f6 tdf#120706: nullptr dereference
Change-Id: I55814a6b4cdfda93a51621b5b31c166507a7e7a6
Reviewed-on: https://gerrit.libreoffice.org/62005
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-19 20:31:22 +02:00
2c1b7e8d6a clang-tidy readability-container-size-empty
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422
Reviewed-on: https://gerrit.libreoffice.org/61967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19 10:02:39 +02:00
e61e4e5699 clang-tidy readability-misleading-indentation
Change-Id: I4673fc7c694924b41d048a1918ddb8b0e0af1f79
Reviewed-on: https://gerrit.libreoffice.org/61935
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19 07:58:15 +02:00
ccb2a1f650 clang-tidy readability-redundant-smartptr-get
redundant get() call on smart pointer

Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd
Reviewed-on: https://gerrit.libreoffice.org/61837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-17 08:25:47 +02:00
db50f2f094 clang-tidy bugprone-copy-constructor-init
message is "calling a base constructor other than the copy constructor"

these constructors are not in use, so just remove them

Change-Id: Ic8cede1eb153a6ae97fd1ca9c96ca8c1f43e3399
Reviewed-on: https://gerrit.libreoffice.org/61784
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15 15:50:08 +02:00
9ec8bf8f22 add SvStream::TellEnd
and simplify callsites to use it instead of the current
    "seek to end, find pos, seek back to original pos"
pattern

Change-Id: Ib5828868f73c341891efc759af8bd4695ae2f33c
Reviewed-on: https://gerrit.libreoffice.org/61738
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15 07:56:42 +02:00
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