Commit Graph

107 Commits

Author SHA1 Message Date
Stephan Bergmann
49c88d8b23 -fsanitize=nullability
Change-Id: I27336c512ed0b46b32344a05611e6ba17e45adef
Reviewed-on: https://gerrit.libreoffice.org/73023
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-05-27 15:24:46 +02:00
Noel Grandin
587ac01f97 loplugin:indentation in basctl..bridges
Change-Id: Ie4e27466c4258c6f774a3ebb82ec3a88c28fd753
Reviewed-on: https://gerrit.libreoffice.org/67525
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-08 10:01:05 +01:00
Noel Grandin
44688e498c clang-tidy performance-unnecessary-copy-initialization in
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-23 08:39:10 +02:00
Stephan Bergmann
206b5b2661 New loplugin:external
...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-17 09:05:38 +02:00
Gabor Kelemen
7af90cc93b Add missing sal/log.hxx headers
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 6ff2d84ade
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-09 10:49:06 +02:00
Noel Grandin
1cb646dc5f loplugin:useuniqueptr in SbiImage
Change-Id: I24ee5de3628d6436dc045cb543d35b16074ef189
Reviewed-on: https://gerrit.libreoffice.org/53700
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-02 08:25:37 +02:00
Noel Grandin
fcd589d4f3 loplugin:useuniqueptr pStringOff in SbiImage
Change-Id: I05de3e910bf857e095c99cade6fec22ccb2dd99d
Reviewed-on: https://gerrit.libreoffice.org/53606
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-29 18:22:23 +02:00
Stephan Bergmann
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
Caolán McNamara
df2e78f1a8 replace check of eof and GetError with good
Change-Id: I7d9f04262ab5420e9a14813fa1274bb9d01e3291
Reviewed-on: https://gerrit.libreoffice.org/45076
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-22 13:33:46 +01:00
Caolán McNamara
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
Andrea Gelmini
d71bcc4dc5 Fix typos
Change-Id: Ia544298334364ece3b3963a4adc00c5e01189b91
Reviewed-on: https://gerrit.libreoffice.org/44654
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-13 08:43:17 +01:00
Mike Kaganski
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
Tor Lillqvist
6978f506a4 Bin some noise comments and ASCII graphics
Change-Id: Ib0e786b0e8401da3e3c93bf254727411774e8f43
2017-09-20 09:47:38 +03:00
Noel Grandin
6d829ae4f2 loplugin:constparams in basic
Change-Id: Idf55f63f2d56be4997a8cdc6afc5690eacac9a60
Reviewed-on: https://gerrit.libreoffice.org/40214
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-07-20 12:01:08 +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
f06e696723 loplugin:salunicodeliteral: basic
Change-Id: I479666b439f1d6324f07253d65181983b7c2c3ea
2017-04-28 18:27:01 +02:00
Noel Grandin
4978328534 convert method names in tools::SvRef to be more like our other..
reference classes, uno::Reference and rtl::Reference.

Specifically rename Is()->is() and Clear()->clear().

Change-Id: Icb7e05e2d09cb9977121508b837ba0961dabb4ae
Reviewed-on: https://gerrit.libreoffice.org/33576
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-02 08:02:54 +00:00
Jacek Fraczek
f004aa9951 tdf#89307: Removed SvRef::operator T*()
Conditional statements are using SvRef::Is() method.
Changed static_cast<T*>(svRef<T>) occurances to svRef.get().
Added operator == and != to SvRef.

SbxObject::Execute is using SbxVariableRef internally.
SbxObject::FindQualified is using SbxVariableRef internally.

Change-Id: I45b553e35d8fca9bf71163e6eefc60802a066395
Reviewed-on: https://gerrit.libreoffice.org/29621
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-10 08:48:30 +00:00
Asela Dasanayaka
057ae1cfca tdf#96505 get rid of "long" integer literals 'L'
Remove L from integer literals in module basic all 0L, 1L, 2L and 3L

Change-Id: Ia46ce3d206020e16fc17e95731244a557941528c
Reviewed-on: https://gerrit.libreoffice.org/27816
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-08-24 12:19:57 +00:00
Michael Stahl
62d270116b tools: rename SvStream::Read/Write to ReadBytes/WriteBytes
Change-Id: Ib788a30d413436aa03f813aa2fddcbc4d6cd2f9a
Reviewed-on: https://gerrit.libreoffice.org/25972
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-06-06 18:09:11 +00:00
Noel Grandin
f107d45381 Convert SbxClassType to scoped enum
Change-Id: I48afcdd9924d22b52a8db21aa253061e4d38c85b
Reviewed-on: https://gerrit.libreoffice.org/25259
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-23 11:49:32 +00:00
baltasarq
2d162b1c70 tdf#84938 Eliminate B_xxx defines in filefmt.hxx for FileOffset scoped enum.
Second step: Make SbiOpenRecord() accept a FileOffset as second parameter

