Commit graph

3964 commits

Author SHA1 Message Date
Noel Grandin
039a18ff14 compute these using floating point
which means we can avoid the checked_multiply complexity

Change-Id: I2badbde7bf9c6f18337913034b24672fddce3af8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168472
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-06-06 08:26:10 +02:00
Caolán McNamara
550e50c529 ofz#69290 Integer-overflow
Change-Id: I20b49bf5e3a507979332cd854205f290a3b3971c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168118
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-28 13:10:34 +02:00
Noel Grandin
45f9627659 loplugin:ostr in tools
Change-Id: I0e601100b034eaa99b08c7cbf09e5f817e69b507
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167736
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-16 14:49:58 +02:00
Noel Grandin
57dc0cbd8e do less OString->OUString conversion in tools datetime functions
Change-Id: I93d012f32b8006019c431b8bf88ab9c7ffb4d3a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167574
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-05-13 14:44:19 +02:00
Noel Grandin
05d4420c5e createFromAscii -> OUString literals in INetURLObject
Change-Id: I3c564f469635271d27fa0513d676241ce7ded51d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167573
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-13 13:05:57 +02:00
Noel Grandin
8b075d020c replace createFromAscii with OUString literals in INetURLObject
Change-Id: Ibad8181624afd745e2fa501cdcc7a5d915dfe6ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167544
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-12 17:01:06 +02:00
Christian Lohmaier
0c4c84a14b makefile simplification: replace $(call gb_CustomTarget_get_workdir,foo)
…by a simple/static $(gb_CustomTarget_workdir)/foo

The build system has a lot of overly complicated leftovers from when it
was introduced and had not only deal with split repositories but also
had to coexist with another buildsystem. Along with lots of copy'n'paste
along the years the makefiles became hard to grasp for newcomers with
all our calls and evals.
As a first step to streamline that, the macros from TargetLocations that
simply prefix a static path to the argument (and similar of the same
kind) are a natural pick before simplifying the rules themselves/getting
rid of a bunch of eval statements.

Change-Id: Ia06dbbcd5d1994755a2ff05b84f72ccbc4e3cab5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167005
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2024-05-03 16:06:14 +02:00
Caolán McNamara
bea8576e82 cid#1596706 Dereference after null check
Change-Id: If7156d9b0aaa392ff0c1e98dfdd4d05c6dcaabce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166982
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-02 00:13:32 +02:00
Caolán McNamara
4742808bf2 WaE: C6011 Dereferencing NULL pointer warnings
Change-Id: I665bb37e1d45ec87489b039b1d1d41529f027328
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166939
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-01 09:16:57 +02:00
Noel Grandin
246ef0b8ea loplugin:singlevalfields
Change-Id: I4d7b38c90d73a00f4dbc8ad7318fe4573328ed46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166503
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-23 11:28:55 +02:00
Noel Grandin
99c857afda loplugin:unusedfields
Change-Id: I43b7a553177bbbdeebe37f7d7e63dfcb2ae70778
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166292
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-04-19 21:26:43 +02:00
Mike Kaganski
3e38fdacba Optimize a bit, to avoid a copy of the vector
Change-Id: I747662e346151e2e055cb803278c2a6c7709f273
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166166
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-18 08:18:21 +02:00
Mike Kaganski
96f62b48b4 Simplify a bit
Change-Id: Iadfa442f762aa3caf3a8de7f3633be4e73bfd91a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166091
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-17 06:40:40 +02:00
Mike Kaganski
ea9904c896 Drop FRound, and use generalized basegfx::fround
Change-Id: I7447e649dc3ef4e51242f69c7486a3e84e103d2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166159
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-17 03:56:59 +02:00
Mike Kaganski
1f1f423200 Round in XmlWriter::attribute when passing a double
Before, it truncated. Rounding provides a closer value.

Change-Id: I213e6ae34ada2f5081cb2c8b2ef431448c712b37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165947
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-04-14 15:13:10 +02:00
Noel Grandin
144dd13818 loplugin:unusedmethods
Change-Id: Ib0a72355972662c6b902bca9a527be91fb3e1d17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164930
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-17 13:06:48 +01:00
Caolán McNamara
17dc98b0f0 Document Colors do not show any color in the Palette
same is true for "Theme Colors", a problem since:

commit 4ccc2f0e3f
Date:   Fri Mar 1 22:11:14 2024 +0200

    cool#8327 use tools::JsonWriter for theme colors

Change-Id: Ibaab5df197bd8005037e066181e8a50bdda5ceda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164658
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164669
Tested-by: Jenkins
2024-03-11 18:47:41 +01:00
Stephan Bergmann
3ba85b7786 Support o3tl::iterateCodePoints with both sal_Int32 and std::size_t
...and clean up the most gross casting offenses

Change-Id: If0d646fb3e73e71a9a2735569395034973563a1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164602
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-09 19:19:04 +01:00
Noel Grandin
06daf1719e avoid a memcpy when constructing output of tools::JsonWriter
we can store the data in an rtl::OString object and then return
that directly

