summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)AuthorFilesLines
2021-01-26loplugin:passstuffbyrefNoel1-2/+2
Change-Id: I330e0ab6c9955939dad313f9d472f93e39dbd313 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109924 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-25tdf#136755, tdf#124008 - delete the variable beforehand REDIMAndreas Heinisch3-2/+82
If an array of objects is passed as an argument to ReDim, delete the variable beforehand, otherwise the construction of the new variable fails, because the old one is still on the stack. Change-Id: Ic863a36f5f2aca658df369f95d275aa287edf795 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106832 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-01-20improve some IllegalArgumentException messagesNoel4-15/+16
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-10fix coverity parse errorsCaolán McNamara1-3/+3
Change-Id: I4884bfb67a061b865e8cf38b2fea6de0cb1bc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109057 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-10static_cast after dynamic_castNoel Grandin1-2/+2
Change-Id: I3792ddadad9582a7e6f4740829c081d9571ddaff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109049 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-09fix coverity parse errorsCaolán McNamara3-9/+9
Change-Id: I3a1179947704452e3ffec02be59d0f7bf0b75ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109017 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-04loplugin:stringviewparam: operator +=Stephan Bergmann2-4/+4
Change-Id: I30ce1b5bd8fb168da7067c1967c5af2569df2653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108512 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-01-02BASIC : simplify SbxVariable constructors and remove impl classArnaud Versini1-65/+18
Change-Id: Iff37e71389594b313a3a3d12998dbbdbf0c85d05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108539 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-30Fix build after 042033f1e6da22616cb76c8d950c20c9efecbad5Mike Kaganski1-2/+2
Change-Id: Ifca32f434442f7838aae6f47dc2831dfa6a3f5db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108496 Tested-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-30vcl: remove {Read,Write}ImpGraphic and ImplExportNative from GraphicTomaž Vajngerl1-1/+3
ReadImpGraphic and WriteImpGraphic have been reimplemented in the TypeSerializer some time ago, but the code has not yet been moved to use that class. This commits does that and changes all the code using those 2 methods and removes them. With this implemented in the TypeSerializer, it is easier to handle In addition it also removes ImplExportNative (and the method on the Graphic interface). This was really used only in one method, and it could be implemented in the mthod itself. Change-Id: I0982429d1c1d5ed7ef07627d87ed9a08df43f040 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108256 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-12-29loplugin:stringviewparam: operator +Stephan Bergmann5-10/+13
Change-Id: I044dd21b63d7eb03224675584fa143009c6b6008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108418 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-28BASIC : simplify SbiSymDef and SbiSymPool initlializationArnaud Versini1-28/+31
Change-Id: I5e7a34330592855aae3ec57d4b90edfa376fbacf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108370 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-27BASIC : SbiRuntime static data should be constArnaud Versini2-6/+6
Change-Id: If8c221a2bfb249a6625df4b466fe5247b7a8ae72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108355 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-26BASIC : simplify SbiExpression initializationArnaud Versini2-23/+17
Change-Id: I3a1cca2f6ea3b6d3fef2e10e2ae4d0674cfe205a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108324 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-26BASIC : remove useless using namespaceArnaud Versini1-2/+0
Change-Id: Ic491f69e7bb098a03f9cdbd8913c4b4be4a570b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108326 Tested-by: Jenkins Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2020-12-26New loplugin:stringliteralvarStephan Bergmann4-12/+12
See the comment at the top of compilerplugins/clang/stringliteralvar.cxx for details. (Turned some affected variables in included files into inline variables, to avoid GCC warnings about unused variables.) Change-Id: Ie77219e6adfdaaceaa8b4e590b08971f2f04c83a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-23Initialize method mapping table at compile timeMike Kaganski4-703/+866
This removes the need to calculate hashes for the table at runtime. Also this introduces a static assertion to make sure that the table has correct structure, and fixes some methods that had wrong argument counts: CreateUnoListener: 1 -> 2 MIRR: 2 -> 3 SLN: 2 -> 3 SYD: 2 -> 4 Changes in basic/source/classes/sb.cxx are related to the change of SbxVariable::MakeHashCode into constexpr function taking string view. Change-Id: I2fec4994e976f36c4b647c30b51a9e879a815775 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108220 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-23Drop RTLNAME obfuscating macroMike Kaganski2-308/+306
which only purpose is to make "git grep SbRtl_Foo" a kind of IQ test. Change-Id: I47cfc2ecd1cc4a5ecf2e348465554fa2caeaccf0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108218 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-22Related: tdf#84098 Unify testsMike Kaganski93-2989/+1772
Shorten the tools module name; use TestUtil.AssertEqual where applicable; remove unnecessary variables that only made noise and masked what was actually asserted; add missing licence headers. Change-Id: If891ed8ceb38fed18335aad061b2b09d341264f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108118 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-21fix for Windows x86-64 buildNoel Grandin1-1/+1
...after 46c5de832868d2812448b2caace3eeaa9237b9f6 "make *String(string_view) constructors explicit" Change-Id: I85138de39d7d7f9fa4ce3c14acf60b770c2f1d4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-20Blind fix for Windows x86-64 buildStephan Bergmann1-1/+1
...after 46c5de832868d2812448b2caace3eeaa9237b9f6 "make *String(string_view) constructors explicit" Change-Id: I6a1d54e8dbcd98027122d33e6b6544ce00b09624 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108052 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2020-12-19tdf#84098 kill copy+paste in VBA testsGeorge Bateman96-4180/+1327
Move repeated code into _test_asserts.vb Change-Id: Idfe124a8dbab4925309fa5f1322e0cce5f097b7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107860 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-19make *String(string_view) constructors explicitNoel Grandin1-2/+2
to make it more obvious when we are constructing heap OUStrings code and potentially inadvertently throwing away performance. And fix a handful of places so revealed. Change-Id: I0cf390f78026f8a670aaab53424cd31510633051 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107923 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-11Adapt the remaining OUString functions to std string_viewStephan Bergmann5-7/+12
...for LIBO_INTERNAL_ONLY. These had been missed by 1b43cceaea2084a0489db68cd0113508f34b6643 "Make many OUString functions take std::u16string_view parameters" because they did not match the multi-overload pattern that was addressed there, but they nevertheless benefit from being changed just as well (witness e.g. the various resulting changes from copy() to subView()). This showed a conversion from OStringChar to std::string_view to be missing (while the corresponding conversion form OUStringChar to std::u16string_view was already present). The improvement to loplugin:stringadd became necessary to fix > [CPT] compilerplugins/clang/test/stringadd.cxx > error: 'error' diagnostics expected but not seen: > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 43 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:42): simplify by merging with the preceding assignment [loplugin:stringadd] > File ~/lo/core/compilerplugins/clang/test/stringadd.cxx Line 61 (directive at ~/lo/core/compilerplugins/clang/test/stringadd.cxx:60): simplify by merging with the preceding assignment [loplugin:stringadd] > 2 errors generated. Change-Id: Ie40de0616a66e60e289c1af0ca60aed6f9ecc279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107602 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-07tdf#43003 - convert parameter to the requested typeAndreas Heinisch1-8/+2
In StepPARAM convert parameters to the requested type, otherwise it loses possible references which leads to an error where the results of a macro has no effect on the caller. Change-Id: I8347eab658e037a29cd04be9c00edd6a4d1b31c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107249 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-12-04update pchesCaolán McNamara1-1/+2
Change-Id: I3e22c2000da03f6f3345353846213203993aa865 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107192 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-12-03convert SvtPathOptions::Paths to scoped enumNoel1-1/+1
Change-Id: I2e6cab798309a1bc2ade00661bc95dd5ae20f748 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107045 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-01cid#1470374 silence Stray semicolonCaolán McNamara1-0/+1
Change-Id: I33bc73ff0d7f94bce5c93f9c9c1b6db8f36f34df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106983 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-11-30loplugin:stringviewparam include comparisons with string literalsNoel6-11/+11
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-27tdf#136801 : IsNumeric("+2") and CInt("+2") return correct valuesAnshu3-1/+11
Change-Id: I036f21c8196530973d2cdc366da7654ccd930892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106556 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-25Use sal_Int32 to print SbxLONG valueStephan Bergmann1-2/+2
(The "%ld" format specifier had now caused -Werror,-Wformat with clang-cl for a Windows 64-bit build.) Change-Id: I741a3e3526a63162dbd75c018dfe7157f06819f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106575 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-24Use std::vector in SbiBufferMike Kaganski8-227/+108
This removes memory management from the class; unifies the types used throughout the code using it; and simplifies it all greatly. Also this changes errors handling. Prevoiusly setting errors to parser didn't handle case when no parser was passed to SbiBuffer ctor, as BufferTransformer did, and could dereference nullptr. Change-Id: I068eb1b3e9a616a5744fc8233781c4dd4403c84d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106452 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-23Simplify SbiBuffer::CheckMike Kaganski1-16/+6
Change-Id: Ic90d8ee858d25bed36c89f95d5de94440cb48f1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106399 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-22BASIC : use initialization list in constructors.Arnaud Versini5-57/+60
Change-Id: I651a16be0a80210504267a743b2c50474fb1cc50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106357 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-18loplugin:stringviewparam: No good reason to exclude operator functionsStephan Bergmann1-1/+3
(at least not in general) Change-Id: I71337b53dc9735e90a37ee532d0a8a08797b518c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106043 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-17loplugin:stringviewparam check methods tooNoel5-11/+11
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-13tdf#123936 Formatting files in module basic with clang-formatPhilipp Hofer12-122/+123
Change-Id: I87736d6f1a1d069c990b4e7b9ca291634ab4fb44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105646 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-11loplugin:stringviewNoel2-2/+2
Add new methods "subView" to O(U)String to return substring views of the underlying data. Add a clang plugin to warn when replacing existing calls to copy() would be better to use subView(). Change-Id: I03a5732431ce60808946f2ce2c923b22845689ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105420 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05BASIC : use std::make_unique instead of std::unique_ptr ( new ... )Arnaud Versini9-17/+16
Change-Id: Ic907f4711685539b6a89411e704845617cc5f04d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105375 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05tdf#42949 Fix new IWYU warnings in directories [ab]*Gabor Kelemen15-10/+14
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib0008b9bb095f27e5e436d6b507dc709ab7bf01a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105313 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-05Use LONG hereMike Kaganski1-2/+1
... since VarDecFromI4 WinAPI uses LONG [1]. Reverts commit 6436302f40252bc6619e304e2051115fee902e20 (partially) and commit 6436302f40252bc6619e304e2051115fee902e20. [1] https://docs.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-vardecfromi4 Change-Id: I5b0805b5b22bea0017b4b2f40400445ab587f2c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105226 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-01use officecfg for Experimental flagNoel Grandin1-6/+7
move IsShowOutlineContentVisibilityButton out of header to avoid having to add extra include paths to all the unit test makefiles. Change-Id: I2763390e07cd85b8f09b6f2ad7702039daecb22f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105100 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-30tdf#85371 - grant write access to the method used as a variableAndreas Heinisch2-0/+75
During the creation of the parameter list of a method, explicitly grant write access to the method which will used as a variable. Otherwise, the name of the method can't be used in certain statements, i.e., index in a for loop or as a dimension in ReDim. Change-Id: I3e4c49c21fd3345d5ddd69bc31a5823b5de5b8e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104696 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-10-29basic: fix build after long->tools::LongThorsten Behrens1-0/+1
Seems 6436302f40252bc6619e304e2051115fee902e20 broke Windows ARM Change-Id: I5c453ce39c81ef34e3cd55e519a7752881fd72a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104991 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-10-28convert some more long -> tools::LongNoel1-1/+1
grepping for stuff in template params this time Change-Id: Ia37bfd85480b3a72c3c465489581d56ad8dde851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104855 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-27Put may succeed even if outer error is setMike Kaganski1-20/+10
And use SbxValues ctor taking SbxDataType for simplicity Change-Id: I25622bae33597a8782d9451f88eadce1cf07388d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104860 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-10-27Replace these macro-based implementations with normal C++Mike Kaganski1-27/+7
Change-Id: Ibb227a0f9e7178ea388e720874ec31a178c2aab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104859 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-10-21use tools::Long in basegfx..chart2Noel7-29/+31
Change-Id: Ide4014348d51f0b5f59e1e91b8d41c7748853254 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104608 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-16tdf#123025 - ReDim Preserve fails if array is filled by SplitAndreas Heinisch2-7/+26
The Split function sets the datatype of the array to SbxVARIANT instead of SbxSTRING preventing any subsequent assignments to the array and to the elements itself. Change-Id: Ib099eee7bfd222c97520ac8970352bcf2b44bc3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104039 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-10-13static_cast after dynamic_castNoel2-12/+8
Change-Id: I487b5dc148f5a3d0d45f198c00179002841242ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104213 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>