Commit Graph

1134 Commits

Author SHA1 Message Date
b9ebabd675 tdf#97231: basic: do not use extra wrapping for string marshaling
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-22 01:07:46 +02:00
de9620dd45 tdf#97231: potential crash fixed
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-21 15:41:09 +02:00
649313625b New o3tl::temporary to simplify calls of std::modf
...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>
2018-05-17 21:03:12 +02:00
40c9a129e5 Resolves: tdf#117612 truncate DateAdd("m",...) to last day of month
... instead of resulting in error because of roll-over not being set.

Fallout from

    commit 6d424f07701bf26d8fb173563b567d5f097c33e2
    CommitDate: Tue May 2 23:12:34 2017 +0200

        Replace mouth-painted "inaccurate around leap year" rollover algorithm

that does stricter checking but DateAdd() needs a lax checking
with truncate to last day of month.

Change-Id: I9d6f95ad3ac38257d492019bd621070491e98e76
2018-05-16 11:38:53 +02:00
657668c378 Related: tdf#116579 tell SvNumberFormatter the proper NfEvalDateFormat
So far Basic relied on the side effect of date acceptance patterns
selected according to the passed format's locale, which changed
with the (temporarily reverted) commit
dfb9138b8b5a239b46f189a717999bcaff19aa79. Explicitly tell the
formatter the behavior to use.

Change-Id: I9819399df69bdfa36d79bc9db116dec37a85cbeb
Reviewed-on: https://gerrit.libreoffice.org/53787
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2018-05-04 00:28:59 +02:00
4cb78942f2 loplugin:expressionalwayszero (clang-cl)
Change-Id: If47b5bb3436ebdf799b74f7c0070f674ab52804e
2018-04-20 08:53:16 +02:00
d43fa87fbc weld SbiInputDialog
this is basically the same as SvRTLInputBox

Change-Id: Idbf0f58cf51ea706928e18b81ce80088015dccc4
Reviewed-on: https://gerrit.libreoffice.org/52763
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-04-12 14:04:53 +02:00
6672151fbb weld SvRTLInputBox
This (forgotten) dialog is the statbasic "InputBox" dialog

