summaryrefslogtreecommitdiff
path: root/basic
AgeCommit message (Collapse)Author
2015-05-20tdf#90110: basic: fix Randomize statementMichael Stahl
- time() is used to seed the RNG but since it only has second resolution, the same values will be generated if it's called multiple times like in the bug report - BASIC using the global rng would be fine except that BASIC Randomize takes an optional parameter to set the seed, which should continue to be supported, but should not affect the RNG state for non-BASIC users of comphelper::random (regression from df466d79cb126667cc9d5c108367bfa4f5ce76c8, but the old implementation was even more delightfully absurd, where Randomize was essentially srand((sal_uInt16)rand()) ...) Change-Id: I0f30e509de08f933c02ac77c5d932b20e79586c5 (cherry picked from commit 564fc483931c0aa2872a33023473c7ac36bfedf1) Reviewed-on: https://gerrit.libreoffice.org/15818 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-05-12tdf#90969: basic: add horrible hack to avoid crash due to ...Michael Stahl
... the stupid global variable GaDocBasicItems. Change-Id: Ib849e0e2b661e54005d00091f6d6fc474dc5549b (cherry picked from commit be88e305eeac88e51f83efc004d4b60b87f1e757) Reviewed-on: https://gerrit.libreoffice.org/15715 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com> Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2015-04-30tdf#84435: Mod operator does not deal with decimals as described in helpJulien Nabet
Change-Id: I8dbfdf4bb2eceac0b5afbddd3f35e1dcde2db68b Reviewed-on: https://gerrit.libreoffice.org/14611 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 0f79a5ff07e5b392044726b657998561cbe97fda) Reviewed-on: https://gerrit.libreoffice.org/15576
2015-04-20tdf#55502: Shell BASIC function with empty third param hangsJulien Nabet
bt: 2 0x00002aaaab2b5226 in __assert_fail_base (fmt=0x2aaaab3ebce8 "%s%s%s:%u: %s%sAssertion `%s' failed. %n", assertion=assertion@entry=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", file=file@entry=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=line@entry=500, function=function@entry=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:92 3 0x00002aaaab2b52d2 in __GI___assert_fail (assertion=0x2aaaae2ecf10 "index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength())", file=0x2aaaae2ecec8 "/home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx", line=500, function=0x2aaaae2ed740 <rtl::OUString::operator[](int) const::__PRETTY_FUNCTION__> "sal_Unicode rtl::OUString::operator[](sal_Int32) const") at assert.c:101 4 0x00002aaaae1f44f8 in rtl::OUString::operator[] (this=0x7fffffff36b0, index=13) at /home/julien/compile-libreoffice/libreoffice/include/rtl/ustring.hxx:500 5 0x00002aaaae274036 in SbRtl_Shell (pBasic=0x3531fc0, rPar=..., bWrite=false) at /home/julien/compile-libreoffice/libreoffice/basic/source/runtime/methods.cxx:3613 Check if third param isn't empty, if not, aCmdLine finishes with a space character Change-Id: I095b6dc7c7d2d4c826fb47aa1414c558bbc27c04 Reviewed-on: https://gerrit.libreoffice.org/15380 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-02-12Resolves fdo#87834: strange behavior of mid()-functionJulien Nabet
See https://bugs.freedesktop.org/show_bug.cgi?id=87834 Thank you Michael Büssow for pointing these cases Change-Id: I3a9b58360ddab529d1fb2f7eeba7f1c7ae69ba7c Reviewed-on: https://gerrit.libreoffice.org/13707 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit b7d02d7a5a374da3e01e0abc4022fba35daa1840) Reviewed-on: https://gerrit.libreoffice.org/14145 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
2015-01-30tdf#76174: basic: lock SolarMutex in BasicScriptListener_ImplMichael Stahl
... before calling into BASIC. Change-Id: I51a59fe5ca9b15ff7ec509c052964523d87a9790 (cherry picked from commit a4faad707c7fb27884fff5f20e5797b160d4f320) Reviewed-on: https://gerrit.libreoffice.org/14237 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2014-12-09Resolves: fdo#86843 avoid getting deleted before finishing BroadcastCaolán McNamara
Change-Id: I19181f9e2fbd5f906e6e5d807b1b2483e7881cf0 (cherry picked from commit 19d0950451f909086c3732ce29812c4cda513908)
2014-11-23busted loop condition and coverity#1255390 Resource leakCaolán McNamara
regression from commit 119873328acd70ca3569c21a0b1fe36277e8bf4c Date: Thu Oct 21 15:34:02 2010 -0500 convert vos/process.hxx and related API Change-Id: I36527a4f0109105b9853a79773b4c92f9bc4e902 (cherry picked from commit ecc56da366960b642d0a7da1b4a47245243252f8) Reviewed-on: https://gerrit.libreoffice.org/13016 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
2014-11-18cppuhelper: clean up public headers with include-what-you-useMichael Stahl
Change-Id: I41ba46831f24b2960a1fe982b74a2b623e682e0b
2014-11-17coverity#735399 Logically dead codeCaolán McNamara
we can only enter the bAssumeExprLParenMode controlled block once because the block sets bAssumeExprLParenMode to false bAssumeExprLParenMode is only true if the first token read in the method is LPAREN so we can only enter this block if the current token is LPAREN and its the first token processed, so the token can't be BYVAL Change-Id: I6e668fca4d127d7dbfe447e2d9f2231e05278a7d
2014-11-17sal: clean up public headers with include-what-you-useMichael Stahl
Sadly cannot forward declare "struct {...} TimeValue;". rtl/(u)?string.hxx still include sal/log.hxx but removing osl/diagnose.h was painful enough for now... Change-Id: Id41e17f3870c4f24c53ce7b11f2c40a3d14d1f05
2014-11-14this is for detecting the type of a variable based on its nameCaolán McNamara
which means legal input is any character which a variable can start with Change-Id: I0c2d13a92ba374f8020e86e90e8e5f18ce8a9c90
2014-11-14coverity#1242865 Untrusted value as argumentCaolán McNamara
Change-Id: Ie7a7a2e7894a204dd55833416b7cbc5b01826e64
2014-11-14fdo#86023 - O[U]String needs a 'clear' methodBrij Mohan Lal Srivastava
Added clear() method to OString and OUString class, Updated appropriate call-sites. Change-Id: I0ba97fa6dc7af3e31b605953089a4e8e9c3e61ac Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-11-14vcl: move the Impl class of MapMode ...uhm... out of the public header?Michael Stahl
And remove the tools/fract.hxx include. grep -l -r fract.hxx workdir/Dep/*Object* |wc -l before: 4569 after: 1851 Shrinks some libraries, example from --enable-dbgutil Fedora gcc 4.8.3: libvcllo.so by 473k (0.35%) libswlo.so by ~1Mb (sadly that is just 0.2%) Change-Id: I09bd025d551a5d2c5528b938a68c6aa5f8f114a0
2014-11-12Fix common typos. No automatic tools. Handmade…Andrea Gelmini
Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959 Reviewed-on: https://gerrit.libreoffice.org/12164 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-05coverity#1242689 Untrusted loop boundCaolán McNamara
Change-Id: Ie226805ef8d430eb3f7b3abaa54ac3af31f72f7b
2014-11-05coverity#1242865 Untrusted loop boundCaolán McNamara
Change-Id: I9dc9cd98d0a02a2867d4c40c7afb7bf873513143
2014-11-05coverity#1242794 Untrusted loop boundCaolán McNamara
Change-Id: I902a5bf989a8f385994a2f927cce4975b18f06d2
2014-11-05markup with event type not checker typeCaolán McNamara
Change-Id: I14c0c5d90b67000cb4fe9e6be647854abfe784da
2014-11-05fdo#38835 strip out OUString globalsNoel Grandin
they are largely unnecessary these days, since our OUString infrastructure gained optimised handling for static char constants. Change-Id: I07f73484f82d0582252cb4324d4107c998432c37
2014-10-30document array_vs_singleton dismissalsCaolán McNamara
Change-Id: I8d7eb4c01197e885abca717c7814c61a7641ac9d
2014-10-24Need basrdll now in the disable-scripting case (iOS)Tor Lillqvist
Change-Id: I01efac10784b134a6016f017c42a3fa71a514a51
2014-10-24coverity#704558 Dereference after null checkCaolán McNamara
Change-Id: I6fe44d8926acd185bb6bc671fb7df8ae935998c1
2014-10-23fdo#84935: basic: avoid silly SolarMutex asserts on exit on MacMichael Stahl
Change-Id: If22b8ff962d2b68130176de3b7b9eccacfc850dc
2014-10-23basic: move SbxAppData to a BasicDLL memberMichael Stahl
... so it is deleted by ~SfxApplication. Change-Id: I161bd92eb9b5082d1fdeea603921d0372a4d97e6
2014-10-23basic: pimplify thatMichael Stahl
Change-Id: I0abe66ded0fd69a2720ad64e1a1426aafc7dfffb
2014-10-23Fraction: Revert "fdo#81356: convert Fraction to boost::rational<long> - wip"Jan Holesovsky
This reverts commit 47a2d7642d249d70b5da0c330a73f3a0032e4bba. Conflicts: cui/source/tabpages/transfrm.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx tools/source/generic/rational.cxx Change-Id: I4849916f5f277a4afef0e279b0135c76b36b9d15
2014-10-23Fraction: Revert "fdo#84854 it seems long is not enough on 32 bit"Jan Holesovsky
This reverts commit 582ef22d3e8e30ffd58f092d37ffda30bd07bd9e. Conflicts: svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdibrow.cxx sw/source/filter/ww1/w1filter.cxx Change-Id: I80abc7abdeddc267eaabc9f8ab49611bb3f8ae83
2014-10-23fdo#60689: replace SUPD variableMarcos Paulo de Souza
Change-Id: Iad63330f8762b595ba5ee94fc20bc2c64ac92f6b Reviewed-on: https://gerrit.libreoffice.org/11937 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2014-10-23fdo#84935: basic: DocBasicItem is a UNO service, lock SolarMutex in dtorMichael Stahl
Change-Id: Ia31d735ba54d18f406653debce04a07c077d09eb
2014-10-22Replace DISABLE_SCRIPTING with HAVE_FEATURE_SCRIPTINGTor Lillqvist
Feature test macros that govern conditional compilation should be defined in config_*.h include files, not on the compilation command line. Change-Id: I40575a4762fd2564f10927b6f38a112dd9f9a3d7
2014-10-16fdo#84854 it seems long is not enough on 32 bitDavid Tardon
Fraction used BigInt internally for computations, rational does nothing like that. Change-Id: I3e9b25074f979bc291208f7c6362c3c40eb77ff5
2014-10-15More -Werror,-Wunused-private-fieldStephan Bergmann
...detected with a modified trunk Clang with > Index: lib/Sema/SemaDeclCXX.cpp > =================================================================== > --- lib/Sema/SemaDeclCXX.cpp (revision 219190) > +++ lib/Sema/SemaDeclCXX.cpp (working copy) > @@ -1917,9 +1917,10 @@ > const Type *T = FD.getType()->getBaseElementTypeUnsafe(); > // FIXME: Destruction of ObjC lifetime types has side-effects. > if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl()) > - return !RD->isCompleteDefinition() || > - !RD->hasTrivialDefaultConstructor() || > - !RD->hasTrivialDestructor(); > + return !RD->hasAttr<WarnUnusedAttr>() && > + (!RD->isCompleteDefinition() || > + !RD->hasTrivialDefaultConstructor() || > + !RD->hasTrivialDestructor()); > return false; > } > > @@ -3517,9 +3518,11 @@ > bool addFieldInitializer(CXXCtorInitializer *Init) { > AllToInit.push_back(Init); > > +#if 0 > // Check whether this initializer makes the field "used". > if (Init->getInit()->HasSideEffects(S.Context)) > S.UnusedPrivateFields.remove(Init->getAnyMember()); > +#endif > > return false; > } to warn about members of SAL_WARN_UNUSED-annotated class types, and warn about initializations with side effects (cf. <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039602.html> "-Wunused-private-field distracted by side effects"). Change-Id: I3f3181c4eb8180ca28e1fa3dffc9dbe1002c6628
2014-10-12Typo: compatability->compatibilityJulien Nabet
Change-Id: If0b98a30452a9d1fcc340173deb6856755926471
2014-10-09fdo#81356: convert Fraction to boost::rational<long> - wipJuan Picca
* Added rational util functions used by Fraction class not available in the boost::rational class. * Replaced usage of Fraction by boost::rational<long> * Removed code that relies on: 1. fraction.IsValid() -- rational only allow valid values, ie denominator() != 0 2. rational.denominator() == 0 -- always false 3. rational.denominator() < 0 -- always false but implementation detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation * Simplified code that relies on: 1. rational.denominator() != 0 -- always true * BUGS EXIST because Fraction allows the creation of invalid values but boost::rational throws the exception boost::bad_rational Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9 Reviewed-on: https://gerrit.libreoffice.org/11551 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
2014-10-08basic: use SolarMutex to lock SfxLibraryContainerMichael Stahl
Originally this used both SolarMutex and an own mutex, then a deadlock was resolved in 2fe6a4a34b38c05e252c71f4d2f18e4a90e61b29 by not locking SolarMutex. Since the class will call event listeners without dropping the mutex e.g. in insertNoCheck(), using the SolarMutex appears better anyway. With this, installing a BASIC extension no longer triggers SolarMutex asserts in SfxBroadcaster. Change-Id: Ib9a2ee491ef53b1a53855af0fc22e863c5e7cb91
2014-10-08basic::ImplRepository: use SolarMutex instead of own mutexMichael Stahl
The locking strategy in the basic module is totally unclear to me, there does not appear to be a dedicated mutex for the core stuff callable via StarBASIC, just a bunch of SolarMutexGuards at random locations; let's try to use SolarMutex at the UNO entry points... Change-Id: Ia9c45fdcfb5ffd0a4acc77ef5d2fabfb8743ad38
2014-10-08back out even more wrong tools::Time changes, geez..Eike Rathke
Change-Id: I52eb3400769999d7f554c3bdb8746f65b7990388
2014-10-08back out more wrong and confusing tools::Time comment changesEike Rathke
Apparently fc04f76336fdf8c96e35382cdeb497e2f939705c used some sed script to change all ... Change-Id: Ie609bd02a2c5d70109fc6185cf4440480f29d8f5
2014-10-08spelling: instanciated -> instantiatedNoel Grandin
Change-Id: I99f3010e30f81786b938dc11736ea1597cd5530d
2014-10-06use comphelper::rng::uniform_*_distribution everywhereCaolán McNamara
and automatically seed from time on first use coverity#1242393 Don't call rand coverity#1242404 Don't call rand coverity#1242410 Don't call rand and additionally allow 0xFF as a value coverity#1242409 Don't call rand coverity#1242399 Don't call rand coverity#1242372 Don't call rand coverity#1242377 Don't call rand coverity#1242378 Don't call rand coverity#1242379 Don't call rand coverity#1242382 Don't call rand coverity#1242383 Don't call rand coverity#1242402 Don't call rand coverity#1242397 Don't call rand coverity#1242390 Don't call rand coverity#1242389 Don't call rand coverity#1242388 Don't call rand coverity#1242386 Don't call rand coverity#1242384 Don't call rand coverity#1242394 Don't call rand Change-Id: I241feab9cb370e091fd6ccaba2af941eb95bc7cf
2014-10-03coverity#1242481 Dereference null return valueCaolán McNamara
Change-Id: I21e6bdd643d898a3515a96e4c9c17c2d6f98b0e4
2014-10-03rename SvRef::AddRef to AddFirstRefNoel Grandin
to make it's intended purpose clearly distinguishable from AddNextRef Change-Id: I5da780b48b19fd873667b648031bc394113f953b Reviewed-on: https://gerrit.libreoffice.org/11763 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-10-02loplugin: cstylecastNoel Grandin
Change-Id: Ic7c9c978baf5602a508aff5976220a02ed03a680
2014-10-01loplugin: cstylecastNoel Grandin
Change-Id: Ie3d13eccdf444d569cbe40befb45eb86941160b6
2014-10-01avoid calling OUString::copy() with length being -1Luboš Luňák
Which asserts in dbgutil build. Change-Id: I0f8205ae98c5a57c430b7d8a574e4c0019855841
2014-10-01fdo#82577: Handle TimeNoel Grandin
Put the TOOLS Time class in the tools namespace. Avoids clash with the X11 Time typedef. Change-Id: Iac57d5aef35e81ace1ee0d5e6d76cb278f8ad866 Reviewed-on: https://gerrit.libreoffice.org/11684 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-09-26remove unnecessary casts in misc calls to SvStream.Write*Noel Grandin
left over from our conversion of the SvStream output operators to more specific methods Change-Id: Ib80032e8626f5476a89b958f590441994594f4e4
2014-09-26remove unnecessary casts in calls to SvStream.WriteUInt32Noel Grandin
left over from our conversion of the SvStream output operators to more specific methods Change-Id: I1d848f19f82783e6eabf2da37dbde78fe36ea1e0