summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2020-09-04tdf#124176 Use #pragma once in basicGeorge Bateman
This commit was carried out by a Python script, source of which is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97. Change-Id: Ief7f29d8efaa3d6ac417080f3147a087844621a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100128 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-03Make ImpSvNumberformatScan::GetColor constMike Kaganski
Change-Id: Idbcce18029944ab884cdde03e21190cbb574a00f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102005 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-09-01tdf#54912 - with option base arrays should start at index 1Andreas Heinisch
Using option base, every array should start at index 1. Previously, it needed option VBASupport too. Without option compatible, the upper bound of an array is increased as well in order to preserve the specified size. Change-Id: I52885f14914a4636b98258aa428c2123f62482a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101269 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-08-28Change OUStringLiteral from char[] to char16_t[]Stephan Bergmann
This is a prerequisite for making conversion from OUStringLiteral to OUString more efficient at least for C++20 (by replacing its internals with a constexpr- generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount, conditionally for C++20 for now). For a configure-wise bare-bones build on Linux, size reported by `du -bs instdir` grew by 118792 bytes from 1155636636 to 1155755428. In most places just a u"..." string literal prefix had to be added. In some places char const a[] = "..."; variables have been changed to char16_t, and a few places required even further changes to code (which prompted the addition of include/o3tl/string_view.hxx helper function o3tl::equalsIgnoreAsciiCase and the additional OUString::createFromAscii overload). For all uses of macros expanding to string literals, the relevant uses have been rewritten as u"" MACRO instead of changing the macro definitions. It should be possible to change at least some of those macro definitions (and drop the u"" from their call sites) in follow-up commits. Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-27tdf#136143 - reset SbxFlagBits::Fixed SbiRuntime::StepPARAMAndreas Heinisch
In order to prevent type conversion errors, reset a variable of type SbxERROR to not fixed. Variable will be of type SbxERROR, but can be converted to any requested type. Change-Id: Ic856376e3f8232577a5e894a2adb2545c8723033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101419 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-08-19Fix typo in codeAndrea Gelmini
Change-Id: Ie8ebbfd9bdf5916d50161fdf39de963730f051a8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100868 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-18loplugin:unusedvarsglobalNoel Grandin
tackle some read-only vars. Mark some of them const to make it obvious they are not really used, and to make the constantparam plugin see more data. Change-Id: Ia25927745866746aa1aa9d5affd5857ad9f9ee24 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100895 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-17Don't forget to increment refcount when loading from imageMike Kaganski
Otherwise it will fail assertion in SbxValue::Clear, because SvRefBase::ReleaseRef would check that its current count is not zero. In release builds, not doing this would leak. Change-Id: I80dfc815f8a2b651ff290af10808212281abf246 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100879 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-08-17tdf#135799: properly load arrays in user-defined types from imageMike Kaganski
This requires to reset Fixed flag temporarily, as in SbiParser::DefType for non-image case. And save the dimensions of the arrays in the custom types correctly: the dimensions are numbered from 1, not from 0. The existing unit test (that happened to not test anything actually) was fixed. Change-Id: I48c6b6d5d735d9972a2c0dd40345d5db75f87f39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100877 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-08-17Fix typosAndrea Gelmini
Change-Id: Id31299912b822baf9eecbb03cba53339f0528ae8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100867 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-08-15remove constructor with plain Bitmap from Graphic, use BitmapExTomaž Vajngerl
Change-Id: Ie429a10a8f54c6779d437ee4bc75a5ea0c427848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100727 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-08-14loplugin:simplifybool moreNoel Grandin
look for expressions like !(a && !b) which can be expanded out Change-Id: I72515a9638762b050f9a258c08da39ebfa2ef8e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100579 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-13loplugin:stringstatic also look for local staticsNoel Grandin
Add some API to O*StringLiteral, to make it easier to use in some places that were using O*String Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-07tdf#135470: Fix checksMike Kaganski
The check should prevent error in case when the variable has wrong type. IsObject returns false e.g. for arrays, which are valid iterables. So proper check is using GetFullType, which will give SbxOBJECT for any variable for which GetObject does not set error. "Next" should also generate an error for uninitialized loops. Regression after 5760c94b8847164f9a7a181f031c7c86643944af Change-Id: Ib58e1cc76ef63aa1ff8a86c9d5dc956e4780fb49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100258 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-08-04Remove dead codeStephan Bergmann
As discussed at <https://gerrit.libreoffice.org/c/core/+/99724> "fix shutdown crash in basic" the code was added in error, and at least clang-cl with latest MSVC standard library and C++20 mode gives a helpful > basic/source/sbx/sbxbase.cxx(53,5): error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result] > std::move(m_Factories); > ^~~~~~~~~ ~~~~~~~~~~~ now. Change-Id: I052efe51d4415838b50de06bb308692fa937b7b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100076 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-03BASIC : no need to initialize manually std::unique_ptrArnaud Versini
Change-Id: I7e4780d41dd43383820cc3ae4ce5cfba24a53b7f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99942 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
2020-07-30fix commentNoel Grandin
Change-Id: Iff0cb697a4f8670c897516d23f2701f3716171f3
2020-07-30fix shutdown crash in basicNoel Grandin
another change I am working on slightly tweaks the shutdown ordering and exposes this problem where two classes both think they own the same object. Change-Id: I7477cf7eda5b5729ee3861cb4a1be43bb34d9ea6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99724 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-25Use comphelper::IsContextFlagActive for flags from comphelper::NewFlagContextMike Kaganski
Change-Id: Ib4a812dd115299d4251d863d0ee275d7acba1c5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99443 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-21Fix uses of char16_t*/wchar_t* stream insertersStephan Bergmann
...that are helpfully deleted in C++20, as now implemented at least by VS 2019 16.6.4 when using --with-latest-c++ Change-Id: Iaf80f793e73fc90768bb146c9cf3d300d6747c8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99170 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-21tdf#134576: basic_macros: Add unittestXisco Fauli
Change-Id: I6078e0712f7983159ea3b3f2060a1c4b69e9d5c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99114 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2020-07-12update pchesCaolán McNamara
Change-Id: I75602277a5a26b012a12f2c4f4b7ff5bb663b0b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98474 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-10tdf#134576: proper handling of For/For Each with On Error Resume NextMike Kaganski
1. In SbiRuntime::PushForEach, always initialize SbiForStack::eForType to avoid handling the loop as simple For loop in SbiRuntime::StepNEXT. 2. In SbiRuntime::PushForEach, just like in SbiRuntime::PushFor, don't set error, but imitialize the loop properly. This allows to proceed to SbiRuntime::StepTESTFOR, where the error will be handled gracefully. 3. In SbiRuntime::StepTESTFOR, check for the proper initialization of the iteration, and set the error. 4. In SbiRuntime::StepTESTFOR, on error, modify the type of iteration into Error - to make sure that loop ends on next iteration (so only a single iteration happens inside the Resume Next). Change-Id: Idd0bab79fb0099fa3ad295b7fc6ab2eb6173f7b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98537 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-10tdf#134692: copy deep when there are multiple references to the old arrayMike Kaganski
E.g., when we redim a copy of an array, the other copy would still have its old dimensions, so shallow copy would share some array elements between the now different arrays. The other possible approach would be to try to modify the original array to have the ByRef semantics. Change-Id: Iab272ecbf4ade67048d6a126f17322441c5aa808 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98481 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-07-10tdf#134576 at least don't crash in this edge-caseCaolán McNamara
Change-Id: I69638fd2130c1ba68915906ced62bda2cd883932 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98491 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-10replace usage of blacklist with excludelist for IWYUThorsten Behrens
Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-07-10replace usage of blacklist with denylistThorsten Behrens
.. and a few cases of instead doing blacklist->excludelist where that made more sense. Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 [API CHANGE] officecfg::Office::Canvas::DeviceBlacklist -> DeviceDenylist [API CHANGE] officecfg::Office::Canvas::BlacklistCurrentDevice -> DenylistCurrentDevice [API CHANGE] officecfg::Office::Common::Misc::OpenCLBlackList -> OpenCLDenyList Change-Id: Ia35e25496bf0cc0692d5de4cb66bfc232d3a869e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98180 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-06-30Upcoming improved loplugin:staticanonymous -> redundantstatic: basicStephan Bergmann
Change-Id: I1046ee1ea28e19afa51b0e20ee573105ced77535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97522 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-26Upcoming improved loplugin:elidestringvar: basicStephan Bergmann
Change-Id: Ie5422ac19289693c44ce81548a74bd727bb0be36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97193 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-24Remove no-longer-relevant commentsStephan Bergmann
...left over by 27239ad23006b1fd1ddb21467f4c1fd637b560d5 "basic: String -> OUString", > // Force length 1 and make char 0 afterwards > - String aNullCharStr( rtl::OUString(" ") ); > - aNullCharStr.SetChar( 0, 0 ); > + OUString aNullCharStr( (sal_Unicode)0); > return aNullCharStr; and > // Force length 1 and make char 0 afterwards > - String aNullCharStr( rtl::OUString(" ") ); > - aNullCharStr.SetChar( 0, 0 ); > + OUString aNullCharStr((sal_Unicode)0); > addStringConst( aPublics, "vbNullChar", aNullCharStr ); Change-Id: Icbf69ff7b92374b690cb5c7f0129c6a494db48f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97031 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-20BASIC : don't initialize and destroy manually std::unique_ptrArnaud Versini
Change-Id: I97921d5a6f7e0f6dfc3100e4ea33ba79e5a135dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94573 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-16tdf#133913 - create variable with Variant/Type in StepLOADNCAndreas Heinisch
During the loading of numeric constants in StepLOADNC, create variables of type Variant and convert them to the requested type, i.e. Variant/Type in order to prevent type conversion errors, when they are passed to a method with variant parameter types. Change-Id: I2ab0111b5b53dd2de9523ba7cf12bd2519d050b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96402 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-06-11tdf#132563 - Convert parameters of type SbxEMPTYAndreas Heinisch
During the construction of the parameter list of a method, convert parameters of type SbxEMPTY to their requested type, since missing parameters are handled differently in StepEMPTY, where separate parameter information (SbxMISSING) is added. Change-Id: Ie1e027cfdd652404ec29bd3d05e7daf533468936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96088 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-06-03loplugin:simplifypointertobool improveNoel Grandin
to look for the x.get() != null pattern, which can be simplified to x I'll do the x.get() == nullptr pattern in a separate patch, to reduce the chances of a mistake Change-Id: I45e0d178e75359857cdf50d712039cb526016555 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95354 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-02Upcoming loplugin:elidestringvar: basicStephan Bergmann
Change-Id: Ie723d07afcc6e0d5e52bec77617fec326a739415 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95374 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-28loplugin:simplifybool in accessibility..basicNoel Grandin
Change-Id: Ibf6cef4baa2d3d400d953ac8bc97a66b5901def9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94972 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-26Fix loplugin:simplifypointertobool for libstdc++ std::shared_ptrStephan Bergmann
...where the get member function is defined on a std::__shared_ptr base class, so loplugin:simplifypointertobool used to miss those until now. (While e.g. using libc++ on macOS found those cases.) 366d08f2f6d4de922f6099c62bb81b49d89e0a68 "new loplugin:simplifypointertobool" was mistaken in breaking isSmartPointerType(const clang::Type* t) out of isSmartPointerType(const Expr* e); c874294ad9fb178df47c66875bfbdec466e39763 "Fix detection of std::unique_ptr/shared_ptr in loplugin:redundantpointerops" had introduced that indivisible two-step algorithm on purpose. The amount of additional hits (on Linux) apparently asked for turning loplugin:simplifypointertobool into a rewriting plugin. Which in turn showed that the naive adivce to just "drop the get()" is not sufficient in places that are not contextually converted to bool, as those places need to be wrapped in a bool(...) functional cast now. If the expression was already wrapped in parentheses, those could be reused as part of the functional cast, but implementing that showed that such cases are not yet found at all by the existing loplugin:simplifypointertobool. Lets leave that TODO for another commit. Besides the changes to compilerplugins/ itself, this change has been generated fully automatically with the rewriting plugin on Linux. Change-Id: I83107d6f634fc9ac232986f49044d7017df83e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94888 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2020-05-24inline some use-once typedefsNoel Grandin
Change-Id: Idddba2f3fd05265b08dbc88edb6152d34a166052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-21tdf#132389 - case-insensitive operation for non-ASCII charactersAndreas Heinisch
Support case-insensitive operation for non-ASCII characters in the Replace function in Basic. Change-Id: I48069ad7be1ae0f012c52f595cc44e6b50580b94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94580 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-19tdf#88205 EasyHack change css::uno::Sequence initializationsvgeof
1st commit. Use initializer lists for uno::Sequence in 4 files Change-Id: I0192b4b8f023fb8d606dff81c4b910c8c7c2a9a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93900 Reviewed-by: Michael Stahl <michael.stahl@cib.de> Tested-by: Jenkins
2020-05-15use for-range on Sequence in basctl..canvasNoel Grandin
Change-Id: Idad3d8fbe785c7b1b8b287a3227372adb2757de8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94260 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-11fix leak in basicNoel Grandin
Change-Id: I9971a824b98193e7d6f926208a4bb9bfe92d5b43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93935 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-10new loplugin:simplifypointertoboolNoel Grandin
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-26update pchesCaolán McNamara
Change-Id: I83a61da7dda6c72552eecd377f1c3744c92a797e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92909 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-25tdf#132388: reimplement SbRtl_ReplaceMike Kaganski
It should not convert strings to uppercase each loop; it should use OUStringBuffer to avoid extra allocations. This reduces tick count for the code in the bug from ~6000 to ~30. Change-Id: I89ea062fc6d012464bb461b6a8ef321f8cc62fe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92884 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-04-22uiobject.hxx only needs forward declaresCaolán McNamara
and update pches accordingly Change-Id: I411712532fd85961bffe6678416fcdc1d9c7f53d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92617 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-04-19loplugin:flatten in basicNoel Grandin
Change-Id: Icb8e3cda312b50c9a9f12f96bec1c746f41c8979 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92483 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-14loplugin:buriedassign in b*Noel Grandin
Change-Id: Ic20f46105a30b54bc5a991b4070e6c8edb15376e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92189 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-02tdf#79426, tdf#125180 - Don't convert missing parameters to requested typeAndreas Heinisch
If a particular parameter type is requested during the construction of a parameter list, don't convert missing parameters to avoid implicit casting to the specified data type and value of the method. Missing parameters are handled in StepEMPTY, where additional information about missing parameters is added. Change-Id: Ia413b2996d7d1feecedc1dfefaf6baf0fd9d917e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90215 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-03-30OSL_ASSERT->assert in basicNoel Grandin
Change-Id: I8abe14706e9c6d1323d5d66a8b700ddaa2803f2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91333 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>