660 Commits
Author SHA1 Message Date
Andrea Gelmini 7ad4b1da80 Fix typos
Change-Id: I08d677970591e303d076ecff87af78c5eed1d6ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210060
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-27 15:01:44 +02:00
Andrea Gelmini c455a75578 Fix typos
Change-Id: I620dbd48232d8d2c7e99586d3445654880699cae

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209806
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-25 15:46:10 +02:00
Xisco Fauli fb28678005 loplugin:unusedmethods
Change-Id: If3dae53e3cf16df2d0c505a898138dfa6fe6c0f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205442
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-22 09:32:38 +02:00
Mehul Sharma 32ccbf31d3 tdf#145538 Use range based for loops in uiwriter11.cxx and poly2.cxx
Convert traditional for loops to range based for loops without
changing the existing behaviour of the code.

Change-Id: I118b12572ea1074e5a9aba329cc1acdd06d61666
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202618
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2026-04-03 14:18:50 +02:00
Noel Grandin ca82a93896 Fraction->double in SfxPoolItem
Change-Id: Ie5fe5f9367c6e657cee20c877a12d4c290aaec94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202588
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2026-03-24 14:07:52 +01:00
Noel Grandin 6993d54041 std::lround is unnecessary here
because we are then casting to a type <=32 bits

Change-Id: Ief4a93724ccbae8d697edbd40e4085389d74473f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-19 15:27:43 +01:00
Gabor Kelemen fd2e467ba3 tdf#146619 Run IWYU in fw decl mode on include/[a-c]*
After recent commit 851fb75779
recheck these directories in include/ again
to test drive the new --headersfwd mode of bin/find-unneeded-includes

Change-Id: I0ede437c4f9958cd98210ed1760a5b98ea8bd1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192377
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2025-11-08 09:37:19 +01:00
Caolán McNamara dfb4cf30d9 cid#1659750 silence Division or modulo by float zero
Change-Id: I8840e0a800292cf0862df301fd7341dfaebff3a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192243
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-12 18:17:44 +02:00
Caolán McNamara 293a41d2c0 ofz#446998346 Direct-leak
Direct leak of 392 byte(s) in 1 object(s) allocated from:
  #0 0x5cc5b75ab144 in ___interceptor_malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:67:3
  #1 0x5cc5ba1b928a in _cairo_image_surface_create_for_pixman_image /work/workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:191:15
  #2 0x5cc5ba1b928a in _cairo_image_surface_create_with_pixman_format /work/workdir/UnpackedTarball/cairo/src/cairo-image-surface.c:370:15
  #3 0x5cc5ba200f40 in cairo_surface_create_similar_image /work/workdir/UnpackedTarball/cairo/src/cairo-surface.c:598:10
  #4 0x5cc5b8b16a5c in createTmpCompatibleCairoContext /src/libreoffice/vcl/headless/CairoCommon.cxx:621:31
  #5 0x5cc5b8b16a5c in CairoCommon::getCairoContext(bool, bool) const /src/libreoffice/vcl/headless/CairoCommon.cxx:432:14
  #6 0x5cc5b8b1a473 in CairoCommon::drawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double, bool) /src/libreoffice/vcl/headless/CairoCommon.cxx:959:19
  #7 0x5cc5b8558575 in SalGraphics::DrawPolyPolygon(basegfx::B2DHomMatrix const&, basegfx::B2DPolyPolygon const&, double, OutputDevice const&) /src/libreoffice/vcl/source/gdi/salgdilayout.cxx:499:5
  #8 0x5cc5b81c0ece in OutputDevice::DrawTransparentNatively(tools::PolyPolygon const&, unsigned short) /src/libreoffice/vcl/source/outdev/transparent.cxx:230:25
  #9 0x5cc5b81c0794 in OutputDevice::DrawTransparent(tools::PolyPolygon const&, unsigned short) /src/libreoffice/vcl/source/outdev/transparent.cxx:460:14
  #10 0x5cc5b83629c0 in GDIMetaFile::Play(OutputDevice&, unsigned long) /src/libreoffice/vcl/source/gdi/gdimtf.cxx:374:26

