summaryrefslogtreecommitdiff
path: root/tools/source/generic
AgeCommit message (Collapse)Author
2021-06-29ofz#35504 promote to double earlierCaolán McNamara
Change-Id: I20906d61f411bba5b37f7248ba9b544afa27a0a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118051 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-28ofz#35504 Integer-overflowCaolán McNamara
Change-Id: I7a462b821f286411d759b5259461fcdbf1741859 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117955 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-23ofz#35504 Integer-overflowCaolán McNamara
Change-Id: If8c460a4890ad23c2656c3b677b6c2ad8d46fb2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117734 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-20Revert "ofz#33769 Integer-overflow"Caolán McNamara
now fixed at an earlier stage so NaN isn't imported from dxf This reverts commit 71fe0aeee20640c57816dc45010d32dac9afeaaf. Change-Id: Id2689e33f89deb08e1bcd39a6d4ba38fb4663681 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117511 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-06-03ofz#33769 Integer-overflowCaolán McNamara
Change-Id: I2f158b1f7c3fdaea00c4334cf3889e0f38674e8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116650 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-05-28no need to allocate these on the heapNoel Grandin
Change-Id: I0f477edb666ff2c6dc9def45ec68c4ce1a34634a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116289 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-21tdf#55007 tdf#142263 tdf#142268 EMF ARC, PIE, CHORD allow to draw circleBartosz Kosiorek
In Metafile specification, if Start Point is the same as End Point, then the full circle should be drawn. Unfortunately with previous implementation, if Start Point is the same as End Point, nothing is drawn. This patch fixes that and removed EDGES optimizations, which causes display issues. Change-Id: I16a1b98f10378d57bed59696db6cc9f228044292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115891 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2021-05-20Simplify a bit: use one minmax in place of 3 min + 3 max callsMike Kaganski
Change-Id: Ief2d8d049d2e05ee762e6855514f75be2f053836 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115835 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-18tdf#55007 tdf#142263 tdf#142268 EMF Properly display ARC and CHORDBartosz Kosiorek
With previous implementation the ARC, ARCTO and CHORD were not displayed if the corners of rectangle was switched. With this patch the shapes are always displayed correctly. Change-Id: Ie8ac7af812298c0b96c3b5af417117784f128ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115757 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
2021-05-03loplugin:unnecessaryparen small improvementNoel Grandin
when calling a function, and passing only one arg, but the function has defaulted args, we were ignoring this case. Change-Id: I86517f18e30531127664088ddc09ef96dbd8bdf5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-28ofz#33769 Integer-overflowCaolán McNamara
Change-Id: I067db0452650cf3e8bc887abac74c4ff796d4ad2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114768 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-27loplugin:moveoptNoel Grandin
An attempt that did not find anything convincing enough to finish it up and make it permanently active. So just leave it in /store for now. Change-Id: I1750e177655a4a510da100f880ba81bf762be277 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114742 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-19use more string_view in OString APINoel Grandin
some parts of the OString seem to have fallen behind its more popular sibling OUString. Change-Id: Ie6d64c3005b2df5da49ba79d0c38282dd5057a23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114252 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-04-14ofz#33235 Integer-overflowCaolán McNamara
Change-Id: I7a717a5bfdd58f22de3dcd61fe4aad67d1463a42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114099 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-10ofz#32973 Integer-overflowCaolán McNamara
Change-Id: Ib290468b4c7388b80da627138435b98feaed354b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113921 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-09ofz#33038 Floating-point-exceptionCaolán McNamara
Change-Id: Ibe4a6667f5a14b5d94f2dbb92ad611ecba4984f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113821 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-07ofz#32965 move fpe fix of ofz#17212 into toRationalCaolán McNamara
Change-Id: Ica301357f45fd289c41234b8a7059ab0ff264321 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113703 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-05Use std::gcd instead of boost versionMike Kaganski
Change-Id: Iba3bd7cbab01a99f46e7b2f5632fd3b11e70458d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113598 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-04-05ofz#32885 regard as invalid fractions that will FPE boost::integer::gcdCaolán McNamara
Change-Id: I59befe0cd21be54d1c94bb28e3d9c01f1483c104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113574 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-04-02vcl: move Fraction reading/writing to GenericTypeSerializerTomaž Vajngerl
Change-Id: Iccacaa7fd9cffe1d99f76def854c2150bb4d94f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113499 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-15cid#1471704 workaroundNoel Grandin
Coverity complaints that "nVal = nNum[0] in bigint.cxx:84 is an assignment of overlapping memory" But this is essentially a tagged union, so it's actually fine. Workaround the warning by using a temporary (which the compiler will optimise away anyhow) Change-Id: I0fda945f831b1cdd7b33f7cb671a744150990bf6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109294 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-14cid#1471346 Uncaught exceptionCaolán McNamara
Change-Id: I535affd6597636aa32e1cf9c6005238f9503ef6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109266 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-01-06bIsBig member is redundantNoel Grandin
we can just use nLen != 0 to get the same information Change-Id: I2406322aa8b7cfc5e276818df763c6de08397454 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108834 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-01-06move the bigint based Scale() implementations to one central placeNoel Grandin
Picking the best looking one in the process. Change-Id: I77f9236fcd21f883a23fe2f43f20336f17b44cc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108831 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-24Revert "add sal*Int64 conversions to BigInt"Stephan Bergmann
This reverts commit 5dae4238ea6e21df42f4437a43d152954fc494fd, which appears to have ambiguitiy problems not only on Windows, but generally with 32-bit builds like <https://ci.libreoffice.org/job/gerrit_android_x86/1518/>: > /home/tdf/lode/jenkins/workspace/android_x86/tools/source/generic/bigint.cxx:501:18: error: conversion from 'int' to 'const BigInt' is ambiguous > *this *= 10; > ^~ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:58:5: note: candidate constructor > BigInt(sal_Int32 nValue) > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:66:5: note: candidate constructor > BigInt( double nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:67:5: note: candidate constructor > BigInt( sal_uInt32 nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:68:5: note: candidate constructor > BigInt( sal_Int64 nVal ); > ^ > /home/tdf/lode/jenkins/workspace/android_x86/include/tools/bigint.hxx:69:5: note: candidate constructor > BigInt( sal_uInt64 nVal ); > ^ Change-Id: I674b14c342ece3e170185b7ce2f34ccb8ff91c7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108186 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-12-24add sal*Int64 conversions to BigIntNoel Grandin
we have the capability, so lets use it Change-Id: Ie5aa7999bb457d274bbcc07ba5c4e6ee2f286df1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108231 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-24custom literal for Degree10Noel Grandin
Change-Id: Id13869138a622e62d9ffebf2c89bddccda6aff01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108238 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-20use CLZ intrinsic in tools::FractionNoel Grandin
which commonly maps to a fast hardware instruction. Change-Id: I65d6b4ce03a1813f014aa7ec7fc8f95aa38832d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108018 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-12-19speedup rational_FromDoubleNoel Grandin
multiplying/dividing by a power of 2 is much cheaper than the equivalent operation on a factor of 10. Change-Id: I31a7196a07649336378be867c67eb8a89fe6765f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108019 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-21Changes to the color classdante
Before colors could be only converted to string rrggbb. Now also supports RRGGBB. It can also be converted back into a color. Change-Id: Ifb89d554b434c243c4f0956ee680ec23de823339 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106224 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-20tools::Polygon::Clip() is broken with bezier curves (tdf#137068)Luboš Luňák
It preserves the points, but not the flags. Work this around by temporarily converting to B2DPolygon, where it works. Change-Id: I120264fbc4c7c508386f23a06435891199565aae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106188 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2020-11-18tdf#123936 Formatting files in module tools with clang-formatPhilipp Hofer
Change-Id: I0f66d02e67388cc4d21c5e96bf84b6848e8de63a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105721 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-18Reduce variable scopeMike Kaganski
Change-Id: Ie1adad9228c4eadbe0d314c0dc27057e84cd721a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106037 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-17Fix vcl_svm_test after making tools::Long 64-bit on _WIN64Mike Kaganski
Just don't rely on details of Point implementation. Change-Id: I0cd0d6b7cacbf2751803a854d78e4b099ccf197f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105978 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2020-11-17simplify BigInt, remove isSetNoel
no need for such a thing to be "nullable", just default it to zero, as one would be expect for such a type. Change-Id: Ic8b78ca3288355c90820135b9ced2c865ff7606e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105970 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-16Instead of labs, use overloaded absStephan Bergmann
...more likely to pick an appropriate version for the involved integer types, esp. after the recent long -> tools::Long changes Change-Id: Ia91259ca35aaf74b0e907de6831fc926f30057f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-13Revert "remove BigInt::operator tools::Long()"Noel Grandin
This reverts commit 1397a1c8e4995b0dd336478e564880fe8ad91d1d. Reason for revert: Some discussion required Change-Id: Id39ee8260790e0722c5bf8338b0b76ca34da83d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105539 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-12Simplify comparison operatorsMike Kaganski
Change-Id: I9f1b386ddb4d7d5377151c54baee207b2444c7d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105541 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-12remove BigInt::operator tools::Long()Noel
which was introduced in commit adf0738d2dbfa742d0e9ef130954fb4638a8e90d Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Jan 3 14:25:15 2018 +0200 long->sal_Int32 in BigInt presumably to make the conversion easier. Instead just fix the call-sites to select a better conversion, BigInt only returns 32-bits of precision anyway. Change-Id: I2e4354bcfded01763fe3312a715ef37800297876 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105602 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11Improved starmath colordante
Color.hxx has now documentation ( even if it is quite obvious if you know RGB standar ). Color.hxx has been reordered in more coherent order, but kept format. Some changes on Color.hxx dynamics. Color.hxx starmath colors list Now colors are managed by starmathdatabse. The path is open for simple addition of colors, there are no more infinite switches with color tokens here and there. To add a color, just put it in Color.hxx and register it in starmathdatabse.cxx. Do not forget to change array size in starmathdatabase.hxx. Now mathml supports RGB colors in #RRGGBB format ( import and export ). New colors have been added. Only the HTML Css1 are available via UI. New colors will be added. I intend to finish Css2 and dvipsnames ( latex colors ) on posterior patches. RGBA command has been unlocked for compatibility reasons. However will be displayed as RGB. Added color #RRGGBB. Improved qa color test on mathml to test RGB on mathml. TODO for someone on the UI team: - Add a color picker. - If it is a color with name: - It will add in the code "color " + starmathdatabase::Identify_Color_DVIPSNAMES( colorvalue ).pIdent +" " - If not: - It will add in the code "color " + starmathdatabase::Identify_Color_DVIPSNAMES( colorvalue ).pIdent +" "+ colorvalue.getRed() +" "+ colorvalue.getGreen() +" "+ colorvalue.getBlue() +" " - Note that those will habe eType with value TRGB or TRGBA. Change-Id: I47af37bd191b3099e8e6e08e7a5fb1a8a227bbf2 Change-Id: If971473ddcc34739439818dba9a62ca3494a4473 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-11make tools::Long 64-bit on Windows platformNoel Grandin
This is only for the 64-bit windows platform. I don't see the point in messing with the 32-bit platforms, they are (a) become more and more rare (b) unlikely to even have enough available process memory to load extremely large calc spreadsheets The primary problem we are addressing here is bringing Windows-64bit up to same capability as Linux-64bit when it comes to handling very large spreadsheets, which is caused by things like tools::Rectangle using "long", which means that all the work done to make Libreoffice on 64-bit Linux capable of loading large spreadsheets is useless on Windows, where long is 32-bit. The operator<< for tools::Rectangle needs to be inside the tools namespace because of an interaction with the cppunit printing template stuff that I don't understand. SalPoint changed to use sal_Int32, since it needs to be the same definition as the Windows POINT structure. Change-Id: Iab6f1af88847b6c8d46995e8ceda3f82b6722ff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-21new tools::Degree10 strong typedefNoel Grandin
partly to flush some use of "long" out the codebase, but also to make it obvious which units are being used for angle values. Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-10-19add tools::Long typedef and use it in toolsNoel
first step to switching long to a 64-bit type on 64-bit windows Change-Id: I640d807426dfe713c7a8984ef560575f8288dbeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104516 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-06loplugin:flatten in toolsNoel Grandin
Change-Id: I6e5c07f4e63b949afb8c259d623a0711a86db021 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100188 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-02Upcoming improved loplugin:staticanonymous -> redundantstatic: toolsStephan Bergmann
Change-Id: I832fbcde277a87ab873ce3477a6886c7002e24ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97709 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-01loplugin:constantparamNoel Grandin
Change-Id: Ie9d4761747f7e97f63f34394b5a8b9f0bb287a0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97528 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-10new loplugin:simplifypointertoboolNoel Grandin
Change-Id: Iff68e8f379614a6ab6a6e0d1bad18e70bc76d76a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91907 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-20add tools::Rectangle::JustifyNoel Grandin
so rectangles can be constructed already valid Change-Id: I3ae5e24add3c81f79dcdf863f855dca439876f11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92521 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-17loplugin:buriedassign in tools..xmloffNoel Grandin
Change-Id: I31df6c4fd82c6f6d15bbe5228e92e5171cacba51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92410 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-12-11Fix typosAndrea Gelmini
Change-Id: I89ff5493c70d6e64ee6ab65b1b789a0db543c0aa Reviewed-on: https://gerrit.libreoffice.org/84917 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>