Noel Grandin
f71606c920
new loplugin:moveit
...
look for local variables that can be std::move'd to parameters
off by default, since it doesn't do proper data flow analysis
Change-Id: I3403a0fcffd165bdea6a772528bc53995c5fdb40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135527
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-06-10 13:13:15 +02:00
Andreas Heinisch
fbce18558a
tdf#149402 - BASIC: Don't extend comment if line ends in a whitespace
...
Change-Id: I8adf530e77a0e65329fa59ac2873b99f48befac4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135336
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de >
2022-06-06 10:24:20 +02:00
Roman Kuznetsov
f30af7b351
tdf#147132 Flatten Basic function
...
Change-Id: I1e445a565dc9c45810e85b045e68db08a56207f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135271
Tested-by: Jenkins
Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com >
2022-06-03 16:36:32 +02:00
Roman Kuznetsov
66fe1fa945
tdf#147132 Flatten Basic function
...
Change-Id: Ib2646bfbebdfb6d8e8a3cd1355db75b0405ccfe6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135268
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-06-03 10:17:02 +02:00
Stephan Bergmann
c387bc7dd1
The elements of XInvocation::invoke aOutParamIndex are non-negative
...
..so use o3tl::make_unsigned when comparing them against an expression of
unsigned integer type, instead of casting that expression to a signed type
Change-Id: I4fc0bd4447f55d5fd9bf893a4b22d6d2c2cfe3d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135280
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-06-02 08:07:08 +02:00
Stephan Bergmann
0af4324c57
Use more appropriate type for SbiImage::GetString nId param
...
Change-Id: I4207830e3923ce9b4f7c0f59cf5880dfcf89979b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135243
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-06-01 21:20:29 +02:00
Stephan Bergmann
bd279d3002
Use more appropriate index variable type
...
Change-Id: I0a6de93876d316a1aa094cf98dc2ee5c7eddebbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135205
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-05-31 22:42:34 +02:00
Stephan Bergmann
b19a2dfafa
Use more appropriate type for SbiImage::nStringIdx
...
Change-Id: I1448739b373c6f7b9f5e6ee5a725fa0a129a4fb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135204
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-05-31 22:03:42 +02:00
Noel Grandin
5ecdedbf81
clang-tidy modernize-pass-by-value in basic
...
Change-Id: I9034ab95a4ccb58e36e77d911dd33cc50857c03a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135176
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-31 15:11:27 +02:00
Andreas Heinisch
b94275f6d2
tdf#149157 - Break multiline continuation in a comment after a new line
...
Change-Id: I3dd875152a6f2cfafb67f13f597c36f01a4759b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135018
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de >
2022-05-31 12:30:21 +02:00
Caolán McNamara
a685679526
cid#1504574 Resource leak
...
make an owner for the PropertyMapEntries
Change-Id: Ie915a8a312f2b24488566814ad67fdeef89b5941
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135123
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com >
Reviewed-by: Caolán McNamara <caolanm@redhat.com >
2022-05-30 16:00:35 +02:00
Roman Kuznetsov
43458f83f2
tdf#147132 Flatten Basic function implementation
...
Change-Id: Ife73d08e57bb1c896a27f8cbbd6b1f4b106587a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135062
Tested-by: Jenkins
Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com >
2022-05-30 08:45:42 +02:00
Noel Grandin
371886dd12
elide some OUString allocation
...
Change-Id: Ia21421731dadc1d0e65da182471eb2b8d799782b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134918
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-25 16:00:48 +02:00
Stephan Bergmann
5060c50158
Use o3tl::make_unsigned in some places
...
...where a signed and an unsigned value are compared, and the signed value has
just been proven to be non-negative here
Change-Id: I20600d61a5d59d739bc1bee838c0038e4611aec2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134875
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-05-24 16:50:03 +02:00
Noel Grandin
30f1ef51e5
elide some OUString allocation
...
Change-Id: Iacbf1da6cdc77466d9f9da399b5cc17f5a87f0ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134833
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-24 08:08:07 +02:00
Noel Grandin
086e5347dc
elide OUString allocation
...
Change-Id: I92d487b657c7d67a4301a499ba05b4b285cfed3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134837
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-24 08:07:31 +02:00
Stephan Bergmann
41a967af06
Extend loplugin:redundantcast to trivial reinterpret_cast from T to itself
...
Change-Id: I7c0be7b435d6b5f97bdd40484023584146638d70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134506
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-05-18 10:52:59 +02:00
Noel Grandin
cfb15d06e8
in SbUnoObject constructor, only query for XTypeProvider
...
if we're going to use the result
Change-Id: I49ad11e287f58c1021e509f56d934aa3ce745b0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134201
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-11 21:55:45 +02:00
Noel Grandin
cde416fea1
in SetGlobalUNOConstant, only retrieve old value if we need it
...
removes some unnecessary Find() work
Change-Id: I6af9c4d9a043d4361fcca1a034b2025fe7c10c28
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134200
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-11 21:55:11 +02:00
Noel Grandin
3c25a2a114
tdf#121740 dont bother checking for VBA libraries
...
speeds up loading by 2%
Change-Id: I63bf7ea2ab8087d6bb60b655fdf7718532050b89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134114
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-10 19:41:31 +02:00
Noel Grandin
e7d3243d22
move creation of xParser to where it is used
...
Change-Id: I03511a8c7b01b0abb69b276b900bf712549e5873
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134113
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-10 19:25:41 +02:00
Caolán McNamara
070b34c2a4
fix --disable-scripting build
...
Change-Id: I41e0da3d379d54ec59f9eba46978cfe7f9e09d33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134105
Tested-by: Caolán McNamara <caolanm@redhat.com >
Reviewed-by: Caolán McNamara <caolanm@redhat.com >
2022-05-10 10:51:20 +02:00
Mike Kaganski
bc1ab88ffa
More usual 1899-12-30 base Date in Basic
...
Omissions from commit 8189d81564
Change-Id: I6b205f7bcc9ff9c30e55b03d39d02b9be15a01c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134064
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-05-10 06:58:24 +02:00
Mike Kaganski
ced3501a93
Unify and simplify SbRtl_Hex and SbRtl_Oct
...
OUStringNumber::toAsciiUpperCase is cheaper than OUString::toAsciiUpperCase.
Let SbRtl_Oct use OUString::number as well.
Change-Id: I3a97ec5d3a7b0005fc300310198bae47c62dfbc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134061
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-05-09 21:42:29 +02:00
Pragat Pandya
6abc09926c
tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro
...
Change-Id: I54257e87da0cd66da59d820c7960c3e4b020fda3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134027
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl >
Tested-by: Jenkins
2022-05-09 20:42:03 +02:00
Mike Kaganski
8189d81564
Use usual 1899-12-30 base Date in Basic
...
It matches VBA, has an optimization in the code, and doesn't
need any additional "-2" hackery.
Change-Id: I4b90674ae643788eda5ce618b4c42e2cc045ec04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134060
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-05-09 19:04:46 +02:00
Xisco Fauli
7251f9c1b8
basic: remove commented out line
...
Introduced in 90d33f5945
"tdf#148358 - Compare Non-ASCII variable names case-insensitive"
Change-Id: I5bccb3f2f54ac61f2fbf960e78e3d4e4a0893f85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134081
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org >
2022-05-09 18:30:35 +02:00
Mike Kaganski
7c8f27e3d8
sal_Int32 cast to tools::Long to pass to a function taking sal_Int32
...
Change-Id: I81bb794e6a154dd3d022b34ce1348f32c854f52b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134059
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-05-09 17:52:11 +02:00
Andreas Heinisch
90d33f5945
tdf#148358 - Compare Non-ASCII variable names case-insensitive
...
Change-Id: I761eb27b16c92d58df1be8e6011fc9b94db2a59c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133774
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de >
2022-05-07 16:00:50 +02:00
Noel Grandin
9f1701d01d
use more o3tl::getToken
...
found by inspecting call sites of OUString::getToken
Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-05 12:57:00 +02:00
Stephan Bergmann
b5ab864096
Just use Any ctor instead of makeAny in basic
...
Change-Id: I21d9679064c4e68a1492d3550f083c3c91b5b43b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133848
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-05-05 07:13:54 +02:00
Noel Grandin
5200a73627
use more string_view in various
...
found by examining uses of OUString::copy() for likely places
Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-05-01 08:30:18 +02:00
Noel Grandin
d3849255b7
use more string_view in INetURLObject
...
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-29 08:53:22 +02:00
Caolán McNamara
09530aec3c
cid#738565 Uninitialized scalar field
...
Change-Id: I17a675d3b7468e528faef89de7ea862de37a57db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133504
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com >
2022-04-27 15:58:45 +02:00
Noel Grandin
d506ff97c2
add string_view wrappers for rtl::math::stringToDouble
...
Change-Id: I114bec72cb933238675e539a8388a607226827cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-27 12:19:55 +02:00
Andreas Heinisch
e4bdf75260
tdf#75263 - Export VBA-Project using detected charset on import
...
Change-Id: Ia1f1bb31e077dcb4293c1106ac324a25a975a656
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133064
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de >
2022-04-25 22:10:42 +02:00
Xisco Fauli
07bf0ce4e7
tdf#148651: basic_macros: Add unittest
...
Change-Id: Iadbe470de5a33dc633fe8f53083520988e497df0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133255
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org >
2022-04-21 19:52:16 +02:00
Julien Nabet
98f88ac1ff
tdf#148651: implement VBA.FormatPercent
...
I started from a copy/paste of FormatNumber.
Then I deduplicated the code (it saved about 99% of it).
Change-Id: Ibcb9ffbf8cebf45d5ffac4713e3d220b8499ba11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133133
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr >
2022-04-21 09:59:43 +02:00
Noel Grandin
33bd16b344
loplugin:stringviewparam convert methods using copy()
...
which converts to std::string_view::substr()
Change-Id: I3f42213b41a97e77ddcc79d84d512f49d68ca559
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132729
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-17 10:27:33 +02:00
Mike Kaganski
fe597a3379
Test StarBasic's native non-ASCII name syntax
...
Change-Id: Ie9f0cd21e59ffc1e3fbe2616e2ae7abbd0169424
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133103
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-04-17 10:08:08 +02:00
Stephan Bergmann
f23f594b17
loplugin:stringviewparam
...
Change-Id: Id3bd8576b134728140dc68b00eebf78a8f3fd4ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133056
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com >
2022-04-15 08:38:43 +02:00
Noel Grandin
fdfd517a6f
loplugin:stringviewparam whitelist some more functions
...
for which we have o3tl:: equivalents
Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-13 08:38:53 +02:00
Noel Grandin
e4ff847fe0
loplugin:stringview check for getToken and trim
...
since we now have o3tl versions of those that work on
string_view.
Also improve those o3tl functions to support both string_view
and u16string_view
Change-Id: Iacab2996becec62aa78a5597c52d983bb784749a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132755
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-10 12:59:38 +02:00
Noel Grandin
3e76797384
move comphelper::string::toInt32 to o3tl
...
so we can use it in places where we cannot include comphelper
Change-Id: Iba0ba3e4c0dcf0f9d1f09092a77c3b2010ec4f6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132732
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-08 20:44:43 +02:00
Mike Kaganski
ad7b90fc54
Fix build
...
... after commit 36e0e88b28
Change-Id: I540d19f7146651035cd5fafe077c0ccdfcee11ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132733
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-04-08 16:39:19 +02:00
Noel Grandin
36e0e88b28
use more subView when converting to Int32
...
Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-08 13:18:41 +02:00
Noel Grandin
3a88b513fd
loplugin:stringviewparam convert methods using trim
...
for which we add a new o3tl::trim method
Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk >
2022-04-08 10:26:10 +02:00
Mike Kaganski
b32c85d0be
Move creation of case-insensitive variable name to a central place
...
SbxVariable::NameToCaseInsensitiveName might then be used wherever
such names may be needed (see e.g. tdf#148358).
Change-Id: I7749a12a05225398848cbf72700c6f0bc119bc22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132561
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-04-05 11:30:24 +02:00
Jan-Marek Glogowski
be7d84a3fb
Fix --disable-scripting build (WASM)
...
Simply include the global transliterator in all builds.
Regression from commit de81c2545a
("Related: tdf#144245 Optimize case-insensitive handling").
Change-Id: Ica1c6e5d67c8458f9977f2ff87d9594a43b4cff2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132517
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de >
2022-04-04 21:36:10 +02:00
Mike Kaganski
de81c2545a
Related: tdf#144245 Optimize case-insensitive handling
...
1. Make BasicCollection::implGetIndexForName take OUString again,
after commit f7de7de118 made it take
std::u16string_view. All call sites pass OUStrings, and commit
ef32c3b4f9 made it create OUString
from the argument.
2. Have SbxVariable cache a case-insensitive variant of the name.
It is currently only used in the Collection implementation, but
may be used in other places; Tthe names are case-insensitive in
Basic, and VBA allows non-ASCII characters in names, so this
caching might be useful elsewhere.
3. Skip non-ASCII characters when calculating name hash, to allow
non-ASCII-containing strings still have some hash variance, when
at least some of the first 6 characters are ASCII.
Change-Id: If90ccea2c4b44c34967e6b764b6fab45b2976c40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132493
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com >
2022-04-04 11:06:00 +02:00