this happens because once a cairo context enters an error state no
functions have an effort on the cairo context.

The error is CAIRO_STATUS_INVALID_MATRIX and the matrix derived
from the polypolygon is degenerate.

The polypolygon contains a polygon with 0 points, which looks invalid,
detect that at import boundary rather than mess around with duplicating
with some with cairo_matrix_invert the invalid matrix at use location.

Change-Id: I3f6a53de3d2638146f969a6f0997c1a58f1669c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192184
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-10-11 15:16:20 +02:00
Bartosz Kosiorek dea3d83e9a tdf#103859 EMF Improve interpolation of the EMR_ROUNDRECT by Bezier curve
Change-Id: I9d297489415e2b36e9566aa358d5eb9a2e94c398
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190146
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-27 21:47:26 +02:00
Caolán McNamara b6db71d04f ofz#437531730 Segv on unknown address
since:

commit 1b68f85903
Date:   Sun Aug 3 01:01:38 2025 +0200

    tdf#167616 EMF Add support for EMR_ANGLEARC record

nPoints can be 0 here

Change-Id: If9aa60e8abbf5e58f5224fe62b84163fbae55448
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189642
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2025-08-15 09:31:52 +02:00
Bartosz Kosiorek ccf1476f70 tdf#103859 EMF Fix quality of EMR_ELLIPSE by using Bazier curve for drawing
Change-Id: I7eaca22dac921229b4a88e07739d379948730bd9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189024
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Tested-by: Jenkins
2025-08-08 17:46:09 +02:00
Alex Berea 4ddabd085a tdf#145759 replaces the defined FSQRT2 with c++ built-in M_SQRT2
Change-Id: I6f27e8cfbfdca9648beffe7d083e22195304d487
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188603
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-07 20:21:14 +02:00
Bartosz Kosiorek e24f16560d tdf#103859 EMF Fix quality of EMR_ROUNDRECT by using Bazier curve for drawing
As WMF and EMF is using integers and previous EMR_ROUNDRECT implementation
used many small lines to display curves, it produces low quality curves.
With this implementation using Bezier curves,
EMR_ROUNDRECT images are scalable without any loss of quality.

Change-Id: I3ef7f15ed9e3835065030bdf196b9bfa044d84a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189016
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-06 22:06:09 +02:00
Bartosz Kosiorek 1b68f85903 tdf#167616 EMF Add support for EMR_ANGLEARC record
Change-Id: Ic872f80b2a318ac7c0f3b0cbdb4ad285795989c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188865
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2025-08-06 14:47:01 +02:00
Caolán McNamara 07393eb2cc cid#1659901 silence Logically dead code
Change-Id: I615714cca414e004368bb781b4ed1aacce027a57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188934
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-05 12:04:55 +02:00
Caolán McNamara 0246482b6a cid#1659848 silence Logically dead code
and

cid#1660004 Logically dead code
cid#1659644 Logically dead code
cid#1659901 Logically dead code
cid#1660015 Logically dead code

Change-Id: I260149b3f46c86cc7e7c4198242cd3f19cb30f05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188900
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-04 12:37:40 +02:00
Caolán McNamara 8571fa5851 reuse number_of_bits
Change-Id: Ice13574ecdec286fc7b410984fdaf5e168ea46b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187391
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-07-10 19:06:23 +02:00
Tomaž Vajngerl b9477183bb tools: moved function to create the color from string to tools
Will be needed again in a follow up commit.

Change-Id: Idbe2f540f9c3fb974f7dadf62dc099a0791bb0c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180378
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-01-20 01:40:10 +01:00
Stephan Bergmann 39f701d540 Avoid UBSan when negating the most negative sal_Int64 value
...as exhibited by recently added 08e566f0c9 "add
a couple of tests for tools::BigInt"