Change-Id: I65af6820bfd3135b38d437cf9736fffff8924e88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164291
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-02 20:11:07 +01:00
Mike Kaganski
18a5df4993 Restore a comment
Mistakenly removed in commit c2dca161c0
(Use <bit> instead of platform-specific intrinsics, 2024-02-29)

Change-Id: I6091a767aebcbb2543656cee2c27330fb6f9d16b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164141
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29 12:50:12 +01:00
Mike Kaganski
c2dca161c0 Use <bit> instead of platform-specific intrinsics
Change-Id: I79636ff9c3b2fe601b0b3c94a111b36af0011775
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164131
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-29 04:01:48 +01:00
Mike Kaganski
3234c4e35f Avoid MAX_PATH limitation in launcher
... and drop some manual memory management.

Change-Id: I4c60ce559ff185d4685a6b9799a97651438115b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162502
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-02-25 07:29:40 +01:00
Noel Grandin
4603aa2888 use more string_view in tools::JsonWriter
Change-Id: Ia3ac54a1164b99a806298a47115ea3bc570f3b0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163810
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-23 16:50:33 +01:00
Noel Grandin
8f53681856 return string_view from some XmlWalker methods
elides some OString temporaries

Change-Id: Ic07f18eb3c71637593e64128605c1ebfa8e68474
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163044
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-06 17:08:27 +01:00
Thorsten Behrens
cefe5464e6 Fix system-libfixmath
Seems distros start to disagree on whether its liblibfixmath or just
libfixmath.

Change-Id: I54a42b2ba050980ae632ab3c82254131cad7787e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161969
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2024-01-14 19:24:20 +01:00
Mike Kaganski
76fad8c981 Simplify a bit
And make sure to write newline, tab, etc. as short \n, \t, etc.

Change-Id: I6a8ae36ff2856fce2f756c643c6266debe79f1ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161813
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-09 13:31:33 +01:00
Szymon Kłos
cf767af8de lok: external data source list
Make possible to filter allowed data sources.
It is used for WebDAV curl, WEBSERVICE function, cell external
references.

Change-Id: Ifc82af31ff1123b5656a21e6a27624fb1616db39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160196
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161772
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2024-01-09 07:49:11 +01:00
Mike Kaganski
7413b4ad50 Simplify JsonWriter a bit
Change-Id: Ifa4278cfd62df4179dd3ae627369c077e31dbd00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161780
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-08 13:05:31 +01:00
Noel Grandin
7de4661827 no need to use SvLockBytes in forms
Change-Id: Ide586997d504e0fbdb72aa1db77c49ba3d6007c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161437
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-12-30 13:45:53 +01:00
Caolán McNamara
8013fcadd9 cid#1471704 Assignment of overlapping memory
overlapping_assignment: Assigning (*this).nNum[0] to (*this).nVal,
which have overlapping memory locations and different types.

Change-Id: I70d7236af27bf5399ad5eb5553befd2eb33e37db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161202
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-23 14:40:09 +01:00
Caolán McNamara
03d7ff28b3 cid#1546500 COPY_INSTEAD_OF_MOVE
and

cid#1546492 COPY_INSTEAD_OF_MOVE
cid#1546468 COPY_INSTEAD_OF_MOVE
cid#1546431 COPY_INSTEAD_OF_MOVE
cid#1546382 COPY_INSTEAD_OF_MOVE
cid#1546350 COPY_INSTEAD_OF_MOVE
cid#1546336 COPY_INSTEAD_OF_MOVE
cid#1546314 COPY_INSTEAD_OF_MOVE
cid#1546152 COPY_INSTEAD_OF_MOVE
cid#1546094 COPY_INSTEAD_OF_MOVE
cid#1546077 COPY_INSTEAD_OF_MOVE
cid#1546047 COPY_INSTEAD_OF_MOVE
cid#1545213 COPY_INSTEAD_OF_MOVE

Change-Id: Ia51df9f9cbde755db4d2685e34f22676ed5eceff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161141
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-22 00:10:39 +01:00
Mike Kaganski
36df3f9ad2 Make BigInt::DivMod public, to allow optimized division
Change-Id: I4f79c30b9ab997d01e59a0dec76986e74abfc11f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161053
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20 20:30:01 +01:00
Mike Kaganski
c684aa9cf3 Simplify and rename for clarity
Change-Id: Ic97a2b313c6f7d9da540a8867f01362c2fe7b0d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161052
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20 20:29:51 +01:00
Caolán McNamara
b64f23b235 ofz#65165 Stack-buffer-overflow READ 4 test case
make VALGRIND=memcheck CppunitTest_tools_test

 Conditional jump or move depends on uninitialised value(s)
    at 0x13348ADA: BigInt::DivLong(BigInt const&, BigInt&, BigInt*) const (bigint.cxx:306)
    by 0x13349A0A: BigInt::operator/=(BigInt const&) (bigint.cxx:635)
    by 0x12A58F67: tools::BigIntTest::testLenB1() (test_bigint.cxx:103)
    by 0x12A5C6A8: void std::__invoke_impl<void, void (tools::BigIntTest::*&)(), tools::BigIntTest*&>(std::__invoke_memfun_deref, void (tools::BigIntTest::*&)(), tools::BigIntTest*&) (invoke.h:74)

