Commit Graph

3777 Commits

Author SHA1 Message Date
Stephan Bergmann
b30ae238b4 No reason not to use RTLFUNC here
Change-Id: I9f01d84b4c518c178220af5cc310a3ba06bdceaa
2017-06-27 16:34:00 +02:00
Takeshi Abe
6ade3ef203 std::unordered_map can erase an element by given key, if any
so that it is unneeded to find its position in advance.

Change-Id: Iccf92f98b8683e4b2fb5252f5e05a357268b7033
Reviewed-on: https://gerrit.libreoffice.org/39156
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-06-24 19:41:04 +02:00
Noel Grandin
7b5fac67fd loplugin:unusedfields in accessibility..comphelper
Change-Id: Ifb68d65fc3e48dd80e3ff2b7a4124468fdda1695
Reviewed-on: https://gerrit.libreoffice.org/39137
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-23 09:01:24 +02:00
Noel Grandin
14c763e793 s/ERRCODE_SBX_OK/ERRCODE_NONE
adds no value

Change-Id: Iedf7a6a7be28fed4059b576312890be8cbb980d7
Reviewed-on: https://gerrit.libreoffice.org/39056
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-21 20:58:36 +02:00
Noel Grandin
528632660b convert ErrCode to strong typedef
would have preferred to re-use o3tl::strong_int, of which this
is a modified copy, but there are lots of convenience accessors
which are nice to define on the class.

Change-Id: I301b807aaf02fbced3bf75de1e1692cde6c0340a
Reviewed-on: https://gerrit.libreoffice.org/38497
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-21 08:42:30 +02:00
Noel Grandin
6ee9f2c188 loplugin:oncevar accessibility..basic
Change-Id: I8fb41b658ef0f6ad1774ea897eace3dc9bb12de6
Reviewed-on: https://gerrit.libreoffice.org/38969
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-20 07:50:06 +02:00
Jochen Nitschke
a5dba7dbec remove unused osl/mutex.hxx includes
Change-Id: I3b50e45fdb99e9cd8bfda07356ee3ddb4dd0f8bb
Reviewed-on: https://gerrit.libreoffice.org/38905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
2017-06-18 13:38:25 +02:00
Jochen Nitschke
d69795b9c9 use local statics in getTypes functions
... instead of double checked locking patterns.

Change-Id: I1b86ce723ff22dd357b3ed69a52757b085472424
Reviewed-on: https://gerrit.libreoffice.org/38906
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-17 13:28:18 +02:00
Noel Grandin
7aee0ea7c5 replace SbxError typedef with ErrCode
part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia56e5d6d8c4217d6f258e2113d20ce737977892f
Reviewed-on: https://gerrit.libreoffice.org/38813
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 09:48:11 +02:00
Noel Grandin
3059ede409 drop SbError typedef
in favour of ErrCode.
Part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia846bfc93c58c85c6a6cec79e9d19b9ecbd1c05f
Reviewed-on: https://gerrit.libreoffice.org/38783
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 08:25:22 +02:00
Noel Grandin
a6aa57ff59 use ERRCODE_NONE instead of 0
peeling off a small chunk of my ErrCode strong_int conversion

Change-Id: Idc89e8496083beed7608cba705cd981139eb7111
Reviewed-on: https://gerrit.libreoffice.org/38777
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-14 15:42:31 +02:00
Noel Grandin
e272761e8f remove MAYBEFUTURE dead code
Seems to date from:
   commit c631cf94e4
   Author: John LeMoyne Castle <jlc@mail2lee.com>
   Date:   Tue Dec 21 15:47:53 2010 +0000
   68bit currency enhancement