Change-Id: Icd1080f86ccd985868fce34d6f86e2706acd58df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176677
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-11-16 23:27:39 +01:00
Caolán McNamara 051365a71f cid#1606943 Overflowed constant
Change-Id: I056e45e19bb3794acbdf7b5c2b4ecb787e52de0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-11-04 09:38:46 +01:00
Noel Grandin 5de73f04f3 new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-11-04 08:51:00 +01:00
Noel Grandin cb24239ef0 cid#1606943 Overflowed constant
Change-Id: If097a933e8d856e4528313cd351959ceb9041b27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175718
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-10-28 18:42:47 +01:00
Stephan Bergmann c3b3b27e57 loplugin:noexceptmove (macOS, LLVM 20 trunk libc++)
Change-Id: I77a48bbdfcb3d80af69155b11b31ee8e8223bd64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174261
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-09-30 11:21:34 +02:00
Caolán McNamara 5f903bd3ad ofz#70815 optimize this a little
#5 0x558251409124 in operator new[](unsigned long) /src/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:98:3
 #6 0x558255fb4937 in ImplPolygon::ImplPolygon(ImplPolygon const&) /src/libreoffice/tools/source/generic/poly.cxx:74:26
 #7 0x558255fbbfd3 in impl_t /src/libreoffice/include/o3tl/cow_wrapper.hxx:195:17
 #8 0x558255fbbfd3 in cow_wrapper /src/libreoffice/include/o3tl/cow_wrapper.hxx:236:26
 #9 0x558255fbbfd3 in tools::Polygon::Polygon(tools::Rectangle const&) /src/libreoffice/tools/source/generic/poly.cxx:887:53

shouldn't need to create a copy here

Change-Id: I44122aaca0b49f31dd85e95920c9911b96e4227f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172706
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
2024-09-01 12:11:53 +02:00
Heiko Tietze 74d910231c Resolves tdf#161766 - WCAG 2.1 compliant luminance for isDark()
Alternative solution to I63b85694584cdc6213e7b904ed6402b6c2f2b422

Change-Id: Ifca47de30616295a9965b9313886456313921401
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171862
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
2024-08-16 08:55:54 +02:00
Caolán McNamara 437412d79b cid#1557980 COPY_INSTEAD_OF_MOVE
and

cid#1557869 COPY_INSTEAD_OF_MOVE
cid#1557807 COPY_INSTEAD_OF_MOVE
cid#1557804 COPY_INSTEAD_OF_MOVE
cid#1557799 COPY_INSTEAD_OF_MOVE
cid#1557781 COPY_INSTEAD_OF_MOVE
cid#1557781 COPY_INSTEAD_OF_MOVE
cid#1557766 COPY_INSTEAD_OF_MOVE
cid#1557746 COPY_INSTEAD_OF_MOVE
cid#1557737 COPY_INSTEAD_OF_MOVE

Change-Id: I1866c576f525ea697c62e9e0a96890e5fdaa780f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171795
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-08-14 09:27:19 +02:00
Caolán McNamara 07d3577569 cid#1555417 COPY_INSTEAD_OF_MOVE
and

