summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2022-09-14move ErrCode to comphelper and improve debug output stringNoel Grandin
need to move it, because modules "below" vcl want to use the debug output method Change-Id: Ibcaf4089a1e0b3fcc0b5189c7ebf1aae90f50b48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139791 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-30ofz#50761 Integer-overflowCaolán McNamara
Change-Id: I8681e7b1b128e7ca33142b7120ad2d4bb3227493 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139019 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-28cid#1500491 silence Untrusted loop boundCaolán McNamara
Change-Id: I508337b8a8482b5aaa056a564a0dfa39cbbb4b56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138943 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-24tools: test Rectangle::Normalize()Chris Sherlock
Change-Id: Ia3fec45b2b6dd0011910c8db5819e161485336c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138713 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-24tools: rename Rectangle::Justify() to Rectangle::Normalize()Chris Sherlock
Jusify() normalizes the rectangle so both the Width and Height are positive, without changing the location of the rectangle. It ensures that the x and y coordinates will be moved to the top left of the rectangle. The name is strange, so renaming Justify() to Normalize(). Change-Id: Idbf163e65e52a798e38f785b8961b8042cf0cf2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137379 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-18Move tools/diagnose_ex.h to comphelper/diagnose_ex.hxxStephan Bergmann
...so that its TOOLS_WARN_EXCEPTION can be used in comphelper/source/misc/logging.cxx in a follow-up commit. (And while at it, rename from diangose_ex.h to the more appropriate diagnose_ex.hxx. The comphelper module is sufficiently low-level for this immediate use case, so use that at least for now; o3tl might be even more suitable but doesn't have a Library until now. Also, for the immediate use case it would have sufficed to only break DbgGetCaughtException, exceptionToString, TOOLS_WARN_EXCEPTION, TOOLS_WARN_EXCEPTION_IF, and TOOLS_INFO_EXCEPTION out of include/tools/diagnose_ex.h into an additional new include/comphelper/diagnose_ex.hxx, but its probably easier overall to just move the complete include file as is.) Change-Id: I9f3222d4ccf1a9ac29d7eb9ba1530d53e2affaee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138451 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-18cid#1500387 alternative silence Resource leakCaolán McNamara
This reverts commit d40bfecddcac38006ee989d8072fb2b453cf6b9f for a different approach Change-Id: I8e058efbff214456b91346ce16e7eba7a89a8a53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138480 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-17cid#1500387 silence Resource leakCaolán McNamara
Change-Id: I847e2be95ad0c56246279e25ac3081967f8f6855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138393 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-16cid#1509285 Use of 32-bit time_tCaolán McNamara
Change-Id: I5aea4aaa6da8cd974234ab3f0c36212d436e11df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138332 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-13tdf#145614 Convert #define to constexprehsan
Change-Id: If783e2fbb65cae8e9c79ad9718f344dedf9dfe4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135074 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-08-09tools: json writer test does not need to use test::BootstrapFixtureChris Sherlock
Change-Id: Iea7fa63ca7a3208d065ac2960998041672fc8d7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136231 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-08-09tools: prefix member variables with an 'm'Chris Sherlock
Also updated debug pretty-printers Change-Id: I5204bb8f1c6a47677ad3c49d6579c090ea69aedc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137388 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-07-18tools: try to work around DavGetHTTPFromUNCPath() not URL-encoding pathMichael Stahl
This was added in commit 20b1e6440aacab043753e93be4499e939a80b05b "tdf#126121: WebDAV redirection detection" and it works fine when i test it on my local Windows 10, returning an URL with encoded path. The logs from the customer system however show a http URL containing an unencoded ' ' in the path, which curl_url_set chokes on. Try to encode the returned URL with rtl_UriEncodeKeepEscapes, which should hopefully work in either situation. Change-Id: I6862fe0828307a13b0004b192153747d85bb3a42 (cherry picked from commit 66e25aad35cf538da86bdd0157428f4bed95258d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137173 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2022-07-12use a read-only stream when reading graphic dataLuboš Luňák
EmbeddedObjectRef::GetGraphicStream() creates a writable SvMemoryStream, read the graphics data into it and then returns the stream, which will be afterwards used to decode the graphics. But if the data is broken, incorrect seeking may cause a seek way past the buffer, and since the stream is writable, it would be done and cause problems such as running out of memory. The VersionCompatRead class is one such place that reads size from the stream and then seeks based on the read data. Add SvMemoryStream::MakeReadOnly() that will change the stream to be read-only after the initial read of the data into it. Change-Id: I1d44aabaf73071a691adafa489e65e4f5e3f021d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137002 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-07-11tools: rename getHeight/Width() to GetOpenHeight/Width()Chris Sherlock
By default Rectangle uses closed interval, if we really want to use half open intervals then we should specifically say as such in the name. Change-Id: Id7a91120ba1a1a4bc330014216b73a692dbf03a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136575 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-06-20elide some makeStringAndClear() callsNoel Grandin
Change-Id: I4420042f7c8fdf743b888d6f7c1c0d2d3e0b877e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136184 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-18cid#1506306 Uninitialized scalar fieldCaolán McNamara
Change-Id: I2daf370dc68dff19f1be538744d7241c080d8149 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136077 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-06-18o3tl: ensure that the initializer of enumarray contains enough elementsMichael Stahl
Currently this silently succeeds. Turns out oox already contains some too-short initializers, let's guess the missing properties are all invalid. One downside of the templated parameter pack approach in the enumarray ctor, as witnessed in vcl/win/window/salframe.cxx, is that argument types can no longer be implicitly deduced and thus need to be spelled explicitly now in certain cases. There were also three uses of enumarry with V being unsigned short (aka sal_uInt16) that started to cause narrowing conversion errors now and needed to be adapted: In editeng/source/uno/unonrule.cxx the obvious fix was to use the proper type for V. In sw/source/core/unocore/unosett.cxx with its odd mix of saL_Int16 and USHRT_MAX, lets keep things that way for now (probably awaiting later clean up) and use casts to avoid the implicit narrowing. And in sw/source/filter/ww8/wrtw8esh.cxx the ESCHER_Prop_* values, while presumably conceptionally of type sal_uInt16, are plain #defines (thus of type int), so rather than changing V to int it looked more consistent to explicitly cast the ESCHER_Prop_* vlaues to sal_uInt16. (And in tools/source/fsys/urlobj.cxx the poor loplugin:redundantfcast started to unhelpfully kick in for (only) the first argument now.) Change-Id: If06c29e673ec7e565e283c6f447889cf1f777cb7 Co-authored-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135970 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-17Rectangle: split SetSize into SetWidth/SetHeightJan-Marek Glogowski
... and inline the functions. Change-Id: I9285c72e8524f8f0a2d242bfd4cd29edf6d1ed73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135811 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2022-06-15Add unit tests for ZCodecofftkp
Add unit tests that check compressing->decompressing a file should result in the same file. This is done by comparing the CRC32 before and after. The same tests also implicitly test that compression/decompression works by checking the return value of ZCodec::EndCompression. Cases added for both mbGzLib=true/false. Change-Id: I5516760eba5f233c20331cef83fd0b1a1603373f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135233 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-06-12Add compression support for GZ through ZCodecofftkp
ZCodec uses zlib to deflate. That file has code to allow for compressing to GZ but it's wrapped in defines. There's places in code where there's need for zlib headers (ie. svx/source/gallery2/codec.cxx:71) and there will be need for gz header compression when EMZ/WMZ/SVGZ export support is added. Made compression functions care about mbGzLib bool. Also added a SetCompressionMetadata function to set metadata which are otherwise impossible to know (such as filename, which is needed in the header) Change-Id: Ic01050262b0b15e0632564b139c66656afac4611 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135213 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-06-03Use more appropriate type for MultiSelection::nCurSubSel et alStephan Bergmann
(In MultiSelection::LastSelected, there is no need to set nCurSubSel (to a potentially negative value) before setting bCurValid to false, as nCurSubSel is only ever used after checking that bCurValid is true.) Change-Id: I3c23c89fbb7b4ef962436476f6576af9fe623fd0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135354 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-30tdf#147021 Use std::size() instead SAL_N_ELEMENTS macroRoman Kuznetsov
Change-Id: Id91ca2d7002b3743ecaed7b40edda3f85e080884 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135061 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
2022-05-24no need to call makeStringAndClear hereNoel Grandin
we are passing it to a u16string_view arg Change-Id: Ieef467fde2acccedf41381e97e93034fffceca22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134873 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-24no need to call makeStringAndClear hereNoel Grandin
we are passing the OUStringBuffer to a method that takes a u16string_view, which means makeStringAndClear() is wasted effort Change-Id: Ib8012f06f18508351d04d5f61cdc032a051faa84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20elide temporary OUStringBuffer in INetURLObjectNoel Grandin
which requires a version of replaceAt for OUStringBuffer, which I'll put in comphelper::string:: for now Change-Id: I70b319b018e29a7dac26965dd92f6c4f9ea470ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134679 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-16no need to stat a dir when opening a temporary fileNoel Grandin
it can never be a dir Change-Id: Ib1c234cb20387cd075a19e13e6656738be88716b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134397 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13add SvStream::ReadLine(OStringBuffer... to reduce OString allocationNoel Grandin
and use it where possible Change-Id: I3efc7a642f73661ce606c917c0323ba9948521c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134265 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-13sw content controls, dropdown: add LOK APIMiklos Vajna
- expose the available list items in a new "items" key of the LOK_CALLBACK_CONTENT_CONTROL callback - add a new lok::Document::sendContentControlEvent() function to be able to select a list item from the current drop-down - add a new listbox to the gtktiledviewer toolbar to select a content control list item when the cursor is inside a dropdown - add tests for the array API of tools::JsonWriter Change-Id: I47f1333a7815d67952f7c20a9cba1b248886f6dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134256 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2022-05-07This condition is apparently fatalStephan Bergmann
...as mnPoints is the size of mxPointAry (see also 323df76698be1e554ba3342f56a812517a25437a "Revert 'tdf#147919 PPTX export: fix curved and bent connector shape'") Change-Id: I10b9c6bd25bc88754d2d52e851c3871621b0d517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133980 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-06tdf#103954: Z compressed graphic formats support for EMF/WMFofftkp
- Added .emz and .wmz file opening support - Added a function to check for Z compression that all z comp. formats can use - Added 3 unit tests for emf/emz/wmz files and the example files have been checked with a different tool (File Viewer 4) - emf/emz file detection changed from magic byte checking to extension checking, like wmf/wmz does Change-Id: I3e433fd23d18482648a51cd04b8f467368e97b62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132456 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-05-03Adapt Base64::decodeSomeChars to change from OUString to std::u16string_viewStephan Bergmann
...in 9c95415de877af1430ab5b7123e11dedd0ea622c "Let comphelper::Base64::decode* take std::u16string_view" Change-Id: I42b1552fba80568b422cb60ccc99a7ab8664f2d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133711 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-01use more string_view in variousNoel Grandin
found by examining uses of OUString::copy() for likely places Change-Id: I6ff20e7b273ad6005410b82719183c1122f8c018 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133617 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-29use more string_view in INetURLObjectNoel Grandin
Change-Id: I4462f7cf4740fa4d1b129d76a0775f4250f41bbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-28use more string_view in tools::INetMIMENoel Grandin
Change-Id: I3bfa5a1402835c21ec70b8d995f79a2edaa6577d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133549 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-28use more string_view in tools::SvGlobalNameNoel Grandin
Change-Id: I814744d250d6ce0ec7049daf215a506adb4f1ac5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133548 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-28use more string_view in tools::ColorNoel Grandin
Change-Id: I0203aff3af19d3994af5325538520469ab2900ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133541 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-27use more string_view in toolsNoel Grandin
Change-Id: I15ca12f35a66994cb90a0ccf60a1ce0f8efcfecc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133459 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-26add o3tl::toUInt32Noel Grandin
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-25use string_view in CompareProtocolSchemeNoel Grandin
Change-Id: I3584042d0341d5c1b4f4e742e25e9eb0aa26f1da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133378 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-12include OutputDevice MapMode in SalLayoutGlyphsCache key (tdf#148400)Luboš Luňák
The mapmode also affects the layout of the glyphs. Change-Id: I9492bc4d3d9e991ef8ab5dc30ce424e44cbc79f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132822 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2022-04-05Fix typosAndrea Gelmini
Change-Id: Ifed6fa039466e580d911af91288c4a37bce08aae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132560 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2022-04-05add tools::Guid class to generate, parse GUID valuesTomaž Vajngerl
Change-Id: Ie4d8fad4d8f22c8277c22c21b7a9eb3e7c9e4f1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132513 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-04-02Recheck modules t* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I109fa07d52721fd10354de07a2ed995ffa2f27c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132369 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-03-31tdf#148253: fix matching algorithmMike Kaganski
Using 'flag' as a "continue the loop" marker allowed to continue processing wildcard after its last character - not crashing because it was a subview of a larger string with separators, but failing the match. Change-Id: I308058b68c59d5719f3c8b5f5656998a95a9ba09 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132336 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-03-20add system-libfixmathRene Engelhard
Change-Id: Ia0bd884d6fefde77c75889bf2ea831ebf1b401cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131876 Tested-by: Jenkins Tested-by: René Engelhard <rene@debian.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: René Engelhard <rene@debian.org>
2022-03-19reduce down to the part and config we are using and move to toolsCaolán McNamara
Change-Id: Ifaddc59c3c7834808d368c138a5ec7c0b80db14c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131850 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-13ofz#45527 detect too many points earlierCaolán McNamara
Change-Id: I7716ca8b9de9312bcaabf1d16e60dbac7ae87e52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131492 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-13pass reference to the target vector insteadCaolán McNamara
no logic change intended here Change-Id: I680914a6a41cceab41f68456e98de5f3b4a8a639 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131491 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-03-12no need to temporary OUString hereNoel Grandin
Change-Id: Iffd95fcf4fd1f9aac0ba77effc3c63eedce69adf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131412 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>