summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)AuthorFilesLines
2019-05-03Resolves: tdf#124605 ditch "if operand 1 is Empty, result is operand 2"Eike Rathke1-25/+11
It has been like that since the initial import but is utter nonsense. It might had (doubtfully) served some early StarBasic compatibility quirk, but is wrong and was implementation defined buggy behaviour. The Option VBASupport 1 even explicitly disabled it. In future we may want to implement the VBA Nothing value for an SbxEMPTY at least for boolean operators, but this for Calc user defined macro functions might even need a distinguished SbxEMPTYCELL or such. Or an explicit SbxNOTHING. Change-Id: I28919d982d0e60b9b840a12271dc717effa59662 Reviewed-on: https://gerrit.libreoffice.org/71701 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 15c39bb2e75df40c30bcbf789d815376dd2e31ce) Reviewed-on: https://gerrit.libreoffice.org/71705 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-01-15tdf#122250 Crash when running extensionNoel Grandin1-1/+5
as a consequence of commit 4e07987ce8134312920682e3481c3f8e3d7b66c3 Date: Thu Aug 25 15:08:55 2016 +0200 cid#1371154 Missing move assignment operator this extensions appears to pass bogus data into VCLXWindow::setProperty, so I had to workaround that when debugging Change-Id: Ib6728c0a990bd7cfbfed43d79b7560bd2f7f5a67 Reviewed-on: https://gerrit.libreoffice.org/66296 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-17Adapt to C++2a char_tStephan Bergmann2-2/+2
u8 literals incompatibly change their type (as implemented by recent Clang trunk) Change-Id: Ia4f7b91f5d86656a056303d2754981ab2093a739 Reviewed-on: https://gerrit.libreoffice.org/63494 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-16loplugin:buriedassign in avmedia..cuiNoel Grandin2-5/+11
Change-Id: Id44f1e98a3aac2c417f8030de603175bf68f0dfe Reviewed-on: https://gerrit.libreoffice.org/63467 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-13Set error also in non-UNO/UCB case file date failures, tdf#121337 follow-upEike Rathke1-28/+55
And do not attempt to format an odd date in case of failure. Change-Id: I82e93f9e473f42735b6a7e7b634b14ee7f09941d Reviewed-on: https://gerrit.libreoffice.org/63331 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-11-13Add reference to test codeStephan Bergmann1-0/+2
...that had inadvertently been missing from the file's inital commit, a6a48eeef16e473be14642469cd922f177f54998 "tdf#121325: Replace all of given length, even if replacement is shorter" Change-Id: I2a09e1d1ee94480d5615106a4e28958218d9b4c7 Reviewed-on: https://gerrit.libreoffice.org/63334 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-13tdf#121325: Replace all of given length, even if replacement is shorterStephan Bergmann4-9/+60
Both LO and MS Basic restrict the amount of replacement text ("If the Length parameter in the <emph>Mid statement</emph> is less than the length of the text that you want to replace, the text is reduced to the specified length." in helpcontent2/source/text/sbasic/shared/03120306.xhp, resp. "The number of characters replaced is always less than or equal to the number of characters in Target." at <https://docs.microsoft.com/en-us/dotnet/visual-basic/ language-reference/statements/mid-statement>). But cc20344010e94eda22fee662aab966d395a0796a "tdf#111313: Honor bWriteNoLenParam in !bCompatibility, too" had introduced a regression (in the non--compatibility- mode case), restricting the amount of replaced text to be no more than the amount of replacement text, even if the given length argument was larger. (Which had already regressed in the past, see <https://bugs.documentfoundation.org/show_bug.cgi?id=62090> "Mid statement doesn't work as expected".) Added test cases now. Change-Id: I21d4409f49a2437eb0e1a1e200561d803c42a24c Reviewed-on: https://gerrit.libreoffice.org/63328 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-13Don't call Date's ImpYearToDays with zero year argumentStephan Bergmann1-1/+1
...on which it asserts since 6d4f2dcc7cbba771e9d9b00de50368db4a88ef1b "Resolves: tdf#100452 class Date full (BCE,CE) proleptic Gregorian calendar". The assert fired when executing the Basic code from attachment 146529 to <https://bugs.documentfoundation.org/show_bug.cgi?id=121337> "FileDateTime("\\nonexistent\smb\path") returns bogus result rather than throwing error": > #4 0x00007ffff1d1c830 in (anonymous namespace)::ImpYearToDays(short) (nYear=0) at tools/source/datetime/tdate.cxx:55 > #5 0x00007ffff1d1c449 in Date::DateToDays(unsigned short, unsigned short, short) (nDay=0, nMonth=0, nYear=0) at tools/source/datetime/tdate.cxx:149 > #6 0x00007ffff1d1c3e5 in Date::GetAsNormalizedDays() const (this=0x7fffffff7268) at tools/source/datetime/tdate.cxx:142 > #7 0x00007ffff1d1dae5 in operator-(Date const&, Date const&) (rDate1=1900-1-1, rDate2=0-0-0) at tools/source/datetime/tdate.cxx:581 > #8 0x00007ffff5f87347 in GetDayDiff(Date const&) (rDate=0-0-0) at basic/source/runtime/methods.cxx:4653 > #9 0x00007ffff5f8aebb in SbRtl_FileDateTime(StarBASIC*, SbxArray&, bool) (rPar=...) at basic/source/runtime/methods.cxx:3054 Change-Id: I6468eeafc3daf325d3da3dfeacd08c7df1d1a8f4 Reviewed-on: https://gerrit.libreoffice.org/63318 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2018-11-10clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2Tamás Zolnai1-1/+1
Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d Reviewed-on: https://gerrit.libreoffice.org/63241 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-11-10Remove unneeded castMatteo Casalin1-1/+1
Change-Id: I04279faaf11bd1249bcea0d07d60facefb5186d8
2018-11-10tdf#120703 PVS: V547 Expression is always true/falseMike Kaganski1-6/+3
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643 Reviewed-on: https://gerrit.libreoffice.org/63235 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-10Replace deprecated boost::optional::reset(val) with operator =Mike Kaganski1-2/+2
Change-Id: I7340a561e0df0c781fd834388deb4b9f83800f9b Reviewed-on: https://gerrit.libreoffice.org/63221 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-11-07move SvTreeListBox to vclCaolán McNamara1-1/+1
Change-Id: I04a146d3d8a428ac1678827dc883525c40240a44 Reviewed-on: https://gerrit.libreoffice.org/62787 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-11-06loplugin:collapseif in accessibility..cuiNoel Grandin5-29/+13
Change-Id: I1437b493f3289b4ac97d061bd71973580571e792 Reviewed-on: https://gerrit.libreoffice.org/62933 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-06remove with_sprintf_ defineNoel Grandin1-93/+0
it has been this way since commit f333ee4564f7786f5f4ca501d71e660b5c366b93 Date: Wed Apr 11 11:54:30 2007 +0000 INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED Change-Id: I317efd9538436480a9fc3d37e748b0a51052ef80 Reviewed-on: https://gerrit.libreoffice.org/62932 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-05tdf#120703 PVS: V547 Expression '!pRTLData' is always falseMike Kaganski2-50/+47
Let SbiInstance::GetRTLData() return reference Change-Id: Iafe7e64f6f296b478003ce66ea66936a65ba9edc Reviewed-on: https://gerrit.libreoffice.org/62855 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-30Make SbiProcDef::Match more readableJan-Marek Glogowski3-7/+11
This reverts commit 02caaef29d60 ("loplugin:useuniqueptr in SbiProcDef") and is hopefully easier to follow. Change-Id: I46be2b3c7a933743795d89fe17a2c499c6983382 Reviewed-on: https://gerrit.libreoffice.org/62548 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-10-27tdf#120703 PVS: V724Mike Kaganski1-2/+1
V724 Converting type 'int' to type 'sal_Bool' can lead to a loss of high-order bits. Non-zero value can become 'FALSE'. Change-Id: I26540aa9fa9390e1990e95d81665567cd0a248b5 Reviewed-on: https://gerrit.libreoffice.org/62426 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27tdf#120703 PVS: V668Mike Kaganski1-6/+2
V668 There is no sense in testing the 'pProc' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. Change-Id: Iec65fd44fa947a2402da33510c29730a46c2e1a4 Reviewed-on: https://gerrit.libreoffice.org/62424 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-27tdf#120703 PVS: V530 The return value of function is required to be utilizedMike Kaganski2-2/+2
Change-Id: Ifc170a45e25b3fd5b7f561cc50afb6452bb359bd Reviewed-on: https://gerrit.libreoffice.org/62420 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-26tdf#42949 Fix IWYU warnings in include/unotools/*Gabor Kelemen4-0/+4
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: I444c43b9d549977039f25bec2b5bf666c3e15e0e Reviewed-on: https://gerrit.libreoffice.org/62041 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-26loplugin:singlevalfields improvementNoel Grandin2-4/+1
look for any kind of types, not just POD types, helps to find smart pointer fields that are only assigned nullptr Change-Id: I2d887e98db012f03b646e1023985bcc196285abc Reviewed-on: https://gerrit.libreoffice.org/62382 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-25tdf#42949 Fix IWYU warnings in include/xmlscript/*Gabor Kelemen2-0/+2
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Iacc5b98b947a26ca920cb9c49e579bc61d69b0c9 Reviewed-on: https://gerrit.libreoffice.org/62119 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-24remove more rtl::OUString and OString prefixesNoel Grandin1-1/+1
which seem to have snuck back in since the great rounds of removals. Change-Id: I85f7f5f4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-23clang-tidy performance-unnecessary-copy-initialization inNoel Grandin6-29/+29
basctl..basic Change-Id: I4009282869cd8a2f269093564bd4fafccab80ec3 Reviewed-on: https://gerrit.libreoffice.org/62212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-22pvs-studio: V794 The assignment operator should be protectedCaolán McNamara1-8/+11
Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669 Reviewed-on: https://gerrit.libreoffice.org/62166 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-21tdf#120703 (PVS): redundant nullptr checksMike Kaganski1-24/+15
V668 There is no sense in testing the 'm_pScriptSubPackageIterator' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. Change-Id: I15e635a6c9420ff444c5998dc0dbbf6f74ca6644 Reviewed-on: https://gerrit.libreoffice.org/62126 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-21tdf#120703 (PVS): redundant nullptr checkMike Kaganski1-4/+1
V668 There is no sense in testing the 'pChan' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. Change-Id: I1cb78c27da753525f05de2d3a0b74c894b07528e Reviewed-on: https://gerrit.libreoffice.org/62124 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-20tdf#120703 (PVS): redundant checkMike Kaganski1-2/+1
V547 Expression 'aData.eType == SbxDECIMAL' is always true Change-Id: I37bf367221ced7bf1c53bcd5138ae7bac656da52 Reviewed-on: https://gerrit.libreoffice.org/62030 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-20when calling std::lower_boundNoel Grandin1-8/+5
it's not enough to compare != end(), you also need to compare the key against the iterator result Change-Id: Ide5f151ba2297a35e5546f47fbc3c53cbe5ab533 Reviewed-on: https://gerrit.libreoffice.org/62014 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19tdf#120706: nullptr dereferenceMike Kaganski1-1/+1
Change-Id: I55814a6b4cdfda93a51621b5b31c166507a7e7a6 Reviewed-on: https://gerrit.libreoffice.org/62005 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-10-19clang-tidy readability-container-size-emptyNoel Grandin1-1/+1
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422 Reviewed-on: https://gerrit.libreoffice.org/61967 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19clang-tidy readability-misleading-indentationNoel Grandin1-82/+82
Change-Id: I4673fc7c694924b41d048a1918ddb8b0e0af1f79 Reviewed-on: https://gerrit.libreoffice.org/61935 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-17clang-tidy readability-redundant-smartptr-getNoel Grandin2-2/+2
redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15clang-tidy bugprone-copy-constructor-initNoel Grandin1-14/+0
message is "calling a base constructor other than the copy constructor" these constructors are not in use, so just remove them Change-Id: Ic8cede1eb153a6ae97fd1ca9c96ca8c1f43e3399 Reviewed-on: https://gerrit.libreoffice.org/61784 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15add SvStream::TellEndNoel Grandin2-6/+4
and simplify callsites to use it instead of the current "seek to end, find pos, seek back to original pos" pattern Change-Id: Ib5828868f73c341891efc759af8bd4695ae2f33c Reviewed-on: https://gerrit.libreoffice.org/61738 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann3-6/+6
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-21new loplugin:methodcyclesNoel Grandin3-95/+0
look for closed cycles of methods i.e. unused code that would not otherwise be found by the unusedmethods loplugin Change-Id: I3fb052132d97aabca573bb8e9fc424201b1e2042 Reviewed-on: https://gerrit.libreoffice.org/60875 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann12-60/+60
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-10tdf#42949 Fix IWYU warnings in include/cppuhelper/*Gabor Kelemen3-0/+3
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ib420e9216b8313f5ed7634ec375e39ceb741fd45 Reviewed-on: https://gerrit.libreoffice.org/59297 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-08cppcheck: variableScope in basicJochen Nitschke4-17/+13
use a range based loop in one case Change-Id: I3d3acc35739634797e2b6e4d1cc2909b3fe33750 Reviewed-on: https://gerrit.libreoffice.org/60188 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-07Fix typoAndrea Gelmini1-2/+2
Change-Id: Ib2c183f5edb94e68f43f92edd83cb8d3ae5b40e1 Reviewed-on: https://gerrit.libreoffice.org/60103 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-09-06clang-tidy performance-unnecessary-value-paramNoel Grandin2-2/+2
Change-Id: I69247498e13331f6ef84afeb242479f8fb1178a8 Reviewed-on: https://gerrit.libreoffice.org/60068 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-05loplugin:useuniqueptr in SbiGlobalsNoel Grandin2-10/+7
Change-Id: Icbf913058ada4714345d0251970e6420b315270c Reviewed-on: https://gerrit.libreoffice.org/60001 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-05loplugin:simplifyconstruct in accessibility..bridgesNoel Grandin6-11/+9
Change-Id: I08f6a64b50f03d1b08027a2ac9e51442255d64bc Reviewed-on: https://gerrit.libreoffice.org/59976 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-04loplugin:useuniqueptr in SbiDdeControlNoel Grandin2-28/+15
Change-Id: I7bded977d12b6105c15a4343206dc43d66b910c6 Reviewed-on: https://gerrit.libreoffice.org/59974 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-03cppcheck: useInitializationList in basicJochen Nitschke4-12/+11
Change-Id: I97fefc25076c2c163f6010745081772ee8c17712 Reviewed-on: https://gerrit.libreoffice.org/59908 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-29Fix typosAndrea Gelmini1-2/+2
Change-Id: I6ca53ead2b125618d0aceff05d5fdfa374662799 Reviewed-on: https://gerrit.libreoffice.org/58809 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-08-27Fix warning in !HAVE_FEATURE_SCRIPTING caseTor Lillqvist1-1/+1
Change-Id: Ibc2a9d4426e9ef09eb874e7a9fef0ea31cad56d5
2018-08-22loplugin:useuniqueptr in SbiExprNodeNoel Grandin3-77/+77
Change-Id: I2025251e35a48f47a51f11d790c3a22e118f3c05 Reviewed-on: https://gerrit.libreoffice.org/59348 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>