cid#1555423 COPY_INSTEAD_OF_MOVE
cid#1555430 COPY_INSTEAD_OF_MOVE
cid#1555436 COPY_INSTEAD_OF_MOVE
cid#1555440 COPY_INSTEAD_OF_MOVE
cid#1555443 COPY_INSTEAD_OF_MOVE
cid#1555454 COPY_INSTEAD_OF_MOVE
cid#1555459 COPY_INSTEAD_OF_MOVE
cid#1555461 COPY_INSTEAD_OF_MOVE
cid#1555468 COPY_INSTEAD_OF_MOVE
cid#1555477 COPY_INSTEAD_OF_MOVE
cid#1555484 COPY_INSTEAD_OF_MOVE
cid#1555511 COPY_INSTEAD_OF_MOVE
cid#1555515 COPY_INSTEAD_OF_MOVE
cid#1555519 COPY_INSTEAD_OF_MOVE
cid#1555534 COPY_INSTEAD_OF_MOVE
cid#1555537 COPY_INSTEAD_OF_MOVE
cid#1555544 COPY_INSTEAD_OF_MOVE
cid#1555553 COPY_INSTEAD_OF_MOVE
cid#1555559 COPY_INSTEAD_OF_MOVE
cid#1555561 COPY_INSTEAD_OF_MOVE
cid#1555563 COPY_INSTEAD_OF_MOVE
cid#1555564 COPY_INSTEAD_OF_MOVE
cid#1555568 COPY_INSTEAD_OF_MOVE
cid#1555571 COPY_INSTEAD_OF_MOVE
cid#1555580 COPY_INSTEAD_OF_MOVE

Change-Id: Ia42a78bffddc80d0e82144f4db51dc6e4d2e9a1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171237
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-31 09:33:06 +02:00
Caolán McNamara 7f135227a9 cid#1556131 COPY_INSTEAD_OF_MOVE
and

cid#1556135 COPY_INSTEAD_OF_MOVE
cid#1556146 COPY_INSTEAD_OF_MOVE
cid#1556164 COPY_INSTEAD_OF_MOVE
cid#1556171 COPY_INSTEAD_OF_MOVE
cid#1556177 COPY_INSTEAD_OF_MOVE
cid#1556181 COPY_INSTEAD_OF_MOVE
cid#1556182 COPY_INSTEAD_OF_MOVE
cid#1556183 COPY_INSTEAD_OF_MOVE
cid#1556192 COPY_INSTEAD_OF_MOVE
cid#1556201 COPY_INSTEAD_OF_MOVE
cid#1556208 COPY_INSTEAD_OF_MOVE
cid#1556215 COPY_INSTEAD_OF_MOVE
cid#1556224 COPY_INSTEAD_OF_MOVE
cid#1556227 COPY_INSTEAD_OF_MOVE
cid#1556228 COPY_INSTEAD_OF_MOVE
cid#1556238 COPY_INSTEAD_OF_MOVE
cid#1556246 COPY_INSTEAD_OF_MOVE
cid#1556247 COPY_INSTEAD_OF_MOVE
cid#1556288 COPY_INSTEAD_OF_MOVE
cid#1556293 COPY_INSTEAD_OF_MOVE
cid#1556305 COPY_INSTEAD_OF_MOVE
cid#1556310 COPY_INSTEAD_OF_MOVE
cid#1556317 COPY_INSTEAD_OF_MOVE
cid#1556321 COPY_INSTEAD_OF_MOVE
cid#1556322 COPY_INSTEAD_OF_MOVE
cid#1556331 COPY_INSTEAD_OF_MOVE
cid#1556339 COPY_INSTEAD_OF_MOVE
cid#1556342 COPY_INSTEAD_OF_MOVE
cid#1556351 COPY_INSTEAD_OF_MOVE
cid#1556358 COPY_INSTEAD_OF_MOVE
cid#1556370 COPY_INSTEAD_OF_MOVE
cid#1556379 COPY_INSTEAD_OF_MOVE
cid#1556390 COPY_INSTEAD_OF_MOVE
cid#1556423 COPY_INSTEAD_OF_MOVE
cid#1556532 COPY_INSTEAD_OF_MOVE
cid#1556561 COPY_INSTEAD_OF_MOVE
cid#1556662 COPY_INSTEAD_OF_MOVE
cid#1556704 COPY_INSTEAD_OF_MOVE
cid#1556730 COPY_INSTEAD_OF_MOVE
cid#1556988 COPY_INSTEAD_OF_MOVE
cid#1557071 COPY_INSTEAD_OF_MOVE
cid#1557081 COPY_INSTEAD_OF_MOVE
cid#1557177 COPY_INSTEAD_OF_MOVE

