summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)AuthorFilesLines
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>
2018-08-19Translate German commentsJohnny_M1-2/+2
Change-Id: I1a4e41ccd3e3eb829419c45edd0417776a73c3ae Reviewed-on: https://gerrit.libreoffice.org/59285 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2018-08-16Resolves: tdf#119013 do not over-aggressively reorder date particlesEike Rathke3-8/+8
In particular not when reading documents as we don't know what the original (default/system) locale was when the date format was created and stored and whether the format's date order actually matched the locale's ordering. Regression from commit 51478cefaa4e265b42e3f67eda0a64767ff3efba CommitDate: Tue Apr 18 17:01:27 2017 +0200 Resolves: tdf#107012 follow date order of the target locale Change-Id: I9d3bdbd512d95ed81ff6459e368a2d7497ec8a2d Reviewed-on: https://gerrit.libreoffice.org/59182 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-08-14create appendCopy method in OUStringBufferNoel Grandin2-2/+2
so we can avoid temporary copies when appending a substring of an OUString to the buffer. I would have preferred to call the method just "append" but that results in ambiguous method errors when the callsite is something like sal_Int32 n; OUStringBuffer s; s.append(n, 10); I'm not sure why Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f Reviewed-on: https://gerrit.libreoffice.org/58666 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-13Fix typosAndrea Gelmini1-1/+1
Change-Id: I47725a9f56528a88cd3db1798eae954eff337560 Reviewed-on: https://gerrit.libreoffice.org/58611 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-08-10unnecessary null check before dynamic_cast, in variousNoel Grandin6-12/+10
Change-Id: I76ad0b3152030c29ee28f6a6cc80d0832188d02b Reviewed-on: https://gerrit.libreoffice.org/58774 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-07loplugin:useuniqueptr in ImplRepositoryNoel Grandin1-17/+15
Change-Id: I664e16e4d61ed11df54bd161ad30c15fc41ce39b Reviewed-on: https://gerrit.libreoffice.org/58648 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-03loplugin:useuniqueptr in SbiProcDefNoel Grandin3-5/+4
Change-Id: I31c43f8fe40d90094d550b02c5d6213e59149bad Reviewed-on: https://gerrit.libreoffice.org/58486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-03loplugin:useuniqueptr in BasicManagerNoel Grandin3-12/+2
Change-Id: I9774a1651c8754f575ebb4b98fbddee5a99a7719 Reviewed-on: https://gerrit.libreoffice.org/58485 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-01add operator+=(OUStringBuffer) method to OUStringNoel Grandin1-1/+1
to reduce needless object creation and copying some more And fix what looks like a bug in CSS hex color parsing at line 609 in sw/../parcss1.cxx that has been there since commit 7b0b5cdfeed656b279bc32cd929630d5fc25878b "initial import" Change-Id: Ibad42b23721a56493bd1edcd7165e6104494a5c3 Reviewed-on: https://gerrit.libreoffice.org/58357 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-27loplugin:stringloop in basic, framework, sax, svtoolsNoel Grandin4-26/+26
Change-Id: I2bad74a8f103e9dc68c8e0d0e6315697068d2f6d Reviewed-on: https://gerrit.libreoffice.org/58135 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-27tdf#109132, load VBA library by default during ODF importMarkus Mohrhard1-1/+1
Without loading the VBA library any of the functions inside of the library will not be available for spreadsheet functions. Change-Id: I7d0b931ef4817e5870635f43f4b4ae4399780bc4 Reviewed-on: https://gerrit.libreoffice.org/58149 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2018-07-26basic: avoid -Werror=deprecated-copy (GCC trunk towards GCC 9)Stephan Bergmann4-10/+0
...by removing explicitly user-provided functions that do the same as their implicitly-defined counterparts, but may prevent implicitly declared copy functions from being defined as non-deleted in the future. (Even if a dtor was declared non-inline in an include file, the apparently-used implicitly-defined copy functions are already inline, so why bother with a non-inline dtor.) Change-Id: I8a31ab0c806cb0f3c226d217f152a205aff6c07f Reviewed-on: https://gerrit.libreoffice.org/58065 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-07-23Fix typosAndrea Gelmini1-1/+1
Change-Id: If6e6df9ac592c77f19e381e50b7eb26fbf429f61 Reviewed-on: https://gerrit.libreoffice.org/57831 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-07-18Fix typosAndrea Gelmini3-6/+6
Change-Id: I563ea72a1e3870f5c362527f018c6b63607b4011 Reviewed-on: https://gerrit.libreoffice.org/57597 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-07-13loplugin:useuniqueptr in SbUnoStructRefObjectNoel Grandin2-4/+3
now that we have upgraded to VS2017, we can use std::unique_ptr in std::map Change-Id: Id01af07ccae7447405b8f0bc44b08043f453e54b Reviewed-on: https://gerrit.libreoffice.org/57384 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-09Add missing sal/log.hxx headersGabor Kelemen15-0/+15
rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from a* to configmgr Change-Id: I6ea1a7f992b1f835f5bac7a725e1135abee3f85a Reviewed-on: https://gerrit.libreoffice.org/57170 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-02Small cleanup and simplificationMike Kaganski1-14/+12
Change-Id: I1e8a750832f365f080f6f60c81560dc942003049 Reviewed-on: https://gerrit.libreoffice.org/56788 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-30Small cleanupMike Kaganski1-5/+1
Change-Id: I0d3cea810b9148859d1c0704e06381f22d7b24c9 Reviewed-on: https://gerrit.libreoffice.org/56762 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-30tdf#118218: Make FormatNumber VBA-onlyMike Kaganski1-1/+1
0f7a7c8e719dab6b79e24285b907b5be17f39fc8 follow-up Change-Id: I79ed02770a4321401f250b85b04ef66d476a67df Reviewed-on: https://gerrit.libreoffice.org/56742 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-29tdf#118218: Implement FormatNumber VBA functionMike Kaganski4-9/+170
The existing unit test (previously non-functional because of defunct success condition) is fixed and extended. Change-Id: I2544f865144b25f51a5f0941e5d961f246f41c4b Reviewed-on: https://gerrit.libreoffice.org/56610 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-06-29Improved loplugin:redundantcast (const-qualified typedefs): basicStephan Bergmann2-2/+2
Change-Id: Ie22fe58dc2c2cc3867bd800f757433b68e0f2448 Reviewed-on: https://gerrit.libreoffice.org/56693 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-29tdf#118442: Fix incorrect index calculationMike Kaganski2-2/+67
If a number string has leading spaces and/or minus, then calculating index into the aBuf as the difference between p and pStart gives wrong (too big) number. This asserts in debug builds, when e.g. an assignment is made in a BASIC macro: Dim f As Double f = " -12.20" "include/rtl/ustrbuf.hxx:490: sal_Unicode &rtl::OUStringBuffer::operator[](sal_Int32): Assertion `index >= 0 && index < pData->length' failed." This affects, e.g., https://gerrit.libreoffice.org/56610 (see https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/9527/consoleFull#1820989527d893063f-7f3d-4b7e-b56f-4e0f225817cd) Change-Id: I14654166be721907e2a26ea6f4091f203a9437d7 Reviewed-on: https://gerrit.libreoffice.org/56611 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2018-06-18Related: tdf#118073 SbiScanner::NextSym: no symbol is no symbolEike Rathke1-0/+9
Whatever may or may not advance or put back nLineIdx, if there's no progress at the end return false so we don't end up in an endless loop with the next NextSym() starting at the same position. Change-Id: I7084fea073490c15b8ff5abb3781ac82cdccd6d6 Reviewed-on: https://gerrit.libreoffice.org/56029 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2018-06-17crashtesting: check nLineIdxCaolán McNamara1-3/+3
Change-Id: If499712955702e760524478711160194ecea47c0 Reviewed-on: https://gerrit.libreoffice.org/55954 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-13valgrind: use OUString::operator to access into stringCaolán McNamara2-59/+64
address some out of bounds oddness seen with rtl_ustr_getlength_heap_buffer_overflow.sample Change-Id: I5a9772de9607644f43e74174f73053d292ca7cc0 Reviewed-on: https://gerrit.libreoffice.org/55722 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-06-06Translate German comments and debug stringsJohnny_M1-3/+3
And correct a few comments (translation and grammar) Change-Id: Ifafa521c683e9ca65aeba8031cd4cbfc1fadc137 Reviewed-on: https://gerrit.libreoffice.org/54888 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
2018-06-01loplugin:includeform (clang-cl)Stephan Bergmann1-1/+1
Change-Id: Ia15fc0ea8d46cd4eab6ca690e1dac3a530512ab6 Reviewed-on: https://gerrit.libreoffice.org/55170 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-05-30Factor out AsyncQuitHandler to be usable elsewhere, tooTor Lillqvist1-26/+1
Or do we already have the corresponding functionality somewhere, and SbModule::Run() could be changed to use that instead? Change-Id: I6f45d4a023f9f9d9a24ab6934117a712ccbe75e2 Reviewed-on: https://gerrit.libreoffice.org/55048 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2018-05-29forcepoint#42 check available str lengthCaolán McNamara1-1/+1
Change-Id: Ie476968ddaa4c3e5475ae9aa6133e7aba38d5975 Reviewed-on: https://gerrit.libreoffice.org/54976 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-05-28Add missing includeSamuel Mehrbrodt1-0/+1
Change-Id: I645e25d6dcff1d395760f3a9980858a4c4ac1378 Reviewed-on: https://gerrit.libreoffice.org/54923 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-05-28basic: Avoid looking up system clock twice to get current datetimeTakeshi Abe1-6/+5
Change-Id: I3de322a420bdbbd7906160b97dca531dfe3092a4 Reviewed-on: https://gerrit.libreoffice.org/53929 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-05-28tdf#96099 Remove some trivial typedef std::vectorArkadiy Illarionov1-3/+2
Change-Id: I41fff78c10d46bde50063536d8cf1a3942dbf6af Reviewed-on: https://gerrit.libreoffice.org/54834 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
2018-05-25loplugin:passstuffbyrefNoel Grandin1-1/+1
Change-Id: I785e96599bbda029adf4698d11d7f981750dec07 Reviewed-on: https://gerrit.libreoffice.org/54802 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-23rename config_extension_update.h.in to config_extensions.h.inRene Engelhard1-1/+1
... and move HAVE_FEATURE_EXTENSIONS there, too Change-Id: I37fe52071e1db32cf5cc1e51dbd89bb4f32a39c1 Reviewed-on: https://gerrit.libreoffice.org/54072 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Rene Engelhard <rene@debian.org>
2018-05-22tdf#97231: basic: do not use extra wrapping for string marshalingVasily Melenchuk1-5/+12
previous approach did wrap string reference once again, making practically "a pointer to pointer to string" so this code was not working correctly for RegQueryValueExA WinAPI call. String is already provided as a reference (see marshalString(), so no reason to wrap its reference. This approach was just copied from from dllmgr-x86.cxx plus some minor changes to make both versions similar. Change-Id: I85065112407de3f078265d2c76437814402eb1b3 Reviewed-on: https://gerrit.libreoffice.org/54645 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-05-21tdf#97231: potential crash fixedVasily Melenchuk2-2/+2
blob2 pointer can be invalidated during marshalString() call, because it also adds new element in data vector and thus later access to blob2 can cause crash. Change-Id: I2de519c363193f34b249e7250a016397b7420882 Reviewed-on: https://gerrit.libreoffice.org/54613 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-05-17New o3tl::temporary to simplify calls of std::modfStephan Bergmann2-8/+6
...that ignore the out-parameter integral part Change-Id: I05f07c1a8909023232f8aecf75ea5541d4eb81ca Reviewed-on: https://gerrit.libreoffice.org/54474 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>