summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2022-01-31jsonwriter: ensure correct number of bytes is availableSzymon Kłos1-2/+37
In some functions author forgot that addCommaBeforeField() can add additional two characters. I didn't change cases where more bytes than needed are requested. Additional change is that in debug mode there is a marker at the end of allocated buffer - we check that after every write to detect overflow. No need to request more space for a marker as we always allocate "needed size * 2". Change-Id: I28066797b0ba833e408b0a731abc01b7fd989da3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126535 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129163 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2022-01-23Improve DBG_UNHANDLED_EXCEPTION output a bitStephan Bergmann1-1/+2
For example, in de3898aecb11307789644a1814e9cbb1ee4cc29b "Add missing test dependency" it would have output > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: "URL at svx/source/unodraw/unoshape.cxx:1600" rather than > warn:svx:680849:680849:svx/source/unodraw/unoshape.cxx:1779: DBG_UNHANDLED_EXCEPTION in setPropertyValues exception: com.sun.star.beans.UnknownPropertyException message: URL svx/source/unodraw/unoshape.cxx:1600 making it slightly clearer that what follows "URL" is not the value of that URL but rather the source location where the exception was thrown. Change-Id: Ia3abd232fce3d95a8b66ff4ed5bab2fcc248df2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128788 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-01-15tdf#146754: consider xyz:123 as host:port when parsing URLs smartMike Kaganski2-2/+55
... rather than scheme: and path. Change-Id: I9a48310b585b8fa3e31635f877a91f1560b065f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128457 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-01-10use less SvStream::Flush()Noel Grandin3-11/+5
Flush() turns into a sync() on the device, which is pretty slow. Most of the time all we actually want to do is to flush the internal buffers from the SvStream. So expose the FlushBuffer method and use that where possible. And also means we don't need the mbDontFlushOnClose flag on SvStream any more. Change-Id: Ibe089b88b325f0fdc565200a97ce72cd26b7fcfb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128214 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-02Introduce OUString::unacquired(const OUStringBuffer&)Mike Kaganski1-4/+2
... and avoid OUStringBuffer::toString when the temporary is used for checking current buffer content Change-Id: I114178f3e74ca3e4a3e517763f9eaab4797b7deb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127478 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-27osl::Mutex->std::mutex in lockFileNoel Grandin1-5/+5
Change-Id: I5ebd56741568ecd25677af57e8c91389c69ddaad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127596 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-12-26Avoid OUStringBuffer::toString where possibleMike Kaganski1-2/+2
Change-Id: I99abbe97a48b2077e28d6221fb70036e5e412657 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127479 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-25Simplify INetURLObject::parseHostOrNetBiosName a bit moreMike Kaganski1-11/+9
Change-Id: Ie22e7a142aabd2c0f12c34945ad0858f5bd868a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127451 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-24Simplify INetURLObject::parseHostOrNetBiosNameMike Kaganski1-54/+37
Change-Id: I18818e89b2e6f0ef203caa51ba554c281753d3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127383 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-24Use rtl functions instead of own surrogate checking/combiningMike Kaganski1-27/+1
Change-Id: I3eb05d8f5b0761bc3b672d4c855eb469f8cc1a29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127375 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-12-24tdf#146382 cant open file from Explorer-attached remote locationNoel Grandin2-0/+12
problem spotted by mikekaganski regression from commit 0b46361ef84a61100a0274a007062317607d097a Author: Noel Grandin <noel@peralex.com> Date: Sat Nov 20 08:03:49 2021 +0200 tdf#133835 speedup calc autofilter (4) where I changed the behaviour of parseHostOrNetBiosName from overwriting the destination buffer to appending to it. Change-Id: I1bd3c7eade035a867c026364f5e114c1e652ca32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127352 Tested-by: Gabor Kelemen <kelemeng@ubuntu.com> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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>