if ( (static_cast<sal_uInt64>(aTmpB.nNum[nLenB1 - 1]) * nQ) >
                                         ^ nLenB1 is 0
    ((nTmp - static_cast<sal_uInt64>(aTmpB.nNum[nLenB1]) * nQ) << 32) + aTmpA.nNum[j - 2])

Since:

commit bcbc0857bf
Date:   Sun Dec 17 21:11:31 2023 +0300

    Simplify BigInt

Co-authored-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Id8dbff23f7b4312ba666e1443c41b7869713bfbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160953
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-20 05:49:41 +01:00
Mike Kaganski
bcbc0857bf Simplify BigInt
Change-Id: I1b88648a84760ea16f32566fe0d88e402c328987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160888
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-17 22:34:02 +01:00
Mike Kaganski
247c64fa02 Drop incorrect conditional compilation
Since commit 396196d614 (BigInt's
non-big value type is currently sal_Int32, 2020-11-14), fixed-size
sal_Int32 is used in the unit test; so it must not depend on size
of unrelated long type.

Change-Id: Ida276e87b927381d093796f4137774a18acded82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160857
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-16 20:29:05 +01:00
Mike Kaganski
fbefacef9e Simplify and fix SvGlobalName comparison
Its operator< (required for stl containers) was not comparing Data4.
The defaulted comparison uses a different order, but that shouldn't
matter.

Change-Id: Id9b9d782b393866100c3e994a3902e7ce9a2676f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160607
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-12 10:39:41 +01:00
Mike Kaganski
70153b7350 Make some SvGlobalName ctors constexpr
Change-Id: Idacca005723b995061dc1df06f98bd584cbfd675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160606
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-12 08:54:59 +01:00
Mike Kaganski
2b4094195e Clean up SvStream API a bit
Change-Id: Ic9847185e8f551eeb05715902374d7a9a9032f60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160546
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-11 07:10:31 +01:00
Mike Kaganski
d88d113c7d Simplify SvStream::WriteDouble
Change-Id: I0ece791b5571d3839c936e104016f53cc3b6d5e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160537
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-10 17:08:06 +01:00
Mike Kaganski
b4fda935de Keep original error
Fix several SetError implementations, to make sure that original
errors are not rewritten, but OTOH warnings could be replaced by
errors.

Change-Id: Ic5e71b791ff3426ff1144778a610ab77fcbf24d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160530
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-12-10 12:38:17 +01:00
Caolán McNamara
49d88e99a2 cid#1545320 Unused value
Change-Id: I772a5d7608b92634b7cfed1c1e1730eab34bee89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160421
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-07 12:29:19 +01:00
Stephan Bergmann
3bc5f0a38a Extended loplugin:ostr: tools
Change-Id: I7a585370b7d2a8021b733984e605cae8cc92c774
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160097
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2023-11-29 16:40:53 +01:00
Stephan Bergmann
db9104a366 Extended loplugin:ostr: tools
Change-Id: I70df74d005c7fca14b1bcb70f4870023bd3af4a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159668
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-19 17:29:09 +01:00
Caolán McNamara
1305f70cff warn about exotic protocols as well
Change-Id: I50dcf4f36cd20d75f5ad3876353143268740a50f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151834
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-07 11:22:03 +01:00
Gabor Kelemen
026be6f62f tdf#146619 Recheck include/t* with IWYU
Change-Id: I005257e458351285b1b35ffe49c8b42834a6db68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156990
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-11-06 00:33:57 +01:00
Caolán McNamara
11ebdfef16 add some protocols that don't make sense as floating frame targets
Change-Id: Id900a5eef248731d1184c1df501a2cf7a2de7eb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158910
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-03 20:56:33 +01:00
Mike Kaganski
9f1289f1e3 tdf#157820: handle \\?\ prefixes in INetURLObject
They are already handled in osl file URL functions.

Change-Id: Id0c224bdb79963e7ce52abde57bf05b0a6a81ff5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158741
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-11-01 10:24:21 +01:00
sahil
d56b619753 tdf#130924 replace '*printf' with 'SAL_*' logging macros in tools
Change-Id: I9721bfd3783fd6c5d41b2d9a0e8468c583ede0c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156864
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-10-23 15:50:09 +02:00
Stephan Bergmann
5f69ffb27a Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: tools
Change-Id: I930c794c6f93531ef8d2b91c5e6ad62b486966dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158245
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20 21:51:02 +02:00