summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2022-04-27cid#738565 Uninitialized scalar fieldCaolán McNamara
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-27add string_view wrappers for rtl::math::stringToDoubleNoel Grandin
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-25tdf#75263 - Export VBA-Project using detected charset on importAndreas Heinisch
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-21tdf#148651: basic_macros: Add unittestXisco Fauli
Change-Id: Iadbe470de5a33dc633fe8f53083520988e497df0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133255 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2022-04-21tdf#148651: implement VBA.FormatPercentJulien Nabet
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-17loplugin:stringviewparam convert methods using copy()Noel Grandin
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-17Test StarBasic's native non-ASCII name syntaxMike Kaganski
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-15loplugin:stringviewparamStephan Bergmann
Change-Id: Id3bd8576b134728140dc68b00eebf78a8f3fd4ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133056 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
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-10loplugin:stringview check for getToken and trimNoel Grandin
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-08move comphelper::string::toInt32 to o3tlNoel Grandin
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-08Fix buildMike Kaganski
... after commit 36e0e88b28e818faf25b8e32cc8c4dc444b8a0be 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-08use more subView when converting to Int32Noel Grandin
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-08loplugin:stringviewparam convert methods using trimNoel Grandin
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-05Move creation of case-insensitive variable name to a central placeMike Kaganski
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-04Fix --disable-scripting build (WASM)Jan-Marek Glogowski
Simply include the global transliterator in all builds. Regression from commit de81c2545aec06a1b269218b7d00656e97d8b66c ("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-04Related: tdf#144245 Optimize case-insensitive handlingMike Kaganski
1. Make BasicCollection::implGetIndexForName take OUString again, after commit f7de7de1189ae4e63f73468076da47b37fe61ede made it take std::u16string_view. All call sites pass OUStrings, and commit ef32c3b4f9b80918d6018e14297fa41245afd381 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-03tdf#147132 Flatten Basic function implementationsofftkp
Change-Id: I21b0ec23de99aaf9b4398d59a5cc56d7d386ad58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132444 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-04-02loplugin:stringviewparam convert methods using indexOfNoel Grandin
.. and lastIndexOf, which convert to find and rfind Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-31Basic Collection class unit testAlain Romedenne
Change-Id: I7b67727ab8c3f7f67c2038500434ab44fa7d1949 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128544 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-31Adapt test to even slower buildsStephan Bergmann
...like my local ASan+UBSan build, which now happened to fail once with > Failed: TestReplacePerformance (t = 60 s) > Tests passed: 0 > Tests failed: 1 when the machine was under load during a parallelizing `make check`, following up on 3564b5c6e93b2bf5881b359015efae351dbe8342 "Adapt test to slow builds" Change-Id: I8f0c8f7e6e145b6d5009f48d2af865ea5caab375 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132335 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-30tdf#114263 tdf#147262 CallByName() function LibO Basic test unitAlain Romedenne
Change-Id: Ia9bd38c0da4d3f94b824ebb1f98ac912758e8d38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129610 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-28-Werror,-Wunused-but-set-variableStephan Bergmann
...since 8e73111faeb9620117801fee89a838a407f0b7e5 "CWS-TOOLING: integrate CWS ab72" Change-Id: Ib2fdccc36090d366ca2288b31bd1948832366c95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132210 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-22Move BSTR wrapper to systools, and fix some wrong BSTR usesMike Kaganski
BSTR is documented [1] to be prefixed by a 32-bit integer specifying its length *in bytes* (not characters), so passing wchar_t* as BSTR is wrong, and the length member of rtl_uString can't substitute the proper BSTR length, since rtl_uString::length specifies length in characters. Any code taking BSTR and using SysStringLen to get its length would only get half of the passed OUString data. In dbaccess/source/ui/dlg/adodatalinks.cxx, the abovementioned error was implemented. OTOH, OLEVariant::getByteSequence() in connectivity/source/drivers/ado/Aolevariant.cxx passed BSTR from tagVARIANT to ctor of OLEString, which resulted in the BSTR being freed in both dtors of OLEString and OLEVariant (the latter calls VariantClear, which itself clears string when vtfield is VT_BSTR). [1] https://docs.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr Change-Id: Iedbd62b20133644258af3660616add7b63cac258 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131950 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-14new loplugin:trivialconstructorNoel Grandin
Change-Id: Iaaf63c49ce94987ab9c4ebc68e963cc3054a3c34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131342 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-11new loplugin:trivialdestructorNoel Grandin
look for potentially trivial destructors that can then be elided Change-Id: I435c251bd4291b5864c20d68f88676faac7c43fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131318 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-07tdf#42982: improve UNO API error reportingDeep17
Change-Id: I82adf31db09d2157ee8f1c776f33e8a0107c3b51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131090 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2022-03-02Change the comment of the test cases to clarify the textual representation ↵Andreas Heinisch
of the calculated string Change-Id: I98478297a577f723864b37514bbd432a6224350d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129844 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-28cid#707501 Uninitialized scalar variableCaolán McNamara
Change-Id: I89f08a858b7a820fce1dd3bc2b914c3e5eb3d656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130703 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-28cid#707500 Uninitialized scalar variableCaolán McNamara
Change-Id: I4680b59483ae827cbceb567968dc6c4e864f7ad4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130702 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-28cid#707503 Uninitialized scalar variableCaolán McNamara
Change-Id: I8e1c27f04d8a2ce2ff4608f97b5ff58c55833a37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130704 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-02-22tdf#147132: Flatten Basic function implementationsRamreiso Kashung
Some SbRtl_* functions have been flattened at basic/source/runtime/methods.cxx Change-Id: Id56485ddfaa972133c9b199d22b141d93df475f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130206 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2022-02-21tdf#147089 - Round Integral Division (IDIV) literals to Integer valuesAndreas Heinisch
Change-Id: Ia243c6117a437d0c6efb33a4e76c5e9ee539fbdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130302 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-12Basic compiler undetected typoAlain Romedenne
Change-Id: I53add0bbb14e084978e3582083978924d1c11c88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129434 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-11tdf#147364: fix function signature to account to calling conventionMike Kaganski
First, the integer function result is returned in a 64-bit register (RAX), and truncation it to sal_Int32 breaks any pointer return value. Second, using explicit (not vararg) first function double argument would pass it through XMM0, without also copying it to RCX (which is guaranteed for varargs). Ref: https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention Change-Id: I08212c44d8690d6910068b13c16af2ce899c94f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129808 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-09tdf#147262: CallByName() argument names does not match that of VBAJulien Nabet
Change-Id: I3029b98abbe3b8facf01f0e50a7efdff545c2141 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129646 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-02-09tdf#146672 - CDbl: skip spaces and tabs at the end of the scanned stringAndreas Heinisch
Change-Id: Ib7a4e8c7145b549a5327de23549d39d11f8590cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129648 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-06tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macroVaibhavMalik4187
Change-Id: I4f5258ca5b37e9b1b4237c5d29e4a9e5362fa855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129116 Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2022-02-06We know the length hereMike Kaganski
Change-Id: I630b7fbda7c9ebf578e74260a0d67eea32e9e429 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129549 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-03tdf#146742 - Move the initialization code of a method to SbMethod::CallAndreas Heinisch
Change-Id: I516bacdcd22ed094a0e9b6e125e941f32fe88c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129238 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2022-02-03Use default argumentMike Kaganski
Change-Id: I44e9c2e5de2c041f2839b14a057e1b88fd6ea01f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129337 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-02SbRtl_Spc is exactly the same as SbRtl_SpaceMike Kaganski
Change-Id: I0ccbffef348fc23ef5ca090ec2112abfe333e8e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129332 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-02-02Use OUStringBuffer in SbRtl_FormatNumberMike Kaganski
Change-Id: Ie3e187b7dd1329f8fae04042fa6375c4bde3fa57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129331 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-31Adapt test to slow buildsStephan Bergmann
...like my local ASan+UBSan build, which kept failing with > Failed: TestReplacePerformance (t = 35 s) > Tests passed: 0 > Tests failed: 1 when the machine was under load during a parallelizing `make check` Change-Id: I59c81a61a29df7165f6fad33e3fe3da975f05ed2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129237 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-31Fix format stringMike Kaganski
Change-Id: I18952bf6641175d25128b512ddfb56fd51767038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129083 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-31tdf#132388: add unit testMike Kaganski
I hope that this performance test is OK. I chose 20 s threshold, as it works much faster on my system (under 4 s); it shouldn't be much slower elsewhere; and both the original bug, and the regression that followed the initial fix, made it execute orders of magnitute slower (I expect hours on fast systems). Change-Id: I75ee4c60e562473fe70a203faa94b48c5fbfb4fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-30tdf#132388: reimplement fix for tdf#142487Mike Kaganski
Each call to css::i18n::XTextSearch::SearchForward transliterates input string, making performance of repeated calls unacceptable. So prepare the transliterated strings once, and use the offset sequence to map search results to indices into original string. Change-Id: Ie08dd5a408aca9a950067db285a480b41a3f9a16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129162 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-28tdf#145614: Convert #define to enumRamreiso Kashung
Change-Id: I1e89d233797461dc363bcd5021cc5347598ffff8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128001 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-01-25tdf#90341 Clean Up Excessive const_cast'ingVaibhavMalik4187
Change-Id: Ib4cab4a4e476b469378b0b86d0819d4642f38893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128907 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-22Related tdf#146909: add missing IDIGNORE in BasicJulien Nabet
Change-Id: Idbbceb2f5375d47c942bab70ce81f7be79b17478 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128780 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins