Commit Graph

8193 Commits

Author SHA1 Message Date
Stephan Bergmann
5da0f455a6 Simplify SQLError::ParamValue to just o3tl::optional<OUString>
Change-Id: Ib4878218fd758c6462de1841fb98b3ae8839d1ed
Reviewed-on: https://gerrit.libreoffice.org/84217
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-02 17:48:06 +01:00
Stephan Bergmann
7e403195e5 Introduce o3tl::optional as an alias for std::optional
...with a boost::optional fallback for Xcode < 10 (as std::optional is only
available starting with Xcode 10 according to
<https://en.cppreference.com/w/cpp/compiler_support>, and our baseline for iOS
and macOS is still Xcode 9.3 according to README.md).  And mechanically rewrite
all code to use o3tl::optional instead of boost::optional.

One immediate benefit is that disabling -Wmaybe-uninitialized for GCC as per
fed7c3deb3 "Slience bogus
-Werror=maybe-uninitialized" should no longer be necessary (and whose check
happened to no longer trigger for GCC 10 trunk, even though that compiler would
still emit bogus -Wmaybe-uninitialized for uses of boost::optional under
--enable-optimized, which made me ponder whether this switch from
boost::optional to std::optional would be a useful thing to do; I keep that
configure.ac check for now, though, and will only remove it in a follow up
commit).

Another longer-term benefit is that the code is now already in good shape for an
eventual switch to std::optional (a switch we would have done anyway once we no
longer need to support Xcode < 10).

Only desktop/qa/desktop_lib/test_desktop_lib.cxx heavily uses
boost::property_tree::ptree::get_child_optional returning boost::optional, so
let it keep using boost::optional for now.

After a number of preceding commits have paved the way for this change, this
commit is completely mechanical, done with

> git ls-files -z | grep -vz -e '^bin/find-unneeded-includes$' -e '^configure.ac$' -e '^desktop/qa/desktop_lib/test_desktop_lib.cxx$' -e '^dictionaries$' -e '^external/' -e '^helpcontent2$' -e '^include/IwyuFilter_include.yaml$' -e '^sc/IwyuFilter_sc.yaml$' -e '^solenv/gdb/boost/optional.py$' -e '^solenv/vs/LibreOffice.natvis$' -e '^translations$' -e '\.svg$' | xargs -0 sed -i -E -e 's|\<boost(/optional)?/optional\.hpp\>|o3tl/optional.hxx|g' -e 's/\<boost(\s*)::(\s*)(make_)?optional\>/o3tl\1::\2\3optional/g' -e 's/\<boost(\s*)::(\s*)none\>/o3tl\1::\2nullopt/g'

(before committing include/o3tl/optional.hxx, and relying on some GNU features).
It excludes some files where mention of boost::optional et al should apparently
not be changed (and the sub-repo directory stubs).  It turned out that all uses
of boost::none across the code base were in combination with boost::optional, so
had all to be rewritten as o3tl::nullopt.

Change-Id: Ibfd9f4b3d5a8aee6e6eed310b988c4e5ffd8b11b
Reviewed-on: https://gerrit.libreoffice.org/84128
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-01 14:57:16 +01:00
Julien Nabet
a3822a4410 Related tdf#128974: Really deal with "default" and "default-release" profiles
See https://support.mozilla.org/gl/questions/1264072 for some background info.

Change-Id: I4939a0c9a8ad09753de4a152f464c647ec637f31
Reviewed-on: https://gerrit.libreoffice.org/84077
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-29 19:25:39 +01:00
Julien Nabet
4895e01dee In the same way as 97ad402d58
OPreparedStatement::setDate works but let's use good habits.

Change-Id: Ic410910ea138cc23d7f33bccd96812efd041732c
Reviewed-on: https://gerrit.libreoffice.org/83842
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-27 08:42:49 +01:00
Julien Nabet
d8feeecfec Fix for 2 commits related to cppcheck:
1) https://cgit.freedesktop.org/libreoffice/core/commit/?id=4e1ae2a9a0d2d9185b49677fa4ea2a2b1fe8bab2
I had let "size" and "fields" initialized twice instead of initializing only

2) https://cgit.freedesktop.org/libreoffice/core/commit/?id=e6ab01ce532d1db01579b70bd476b2f643522bf9
put back original order for NestedKeyImpl and adjust initialization accordingly

Change-Id: I6ca4e6520558011c359f8ea089b6d431ad79edfe
Reviewed-on: https://gerrit.libreoffice.org/83810
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-26 23:31:56 +01:00
Julien Nabet
97ad402d58 tdf#128698: MySQL/MariaDB direct Connection: time-values not written to table
Initialize MYSQL_TIME my_time structure before using it
Same idea as part of f4393330b2
but by using modern initialization instead of memset

Change-Id: Ife9741604e7bf8f0fbe4671ddb16a56204f4fa43
Reviewed-on: https://gerrit.libreoffice.org/83811
Tested-by: Jenkins
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
2019-11-26 22:20:45 +01:00
Julien Nabet
a2b8286a5c Fix e6ab01ce53
+ fix:
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/connectivity/source/drivers/mork/MStatement.cxx:64:6: error: no need to explicitly init an instance of 'std::unique_ptr<connectivity::OSQLParseNode>' with nullptr, just use default constructor [loplugin:simplifyconstruct]
    ,m_pParseTree(nullptr)
     ^~~~~~~~~~~~~~~~~~~~~
from another patch to calm down clang Jenkins

Change-Id: Ia8304b7baedbce760a6e01ea154c5ff3cd19cbd4
Reviewed-on: https://gerrit.libreoffice.org/83595
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-24 11:07:34 +01:00
Julien Nabet
a81489978c cppcheck: fix 2 funcArgOrderDifferent
1) sd/source/filter/ppt/pptin.cxx
Function 'ProcessObj' argument order different:
declaration 'rSt, rData, rClientData, rTextRect, pObj'
definition 'rSt, rObjData, rData, rTextRect, pRet'

2) connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.cxx
Function 'OPreparedResultSet' argument order different:
declaration 'rConn, pStmt, pMyStmt'
definition 'rConn, pPrepared, pStmt'

Change-Id: I83f8427ee15c3025676c39f262c2e9881cdd33ae
Reviewed-on: https://gerrit.libreoffice.org/83593
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-24 00:55:44 +01:00
Julien Nabet
4e1ae2a9a0 cppcheck: performing init in init list (comphelper/connectivity/cppu/cui)
Change-Id: I786c2c10e8b37b48adf6d619c0fa6a905de1bf7f
Reviewed-on: https://gerrit.libreoffice.org/83584
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-23 23:51:35 +01:00
Stephan Bergmann
f853ec317f Extend loplugin:external to warn about classes
...following up on 314f15bff0 "Extend
loplugin:external to warn about enums".

Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:

  filter/source/svg/svgexport.cxx
  sc/source/filter/excel/xelink.cxx
  sc/source/filter/excel/xilink.cxx
  svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx

All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage.  (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)

For friend declarations using elaborate type specifiers, like

  class C1 {};
  class C2 { friend class C1; };

* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")

* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".

Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace.  But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".

Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.

And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.

And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is.  GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>)  The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.

Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-22 12:57:32 +01:00
Miklos Vajna
3ea4bda77b connectivity: avoid redundant access specifier
Change-Id: Id30b699dfdf561a42012e620db7cafabeab3ebc0
Reviewed-on: https://gerrit.libreoffice.org/83238
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-20 08:35:57 +01:00
Noel Grandin
158fbb78ca make some classes module-private
Change-Id: I95845d7217fc5e77e3f8e205030e9cd761ad0cc5
Reviewed-on: https://gerrit.libreoffice.org/82116
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-15 08:13:06 +01:00
Stephan Bergmann
1205a4b774 New loplugin:consttobool
...to: "Find implicit conversions from non-'bool' constants (e.g., 'sal_False')
to 'bool'".

Due to how FALSE is defined as just

  #define FALSE (0)

(i.e., a literal of type 'int') but TRUE is defined as

  #define TRUE (!FALSE)

(i.e., an implicit conversion from 'int' to 'bool') in GLib (see the comment in
ConstToBool::VisitImplicitCastExpr), we get more warnings about uses of 'TRUE'
than of 'FALSE'.  For example, in libreofficekit/source/gtk/lokdocview.cxx there
is a warning about the 'TRUE' in

  g_main_context_iteration(nullptr, TRUE);

but not about the 'FALSE' in

  g_main_context_iteration(nullptr, FALSE);

(where the parameter of 'g_main_context_iteration' is of type 'gboolean').  Lets
live with that asymmetry for now...

(Besides the issues addressed directly in this commit, it also found the two
bogus asserts at 7e09d08807 "Fix useless
assert(true) (which would never fire)" and
122a0be8ae "Fix useless assert(true) (which would
never fire)", plus 5f0d6df7f5 "Use two-argument
form of static_assert".)

Change-Id: Id77322de9f94b85a7b65608a03e0e9865d14467b
Reviewed-on: https://gerrit.libreoffice.org/82667
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-14 19:53:53 +01:00
Stephan Bergmann
913d34ec6b Extend loplugin:salbool to loplugin:fakebool
...checking for unnecessary uses of more "fake bool" types.

In the past, some of the checks involving the types of variables or data
members, or the return types of functions, issued warnings that required
surrounding code to be changed too (e.g., when changing the signature of a
function whose address was taken).  These checks have been tightened now to not
warn in such cases (which avoids warnings that require changes to additional
code, or changes that might even be impossible to make, at the cost of being
less aggressive about removing all unnecessary uses of those "fake bool" types).

Change-Id: I70eb75039817cda34ed611387ee27dc5f36a3e2e
Reviewed-on: https://gerrit.libreoffice.org/82554
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-13 15:06:42 +01:00
Noel Grandin
1a2926a995 use std::move when popping stuff off stacks
Change-Id: I6ba0ee8afee1a9579045643cd0118cf19599d5b9
Reviewed-on: https://gerrit.libreoffice.org/82497
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-11-12 13:59:50 +01:00
Stephan Bergmann
05bec2bc26 loplugin:stringadd (clang-cl)
Change-Id: Icf2894f77c90aa4620910d621249947bad4be8b7
Reviewed-on: https://gerrit.libreoffice.org/82269
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-08 11:28:31 +01:00
Julien Nabet
032b6698c1 Base/Firebird fix column creation
Avoid these logs when saving a brand new table in embedded Firebird:
warn:legacy.osl:6038:6038:comphelper/source/property/propertycontainerhelper.cxx:181: OPropertyContainerHelper::implPushBackProperty: name already exists!
warn:legacy.osl:6038:6038:comphelper/source/property/propertycontainerhelper.cxx:182: OPropertyContainerHelper::implPushBackProperty: handle already exists!
...

Change-Id: I305791ad14d0bd18b3a527b848c031e02d661dbb
Reviewed-on: https://gerrit.libreoffice.org/81926
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-11-06 16:58:22 +01:00
Tamas Bunth
8349e919a8 mysqlc: replace initializer list with assignment
Because visual c++ compiler may not support it without creating a
constructor for the struct.

Change-Id: I6c8868c4e34cbe7b67e413b1db18aed01378c959
Reviewed-on: https://gerrit.libreoffice.org/65905
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/76727
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/81901
Tested-by: Jenkins
2019-11-03 23:08:50 +01:00
Stephan Bergmann
d526bd7dd5 Fix StringAdd::isCompileTimeConstant
...to find StringLiteral on the RHS of +=.  Which revealed that the
VisitCompoundStmt/checkForCompoundAssign logic needed to be fixed, too, so that

  s += side_effect();
  s += "literal";
  s += side_effect();

only gets combined to

  s += side_effect() + "literal";
  s += side_effect();

and not all the way to

  s += side_effect() + "literal" + side_effect();

Change-Id: I432e3458b933a7d0ad6141c747b675cc8b0f0ba4
Reviewed-on: https://gerrit.libreoffice.org/81804
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-31 09:14:39 +01:00
Noel Grandin
e276c81264 size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site
did not need re-alloc, but clamped it at 512 (e.g. in emfio/).

Change-Id: Ib7caf35a1b7e42b0e4ed8aa812493449e3eefc8f
Reviewed-on: https://gerrit.libreoffice.org/81540
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-26 12:38:33 +02:00
Stephan Bergmann
c820bf8baf loplugin:stringadd (macOS)
Change-Id: Ic9c23fcda4c798c1ca2de5a010da292d56b10e8b
Reviewed-on: https://gerrit.libreoffice.org/81201
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-21 11:43:37 +02:00
Stephan Bergmann
7e4358a0ca loplugin:bufferadd (macOS)
Change-Id: I97822e6843d6adef1af2435e186ac93d016e5322
Reviewed-on: https://gerrit.libreoffice.org/81202
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-21 11:43:22 +02:00
Caolán McNamara
d8f11761d8 mariadb still uses char for my_bool
mariadb-devel-10.3.17-1.fc30.x86_64

still has

typedef char my_bool;

Change-Id: I3d1f5423c8750180bc28c56bc0ead4f746fd1c23
Reviewed-on: https://gerrit.libreoffice.org/81137
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-10-19 21:06:25 +02:00
Peter Levine
5917ba8bc6 Fix building against MySQL Connector/C 8
In MySQL Connector/C 8, my_bool is replaced by bool. It was
previously defined as char. When building against
MySQL Connector/C 8, this leads to type punning build errors.
Redefine affected members of struct BindMetaData as bool if using
version 8 of greater. Otherwise, default to char.

Change-Id: If12b975d95afae86502867cb334cb4195802f91d
Reviewed-on: https://gerrit.libreoffice.org/81002
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-10-18 07:39:40 +02:00
Noel Grandin
3ebbb15024 loplugin:buffereadd find stuff involving adding *StringBuffer
and create conversion methods on *StringBuffer to make this work

Change-Id: I3cf5ee3e139826168894b46eff8ee4bcde00cb7e
Reviewed-on: https://gerrit.libreoffice.org/80949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-17 18:16:28 +02:00
Mike Kaganski
d51db77c8d Remove some memset calls
Replace them with default initialization or calloc

Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1
Reviewed-on: https://gerrit.libreoffice.org/80805
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17 09:53:42 +02:00
Stephan Bergmann
c8eaadb5d7 Remaining loplugin:bufferadd
...that had been missing because the plugin didn't implement postRun, so it
didn't report anything when run as part of the shared plugin.  (But did report
the expected warnings when run as a standalone plugin during
CompilerTest_compilerplugins_clang.)

Most fixes are straightforward.  A noteworthy one is PreparedStatement::setBytes
in connectivity/source/drivers/postgresql/pq_preparedstatement.cxx:  The old
preallocation of a 20 character OStringBuffer might have prevented

  buf.append( reinterpret_cast<char *>(escapedString), len -1 );

from potentially throwing std::bad_alloc, which would have caused escapedString
to be leaked.  Even though that 20-character preallocation was likely just
random junk and not meant to address the potential leak, lets address it now.

Change-Id: Ib506332d061684a22a74e5e39e591539fd2c4900
Reviewed-on: https://gerrit.libreoffice.org/80925
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17 09:03:53 +02:00
Stephan Bergmann
8b4719c29f Rename OUStringLiteral1 to OUStringChar
It started out as a wrapper around character literals, but has by now become a
wrapper around arbitrary single characters.  Besides updating the documentation,
this change is a mechanical

  for i in $(git grep -Fl OUStringLiteral1); do sed -i -e s/OUStringLiteral1/OUStringChar/g "$i"; done

Change-Id: I1b9eaa4b3fbc9025ce4a4bffea3db1c16188b76f
Reviewed-on: https://gerrit.libreoffice.org/80892
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-17 07:28:49 +02:00
Noel Grandin
f13c6ad5f0 new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations

Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-15 14:33:57 +02:00
Julien Nabet
1ec93ef100 Replace getDefaultValue by getColExprForDefaultSettingVal (postgresql)
Change-Id: I8e0eea84a711ce45d991c07d7811094e33bcce38
Reviewed-on: https://gerrit.libreoffice.org/80787
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-10-15 07:24:26 +02:00
Noel Grandin
9b5dad13b5 loplugin:stringadd look for unnecessary temporaries
which defeat the *StringConcat optimisation.
Also make StringConcat conversions treat a nullptr as an empty string,
to match the O*String(char*) constructors.

Change-Id: If45f5b4b6a535c97bfeeacd9ec472a7603a52e5b
Reviewed-on: https://gerrit.libreoffice.org/80724
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-14 08:26:14 +02:00
Julien Nabet
0c46c81e04 tdf#128111: "adsrc" doesn't exist from Postgresql 12
Before Postgresql 8.0, there was only "adsrc"
then it's been deprecated
"The adsrc field is historical, and is best not used, because it does not track outside changes
 that might affect the representation of the default value.
 Reverse-compiling the adbin field (with pg_get_expr for example) is a better way to display the default value
"
and finally it's been removed with version 12

See evolution with:
- https://www.postgresql.org/docs/8/catalog-pg-attrdef.html
- https://www.postgresql.org/docs/11/catalog-pg-attrdef.html
- https://www.postgresql.org/docs/12/catalog-pg-attrdef.html

Change-Id: I57e9da423a23b5a96bbb64b0e026b160e9643ab9
Reviewed-on: https://gerrit.libreoffice.org/80722
Tested-by: Jenkins
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
2019-10-13 16:40:15 +02:00
Noel Grandin
cdbac696fb simplify "a = a +" to "a +="
mostly so that my stringadd loplugin can point out places to improve

Change-Id: I9920ee1c99cdb6b811ba67ff9d8e32aa261884b5
Reviewed-on: https://gerrit.libreoffice.org/80618
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-11 07:18:11 +02:00
Noel Grandin
241bee7e4b convert WriteCharPtr..getStr to WriteOString
and improve the WriteOString method, we can avoid the strlen here, we
already have the length

One change in behaviour to be noted - if the string contains
trailing zero bytes, which ARE INCLUDED IN THE STRING LENGTH,
i.e. I'm not talking about the normal terminating zero, then this
patch changes behaviour because we will now write those zeros to
the stream.

Change-Id: I4668b9b9eb877f820b1dc70d6cd10ba2623bc0a2
Reviewed-on: https://gerrit.libreoffice.org/80597
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-10 18:50:52 +02:00
Julien Nabet
8e0c45246a Resolve FIXME Decimal Separator should be OUString (connectivity/dbaccess/svx)
instead of a sal_Char

Change-Id: I14fd983dac7ceb83a788c26dd4ea9d1c87444c9a
Reviewed-on: https://gerrit.libreoffice.org/80493
Tested-by: Jenkins
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-10-09 14:09:22 +02:00
Noel Grandin
682fdbf131 loplugin:redundantpointerops check other pointer types
as well as unique_ptr

Change-Id: I54842bca161ee460fb96c46ca31b6f9c0a7dbbdf
Reviewed-on: https://gerrit.libreoffice.org/80455
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-09 07:44:49 +02:00
Stephan Bergmann
b16730d8f1 loplugin:stringadd (macOS)
Change-Id: I4dde1fa6f1f3e6d75abe5002655d3cd5fa685c0b
Reviewed-on: https://gerrit.libreoffice.org/80487
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-08 23:50:48 +02:00
Noel Grandin
4390041224 enable -Wrange-loop-analysis on clang
Change-Id: I2095308943c94ad16c110d5fac47715398eb5d39
Reviewed-on: https://gerrit.libreoffice.org/80187
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-07 09:42:23 +02:00
Stephan Bergmann
f2bd7857ac loplugin:redundantcast (clang-cl)
Change-Id: I3f66a7850b4604dee576aeb61a39c4e45563d0c1
Reviewed-on: https://gerrit.libreoffice.org/79930
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 16:51:08 +02:00
Stephan Bergmann
a3e29642b9 loplugin:data (clang-cl)
Change-Id: Ib8b2bc1c5f7b27a646036ce23cae2b6a06edd038
Reviewed-on: https://gerrit.libreoffice.org/79922
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 13:20:30 +02:00
Stephan Bergmann
664de5a816 loplugin:stringconstant (clang-cl)
Change-Id: Id1a82cea4444255fdb693e126b7571a406094624
Reviewed-on: https://gerrit.libreoffice.org/79916
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 13:19:04 +02:00
Stephan Bergmann
404a3c806f loplugin:simplifyconstruct (clang-cl)
Change-Id: I08da288a88c2bce1d4250ec77f17bd483e6bc09c
Reviewed-on: https://gerrit.libreoffice.org/79911
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 10:51:48 +02:00
Noel Grandin
727200b81d loplugin:stringadd in basctl..cui
Change-Id: I2fdeb7eb3ead3512ad6d3fe793305038ab3aa7ae
Reviewed-on: https://gerrit.libreoffice.org/79886
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-01 09:22:23 +02:00
Luboš Luňák
2f5f45921b support O(U)String::number() for fast string concatenation
When I did the fast string concatenation, I didn't add any support
for number(), which simply returned a O(U)String, and so it did
the extra allocation/deallocation, although that could be avoided.
In order to support this, number() now returns a special temporary
return type, similarly to O(U)StringConcat, which allows delaying
the concatenation the same way.
Also similarly, the change of the return type in some cases requires
explicit cast to the actual string type. Usage of OString::getStr()
is so extensive in the codebase that I actually added it to the helper
class, after that it's only relatively few cases.

Change-Id: Iba6e158010e1e458089698c426803052b6f46031
Reviewed-on: https://gerrit.libreoffice.org/78873
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-24 12:58:14 +02:00
Arkadiy Illarionov
1d398fb983 tdf#39593 use getUnoTunnelImplementation
Change-Id: I78eb67913a568c610e38e5002f914773c4906dfd
Reviewed-on: https://gerrit.libreoffice.org/79350
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
2019-09-23 15:47:12 +02:00
Stephan Bergmann
ea1d4f6ca1 loplugin:fragiledestructor (macOS)
Change-Id: I908a7dbdb44c0b49315f0fd8559c21302dbc83a8
Reviewed-on: https://gerrit.libreoffice.org/79399
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-23 15:40:20 +02:00
Julien Nabet
f23e19cd15 tdf#127657: FIREBIRD error in query input param when referred field is integer
Change-Id: I626c8a8869570986d0293cd9070a1ee40ec585dc
Reviewed-on: https://gerrit.libreoffice.org/79314
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-23 08:49:55 +02:00
Noel Grandin
82572caae4 improve and enable loplugin:fragiledestructor
Where the problem was benign and the class was not extended, I marked
the class as final.
Where the problem was benign and the class was extended, I marked the
relevant callee methods as final.

Other cases were excluded in the plugin.

Change-Id: Idb762fb2206af4e8b534aa35ff77f8368c7909bc
Reviewed-on: https://gerrit.libreoffice.org/79089
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-19 11:42:47 +02:00
Tamas Bunth
47a62ede24 tdf#126852 Bind TEXT mysql type to Clob
Change-Id: I5a71666f1fafa9507032deffafebf885813a0369
Reviewed-on: https://gerrit.libreoffice.org/78815
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
2019-09-17 13:24:34 +02:00
Caolán McNamara
23a9dffb84 cid#1453559 silence Unchecked return value
cid#1453560 silence Unchecked return value
cid#1453562 silence Unchecked return value

Change-Id: I6b7dc42d6f2ebd8abb47fb71805c66c7f45d7748
Reviewed-on: https://gerrit.libreoffice.org/78838
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-09-12 22:04:26 +02:00