summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2021-07-19tdf#143332 - Use utl::TextSearch to implement the InStrRev functionAndreas Heinisch
Change-Id: I2dae038d061f036b3b7c0fbbcb6a821305d4839e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119094 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-16tdf#139840 - Use utl::TextSearch to implement the InStr functionAndreas Heinisch
In addtion, fixed a crash if the start position is greater than the length of the string being searched. Change-Id: I9bcda1131324bdfac6957018e91b3a36dd2dc3d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118996 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-15tdf#111313: basic_macros: Add unittestXisco Fauli
Change-Id: Id6f8bc0998d4f79434d46017b998917dcc53ac6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118949 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-14tdf#98778: basic_macros: Add unittestXisco Fauli
Change-Id: I35468fb35f5c24af2138688d99af0e41ba672334 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118944 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-14tdf#114011: basic_macros: Add unittestXisco Fauli
Change-Id: Ib9a7e87b4c8159fd5fbaaaa66705cddae138fcdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118942 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-12tdf#142487 - use utl::TextSearch in order to implement the replace algorithmAndreas Heinisch
In the old algorithm, some special unicode characters lead to a malfunction of basic's replace function. For instance, replacing a German ß to uppercase in the insensitive case will lead to SS, breaking the replace positions. Change-Id: I4e6f6e5fba3d560b8cfd0786fa2439ed5174a928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118760 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-07-07basic_coverage: use Option Explicit where possibleXisco Fauli
Add missing license headers to a couple of files Change-Id: I7610f922e9ac914ae8fda0d0b6a7ca389401caca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118489 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-06tdf#142922 fixes Round to follow half-to-even roundingbaltasarq
The LibreOffice's Basic Round function does not return values that are compatible with VBA's Round. This can be easily fixed using rtl/round, which has a flag parameter called rtl_math_RoundingMode_HalfEven which rounds real numbers exactly in the expected way. Change-Id: I2215f08427e5777fc2d35f054b635dfa6247af8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118444 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-07-06basic: remove unneeded variable in testXisco Fauli
Kudos to M. Kaganski for spotting it Change-Id: I04ceea4607cf94a5a84af4f171d6f2b204ef8653 Change-Id: Ie9064d3c12da657ecd82fdab6891bc8703ee6f37 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118464 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-05tdf#117612: basic_macros: Add unittestXisco Fauli
Change-Id: I4189b52be788deafe921c860f807ec5cee8ec667 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118443 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-05tdf#134692: basic_macros: Add unittestXisco Fauli
Change-Id: I9115eca2fce784cd55a8eb4f1cfd6e614fd3612b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118442 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-02Move utility code out of test directoriesMike Kaganski
This simplifies iteration over the test files, and avoids relying on file URLs being the same (e.g., having no /./ segments). Change-Id: I227785806e474a3a2dffeb46df21617eae43327e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118329 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-07-02Rename LibreOffice Basic test files from .vb to .bas: they are not VBAMike Kaganski
Change-Id: I4ff8a8dc855da2c60084318e067d4ec8149d055e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118330 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-07-02tdf#143081: basic_macros: Add unittestXisco Fauli
Change-Id: I2d9fa23627f40a2398288b1ee7f5bfd4de4a6131 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118326 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-02tdf#84098 kill copy+paste in basic/qa/basic_coverageXisco Fauli
This also fix the problem of basic_coverage tests not showing the results when they were failing, since doUnitTest returned a Integer Change-Id: I637cd4cfaa34047bc99bfe6e0930f2945f1a9315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118234 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2021-07-01tdf#143081: fix Basic Replace() function crashes LOJulien Nabet
0x00007f19c0aa6e57 in rtl::OUStringBuffer::append(char16_t const*, int) (this=0x7fff100d0748, str=0x6f6f46a u"晦饖香©", len=-1) at include/rtl/ustrbuf.hxx:659 0x00007f19c0c3c8a8 in SbRtl_Replace(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods.cxx:1321 see bt here: https://bugs.documentfoundation.org/attachment.cgi?id=173298 Calling xCharClass->toUpper may change words, eg: "Straße" becomes "Strasse" so the length of the word increases. In brief, we want to use the length of aSrcStr not aExpStr Change-Id: Ia291d47a2021efc7dd9162ca5cc72b7940fdd71e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118202 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-01Purge out rtl::math::setInfBaiXiaochun
Change-Id: I71af8273c672a4cbcbfefafffd0003ab266dcce6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118132 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-28loplugin:indentation improve checks for brace alignmentNoel Grandin
Change-Id: I333100fda7e181f68f36b03279b3fbb8cb768310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117615 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-25tdf#142460: properly handle boolean values in string poolbaltasarq
This makes sure that results of comparison of literals have proper boolean type, and that this type is properly stored to/read from the string pool. This introduces a new non-standard "type" character used in the pool: 'b'. It is not a proper type character used in Basic (unlike '%'/'&'/'!'/'@'), but we have to use this trick locally, because we need to pass the type that has no own type character. The change should be backward-compatible: older versions reading the value should just ignore the 'b', and read the value as double. Change-Id: Ibd4a70b366331342346eb171c8ed3c7026279596 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117655 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-06-25No need for a std::string_view hereStephan Bergmann
...where proc.name is of type OString. (Following up on eebd84b337506c8fff151493f9b51bd127dbc89f "loplugin:stringview (clang-cl)".) Change-Id: I9e465b431f253d316e8dbff26e6768f5544e91f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117835 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-17use string_view in the Translate APINoel Grandin
Change-Id: I0bb0ea9d39ed623928060ffd3f2e2bc36ba33209 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117272 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-06-15vcl: outdevmap.hxx -> rendercontext/ImplMapRes.hxxChris Sherlock
Change-Id: I96e191999e43e1a4203d548eeacd386ed883cd8b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115368 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-06-01loplugin:stringview (clang-cl)Stephan Bergmann
Change-Id: Id1f8f24fec638efcdf5a04ca7253e6f401afd2fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116548 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-24fix leak in dbaccessNoel Grandin
when loading form controls Change-Id: Ifa731ca1c7bc16579ce03d256691a50ccfbeb82b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116050 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-23tdf#142180 Swapped comparison operators for static stringsJoshua Williams
It seems that, for some reason, the comparison operators for strings in basic were swapped in the code that evaluates string comparisons at compile-time. This is what caused bug #142180. This commit simply swaps the operators and should fix the bug. Change-Id: I14f90db8598f2f7f8b709e26902986e1f64af576 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115983 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-14Improve loplugin:stringviewStephan Bergmann
Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for operator call arguments. (The "rather than copy, pass subView()" diagnostic is already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly for operator call arguments.) (And many call sites don't even require an explicit [u16]string_view, esp. with the recent ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator += overloads". Just some test code in sal/qa/ that explicitly tests the O[U]String functionality had to be excluded.) Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-13tdf#132389 - Case-insensitive operation for non-ASCII charactersAndreas Heinisch
The replace function should depend on the application locale, instead of the UI language. Change-Id: I1582db07a1560da9ea87c0b127cf92611c8544bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115540 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-05-13tdf#139840 - Case-insensitive operation for non-ASCII charactersAndreas Heinisch
Support case-insensitive operation for non-ASCII characters in the InStr function in Basic. Change-Id: Idb2b8e128adf3596fa49e3e86365d5724ea3e11c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115538 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-05-10fix some leaks in basicNoel Grandin
Change-Id: I52c10cdbe9661974c908ee052336c779a40de402 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115323 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-07cid#1474072 silence Untrusted loop boundCaolán McNamara
Change-Id: I2f966440b59c61bfd692c0e63bdffc37eafdb7a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115229 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-06Change en_GB calendar StartDayOfWeek to Monday and MinimalDaysInFirstWeek to 4Eike Rathke
Inherit day, month and era names from en_US but with proper values. See https://lh.2xlibre.net/locale/en_GB/ - Week definition (week) - First day of week (first_weekday) or % LC_TIME=en_US locale -k LC_TIME week-ndays=7 week-1stday=19971130 week-1stweek=1 first_weekday=1 first_workday=2 % LC_TIME=en_GB locale -k LC_TIME week-ndays=7 week-1stday=19971130 week-1stweek=4 first_weekday=2 first_workday=2 This makes it necessary to adapt basic/qa/vba_tests/weekdayname.vb because basic/qa/cppunit/test_vba.cxx sets LANGUAGE_ENGLISH_UK Change-Id: I752bf0e59396f0cbd601beb596c07e77e4e4cfaf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115160 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2021-05-05loplugin:constmethodNoel Grandin
Change-Id: I7913fd8144d521b8293ac43036d0fad82e457cd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115145 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-01tdf#124184 Fixing StrConv VBA Functiontushar
* vbUnicode/vbFromUnicode considers optional third LCID argument. * LCID is also used for other conversions. * The encoding is decided based on the language defined in LCID, or on program locale when LCID is omitted, using MS default ACP mapping for languages. * Unit testis for vbWide / vbNarrow are changed and enabled. * Unit tests for vbKatakana / vbHiragana are changed and enabled. * Unit test for vbFromUnicode / vbUnicode is changed to rely on en-US locale used in testing, and is enabled. Change-Id: Iabd4153db311cd02c3f3e7247f9fc71ad9f5f682 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112539 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-28use string_view in INetURLObject::encodeNoel Grandin
Change-Id: Ib686c6872388b02c8939d3b65f6bd25cda348bc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114754 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-27loplugin:stringadd convert chained append to +Noel Grandin
which can use the more efficient *StringConcat Also fix a crash in stringview plugin which started happening while I working on this. Change-Id: I91a5b9b7707d1594d27d80b73930f5afac8ae608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-27use more string_view in tools/streamNoel Grandin
Change-Id: I2a957cd72d71fea717734488cdb3670e0bcdd6f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-22no need makeStringAndClear() when appending to bufferNoel Grandin
it just creates an unnecessary temporary Change-Id: Ide3cd99b2ac4f2a621e5d55ce4bdc95d05430709 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114467 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-20use OUString::Concat here, not OUStringLiteralNoel Grandin
Change-Id: Ia2172bcab60f32c9d9d4f6ca0230484343eef69b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114321 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-08update PCHsLuboš Luňák
Change-Id: Ia9d04447f927e270a55500e7f35723a729bc01dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113801 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-04-07Updated README.md files to represent current code / use Markdown formatHossein
Previously, all of the README files have been renamed to README.md and now, the contents of these files were changed to use Markdown format. Other than format inconsistency, some README.md files lacked information about modules, or were out of date. By using LibreOffice / OpenOffice wiki and other documentation websites, these files were updated. Now every README.md file has a title, and some description. The top-level README.md file is changed to add links to the modules. The result of processing the Markdown format README.md files can be seen at: https://docs.libreoffice.org/ Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-04-05tdf#141201 - Round MOD literals to Integer valuesAndreas Heinisch
(regression from commit I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b "tdf#84435: Mod operator does not deal with decimals as described in help"). Change-Id: I74b231d3814148579a3be0a92b7602fa4387281f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113571 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-04-02Simplify some static variable initializationsMike Kaganski
Change-Id: I6cdd44aa66b9597ccc51fc3fd69b57485ccb3230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113515 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-01cid#1473732 Untrusted loop boundCaolán McNamara
and cid#1474044 Untrusted loop bound Change-Id: If30dc454d60adca11fd1a53ecf472555e328bd42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113441 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-30fix some --disable-scripting warningsCaolán McNamara
Change-Id: I0fa5ec5e0fc7a08f5558f013ec75fd7d4fe5c1a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113379 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-30cid#1474044 Untrusted loop boundCaolán McNamara
Change-Id: I9f060fe0b56905def7b81a9b7da0b504367eb36c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113337 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-29TypeName, VarType, TypeLen Basic QA test casesAlain Romedenne
1- exhibiting array type names 2- highlighting supplemental libO Basic constants 3- precising data types internal representations I intend to document in help: 1- primitive data types array names: Boolean(), Byte(), … as IsArray() function does not provide such info 2- Publish extra Basic constants for already published values: - V_OBJECT=9, V_BOOLEAN=11, V_VARIANT=12, V_BYTE=17 - not necessarily V_ARRAY=8192, V_ERROR=10 The latter is conditioned to the creation of an enhancement request. FYI, published Vartype() values and constants for VBA and other Basic-like languages: https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/vartype-function https://docs.xojo.com/VarType https://help.hcltechsw.com/dom_designer/9.0.1/appdev/LSAZ_DATATYPE_FUNCTION.html Change-Id: I51bac3caf555d94e91de7c6d624b3fca9e73a673 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111042 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-03-29cid#1474044 Untrusted loop boundCaolán McNamara
Change-Id: Ibb20ffc2219c25add421cd4803e80b15b131c93b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113306 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-03-26loplugin:flattenNoel
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-03-25const OUString -> const OUStringLiteralMike Kaganski
Mostly automated rewrite Change-Id: Ie020a083f898bc126b8fb039d4ecb2e687172da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112965 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>