Change-Id: Ifb65fb382be7bd6b5a2ba904e0cb64ddce2485a8
Reviewed-on: https://gerrit.libreoffice.org/52749
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-04-12 10:52:01 +02:00
cc20344010 tdf#111313: Honor bWriteNoLenParam in !bCompatibility, too
e8deba22e887a972f60ff05551e93c334ac1e7b6 "INTEGRATION: CWS ab26" had added
the bCompatibility case with all the argument checking ("2006/05/04 08:33:46 ab
1.66.10.3: #111951# Changed Mid runtime behaviour only for
CompatibilityMode(true)"), and it was probably an oversight that, for
!bCompatibility, it left the bWriteNoLenParam case (triggered by Basic code like

  s = "abc"
  Mid(s,1) = "d"

) calling OUStringBuffer::remove with an illegal argument of len=-1.

Change that so that only setting ERRCODE_BASIC_BAD_ARGUMENT is controlled by
bCompatibility, while all the other checks (that are probably all necessary to
not call rtl string functions with illegal arguments) are done in both modes.

Also, the check

  nStartPos + 1 > nArgLen

should probably be

  nStartPos > nArgLen

instead, as nStartPos has already been decremented from the one-based Basic
index to the zero-baesd rtl string index.

Change-Id: I75deec0acf75b8677aa89f91897c06c1caa5614d
Reviewed-on: https://gerrit.libreoffice.org/52500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-04-06 14:56:20 +02:00
9fcef57a34 convert Redline warning dialog to .ui to get helpids
etc.

Change-Id: Ic5e6031fe99347f19002d5d8527b5632333fefb0
Reviewed-on: https://gerrit.libreoffice.org/50431
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-27 17:25:59 +01:00
0fad8d3081 convert remaining WarningBox to weld::MessageDialog
Change-Id: I7e3c156a6ad47ac232636ae274280c1cb7556d4a
2018-02-27 09:52:32 +00:00
d75144cf44 convert remaining InfoBox to weld::MessageDialog
Change-Id: I91d828e38d96264cf4a76f30940942556b8f78d8
Reviewed-on: https://gerrit.libreoffice.org/50205
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-25 20:03:26 +01:00
1daf4db963 Blind fix for 3ceb01afc3e5f47930e24fb0b21e6e85b86f660e
Change-Id: I01649065c93de368f900eb836a0467693f361f68
Reviewed-on: https://gerrit.libreoffice.org/50297
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-02-25 12:02:53 +01:00
3ceb01afc3 Use for range loops in basegfx and basic
Change-Id: I5b2086c245695aeb30630150b3c5ccf61fbd6a56
Reviewed-on: https://gerrit.libreoffice.org/50280
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-02-24 17:28:43 +01:00
bddd6c7781 Revert "loplugin:changetoolsgen in avmedia..basic" and reapply plugin
because I
(a) forgot to insert parentheses which changes the meaning of some expressions and
(b) I now use the AdjustFoo calls when changing unary operations, which reads much better

This reverts commit 1adb1a320a7e9832a41545bde13fd59d27ce7954.

Change-Id: I52924b35008c8e4b44c8a6b6657cc3a1ac513886
Reviewed-on: https://gerrit.libreoffice.org/49848
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-16 19:50:47 +01:00
1adb1a320a loplugin:changetoolsgen in avmedia..basic
Change-Id: I4e355ae27b9fad1cc6e8f8f408dbd9e93d7256d7
Reviewed-on: https://gerrit.libreoffice.org/49603
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-02-13 07:38:03 +01:00
7c7aa4e307 loplugin:pointerbool (clang-cl)
Change-Id: Idaf9e1858afb8f22bba1767470138ec820a8d7cb
2018-01-25 08:13:11 +01:00
9af8f190ed More loplugin:cstylecast on Windows
Automatic rewrite (of loplugin:cstylecast and loplugin:unnecessaryparen) after
cab0427cadddb3aaf1349c66f2fa13a4234ba4b2 "Enable loplugin:cstylecast for some
more cases" and a409d32e7f6fc09e041079d6dbc3c927497adfed "More
loplugin:cstylecast"

Change-Id: Ib3355159dd08333e1b7a8d091caf2069cdcc7862
Reviewed-on: https://gerrit.libreoffice.org/48317
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-23 07:54:51 +01:00
000fa4c495 loplugin:useuniqueptr in SbiStdObject
Change-Id: Ic66d817746de423549c87f58068e47f9942d04fd
2018-01-19 08:58:46 +02:00
5954878448 loplugin:useuniqueptr in SbiGlobals
Change-Id: I0ebec3193b4369039f90be4223ebdf6d048b8478
2018-01-19 08:58:46 +02:00
263d732569 loplugin:useuniqueptr in SbModule
Change-Id: I20525bd69c91ff35c9e569525a0d4556bc184982
2018-01-19 08:58:46 +02:00
3a40d3de89 More loplugin:cstylecast: basic
Change-Id: I0bb219632da384ab047a2b1fc3f2b041dacaf2cb
2018-01-15 09:07:14 +01:00
6070aaa47d More loplugin:cstylecast: basic
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I20b38196ee1b6a34384dc46d9de1b6e1b44947ae
2018-01-12 20:29:14 +01:00
ee4b074ce2 basic, solve link problems
When not using scripting, there were a number of
unresolved symbols. First aproach did not work, so this
commit is the more extensive.

Change-Id: Iaf78bde10d9a43862d58d1aa8f46b14aa075eddb
2018-01-08 13:18:36 +01:00
2a421b26c0 loplugin:passstuffbyref improved return in basic,framework
Change-Id: Ib19836febb59f4e2bb07dc874cfc6baabc653237
Reviewed-on: https://gerrit.libreoffice.org/47065
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-26 19:56:02 +01:00
00bc5a0973 wrap scoped enum around css::util::NumberFormat
Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa
Reviewed-on: https://gerrit.libreoffice.org/46339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
2017-12-19 22:08:26 +01:00
c947a25b3a loplugin:countusersofdefaultparams in basctl..basegfx
Change-Id: I515acfb9de1f6dff1de94a60055c5b600e5e5241
Reviewed-on: https://gerrit.libreoffice.org/45957
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-07 07:19:59 +01:00
ef6940a480 Save an unnecessary duplicate GetObject() call
Change-Id: Ib0efc84ad2cedc1a149fa57996bc0481bd64591b
2017-12-05 20:06:07 +01:00
36493607d8 Simplify the IsObject()/GetObject() logic here
Change-Id: I816b15b6795b4946b1bfed0d1f6d103a6a1aba4f
2017-12-05 18:30:22 +01:00
d1cd68fac3 Rather call GetObject() only if IsObject(), tdf#112571 follow-up
Which effectively is what GetObject() internally also does to
determine whether to set an error, so resetting an error here is
moot (or might even hide a nested error?).

Change-Id: I8736d16e386d1833126965538f96aaa1fd73dfd6
2017-12-05 18:17:06 +01:00
863e269cd3 Resolves: tdf#114232 reset error after unsuccessful GetObject() query
Probably broken already since

    commit 0b21b8b146fc4b982c7c9bbb866b9ff18a29332a
    Date:   Wed Oct 6 10:16:27 2010 +0100

        initial commit for vba blob ( not including container_control stuff )

Change-Id: Iecce564851a76921b491ff101365c70883ad7475
2017-12-05 17:27:57 +01:00
af8431d8db Find VBA-only functions when compiling first on module level
This likely never worked as there is no SbiInstance in that step,
but worked by chance when running a module's code that was
compiled with VBA support where the VBA-only function was added as
a symbol to be resolved later during runtime and then the
SbiInstance exists and the symbol was magically resolved.

Found when trying to correct vba_tests to actually fail if all
subtests fail that then started to fail in Atn.vb because of the
Round() function being VBA-only.

Change-Id: I7d9f6e2640a73388a2a58c3d180820c6ef85abe3
Reviewed-on: https://gerrit.libreoffice.org/45425
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
2017-11-29 11:08:58 +01:00
2f8174594d Aaand another one.. SvNumberFormatter instance
... just to parse with LANGUAGE_ENGLISH_US if system locale failed..

Change-Id: Id9b7cfb5b5f21c46789f30e8e8c72a7524491e95
Reviewed-on: https://gerrit.libreoffice.org/45238
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-11-24 21:32:01 +01:00
4b98e352e5 Make the SbiInstance SvNumberFormatter shared_ptr
In preparation to get rid of the per call locally created
SvNumberFormatter instances..

Change-Id: Ic7db3bbb655aa18e939f5722964655a20f2eadf2
Reviewed-on: https://gerrit.libreoffice.org/45227
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
2017-11-24 21:30:02 +01:00
db080dad6c tdf#114011 limit/truncate date, not only year
Change-Id: I479040f411fb8b5975c0aa1aa24f95c957cf80cf
2017-11-23 18:44:48 +01:00
2161d04688 drop duplicate method
Change-Id: Idadd0a64e41cd02f5167b275081c3576a6224b12
Reviewed-on: https://gerrit.libreoffice.org/45075
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-22 13:33:25 +01:00
5280b3eaa6 silence some coverity warnings
Change-Id: I5a530e37156b5cd36e8a07ac20851880a46f520d
Reviewed-on: https://gerrit.libreoffice.org/44875
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-18 21:59:23 +01:00
a8f31d5120 Fix typos
Change-Id: I8bdced3fa572074aedabdcfce841adf525ae8b81
Reviewed-on: https://gerrit.libreoffice.org/44710
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-15 07:52:19 +01:00
3dde9d988f loplugin:constparams in various(1)
Change-Id: Ic80ca59abc3e104c7adf0c1eff1d16addf48bc8b
Reviewed-on: https://gerrit.libreoffice.org/44261
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-04 07:50:01 +01:00
5d618d73ed loplugin:constantparam in basic,basctl
Change-Id: If918c42d4b82d78c07786cfa47c74d0dfb7493d6
Reviewed-on: https://gerrit.libreoffice.org/44131
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-01 07:14:13 +01:00
11d2f3d6e1 vcl: make MapMode constructor explicit
Insert constructor everywhere, except a couple places that apparently
want to compare GetMapUnit().

Change-Id: I1910deb60562e5e949203435e827057f70a3f988
2017-10-26 23:17:45 +02:00
daf7c3e732 basic: consistently use "" and <> in include directives
Change-Id: I147c0e9b9b1e09af593f54799e45e1348cd40716
Reviewed-on: https://gerrit.libreoffice.org/43298
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-10 07:43:46 +02:00
1944e3ddc0 Rename and move SAL_U/W to o3tl::toU/W
Previosly (since commit 9ac98e6e3488e434bf4864ecfb13a121784f640b)
it was expected to gradually remove SAL_U/W usage in Windows code
by replacing with reinterpret_cast or changing to some bettertypes.
But as it's useful to make use of fact that LibreOffice and Windows
use compatible representation of strings, this commit puts these
functions to a better-suited o3tl, and recommends that the functions
be consistently used throughout Windows-specific code to reflect the
compatibility and keep the casts safe.

Change-Id: I2f7c65606d0e2d0c01a00f08812bb4ab7659c5f6
Reviewed-on: https://gerrit.libreoffice.org/43150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-05 16:02:52 +02:00
532a4dcba6 Replace more reinterpret_cast with SAL_W/SAL_U
Change-Id: Ia632e4083222ad9e7f17c2ad0d0825f189c700cc
Reviewed-on: https://gerrit.libreoffice.org/43071
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-03 16:30:36 +02:00
c3609f107b Use SAL_W/SAL_U instead of reinterpret_cast btwn wchar_t* and sal_Unicode*
This is type-safe, and allows to catch cases where a source type
is changed for some reason, but reinterpret_cast masks that

Change-Id: Ib64b6fa2e22d94a6bba890f0ccc3e20325c6f0a1
Reviewed-on: https://gerrit.libreoffice.org/42961
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 19:08:28 +02:00
362a21d3a1 Use explicit function names for fooA/fooW WinAPI; prefer fooW
We should only use generic foo function name when it takes params
that are also dependent on UNICODE define, like
LoadCursor( nullptr, IDC_ARROW )
where IDC_ARROW is defined in MSVC headers synchronised with
LoadCursor definition.

We should always use Unicode API for any file paths operations,
because otherwise we will get "?" for any character in path that
is not in current non-unicode codepage, which will result in failed
file operations.

Change-Id: I3a7f453ca0f893002d8a9764318919709fd8b633
Reviewed-on: https://gerrit.libreoffice.org/42935
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-09-30 11:23:41 +02:00
6978f506a4 Bin some noise comments and ASCII graphics
Change-Id: Ib0e786b0e8401da3e3c93bf254727411774e8f43
2017-09-20 09:47:38 +03:00
84cbd6a543 clang-tidy modernize-use-emplace in b*
Change-Id: I51e0369ba2e1fe0b7c934531f71d3bda95ba09ec
Reviewed-on: https://gerrit.libreoffice.org/42109
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-08 20:17:31 +02:00
8e8c789742 oovbaapi: create XOval and XLine shape types
This is needed in order to make "TypeOf myLine Is Line" or similar
expressions return the expected "true" value.

The implementation of the basic interpreter of TypeOf uses XTypeProvider
to determine the type of an object by getting the last part of the type
name. E.g. "ooo:vba::msforms::XLine" is determined as a "Line". That's
why I created the XLine and XOval blank classes.

TypeOf doc:
https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/typeof-operator

Change-Id: Ia49cc92d672e30d0126f02d61a55a956ac1425f0
Reviewed-on: https://gerrit.libreoffice.org/42083
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
2017-09-08 09:29:36 +02:00
c497c4ca4d Replace list by vector in dllmgr-x86-x64 (basic)
Change-Id: I169590700474100e88f2e287f205ce7cbadedabe
Reviewed-on: https://gerrit.libreoffice.org/41797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-09-01 19:51:07 +02:00