Commit Graph

1383 Commits

Author SHA1 Message Date
Noel Grandin
e276c81264 size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512 (e.g. in emfio/).

Change-Id: Ib7caf35a1b7e42b0e4ed8aa812493449e3eefc8f
Reviewed-on: https://gerrit.libreoffice.org/81540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-26 12:38:33 +02: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
8b4719c29f Rename OUStringLiteral1 to OUStringChar
It started out as a wrapper around character literals, but has by now become a
wrapper around arbitrary single characters.  Besides updating the documentation,
this change is a mechanical

  for i in $(git grep -Fl OUStringLiteral1); do sed -i -e s/OUStringLiteral1/OUStringChar/g "$i"; done

Change-Id: I1b9eaa4b3fbc9025ce4a4bffea3db1c16188b76f
Reviewed-on: https://gerrit.libreoffice.org/80892
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17 07:28:49 +02:00
Noel Grandin
4a96fb8ec0 loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a
length

Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8
Reviewed-on: https://gerrit.libreoffice.org/80872
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-16 12:12:31 +02:00
Noel Grandin
f13c6ad5f0 new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations

Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-15 14:33:57 +02:00
Noel Grandin
9b5dad13b5 loplugin:stringadd look for unnecessary temporaries
which defeat the *StringConcat optimisation.
Also make StringConcat conversions treat a nullptr as an empty string,
to match the O*String(char*) constructors.

Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
Reviewed-on: https://gerrit.libreoffice.org/80724
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14 08:26:14 +02:00
Noel Grandin
cdbac696fb simplify "a = a +" to "a +="
mostly so that my stringadd loplugin can point out places to improve

Change-Id: I9920ee1c99cdb6b811ba67ff9d8e32aa261884b5
Reviewed-on: https://gerrit.libreoffice.org/80618
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-11 07:18:11 +02:00
Andrea Gelmini
c12c84e6d8 Fixing "...."
Change-Id: I3424e17cfdfb563fdc5882942031deafae8689fe
Reviewed-on: https://gerrit.libreoffice.org/78678
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-06 09:13:38 +02:00
Andrea Gelmini
ee8f0a1066 Fix '..'
To complete this:
https://gerrit.libreoffice.org/#/c/78312/

This is a massive replace for
".." instead of "..." between words.

It passed "make check" on Linux.

Change-Id: I144d8061fca9f545c762941551e59dffdd3650e8
Reviewed-on: https://gerrit.libreoffice.org/78357
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2019-09-01 12:29:39 +02:00
Stephan Bergmann
5264c7dcef Clean up OSL_ASSERT in stoc/source/uriproc/
Change-Id: Ia474439d4e35009ec0941b122653a649692aead7
Reviewed-on: https://gerrit.libreoffice.org/77943
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-23 14:47:43 +02:00
Stephan Bergmann
5bbf9ca7cc [API CHANGE] Adapt css.uri UNOIDL entities to RFC 3986
...which obsoleted RFC 2396.  Notable changes are that the distinction between
hierarchical and opaque URIs has been dropped, and that the relative URI
resolution specification has been made more rigid.

As a consequence, various features of css.uri entities have changed:

* XUriReference.isHierarchical is obsolete and deprecated.

* The behavior of XUriReference.hasAuthority, XUriReference.getAuthority,
  XUriReference.getPath, XUriReference.hasRelativePath,
  XUriReference.getPathSegmentCount, XUriReference.getPathSegment,
  XUriReference.hasQuery, and XUriReference.getQuery has been made consistent
  for all URIs, no matter whether they were considered hierarchical or opaque in
  the past.

* The behavior of XUriReferenceFactory.makeAbsolute and
  XUriReferenceFactory.makeRelative has been changed to match the RFC 3986
  reference resolution specification.  The XUriReferenceFactory.makeAbsolulte
  parameter processSpecialBaseSegments has been renamed to
  processAdditionalSpecialSegments, as per the updated specification it now
  controls treatment of special segments in the given uriReference, in addition
  to special segments in the given baseUriReference.  (Renaming UNOIDL interface
  method parameters is technically an incompatible change, but the benefits of
  improved clarity presumably outweigh any potential drawbacks in this case.)

