summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2022-09-05tdf147132 basic : flaten some functionsArnaud VERSINI
Change-Id: I462cbac4183f304e9f4b296a6361a05a4615c7eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137650 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-05BASIC : missing parameter check in SbRtl_CreateObjectArnaud VERSINI
Change-Id: I44e8c17274e20eb080494b2eaf25f74d33a35b36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137394 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-31cid#1509223 Inefficient vector resizing with reserve.Noel Grandin
Change-Id: I12f215d60a7420676523c7cec85bfa5149683841 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139083 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-22tdf#150139 - Add a concrete name to the error messageAndreas Heinisch
Add a concrete name to the "Property or method not found: $(ARG1)" error message when creating a listener. Change-Id: I76c904793a96082c49f8aa2d45c76c50a453d892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138061 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18cid#1500645 silence Resource leakCaolán McNamara
Change-Id: I1548017a39f5080dce0731169811fcb0a059c4d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138478 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-16cid#1509215 Using a moved objectCaolán McNamara
and cid#1509294 Using a moved object Change-Id: Ic4ef9bbc94d7b946d7d1904edf4b5b23278baafd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138348 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-10Better cast to sal_[u]IntPtr when passing pointer to O[U]String::numberStephan Bergmann
Change-Id: I5b7a0fa060c1e0ae4aa194e0c1862f303dd8a2d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138062 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-25loplugin:moveitNoel Grandin
make the plugin more conservative, so we see less false+ (although we also miss some possibilities in the process) Change-Id: I91b1806271e7f802d7459834ab7bcc569047da3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-07-20move wintypes.hxx from tools to vclChris Sherlock
Change-Id: Ief9949fd4252de9e33df172af07aa7ed097b5520 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136560 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-13tdf#147132 Flatten a Basic functionRoman Kuznetsov
Change-Id: I85eef5ca499197cfd96fecc4d05a82f7d11089cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136856 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-28Removed executable bits on filesAndrea Gelmini
Change-Id: I8508d26067084ff7bb15bbf2326a1ff7bc61a6ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136521 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-06-28tdf#149447: use proper UNO types for marshalling unsigned Basic typesMike Kaganski
cppu::UnoType<sal_uInt8> corresponds to UNO boolean, so its use made the unsigned values be converted to a true/false in Any; and additionally, using such a boolean Any, even having a 'true' value, as a parameter to a double argument would make operator >>=(const Any &, double &) return false, giving the resulting double equal to 0. The wrong conversion of UShorts and ULongs to cppu::UnoType<sal_uInt8> (aka TypeClass_BOOLEAN) was introduced in commit 11f9aa4fcb2ad0a5fada8561c7041e7f25a059fc Author Andreas Bregas <ab@openoffice.org> Date Thu May 10 14:22:42 2001 +0000 #79615# sbxToUnoValue(): Choose smallest possible type for numeric values Treating of unsigned Basic Byte as a signed cppu::UnoType<sal_Int8> (aka TypeClass_BYTE) was already introduced in commit c25ec0608a167bcf1d891043f02273761c351701 Author Jens-Heiner Rechtien <hr@openoffice.org> Date Mon Sep 18 15:18:56 2000 +0000 initial import Then, in commit 553cf2a834fcca17be6f7712c53e190e90e260eb Author Andreas Bregas <ab@openoffice.org> Date Fri Jun 08 14:59:57 2001 +0000 #87927# Map TypeClass_BYTE to SbxINTEGER instead of SbxBYTE because of signed/unsigned problem an attempt was made to handle obviously this same problem, changing the corresponding UNO type to TypeClass_SHORT. But it seems that it created problems when passing arrays of Byte through UNO to COM, where it needed to convert to a safearray, so this decision was reverted in commit dd6ba6b64aec20d37a402bee233e742e29285e88 Author Mikhail Voytenko <mav@openoffice.org> Date Thu Jul 08 21:33:48 2010 +0200 mib17: #162917# let basic byte use one byte, let olebridge convert sequence to safearray correctly This change tries to avoid the problem that caused the latter revert, by only treating Bytes as UNO shorts in getUnoTypeForSbxValue, where scalar Byte values are considered, keeping old handling for arrays. Change-Id: I805108743376e2fc27dd21a27c31759b76dc0d09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136526 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-24tdf#147529 - BASIC MsgBox: Check for missing optional parametersAndreas Heinisch
Change-Id: Iecb47e0005c609ee1117d6fb141e810c0166806a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136339 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-06-22crashtesting: assert seen with forum-mso-de-125088Caolán McNamara
where at restoring the SaveIndex the underlying aLine string had been replaced, so the index is for a different string. Save and restore the aLine too. Not entirely sure this is what we want, but it does seem to be what this restoring code expects. Change-Id: I25bd02fad72d9b0729b9504fe04416340d0e070a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136286 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-06-21elide some makeStringAndClear() callsNoel Grandin
Change-Id: Ie8c04a8c414f32cc0e68fbab1d24a9707f179011 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136201 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-20tdf#149622: also clear return value before calling method from SbxObject::CallMike Kaganski
Moves the custom cleanup logic to overridden SbxMethod::Clear, to simplify the cleanup code and make sure it restores empty Variant correctly. Change-Id: I01fa0529acd9ac787ffcda60fd6836ade4afdcb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136108 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-06-10new loplugin:moveitNoel Grandin
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-06tdf#149402 - BASIC: Don't extend comment if line ends in a whitespaceAndreas Heinisch
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-03tdf#147132 Flatten Basic functionRoman Kuznetsov
Change-Id: I1e445a565dc9c45810e85b045e68db08a56207f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135271 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
2022-06-03tdf#147132 Flatten Basic functionRoman Kuznetsov
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-02The elements of XInvocation::invoke aOutParamIndex are non-negativeStephan Bergmann
..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-01Use more appropriate type for SbiImage::GetString nId paramStephan Bergmann
Change-Id: I4207830e3923ce9b4f7c0f59cf5880dfcf89979b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135243 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-31Use more appropriate index variable typeStephan Bergmann
Change-Id: I0a6de93876d316a1aa094cf98dc2ee5c7eddebbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135205 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-31Use more appropriate type for SbiImage::nStringIdxStephan Bergmann
Change-Id: I1448739b373c6f7b9f5e6ee5a725fa0a129a4fb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135204 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-31clang-tidy modernize-pass-by-value in basicNoel Grandin
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-31tdf#149157 - Break multiline continuation in a comment after a new lineAndreas Heinisch
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-30cid#1504574 Resource leakCaolán McNamara
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-30tdf#147132 Flatten Basic function implementationRoman Kuznetsov
Change-Id: Ife73d08e57bb1c896a27f8cbbd6b1f4b106587a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135062 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
2022-05-25elide some OUString allocationNoel Grandin
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-24Use o3tl::make_unsigned in some placesStephan Bergmann
...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-24elide some OUString allocationNoel Grandin
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-24elide OUString allocationNoel Grandin
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-18Extend loplugin:redundantcast to trivial reinterpret_cast from T to itselfStephan Bergmann
Change-Id: I7c0be7b435d6b5f97bdd40484023584146638d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134506 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-11in SbUnoObject constructor, only query for XTypeProviderNoel Grandin
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-11in SetGlobalUNOConstant, only retrieve old value if we need itNoel Grandin
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-10tdf#121740 dont bother checking for VBA librariesNoel Grandin
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-10move creation of xParser to where it is usedNoel Grandin
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-10fix --disable-scripting buildCaolán McNamara
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-10More usual 1899-12-30 base Date in BasicMike Kaganski
Omissions from commit 8189d815641c583b5506d482f0b4f1ab47924f6a 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-09Unify and simplify SbRtl_Hex and SbRtl_OctMike Kaganski
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-09tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroPragat Pandya
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-09Use usual 1899-12-30 base Date in BasicMike Kaganski
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-09basic: remove commented out lineXisco Fauli
Introduced in 90d33f5945336fa46b7c02f425100af794768b15 "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-09sal_Int32 cast to tools::Long to pass to a function taking sal_Int32Mike Kaganski
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-07tdf#148358 - Compare Non-ASCII variable names case-insensitiveAndreas Heinisch
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-05use more o3tl::getTokenNoel Grandin
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-05Just use Any ctor instead of makeAny in basicStephan Bergmann
Change-Id: I21d9679064c4e68a1492d3550f083c3c91b5b43b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133848 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-01use more string_view in variousNoel Grandin
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-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>