summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2023-11-07warn about exotic protocols as wellCaolán McNamara
Change-Id: I50dcf4f36cd20d75f5ad3876353143268740a50f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151834 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-06tdf#146619 Recheck include/t* with IWYUGabor Kelemen
Change-Id: I005257e458351285b1b35ffe49c8b42834a6db68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156990 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2023-11-03add some protocols that don't make sense as floating frame targetsCaolán McNamara
Change-Id: Id900a5eef248731d1184c1df501a2cf7a2de7eb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158910 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-11-01tdf#157820: handle \\?\ prefixes in INetURLObjectMike Kaganski
They are already handled in osl file URL functions. Change-Id: Id0c224bdb79963e7ce52abde57bf05b0a6a81ff5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158741 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-10-23tdf#130924 replace '*printf' with 'SAL_*' logging macros in toolssahil
Change-Id: I9721bfd3783fd6c5d41b2d9a0e8468c583ede0c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156864 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2023-10-20Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: toolsStephan Bergmann
Change-Id: I930c794c6f93531ef8d2b91c5e6ad62b486966dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158245 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-18Clean up the remaining uses of OUStringConstExpr, and drop itStephan Bergmann
Change-Id: I30b2ac77b58e2ae1d1e997a0c830c513542b973d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158101 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-15Repurpose loplugin:stringstatic for O[U]String vars that can be constexprStephan Bergmann
...now that warning about O[U]String vars that could be O[U]StringLiteral is no longer useful Change-Id: I389e72038171f28482049b41f6224257dd11f452 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-07loplugin:ostr: automatic rewriteStephan Bergmann
Change-Id: I2d09b2b83e1b50493ec88d0b2c323a83c0c86395 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157647 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
2023-10-05Drop MinMax in favor of std::clampMike Kaganski
Change-Id: I021f524b232ddbe091981444d859d35dd9cd05ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157582 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-08-03Resolves: tdf#127334 Increase tools::Duration accuracy epsilon unsharpnessEike Rathke
... when converting from double, i.e. to 300 nanoseconds. Empirically determined.. Change-Id: I92c43b5f244923363af5d44bece9c155126ca343 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155324 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-08-02split Point/Size/Rectangle into AbsoluteScreenPixel* typesNoel Grandin
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-07-27Check / adjust the correct variablesMike Kaganski
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-22no need to create OString temporaries when calling XmlWriter methodsNoel Grandin
Change-Id: Ief1101c55a0635dac43a7c4d66dd4ed0d5be70bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154764 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-22avoid some unnecessary string copies in tools::XmlWriterNoel Grandin
Change-Id: I5844a878f3e1d85956eae828e9093b2fd1f5a275 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154757 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-16cid#1537992 deadcodeJulien Nabet
since 16b0da38515467bf1819ccd88027934481cc5727 jsdialog: encode properly control characters Change-Id: Ic447a819d3d0b3f9ff66e00f0b05a037ec53a9cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154488 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2023-07-13linking: api: use JsonWriterSzymon Kłos
Change-Id: If5bf1897f1aef8db1672789cbee14b90cb96dc08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151959 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154378 Tested-by: Jenkins
2023-07-06make tools::Poly*gon single-arg constructors explicitNoel Grandin
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-04jsdialog: encode properly control charactersSzymon Kłos
according to https://www.rfc-editor.org/rfc/rfc7159#section-7 strings in JSON should contain control characters (0x00-0x1f) encoded as \uXXXX Signed-off-by: Szymon Kłos <szymon.klos@collabora.com> Change-Id: I1f828f64e57328b5fa2dcf5853afe0d6ea643081 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152262 Reviewed-by: Attila Szűcs <attila.szucs@collabora.com> Tested-by: Attila Szűcs <attila.szucs@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153946 Tested-by: Jenkins
2023-06-27Fix typoAndrea Gelmini
Change-Id: I8dee1f762a39b21e88609d1d108846623d0b8bc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153207 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-23Introduce tools::Duration individual time values ctorEike Rathke
Change-Id: I516d3727cbcf6667b32dc963febbf4b753ef6a91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153497 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-23Clamp and assert maximum hours value in Time::init()Eike Rathke
Change-Id: Ia777222f3c797b90663b55499a57025e410b1d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153407 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-22Introduce tools::Duration(sal_Int32 nDays, const Time& rTime) ctorEike Rathke
Change-Id: If002e04536149b49b2249103ac914d17dec3fae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153409 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-21Change DateTime friend operator-() to return tools::Duration instead of doubleEike Rathke
Change-Id: Ica69b1a8916c73443d9ec91dd35ed126fcf97151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153392 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
2023-06-21rbOverflow was already set for bBadNS, unnecessary to set it againEike Rathke
Change-Id: I26e32b25b53be590bc24646803c7442385ec4d3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153393 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-21Introduce double DateTime::Sub() as a substitute for friend double operator-()Eike Rathke
Change-Id: Idb93b3e9b4dcbd09ad7f4253a523fe5be24d0776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153354 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-20Use tools::Duration in friend double operator-() if DateTime has Time setEike Rathke
Change-Id: Iff3e2aad596fdfd1530c46cdeff28b44e5142517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153327 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-06-19Fix TB Jenkins_Linux_Ubsan (duration.cxx)Julien Nabet
/tools/source/datetime/duration.cxx:190:77: runtime error: negation of -2147483648 cannot be represented in type 'sal_Int32' (aka 'int'); cast to an unsigned type to negate this value to itself 0 0x7f08bd84936d in tools::Duration::Mult(int, bool&) const /tools/source/datetime/duration.cxx:190:77 1 0x7f08c1c1d27a in tools::DurationTest::testDuration() /tools/qa/cppunit/test_duration.cxx:219:26 Detected thanks to eac63ab120a181a1dff6317ee3d223327080e992 Related: tdf#153517 Introduce class tools::Duration Change-Id: I3804cc4ff4011a7f3b393b82b27f0c805682fbb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153254 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-06-17Fix typoAndrea Gelmini
Change-Id: I1d7b271eed63dd0272bd92431eaac3e2dfbfe2b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153206 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-06-17Related: tdf#153517 Introduce class tools::DurationEike Rathke
Change-Id: I73ea6e162c73382ba470a306ce2852dbff3d1314 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153202 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-05-28Factor out DateTime::NormalizeTimeRemainderAndApply(tools::Time& rTime)Eike Rathke
Change-Id: Ie520b10baaeb4c94973c44435c3241e5d2254968 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152345 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-05-19Eliminate 24h loops in DateTime::operator+=/-=(tools::Time&)Eike Rathke
... and repeated Date::operator++/--() that each calculate lcl_DaysToDate( GetAsNormalizedDays() + 1 ) where Date::AddDays() does it once. Also, that probably never worked correctly with negative time results >=24h Change-Id: Ic67aaa3d93e0d6533501d52671acf765e2d9bbdd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151984 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2023-04-27fix bug in json_writerJaume Pujantell
Ruler stores null-terminated strings in fixed length char arrays, so when creating a JSON a string might end earlier that it's size sugsests. Change-Id: Icdcaf35f9ce54c24dcd36368dc49bb688a2a65ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150542 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins
2023-04-24loplugin:unnecessarygetstr extend to more std::string checkingNoel Grandin
suggested by mike kaganski Change-Id: I5f5f254142767aca45a6101abdd84a0163ca6a34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-24loplugin:unnecessarygetstr extend to createFromAsciiNoel Grandin
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-18tdf#143200 assert when pasting a cell to a large-height rangeNoel Grandin
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-11Drop Writer::OutLongMike Kaganski
... and use SvStream::WriteNumberAsString, replacing Write[U]Int32AsString Change-Id: I10e56c532494239ed40ec01b6184dd06db463a0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150193 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-10Drop SvStream::WriteCharPtrMike Kaganski
WriteOString is a better replacement Change-Id: Ic431b9aeb98d19fe61cff71360eee555105cc2bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150192 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-10Use more *string_viewMike Kaganski
Change-Id: I1172febd45da4dba006f8495427fe45c6d9b9fa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150187 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-04-09new loplugin:unnecessarygetstrNoel Grandin
which prevents constructing unnecessary temporaries via getStr() Change-Id: I9ca70893a10e954b5ee0e6ad6098660ee24c2bef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-05fix leaks when using tools::JsonWriterNoel Grandin
Specifically in sd/source/core/annotations/Annotation.cxx We seem to end up fixing leaks here often. The current tools::JsonWriter API is just very hard to use correctly. So rather return an OString, which is cheap to copy, and push that down into the LOK code. AFAIK that seems to end up requiring less code and less adhoc copying of data (specifically the queueing code in init.cxx was creating copies when converting to std::string). Ideally, we could have some special API to avoid the new strdup() calls in init.cxx, but not sure how to prevent other people from accidentally using that. Change-Id: Ia33437c1bfd9cc2d54dfb99914d1b72db20335f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149963 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-04-03Simplify JsonWriter a bitMike Kaganski
Change-Id: I0ca4a0fcf4f19bc26ae931bae0b2ee53db47f12c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149951 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-30loplugin:stringadd in test..toolsNoel Grandin
when applying my upcoming patch to also consider O[U]StringBuffer Change-Id: I8619fa3280338afdfe75bdbfda6cb118d396e1c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149749 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-18loplugin:stringadd use more O[U]StringCharNoel Grandin
Change-Id: I196e4539ad430a39415eff9d7170b33df7228230 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149062 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-03-08tdf#82984 tdf#94915 zip64 support (import + export)Attila Szűcs
Implemented import + export for "Zip64 Extended Information Extra Field", (in "Local file header" and "Central directory file header") and for Data descriptor. Focused only to be able to handle files with over 4GB uncompressed size, in the zip archive. The 64k filecount, and the 4GB compressed size limit is probably still present Tried to follow pkware .ZIP File Format Specification, Some cases were not clear to me and/or some zip compressing tool may not perfectly follow the standard, like 'extra field' should be 28 bytes long, but its reader now can read shorter (or longer) 'extra field'. Replaced some 32bit codes with 64bit codes, in stream handling, in deflater. Tested with an ods file that contained a content.xml that bigger then 4BG+ (import + export + reimport) on windows. I think 4GB+ files import/export would be too slow fot unittest. So, for unit test, used the small but zip64 format files, that was attached to the bugzilla tickets Note: It helps with Bug 128244 too (1 of the unittest tests it), but that ods file missing manifest.xml, so LO won't be able to import it. Change-Id: Idfeb90594388fd34ae719677f5d268ca9a484fb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147306 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2023-03-01Teach INetURLObject about RFC 7230 URLs with no path but queryStephan Bergmann
While RFC 2616 "Hypertext Transfer Protocol -- HTTP/1.1" defined > http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]] RFC 7230 "Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing" defines > http-URI = "http:" "//" authority path-abempty [ "?" query ] > [ "#" fragment ] Change-Id: I83b1baa404d28bf3b28b1db812f8930bbc1aaf90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148064 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-02-28move sanitizing of Size inside GenericTypeSerializerNoel Grandin
I cannot see a useful application of a Size that is negative (at least not in a file format). Change-Id: I0c5bd8c7d3987a5c7803af2a6ae0543c4a6d7754 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147884 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-27inline StreamData into SvFileStreamNoel Grandin
Change-Id: Ib2bfaa903b5c57b7d802afe7928720e6007d54ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147865 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-16Only specialize CppUnit::assetion_traits<T>::toString member functionsStephan Bergmann
...not the whole CppUnit::assetion_traits<T> classes (where applicable). That avoids spelling out the (identical) equals member functions, and also leaves around the less and lessEqual member functions, in case they want to be used after all. Change-Id: I18f8d6cff0353921ced4952b33a0c85ff8292923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-29tools: rearrange Rectangle test, add construction test caseTomaž Vajngerl
Change-Id: I735600181665100e8540b6f5f14ffebfe6f33371 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146305 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>