summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2021-12-10Make BOM detection slightly more straightforwardMike Kaganski1-32/+34
Without taking system endianness and current stream endianness into account - just read and check single bytes. Change-Id: I9273d8f403caad7adb5e11cecc04e326919dad1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126595 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-06tdf#128715 fix tools::Time::GetMonotonicTicks() on 32-bit linuxUrja Rannikko1-2/+3
Since time_t and thus tv_sec is (still, for now) 32-bit on these architechtures, the multiplication of seconds to microseconds happened in 32-bit thus causing a rollover roughly every 4295 seconds. Fix by casting tv_sec to sal_uInt64 before the multiplication. Also fixes tdf#144975. Change-Id: I829d3406208545a816979cb58daaeb99ec2d5294 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126379 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2021-12-01Fix typosAndrea Gelmini1-1/+1
Change-Id: I5e41be3f7e650db0019bcd42a3c1c2cb3bc5dd0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126155 Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2021-11-29tools Color: implement MSO-style luminance modulation/offset filterMiklos Vajna2-0/+45
To be used when a filtered theme color will be applied on the UI, and not at PPTX import time. Change-Id: Ifb56e38e59b529ef436063c407ee156d76a77f9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126011 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-11-26speed up Fraction::operator*= a littleNoel Grandin1-6/+15
for my test spreadsheet this reduced the time spent in Fraction by 30% Change-Id: Ib14a93284dbd6c6ea2349c1754979135463ca61b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125878 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-26tdf#133835 speedup calc autofilter (10)Noel Grandin1-20/+22
Remove more temporary buffers in INetURLObject::setAbsURIRef Change-Id: I3c5430937e3365a15b396504226d3bbdd39c4cc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125668 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-24Fix typos and translationsAndrea Gelmini1-1/+1
Change-Id: Ic358f008e09718b6f726a55edfe3a3f78bba2942 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125728 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2021-11-23Use proper type for OUString length variablesStephan Bergmann1-3/+3
Change-Id: Id116ed42c553bb6524876288ca0066be4a4a1820 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125694 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2021-11-23Add test for INetURLObject::changeSchemeStephan Bergmann1-0/+18
Change-Id: I84497ee93e30b639199bbbb958ac1b2c758db50c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125693 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-23O[U]String::replaceAt overloads that take string_viewNoel Grandin1-1/+1
which results in lots of nice string_view improvements picked up by the plugins Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-23avoid OUString temporary in INetURLObject::changeSchemeNoel Grandin1-4/+2
Change-Id: I8a97c1d89770fe2c0ba0d3f75ce9f3fec0df2e53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125692 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-23tools: fix INetURLObject::changeScheme()Michael Stahl1-4/+5
(regression from dc2010964fb8d18d5c4fe96172ee082276a1e587 which broke JunitTest_ucb_unoapi) Change-Id: I14a79c3b7d1161234da64822186bcf97d4022264 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125671 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-22tdf#133835 speedup calc autofilter (9)Noel Grandin1-48/+46
Remove the temporary buffer in INetURLObject::setAbsURIRef, and just write directly to the main buffer. This is a behaviour change since we are "committing" bad data to the buffer if the URL is incorrect, but since it that case we set the whole object to be invalid, that should not matter. Change-Id: Ic8e7d4027bcb927005edd7de4098f4f525412869 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125648 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-22tdf#133835 speedup calc autofilter (8)Noel Grandin1-1/+1
Add move operator to OUStringBuffer to avoid copy Change-Id: Ifef326449d87aac79f4b1142db7a53faad427580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125626 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-22tdf#133835 speedup calc autofilter (6)Noel Grandin1-19/+19
INetURLObject::SetPort Avoid allocating temporary string on heap, saves 20% Change-Id: I61ba4bd80c561266341143e35650b54b9d70f1d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125624 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-21tdf#133835 speedup calc autofilter (5)Noel Grandin1-44/+73
Tweak INetURLObject to reduce the number of OUString and OUStringBuffer we create, saves 5% And add a asView() method to OUStringConstExpr, to make it easier to pass to OUStringBuffer::insert Change-Id: I115ec2398cfc8df39bd1efbbd5f0d5cc9712dba7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125600 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-21tdf#133835 speedup calc autofilter (4)Noel Grandin1-57/+101
Tweak INetURLObject::parseHost so it doesn't need its own OUStringBuffer, and can just use the callers' Saves 5% Change-Id: I481fabd4272bc9f172dd751a7019090b95a65e2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125599 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-20tdf#133835 speedup calc autofilter (3)Noel Grandin1-34/+32
Tweak INetURLObject::parsePath to avoid an OUStringBuffer copy, saves 5% Change-Id: I49eff3443f34971b8ce15f4c1ab6c9395ee0690f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125565 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-19Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversionsMike Kaganski3-3/+3
Change-Id: Ib89b00c3dc8cd440e8a88906eea133becd1cef64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125509 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
2021-11-19Drop F_2PIMike Kaganski1-2/+2
Change-Id: Ie98606607b2ce262e4eed76bb8cd86fbfe846f76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125506 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-19Use M_PI* instead of F_PI*Mike Kaganski1-3/+3
Change-Id: Ie2b7a1c74fc516781a17a20157b8217bc41e383d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125504 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-11-19rtl::Static->thread-safe static in toolsNoel Grandin1-4/+7
Change-Id: I6c45fc533ec6281d011282bf2e8d49f23e2c29e6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125494 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-31Prepare for removal of non-const operator[] from Sequence in toolsMike Kaganski1-18/+18
Change-Id: Ifff56df8da9b0b9e4d4e96d6b09f490807e96f52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124402 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-29Let's assume this is a bogus warningTor Lillqvist1-2/+0
Change-Id: I3941d8b1811d34b2b7646b20bc7e91c9034770be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124427 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-10-28-Werror,-Wunused-macrosStephan Bergmann3-0/+6
(when e.g. building natively on macOS ARM64) Change-Id: Ibff6f913a6251573058c52a8b4106233fad1d443 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124322 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-27CPU-specific files should not include templates or inlinesLuboš Luňák3-16/+16
Otherwise the possible copy emitted compiled with CPU-specific instructions might be chosen as the copy to keep and would be used by generic code. See history for the Calc Kahan code. Change-Id: Ifc1bbd8d9720d9effe05b8ff8ee5e804363939df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124257 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-10-14use std::vector::insert instead of push_backNoel Grandin1-4/+2
because it will pre-allocate space and often is optimised to memcpy Change-Id: I03ed7915f2762d3d27e378638052a47a28bbf096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123588 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-14Simplify JsonWriter a bitMike Kaganski1-13/+16
Move ensureSpace code to json_writer.cxx, and merge with reallocBuffer. The methods are private, and are only used in methods in the same .CXX, so the code will get inlined as compiler decides anyway, but becomes simpler. Make extractDataAs* to consider the known size of the data, to avoid calculating null-terminated size. To do that, the code is moved from extractData to private extractDataImpl, which returns both pointer and size. Change-Id: I7c0e425b5c584089c6e866c31d4cfdb5e242d66b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123568 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-13Improve JsonWriter's escapement codeMike Kaganski1-56/+79
It should now be conformant to JSON spec; and additionally, it escapes two characters that are valid in JSON, but invalid in JavaScript (as described in [1]). [1] http://web.archive.org/web/20201203234157/http://timelessrepo.com/json-isnt-a-javascript-subset Change-Id: I1081ade89a57fefefde672f2b8fa08e97627fc50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123510 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-13Unify JsonWriter::put and putRaw a bitMike Kaganski2-58/+8
In the process, it turned out that there was unnecessary conversion of OStringBuffer to OString and back to OStringBuffer when using putRaw, which is avoided now. Change-Id: I1e3ee685679df0b025bee8f4430624ee5bc9ccb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123547 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-11In O[U]StringBuffer, make string_view params replacements for OUString onesStephan Bergmann1-24/+18
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That way, loplugin:bufferadd and loplugin:stringviewparam found many further opportunities for simplification (all addressed here). Some notes: * There is no longer an implicit conversion from O[U]String to O[U]StringBuffer (as that goes via user-defined conversions through string_view now), which was most noticeable in copy initializations like OStringBuffer buf = someStr; that had to be changed to direct initialization, OStringBuffer buf(someStr); But then again, it wasn't too many places that were affected and I think we can live with that. * I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to get them in line with their counterparts taking O[U]String. * I added an OUStringBuffer::lastIndexOf string_view overload that was missing (relative to OUStringBuffer::indexOf). * loplugin:stringconstant needed some addition to keep the compilerplugins/clang/test/stringconstant.cxx checks related to OStringBuffer::append and OStringBuffer::insert working. * loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea "loplugin:stringviewparam extend to new.." Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-10-02fix buffer overruns in JsonWriter::put with UTF-8 valuesNoel Grandin1-3/+8
Change-Id: I694585a1a540bfefc0e59bd58d8033a96ca35acb Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122996 Tested-by: Jenkins
2021-10-02simplify JsonWriter::reallocBuffer by using reallocNoel Grandin1-4/+1
instead of malloc and copy. spotted by mmeeks Change-Id: Ibac83be597cfaf61f783a265562c5102bbaf29d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122995 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30loplugin:constmethod handle more casesNoel Grandin1-1/+1
remove some of the naming limitations, and handle pointer parameters better. I only let the plugin run up till vcl/ Change-Id: Ice916e0157031ab531c47f10778f406b07966251 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-30no need to copy the name in XmlWalker::attributeNoel Grandin1-3/+2
sName and the parameter we pass to xmlGetProp are both null-terminated char strings Change-Id: Ia8cb036f33cada8fa59d1e4f05df318a9cf28115 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122875 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-20clean up ambiguous confusing rectangle APIs like IsInside()Luboš Luňák4-15/+30
Reading 'rectA.IsInside( rectB )' kind of suggests that the code checks whether 'rectA is inside rectB', but it's actually the other way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(), which should make it clear which way the logic goes. Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> Tested-by: Jenkins
2021-09-17ensure that some basic geometry classes are trivially copyableLuboš Luňák1-0/+7
They in practice are, since they are just integers, but SwRect had explicit implementations of some functions that technically prevented SwRect from being considered trivially copyable, even though they were identical to default implementations. Change-Id: Ib5086dcd5279f3b4c0c530535c91524671cc6656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122213 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2021-09-16Revert "speedup rational_FromDouble"Noel Grandin1-5/+5
This reverts commit 67d83e40e2c4f3862c50e6abeabfc24a75119fc8. because it causes less accuracy sometimes, eg. see https://gerrit.libreoffice.org/c/core/+/122186 Change-Id: I06eb4921359a8fe6689c6cfd3e2967e25b646fa3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122124 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-15No need to check if nDX is 0 for atan2Mike Kaganski1-1/+1
We rely on IEEE floating-point arithmetic anyway, and then even both arguments equal to 0 do not result in an error. Even if it was different, it would be better to check id both nDX and nDY are 0, and return 0 early. It was so ever since "MWS_SRX644: migrate branch mws_srx644 -> HEAD" commit fd2cf3dc7cd9c73070fa4d70c8ca99c9fc1ce135. Change-Id: I5b8e2a359374dd1500b149d74eba4c0b0e5cd8d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122115 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-09-10clang:optin.performance.Padding in toolsNoel Grandin1-3/+3
Excessive padding in 'class tools::JsonWriter' (15 padding bytes, where 7 is optimal). Change-Id: I7e37eec095d935a344b2e5fea7bb108ee878472a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121920 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-06tdf#144319 fix formula loadNoel Grandin1-0/+3
regression from commit 67d83e40e2c4f3862c50e6abeabfc24a75119fc8 Author: Noel Grandin <noelgrandin@gmail.com> Date: Sat Dec 19 13:25:53 2020 +0200 speedup rational_FromDouble Change-Id: Icb728b63f950e827f1492087114f927c2f85ddb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121719 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-06clang-tidy:readability-redundant-member-initNoel Grandin2-6/+3
Change-Id: I8590d67f064dd74da42c0e3bf543f2aadbd2b893 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121693 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-26tdf#142307 - Upgrade SSE2 sum to AVX512 sum with Neumaier 1dante1-0/+5
This part focuses on allowing it on replacing arrayfunctor By thefault it will try AVX512F (1,17%) If not available will use AVX (94,77%) Use of AVX2 (82,28%) has been avoided even if the code could been more compact Source of hardware statistics: https://store.steampowered.com/hwsurvey Change-Id: Iae737a565379e82c5f84f3fdee6321ac74f59d40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115675 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-17Fix o3tl::convert for Rectangle, to operate on right/bottom valuesMike Kaganski1-0/+24
... instead of using confusing/ambiguous size having two interpretations. This reverts some of the unit test changes made in commit fa339b3adb53300ae68913bed87e18caf9f2e262. Change-Id: Ic56417703e32c1d92bcee76ad8ff494824bd4a1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120564 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-17Rename SaturatingSet[XY] to SaturatingSetPos[XY]Mike Kaganski1-2/+2
... to align with commit 4639ca2f878b04ffc50d9c20d92e90464d2d67a7 Change-Id: Ibec7a451a61ca7f2d141a9624369a6f9656ed468 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120562 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-17Simplify and inline tools::Rectangle::JustifyMike Kaganski1-9/+0
Change-Id: I535fb70fa532d98542ac30e0b2053bdaa6b94383 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120494 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-17Fix ctor taking Point and Size, to properly handle regative sizesMike Kaganski1-0/+11
(alinged to SetSize) Change-Id: I123a584ead91faae0fec4d25938529b2d68e4a3c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120559 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-16Rename setX/setY to SetPosX/SetPosY, to align with SetPosMike Kaganski2-16/+2
Change-Id: I856194f26fefad993f416d7b92b57a9417a3c0a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120546 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-16Drop tools::Rectangle::getX/getY, which are just duplicates of Left/TopMike Kaganski2-3/+3
The change allowed to simplify many places where previously this API was used, to avoid inefficient calculations (e.g., moving rectangle keeping its size, and then immediately changing the size). Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-08-15Simplify tools::Rectangle a bitMike Kaganski1-36/+18
1. Simplify/delegate ctors 2. Simplify getWidth/getHeight 3. Simplify expand 4. Simplify operators += / -= / + / - Change-Id: I023aa1bb2905394fbbd29adc7c544d629f9ae2d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120476 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>