The implementation in stoc has been adapted, and various call sites have been
adapted to the deprecated XUriReference.isHierarchical semantics.

Change-Id: Ic6e00fdbce5abef70d75ec2f753d22fefe361457
Reviewed-on: https://gerrit.libreoffice.org/77861
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-23 14:47:01 +02:00
Noel Grandin
95dd183c41 loplugin:constvars in solenv..svtools
Change-Id: Ieb0116321bbddd804db6d1789ea3521c5b220840
Reviewed-on: https://gerrit.libreoffice.org/77807
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-20 15:35:37 +02:00
Julien Nabet
cc70a9dec7 tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor
in sfx2, stoc

Change-Id: I7138f702317d0e693438216732bf181f1972cdc1
Reviewed-on: https://gerrit.libreoffice.org/77648
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-17 22:16:31 +02:00
Arkadiy Illarionov
3e64065612 Optimize NestedKeyImpl::openKeys
* Use const methods of Sequence
* Get rid of extra loop over localSeq
* Simplify default keys insert condition

Change-Id: I112c0a53d3ebfc2ff54a4ac904e6e112beaf3cdd
Reviewed-on: https://gerrit.libreoffice.org/77472
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
2019-08-15 23:44:41 +02:00
Noel Grandin
c504780e78 loplugin:sequenceloop in starmath..svl
Change-Id: I473a8eec9cbf6d44b55ffd6f2233bf39cf6217da
Reviewed-on: https://gerrit.libreoffice.org/77528
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15 20:23:04 +02:00
Stephan Bergmann
b122db670b Reformulate TypeConverter_Impl::toHyper FLOAT/DOUBLE cases
...to avoid UB when fVal was cast to nRet *before* checking that fVal actually
fit into the bounds, and to avoid Clang 10
-Werror,-Wimplicit-int-float-conversion when comparing fVal against
SAL_MAX_INT64 ("implicit conversion from 'const sal_Int64' (aka 'const long') to
'double' changes value from 9223372036854775807 to 9223372036854775808")

Change-Id: I9e2f6c97309609d9ec2455d4ecf9c341d85c1680
Reviewed-on: https://gerrit.libreoffice.org/77430
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-14 08:58:22 +02:00
Stephan Bergmann
63128dd267 Drop MSVC workaround from 2002
(cf. f2b0299972 "#97095# MS Visual C++ unsigned
__int64 to double missing"), assuming that our baseline MSVC is capable of that
by now.

Replace DOUBLE_SAL_UINT64_MAX with double(SAL_MAX_UINT64) and replace
unsigned_int64_to_double(X) with either X or static_cast<double>(X), matching
respective context.

Change-Id: Ia1e1daff5cbcb545738615fad541082810d7a46b
Reviewed-on: https://gerrit.libreoffice.org/77414
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-13 17:23:03 +02:00
Stephan Bergmann
ce1ac2973e Use existing SAL_MIN/MAX_...
Change-Id: Ic1c18f1eb7db7b25cc1b276b8786630bd1d68929
Reviewed-on: https://gerrit.libreoffice.org/77397
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-13 14:45:28 +02:00
Stephan Bergmann
d15e0ff4fd Improved loplugin:stringconstant (now that GCC 7 supports it): stoc
Change-Id: Id739d5ff815d3bb1db48e9b1c2b3f739e3f11dfd
Reviewed-on: https://gerrit.libreoffice.org/76644
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-31 12:54:36 +02:00
Arkadiy Illarionov
6ffdc88e79 Simplify Sequence iterations in shell..svgio
Use range-based loops, STL and comphelper functions

Change-Id: I612d36abcc09a91c60f7212de6747a1a1bdcfc69
Reviewed-on: https://gerrit.libreoffice.org/76056
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
2019-07-22 18:42:35 +02:00
Noel Grandin
17db60eb46 loplugin:referencecasting in slideshow..svtools
Change-Id: Id0f0332d5d66c0bce309643bf42059b9bdc7d448
Reviewed-on: https://gerrit.libreoffice.org/75997
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-21 08:49:01 +02:00
Noel Grandin
e1eb7cb04a loplugin:logexceptionnicely in starmath..svgio
Change-Id: I356e574e28338f6fddc6932b4e41a461d851406d
Reviewed-on: https://gerrit.libreoffice.org/74141
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-18 09:27:59 +02:00
Stephan Bergmann
c18e2ea2a5 New loplugin:data
...following up on 1453c2c8f1 "prefer vector::data
to &vector[0]"

Change-Id: I7c113747d92d144a521d49b89384dd8bf1215c01
Reviewed-on: https://gerrit.libreoffice.org/72765
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-05-22 16:35:20 +02:00
Gabor Kelemen
62605b16b0 tdf#42949 Fix IWYU warnings in stoc/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I3c1b091d30449243faec3f875e6f0ac6d8b34259
Reviewed-on: https://gerrit.libreoffice.org/72214
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-20 10:33:01 +02:00
Arkadiy Illarionov
f20810f782 Use hasElements to check Sequence emptiness in sfx2..svx
Similar to clang-tidy readability-container-size-empty

Change-Id: Icabd773f3b924d465b33e8581175f1fcf70c282e
Reviewed-on: https://gerrit.libreoffice.org/71704
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-03 10:08:31 +02:00
Noel Grandin
dd8d5e5795 improve loplugin:stringconstant
to find more places we can elide the OUString() constructor at call
sites

Change-Id: Ie09f3c61f2c4b4959c97dc98ebcbaf7c51d5d713
Reviewed-on: https://gerrit.libreoffice.org/71514
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-30 08:43:51 +02:00
Noel Grandin
22f2cf3ccc implement std::hash for css::uno::Reference and rtl::Reference
The declaration in BarChart.cxx is particularly suspicious, because it
was using a < for the KeyEqual template parameter.
Been there since:
    commit b2c3233e5f
    Date:   Thu Dec 21 20:08:33 2017 +0900
    chart2: suspend/resume setting rects dirty for 3D shapes

comphelper::OInterfaceCompare is no longer necessary

Change-Id: I8278c4a3d9113a18570ca237cd05d553ec8f3975
Reviewed-on: https://gerrit.libreoffice.org/71537
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-30 08:43:04 +02:00
Noel Grandin
8f59317223 loplugin:sequentialassign in starmath..svl
Change-Id: I95d7b67cd8b6b68c087ff96fdb6bb283ab8b49ec
Reviewed-on: https://gerrit.libreoffice.org/70718
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-14 08:29:08 +02:00
Juergen Funk
14a11ab5df pUnoReturn should be null when UNO methode is VOID
the problem is that at least the msvc_win32_x86-64 bridge's 
unoInterfaceProxyDispatch 
(bridges/source/cpp_uno/msvc_win32_x86-64/uno2cpp.cxx) 
requires pUnoReturn to be a nullptr when the UNO method has VOID 
return type (see computation of retKind in cpp_call in the same file), 
but that IdlInterfaceMethodImpl::invoke doesn't set up the arguments 
according to that expectation.


Change-Id: I187a997300571cd9822de2eeacf7ad887ad00a4f
Reviewed-on: https://gerrit.libreoffice.org/69495
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-21 12:41:45 +01:00
Noel Grandin
28239c4043 simplify UNO getTypes methods
Change-Id: Ia8b07edec54527fb4904536fabb03a18e8452550
Reviewed-on: https://gerrit.libreoffice.org/68659
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-04 08:52:39 +01:00
Matteo Casalin
972b9968cd Avoid index for single getToken() call
Change-Id: I907c108f4b056d3388464e29ce2fc40b319380c0
Reviewed-on: https://gerrit.libreoffice.org/67627
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin@yahoo.com>
2019-02-13 07:46:26 +01:00
Mike Kaganski
cfbd830e9c tdf#120703 PVS: remove redundant static casts
V572 It is odd that the object which was created using 'new' operator
     is immediately cast to another type.

Change-Id: I5fee1c4bebd1972fbb5e43da37149d4e2ff6ce0d
Reviewed-on: https://gerrit.libreoffice.org/67664
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-02-12 09:04:54 +01:00
Noel Grandin
0d1253c232 new loplugin writeonlyvars
largely based on the relevant portion of the unusedfields loplugin, but
adapted for local vars

Change-Id: Ic522a941573940e8f75c88f90ba5f37508ca49b1
Reviewed-on: https://gerrit.libreoffice.org/66835
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-11 13:25:31 +01:00
Noel Grandin
f68f3b98cc loplugin:indentation in soltools..svl
Change-Id: I270a12cdb68920b8fa23b82dd933724e30334485
Reviewed-on: https://gerrit.libreoffice.org/67565
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-10 11:18:35 +01:00
Mike Kaganski
b7e89cd6c0 const_cast is not needed here
Change-Id: Ifdc1b9006fb325f14ce7623d9a28acc41a067167
Reviewed-on: https://gerrit.libreoffice.org/67193
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-01-31 12:31:25 +01:00
Stephan Bergmann
553fcbbb39 loplugin:unnecessaryparen (clang-cl)
Change-Id: I0cd14e0ace9c9d2fcd880477b0485295e3010b71
Reviewed-on: https://gerrit.libreoffice.org/67138
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-31 10:59:40 +01:00
Stephan Bergmann
d0265c128c loplugin:redundantinline (clang-cl)
Change-Id: Ib6320ddc049e93cca4c5931ad28d1873d34bd8b4
Reviewed-on: https://gerrit.libreoffice.org/67137
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-30 16:25:15 +01:00
Noel Grandin
98e6080561 loplugin:flatten in stoc..store
Change-Id: Ib8c86179a3d13852cbb02b389b6103aca5456dba
Reviewed-on: https://gerrit.libreoffice.org/67013
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-29 07:11:04 +01:00
Stephan Bergmann
70519a43e0 Replace OUStringBuffer::appendCopy with append(std::u16string_view)
...which is more general

Change-Id: I94f28f8eda887120cf5f143b4549e0339b60e6a7
Reviewed-on: https://gerrit.libreoffice.org/66155
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-11 13:55:14 +01:00
Arkadiy Illarionov
0ded54c33f Simplify containers iterations in slideshow, sot, starmath, stoc
Use range-based loop or replace with STL functions

Change-Id: I94792c28b283a0998bf813317e5beb37d93e0c23
Reviewed-on: https://gerrit.libreoffice.org/64125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-29 12:06:44 +01:00
Noel Grandin
06ad764cfb improve function-local statics in scripting..svtools
Change-Id: Idf3785a1fbc6fc5b8efbdc4cd363047709f3af91
Reviewed-on: https://gerrit.libreoffice.org/63782
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-22 12:46:56 +01:00
Noel Grandin
270e41adb0 loplugin:buriedassign in sd..writerfilter
Change-Id: I954c12d9e1c493be6ac8c7b15076077b5bff5b74
Reviewed-on: https://gerrit.libreoffice.org/62811
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-16 18:42:57 +01:00
Mike Kaganski
628e96ce1f tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I3432afca1ee9bf9e8adce1d55d58d57bf1a09cb4
Reviewed-on: https://gerrit.libreoffice.org/62847
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-04 16:57:59 +01:00
Mike Kaganski
e128f78069 replace double-checked locking patterns with thread safe local statics
Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323
Reviewed-on: https://gerrit.libreoffice.org/62839
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-04 14:46:01 +01:00
Noel Grandin
8467d76418 fix signatures of deleted copy/assign operators
Change-Id: Id1a0749b78a7021be3564487fb974d7084705129
Reviewed-on: https://gerrit.libreoffice.org/62718
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-02 07:03:08 +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
5fb66ae559 clang-tidy readability-simplify-boolean-expr
Change-Id: I78fa01a6c803dec782488490b730af3a11814d64
Reviewed-on: https://gerrit.libreoffice.org/61902
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-18 09:46:28 +02:00
Noel Grandin
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
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
Mike Kaganski
b2d156b6ef tdf#120362: Don't ask user to enable JVM when enumerating scripts
Since it wasn't an explicit user's intention to run something that requires
JVM, asking to enable it in case it's disabled is nonsense, and it happened
every first time in a LO session when user wanted to start e.g. Basic macro
using Tools->Macros->Run Macro... tool.

Change-Id: I5afae804e183c185472d41a2d419ec80b7955110
Reviewed-on: https://gerrit.libreoffice.org/61465
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-08 13:13:52 +02:00