summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
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>
2023-01-27Remove support for AIXStephan Bergmann
As discussed in the mailing list thread starting at <https://lists.freedesktop.org/archives/libreoffice/2023-January/089808.html> "Plan to remove dead C++ UNO bridge implementations (bridges/source/cpp_uno/*)", the bridge implementation at bridges/source/cpp_uno/gcc3_aix_powerpc is apparently dead and should thus be removed. However, that was the only bridge implementation for AIX, which implies that support for the AIX platform as a whole is dead and should thus be removed. Change-Id: I96de3f7f97d4fd770ff78256f0ea435383688be9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146057 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-09tdf#147906 Use std::hypot for Pythagorean additionLeonid Ryzhov
Change-Id: Ia325af8d9a23e617eb62e6cecab0aa68f1d206f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145089 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
2022-12-30I get "warning: unsupported syscall: __sys_prlimit64" in WASM so avoid thatTor Lillqvist
Change-Id: I8a9a19d3c7757e1b7e1d194c439280a9d4824c3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144876 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2022-11-22Calculate null-date days to assert only onceEike Rathke
Massively called it is really unnecessary to do that each and every time. The debug build is slow enough.. Change-Id: I06525e4ca1fa23a1d49dd735370eb157157800e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143127 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-11-22Avoid second null-date check of convertDateToDaysNormalizing()Eike Rathke
This is micro-optimization, but.. Change-Id: Ic5d43bc0ce9343cf194e189777109636d3b587c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143126 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-11-22Related: tdf#152114 Move some tools' Date class algorithms to comphelper::dateEike Rathke
So they can be reused, specifically in connectivity/source/commontools/dbconversion.cxx Change-Id: I8b2b59e3cb078a73d5f670f0756404471009cf9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143114 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
2022-11-18ofz#53450 Integer-overflowCaolán McNamara
Change-Id: Iccabfb8991a4dca6ec05565f01f6cff82c642d27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142934 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-17ofz#53450 Integer-overflowCaolán McNamara
Change-Id: I106e703714083631c67d7b8a84180c3c485953d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142814 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-11-13Fix typosAndrea Gelmini
Change-Id: Ic1fb0ea483954f2994a87e05f33b320da3795227 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142661 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2022-11-06-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): toolsStephan Bergmann
(The "clang-format off" in tools/source/misc/json_writer.cxx is necessary because otherwise the code between the SAL_WNODEPRECATED_DECLARATIONS_PUSH/POP macros would be ill-formatted in a way that would trigger loplugin:indentation.) Change-Id: Ic96787865d4c96be07c41f4939893420dfa04046 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142339 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-10-27add some more asserts in Fraction::MakeFractionNoel Grandin
which I missed when inlining code in commit 8ac4dd510bd5f41882db0b647797674b06339f4e Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Thu Oct 27 08:48:25 2022 +0200 tdf#123419 optimise ImplMakeFraction Change-Id: Ifd271ce89cea29a22d41b8e143e27df118f8df3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141906 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27rational_ReduceInaccurate unnecessary hereNoel Grandin
as pointed out by mike kaganski, since we are already dealing with 32-bit values Change-Id: Ic621757f2d9a689e54c47f36cc6ba85a322c500e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141904 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27tdf#123419 optimise ImplMakeFractionNoel Grandin
which is very hot here. Push it down into Fraction, where we can skip the construction of boost::rational intermediate values Change-Id: I7e5f18456a252a159d3a50e9297168e5ba9e1588 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141894 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-24tdf#133768 speed up temp file creationNoel Grandin
Use DELETE_ON_CLOSE attribute, so we can avoid calling osl_removeFile. Shaves 5% off the export time. Change-Id: I4fef8f181ef7a92c4805cc5996c3a17800a22602 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141718 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-22Fix StartWritingUnicodeTextMike Kaganski
Its comment in include/tools/stream.hxx tells: Switch to no endian swapping and write 0xfeff It was introduced in commit 3c2105e07d29b2069349e1a54e08463d359f988f Author Eike Rathke <er@openoffice.org> Date Fri Dec 22 00:19:05 2000 +0000 new: read/write Unicode or Bytecode and included a call to SetEndianSwap( FALSE ). That call was dropped in commit 8130714148d58dd2bf1ef12dcc6dd6d5838be0d1 Author Noel Grandin <noel@peralex.com> Date Mon Jan 05 08:47:31 2015 +0200 fdo#84938: replace NUMBERFORMAT_INT_ constants with 'enum class' (likely by accident). To simplify the fix, drop redundant m_nEndian: m_isSwap is enough. Change-Id: Ia9a0fe2d55563e7ba21bd4cf17c4ca999c6feaf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141521 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-16Simplify a bitMike Kaganski
Change-Id: Ia983d24c539ab37bcc6457630634142cd5826056 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141399 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2022-10-07ofz#52191 Integer-overflowCaolán McNamara
Change-Id: I97daf9327c55229fe7da546164d398353e0696a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141046 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
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>