Change-Id: I2c723f0fe9a4eefa62a68f47049ed690d06eb0ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170932
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-07-24 22:12:32 +02:00
Yuki Joou cfe6ce1656 tdf#145538 - related: Make tools::PolyPolygon iterable
This patch allows tools::PolyPolygon to be iterated using c++11's
fancy range-based for-loops. It also upgrades a bunch of old-style
for-loops iterating over polypolygons to the new style to make code
more readable.

Note that not all for-loops iterating over polypolygons have been
upgraded, as I didn't find a way to automatically find those. I just
did a few I found manually.

Change-Id: Ifa8d0d44e6f0aa28fdcfd87d70058b12f48c1349
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168730
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-07-14 12:24:14 +02:00
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
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 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
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
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 McNamaraandMike Kaganski 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
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
Mike Kaganski d205274a01 Drop MinMax in favor of std::clamp
Change-Id: I021f524b232ddbe091981444d859d35dd9cd05ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157582
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-05 13:58:12 +02:00
Noel Grandin b6b26421a1 split Point/Size/Rectangle into AbsoluteScreenPixel* types
to attempt to make it obvious in code what kind of coordinate
system we are dealing with.

The idea is that by doing this, the compile-time type checking
will flush out inconsistencies between different code.

I started with vcl::Window::OutputToAbsoluteScreenPixel
and worked outwards from there.

Change-Id: Ia967d7a0bb38886695f3a761b85c8b9340ddb1c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154676
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-08-02 08:13:15 +02:00
Mike Kaganski a7ffd469fb Check / adjust the correct variables
mnNumerator / mnDenominator are sal_Int32, so after they were assigned,
they can't be out of range.

Introduce a gcd initial step to avoid precision loss sometimes.

Negative denominator is used quite some time, so drop the obsolete
comment, while here.

Change-Id: I66b77fb3d69cfd2265ac2ed88344af9cfade405b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154957
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-07-27 15:49:17 +02:00
Noel Grandin 13d7184351 make tools::Poly*gon single-arg constructors explicit
which will help avoid ambiguity in method calls in an upcoming patch

Change-Id: Ic7607ac7d95559e0942a84fb3226cfdd6ade22bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154146
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-06 20:28:05 +02:00
Noel Grandin dba55c304a loplugin:unnecessarygetstr extend to createFromAscii
idea from mike kaganski

Change-Id: I0ecb9cad091d7a048d2ddae73165bf22748f3872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150907
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-24 12:45:22 +02:00
Noel Grandin b1684730cc tdf#143200 assert when pasting a cell to a large-height range
The values are unfortunately genuinely outside the range that our
Fraction class can work with.
So do the least-bad thing for now, and reduce the magnitude of the
values until they fit.

Change-Id: Iedc34e9767b3d4a502f5d84efcdebc96c6514cac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150493
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-18 07:51:38 +02:00
Leonid Ryzhov 1b44a4c558 tdf#147906 Use std::hypot for Pythagorean addition
Change-Id: Ia325af8d9a23e617eb62e6cecab0aa68f1d206f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145089
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
2023-01-09 09:18:12 +00:00
Caolán McNamara f017eaf5d6 ofz#53450 Integer-overflow
Change-Id: Iccabfb8991a4dca6ec05565f01f6cff82c642d27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142934
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-18 14:54:35 +01:00
Caolán McNamara c2fc5d4fc0 ofz#53450 Integer-overflow
Change-Id: I106e703714083631c67d7b8a84180c3c485953d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142814
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-17 10:31:21 +01:00
Andrea Gelmini 517d05dbfd Fix typos
Change-Id: Ic1fb0ea483954f2994a87e05f33b320da3795227
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142661
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-11-13 22:21:58 +01:00