This is a [partial] patch The objective is to substitute all apparitions of
#defined constants for enum class.
The victim here is the series of constants B_xxx that were located in
filefmt.hxx and were changed for a FileOffset enum class.

Obviously some other files where the type is used must be changed too.

Change-Id: I7406bdc8e780ee89802ab6823f9c91c4c9b765c0
Reviewed-on: https://gerrit.libreoffice.org/22697
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-26 07:18:25 +00:00
Johannes Hauf
bccd83ea54 Some cleanup for sal_uIntPtr usage
Change-Id: Ia9779e6477d8848588f3543d09ea6b4477f594a2
Reviewed-on: https://gerrit.libreoffice.org/21022
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-01-07 14:13:49 +00:00
Stephan Bergmann
08e49fa337 loplugin:nullptr (automatic rewrite)
Change-Id: I1ec9a671fe3ac838feb36297915e3cdf8749d944
2015-11-10 10:31:17 +01:00
Stephan Bergmann
a80bab7058 loplugin:stringconstant: elide explicit ctor usage (automatic rewrite)
Change-Id: I9979100550a86ac3f42d74a5403fb3ffd9d5006b
2015-11-06 09:34:39 +01:00
Caolán McNamara
79f060d451 coverity#1242865 Untrusted loop bound
Change-Id: I9332fa9b805e702fb56067efc308aff09310f603
2015-09-01 09:40:21 +01:00
Laurent Godard
8a7b7b7b72 New identifier for save/open macro with user defined types
no version bump but B_USERTYPE defined

fix test from commit de26ef85 that should be nMaxRecords

tested full round trip on password protected document (ie. use binary storage)
master --(0)--> master --(1)--> libreoffice 4.4 --(2)--> master --(3)--> master

(0) in master, User type supported, big module supported
(1) in libreoffice 4.4, user type not supported, big module supported, no loss of code
(2) in master, user type not supported, big module not found, no loss of code
    it is OK as libreoffice 4.4 saves to LegacyVersion
(3) in master, User type supported, big module supported (all is restored)
    it is OK as module was saved with CURRENT_VERSION (see sbxmod.cxx)

Change-Id: I237cf7de70adf1a755be1bc30987b21c43b6ab35
Reviewed-on: https://gerrit.libreoffice.org/17871
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-31 10:14:12 +00:00
Caolán McNamara
de26ef857b coverity#1242865 Untrusted loop bound
Change-Id: I9c6f821f7bd1e9bd3eb8f47e269e62a792523f1a
2015-08-23 16:57:37 +01:00
Laurent Godard
6e40334663 null pointer guard if no user defined types declared at the module level
Change-Id: I368a168c636e4029e9cd9bbe4a4df5d9b846c923
Reviewed-on: https://gerrit.libreoffice.org/17834
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-18 12:16:29 +00:00
Laurent Godard
ba5fd0cc77 correct wrong comments
Change-Id: I6682248873bcd6302b1d8d041bbc2e19a8e0ba7b
Reviewed-on: https://gerrit.libreoffice.org/17831
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-18 11:40:26 +00:00
Laurent Godard
0405975042 tdf#75973 : User Defined Types in password encrypted macros
save/load basic script so that when executing password protected
the user defined types can be rebuilt

supports array and nested types

a unit test in sc macros-test.cxx

Change-Id: Ie127ea7ad9aea3353741048c00f1b3910c5517a4
Reviewed-on: https://gerrit.libreoffice.org/17815
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-18 09:50:53 +00:00
Takeshi Abe
0980095619 Replace boost::scoped_array<T> with std::unique_ptr<T[]>
This may reduce some degree of dependency on boost.
Done by running a script like:

git grep -l '#include  *.boost/scoped_array.hpp.' \
 | xargs sed -i -e 's@#include  *.boost/scoped_array.hpp.@#include <memory>@'
git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \
 | xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/'

... and then killing duplicate or unnecessary includes,
while changing manually
m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx,
extensions/source/ole/unoconversionutilities.hxx, and
extensions/source/ole/oleobjw.cxx.

Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd
Reviewed-on: https://gerrit.libreoffice.org/16289
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-06-17 15:50:45 +00:00
Caolán McNamara
556373c41f V668 no sense in testing the result of new against null
Change-Id: I4a33bd92fc8448638a4bfe1eab7e5041a4c5cc39
2015-03-11 09:58:36 +00:00
Noel Grandin
e9beb26470 convert SBI_ constants to enum class
Change-Id: I65e706f4e1adfe242808293d9514c9db8d22cc12
2015-03-02 08:59:18 +02:00
Stephan Bergmann
4130c64355 Some more loplugin:cstylecast: basic
Change-Id: Ib22bc7408d333a7080fa44c9c3ac9535ccf00752
2015-01-20 09:06:45 +01:00
Noel Grandin
2f69f6efa0 remove unnecessary parentheses
left over from "SVStream operator>> to Write method" conversion

Change-Id: I619eb743d7890d5c70d0a94e51ce263567fa6f3b
2015-01-16 08:08:44 +02:00
Caolán McNamara
41029bcdd0 coverity#1242865 Untrusted value as argument
Change-Id: Ie7a7a2e7894a204dd55833416b7cbc5b01826e64
2014-11-14 12:02:48 +00:00
Caolán McNamara
1409c0bd88 coverity#1242865 Untrusted loop bound
Change-Id: I9dc9cd98d0a02a2867d4c40c7afb7bf873513143
2014-11-05 21:03:24 +00:00
Noel Grandin
059f5a95b2 loplugin: cstylecast
Change-Id: Ic7c9c978baf5602a508aff5976220a02ed03a680
2014-10-02 07:37:19 +02:00
Noel Grandin
5cefde06ea remove unnecessary casts in calls to SvStream.WriteUInt32
left over from our conversion of the SvStream output operators
to more specific methods

Change-Id: I1d848f19f82783e6eabf2da37dbde78fe36ea1e0
2014-09-26 15:27:17 +02:00
Noel Grandin
04fd62096f remove unnecessary casts in calls to SvStream.WriteInt32
left over from our conversion of the SvStream output operators
to more specific methods

Change-Id: I0c0172519479be0535a447e41a592fbf782751bd
2014-09-26 15:27:17 +02:00
Noel Grandin
dedfa972bc remove unnecessary casts in calls to SvStream.WriteInt16
left over from our conversion of the SvStream output operators
to more specific methods

Change-Id: Ie44bec6b988f3e46fe78d14b740818c9141f5df0
2014-09-26 15:26:48 +02:00
Takeshi Abe
d97b5e420f Avoid possible memory leaks in case of exceptions
Change-Id: Icecc2cce52d7f27c030270639e6b85877e3aa620
2014-07-16 18:01:39 +09:00
Noel Grandin
39c7532933 basic: prefer passing OUString and OString by reference
Change-Id: I8121204cdb37d4e1d8967397f3e45bdab6aaddad
2014-03-13 08:39:26 +02:00
Norbert Thiebaud
295bc8703f basic: remove use of sal_uIntptr in favor of more appropriate type
Change-Id: Ie878f43c7245838519fe7477b039827b079dde63
Reviewed-on: https://gerrit.libreoffice.org/8214
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2014-02-25 00:26:43 +00:00
Noel Grandin
15535e32dd convert SvStream::operator>> methods to ReadXXX methods
First, I updated the clang rewriter to do the conversion.
Then I lightly hand-tweaked the output for the few places where
the rewriter messed up, mostly when dealing with calls on "this".

Change-Id: I40a6a977959cd97415c678eafc8507de8aa3b1a9
Reviewed-on: https://gerrit.libreoffice.org/7879
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2014-02-12 15:31:40 +00:00
Noel Grandin
b69864f3f8 re-write SvStream operator<< to non-overloaded methods
This is the actual re-write.

Use a clang rewriter to rewrite SvStream::operator<< to methods
like WriteuInt32.
Note that the rewriter is not perfect, and I hand-tweaked the output.
In particular, I had to adjust places doing things like
  (*this) << 1;

Change-Id: I5923eda3f4ebaa8b452b6ef109e726e116235a2a
Reviewed-on: https://gerrit.libreoffice.org/7342
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2014-01-10 13:26:24 +00:00
Tor Lillqvist
a7724966ab Bin comments that claim to say why some header is included
They are practically always useless, often misleading or obsolete.

Change-Id: I2d32182a31349c9fb3b982498fd22d93e84c0c0c
2013-10-22 16:56:28 +03:00
Caolán McNamara
12b3dc2390 CID#707636 uninitialized members
Change-Id: I7eba8ac0f676a2a16dc12ed423356539aec7148b
2013-10-07 09:16:24 +01:00
Norbert Thiebaud
6a08067902 OUString convertion for unotools
Change-Id: Ifae7f344e3827875e32afa3cda23c771f5735707
Reviewed-on: https://gerrit.libreoffice.org/4659
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
2013-07-02 07:31:30 +00:00