Change-Id: I81863991ec3717ea213dffb535283e6fc8abceb7
Reviewed-on: https://gerrit.libreoffice.org/38693
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-13 09:12:58 +02:00
Jochen Nitschke
febbad7263 cleanup unused css/frame/* includes
Change-Id: I173a29fd1ee889127369d2bc2fce8e010b89ca65
Reviewed-on: https://gerrit.libreoffice.org/38633
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-12 13:05:38 +02:00
Noel Grandin
1dd5e226bd clang-tidy readability-non-const-parameter
Change-Id: I7b2680898dbfc49185fb949349d81f4ac615a470
Reviewed-on: https://gerrit.libreoffice.org/38593
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-09 15:05:54 +02:00
Stephan Bergmann
b5594f06c4 Cater for UNO (signed) vs. BASIC (unsigned) byte mismatch
See <https://listarchives.libreoffice.org/global/users/msg51243.html>
"[libreoffice-users] type byte in Basic", where

> Sub Main
>   dim oOutputStream as variant
>   oOutputStream = createUnoService("com.sun.star.io.SequenceOutputStream")
>   dim nA as byte
>   nA = 195
>   oOutputStream.writeBytes(array(nA))
>   oOutputStream.flush
>   dim back(0) as byte
>   back = oOutputStream.getWrittenBytes
>   MsgBox(back(0))
> End Sub

failed with "Inadmissible value or data type. Overflow." instead of showing
"-61".

Change-Id: I0445476c67510d5f8669a6e711e92332c01ec06c
2017-06-08 14:48:25 +02:00
Mike Kaganski
ef117cad3a tdf#108039: check for nullptr in rtl_uString and OUString
rtl_[u]String_newConcat now checks allocation result to return
early and avoid SIGSEGV. Other functions are not modified, to
keep old behavior relying on allocation success and crashing
early on OOM to avoid added overhead in performance-critical
places.

OUString operator+= now checks rtl_uString_newConcat result and
throws std::bad_alloc on failure, to specifically address BASIC
problem. It keeps strong exception guarantee of leaving this'
state unaltered.

Concatenation in BASIC now checks for bad string allocation
(previously SIGSEGV was generated).

Unit test included.

Change-Id: I1513311d3d58eac43b2d2ec9a230e22dff0b4245
Reviewed-on: https://gerrit.libreoffice.org/37965
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2017-06-07 11:48:57 +02:00
Noel Grandin
de8caac6be replace SVSTREAM_OK with ERRCODE_NONE
since the first is #define'd to the second, and offers no extra value

Change-Id: I2c67e09ea3aa5361b8e7dfe7a20858c6ae054450
Reviewed-on: https://gerrit.libreoffice.org/38406
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-06 08:15:57 +02:00
Stephan Bergmann
3fdfbe68ba Improved loplugin:cstylecast to reference types: basic
Change-Id: Ib2159aef39d416905899fe91280d2234835e23e9
2017-06-05 21:18:14 +02:00
Noel Grandin
17a2c9e8e2 clang-tidy performance-unnecessary-value-param
Change-Id: I6ed8c54c7c45931d91709cc818f2483c70197192
Reviewed-on: https://gerrit.libreoffice.org/38400
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-05 09:22:51 +02:00
Noel Grandin
2ccde70d60 teach redundantcast plugin about functional casts
Change-Id: Iac8ccd17d9e46ebb2cb55db7adb06c469bbd4ea0
Reviewed-on: https://gerrit.libreoffice.org/37910
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-30 08:50:31 +02:00
Noel Grandin
ef513fd4b0 remove unnecessary use of OString::getStr
Change-Id: I0490efedf459190521f4339854b3394d57765fdb
Reviewed-on: https://gerrit.libreoffice.org/38058
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-28 19:44:08 +02:00
Grzegorz Araminowicz
f45463d8e2 tdf#93727 Support date literals in basic
* detect #...# in SbiScanner
* add vb test
* made date locale-independent

Change-Id: Ic269df2df8d3a7c5af7858c3655bb40a0b6033f0
Reviewed-on: https://gerrit.libreoffice.org/36002
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-05-24 18:55:45 +02:00
Takeshi Abe
7948e84091 basic: Stop detecting the number of tokens at runtime
which removes static variables and improves SbiTokenizer's
thread-safety.

Change-Id: Ic3eb52adfa85691af65f214c1b90c43c03f9a3dd
Reviewed-on: https://gerrit.libreoffice.org/37867
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-24 04:15:32 +02:00
Takeshi Abe
514fd7073c basic: Kill unnecessary ifdef stuff
Change-Id: Id890eb2b7ff2f87005e114dd0fcea0fe3eb81eea
Reviewed-on: https://gerrit.libreoffice.org/37866
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-22 05:01:57 +02:00
Jochen Nitschke
cae3e20571 cleanup unused css/resource/ includes
Change-Id: I1e2c795cef64799d5e28e5fafec6cd72f621abba
Reviewed-on: https://gerrit.libreoffice.org/37853
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-20 18:00:42 +02:00
Jochen Nitschke
a0b93fe081 cleanup unused css/script/ includes
but keep exception includes in headers for now

Change-Id: I826828675a2d14b906e57068cbced2e790e12bce
Reviewed-on: https://gerrit.libreoffice.org/37846
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-20 10:23:38 +02:00
Stephan Bergmann
f0fddb1d2d loplugin:stringcopy: basic
Change-Id: I39d8ae76be2794d5e7b5a9979d7211823c995c2c
2017-05-19 17:19:14 +02:00
Caolán McNamara
2155e04d63 make string translation loading more uniform
change various ResId classes that use conversion operator to OUString to
functions that return a OUString

drop various defines

drop unnecessary toString calls

Change-Id: Ibeccdf2b91a46a2ed5b4b74e6024e301a023bc92
Reviewed-on: https://gerrit.libreoffice.org/37817
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-05-19 15:40:40 +02:00
Noel Grandin
2e51afc77c loplugin:comparisonwithconstant in basic
Change-Id: Ie34a17d2fb465ffbe675ba4e99917d23959f1fb5
Reviewed-on: https://gerrit.libreoffice.org/37809
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-19 12:53:34 +02:00
Noel Grandin
6df22f0ec5 loplugin:checkunusedparams various
Change-Id: I5d1cc807134230d86e0226a12fada204004312d3
Reviewed-on: https://gerrit.libreoffice.org/37675
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-16 14:20:27 +02:00
Johnny_M
2c3f58eff2 Translate German comments and debug strings (leftovers in dirs a... to c...)
Translates all (leftovers) found using a custom regex, in directories not
shown by /bin/find-german-comments and beginning with "a" to "c".

Change-Id: I3b0152ee78ad80a29d714cbd98bf888f31be4763
Reviewed-on: https://gerrit.libreoffice.org/37573
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-05-15 15:27:52 +02:00
Noel Grandin
4582acb3ee remove some unnecessary locking
Change-Id: I7da9e82930d3fe8f927c495aeca270b8bb5cf65c
Reviewed-on: https://gerrit.libreoffice.org/37602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-15 08:40:46 +02:00
Takeshi Abe
f99c95c80d basic: Fix VBA constant vbNewLine with unit test
... making its value CRLF on Windows and LF on others.

A winding road of regressions passed through it;
first b680e35254,
then 7beeced463.

Change-Id: I9e4da4a17436949b4fea35481b8355b4321cb268
Reviewed-on: https://gerrit.libreoffice.org/37500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-15 04:57:59 +02:00
Noel Grandin
dd6d7992d6 loplugin:constantparam
Change-Id: I67d74072c776c32a1f91df94c621efe180baf5dc
Reviewed-on: https://gerrit.libreoffice.org/37481
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-12 12:30:53 +02:00
Noel Grandin
389da66dfc remove unused uno::Reference vars
found by temporarily marking Reference as SAL_WARN_UNUSED.

Change-Id: I18809b62654467f890016adcc92576980ced393b
Reviewed-on: https://gerrit.libreoffice.org/37511
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-12 09:56:01 +02:00
Takeshi Abe
9425245a87 basic: Remove strange ifdef-guard for SHARED
Was there any platform predefining it?

Change-Id: I4c155c00272b426c0d2b1b1ec0184cc223f9e38c
Reviewed-on: https://gerrit.libreoffice.org/37461
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-12 03:57:08 +02:00
Takeshi Abe
e93cf20603 basic: Compare strings in a case-insensitive manner
without creating temporary strings.

Change-Id: I8d0e8286089cb78fa9d8612bff6c51f6901637f1
Reviewed-on: https://gerrit.libreoffice.org/37249
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-10 05:54:25 +02:00
Takeshi Abe
e5a4858e1a basic: Compare with keywords without creating temporary strings
Change-Id: Ie284bbe4759a31c48cde415a4e673efd4c789741
Reviewed-on: https://gerrit.libreoffice.org/37252
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-10 05:49:19 +02:00
Jochen Nitschke
959496794c cleanup osl/diagnose.h includes
with command
> git grep -l osl/diagnose.h *.cxx |
  xargs grep -L -w 'OSL_\w*' |
  xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d'

headers need more work

Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab
Reviewed-on: https://gerrit.libreoffice.org/37350
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-09 15:41:46 +02:00
Noel Grandin
12191a4f30 make loplugin constantparam smarter about string params
Change-Id: Id3df69b38fd35f46735246a6d307a89aa10d4294
Reviewed-on: https://gerrit.libreoffice.org/37426
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-09 13:52:30 +02:00
Noel Grandin
719a2adfbd remove unnecessary empty OUString fields and vars
Change-Id: I940120087a0bc6b1b0abc30a3e7727ce22b7d9a7
Reviewed-on: https://gerrit.libreoffice.org/37394
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-09 08:28:56 +02:00
Noel Grandin
4763091bbe loplugin:constantparam
Change-Id: Ia9500b25602c14aadf49fe373682ae9d87a0a1a2
Reviewed-on: https://gerrit.libreoffice.org/37390
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-09 08:28:04 +02:00
Chris Sherlock
97eb00c75e revert OSL_ASSERT changes
Change-Id: I365d140446bd2a62cf8256acbfdd53fe72987380
2017-05-07 17:03:35 +10:00
Chris Sherlock
6b3b0b85f9 tdf#43157: convert basic module away from OSL_ASSERT to assert
Change-Id: Idfd05d410ad3d76c3699492d98e1284a21f5f7d6
2017-05-07 09:29:23 +10:00
Andrea Gelmini
a940826162 Fix typos
To complete commit 0ef94e2b55
and f12096272e

Change-Id: Ie86bbfbd58dd728a013bef221e4d5c8fbcaf8e03
Reviewed-on: https://gerrit.libreoffice.org/37199
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-05-05 23:35:06 +02:00
Eike Rathke
cc0ea8bb25 More likely month pos first
Change-Id: I0033c176071642f8df245307af79b8505644a004
2017-05-03 16:37:50 +02:00
Eike Rathke
e0eb3f5edd CDateFromIso: accept YYMMDD two digit year for compatibility
Some may even rely on that..

Change-Id: Icdaf9b2917aa0b1ca5e76c5220022c65fc654d86
2017-05-03 16:13:21 +02:00
Eike Rathke
6d424f0770 Replace mouth-painted "inaccurate around leap year" rollover algorithm
... with proper tools::Date methods Normalize() and AddMonths().

Also prepare functionality to easily switch on rollover for StarBASIC as well,
i.e. when called by DateSerial() runtime function.

For StarBASIC, invalid date for day > daysinmonthofyear is now (or better since
a previous commit 94bb96ada421b423e9ed30526fe5a6aac95f00b9 from today) properly
detected, not just dumb 1<=day<=31.

Change-Id: Ibb44f7247726f1e1168f0e66c5ae18e073d19f08
2017-05-02 23:12:34 +02:00
Eike Rathke
b5483b46f6 SbiRuntime::isVBAEnabled() needs to be guarded with #if HAVE_FEATURE_SCRIPTING
Change-Id: I7fab0c946c13a9779fad05f88be6ae6a9da93775
2017-05-02 16:06:51 +02:00
Eike Rathke
1b13548f33 BASIC: handle the full tools::Date range from -32768-01-01 to 32767-12-31
* Input of two-digit years only possible through CDateFromIso() though to
  maintain compatibility with previous behavior and also VBA mode.
* VBA mode restricted to years 1..9999

Change-Id: Ia9574c3bf136619b4831b349d263c96b162d1ed4
2017-05-02 15:56:20 +02:00