Commit Graph
91 Commits
Author SHA1 Message Date
Tor Lillqvist af560f84ef I get "warning: unsupported syscall: __sys_prlimit64" in WASM so avoid that
Change-Id: I8a9a19d3c7757e1b7e1d194c439280a9d4824c3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144876
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2022-12-30 12:15:06 +00:00
Stephan Bergmann 4280a32579 -Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): tools
(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-11-06 01:13:45 +01:00
Gabor Kelemen 52ef78f492 Recheck modules t* with IWYU
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-04-02 23:32:08 +02:00
Caolán McNamara 59a7c40255 reduce down to the part and config we are using and move to tools
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-19 22:56:05 +01:00
Szymon Kłos 496fcccfa6 jsonwriter: ensure correct number of bytes is available
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-31 17:01:33 +01:00
Mike Kaganski 02d225f2a4 Simplify JsonWriter a bit
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-14 07:40:52 +02:00
Mike Kaganski aff3ce8837 Improve JsonWriter's escapement code
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-13 19:34:13 +02:00
Mike Kaganski 03c474c640 Unify JsonWriter::put and putRaw a bit
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-13 17:39:32 +02:00
Noel Grandin 9946a2fef0 fix buffer overruns in JsonWriter::put with UTF-8 values
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-02 22:36:17 +02:00
Noel Grandin 897192f07c simplify JsonWriter::reallocBuffer by using realloc
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-10-02 19:15:00 +02:00
Noel Grandin 9490588c24 clang:optin.performance.Padding in tools
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-10 21:19:24 +02:00
dante 5b9cf5881e tdf#142307 - Upgrade SSE2 sum to AVX512 sum with Neumaier 1
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-26 08:48:35 +02:00
Tor Lillqvist 5aee16cf09 Make JsonWriter::writeEscapedOUString() handle surrogate pairs properly
It is wrong to iterate over UTF-16 code units one by one. We have
OUString::iterateCodePoints() to iterate over Unicode code points.

The two UTF-16 code units of a surrogate pair (for a non-BMP code
point) should not be encoded separately to UTF-8 bytes. It is the code
point that should be encoded (to four bytes).

Change-Id: Ica4341308deb6618c9c2da8dcee8a11ef4e8238d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109318
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2021-01-15 08:54:12 +01:00
Henry Castro 6002ff0354 tools: json: fix missing escaped chars
When client side tries to show the "Macro Security Warning"
message dialog, it fails to parse the JSON objects

Change-Id: Id73c291ddd9cf739d63d69f06094eacb7b43a2f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108287
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
2020-12-28 13:26:46 +01:00
Szymon Kłos 913fa080fa jsdialog: send close on dialog response
Change-Id: I730d99cc9aa519f07d6b1c436d749f2c0b044bfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107151
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107349
Tested-by: Szymon Kłos <szymon.klos@collabora.com>
2020-12-08 11:22:31 +01:00
Szymon Kłos 7fc2fe5c61 jsdialog: fix arrays in JsonWriter output
Change-Id: I5638b1b02afcdd57b16b60d83d3d15da45866060
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107066
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-12-03 08:45:24 +01:00
Philipp Hofer 1582d9a2c5 tdf#123936 Formatting files in module tools with clang-format
Change-Id: I0f66d02e67388cc4d21c5e96bf84b6848e8de63a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105721
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-18 12:04:58 +01:00
Jan-Marek Glogowski 8babcdb9c9 osl+tools: fix Windows Arm64 build
Change-Id: I17cbc1c8474880024921f476aa602d61978da868
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102851
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2020-09-17 06:38:23 +02:00
Andrea Gelmini b866b71e24 Fix typo in code
It passed "make check" on Linux

Change-Id: I4db1681869907f050ea224ed24dcb7469a50eb20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101792
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-09-01 08:49:07 +02:00
Stephan Bergmann 4ad4468675 Missing include (std::max; Windows --disable-pch)
Change-Id: I31d44c0a1791c58c0fc348fb2ec42fe2e2ec4323
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100003
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-03 17:11:42 +02:00
Miklos Vajna 51a4c85bf9 tools: fix 32bit Android build
tools/source/misc/json_writer.cxx:289:34: error: format specifies type 'long' but the argument has type 'sal_Int64' (aka 'long long') [-Werror,-Wformat]
    mPos += sprintf(mPos, "%ld", nPropVal);
                           ~~~   ^~~~~~~~
                           %lld
1 error generated.

Change-Id: Ieacf2f521f77292d61fa714bf584c9e2045c2e1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97367
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2020-06-29 12:31:52 +02:00
Noel Grandin 01e37e3e56 use tools::JsonWriter for dumping property tree
Change-Id: I8f55af19ba10b71bd621e69b27000ab7cb565309
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96677
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-25 10:16:37 +02:00
Noel Grandin 3fb5c11ac6 fix JsonWriter::reallocBuffer
was not updating mSpaceAllocated

Change-Id: Ie5404e58c6520d32b72c19ddfa58b2ab2b895199
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97049
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-24 22:16:45 +02:00
Stephan Bergmann 18b9f927a0 Avoid one more unhelpful -Werror=stringop-truncation
...after cb95276e6e "use JsonWriter for the rest
of ITiledRenderable", similar to de32eb539b "Avoid
unhelpful -Werror=stringop-truncation"

Change-Id: I8782a8a936a5ff0351b6e6d171a00cb8f4a1b2d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-21 23:55:10 +02:00
Noel Grandin cb95276e6e use JsonWriter for the rest of ITiledRenderable
and fix bug in buffer reallacotion where mPos pointing
at the beginning of the new buffer instead of at the
correct index inside it.

Change-Id: Ie1ffaa176f6165e2cec85c93adc945312eff38e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96650
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-20 21:25:11 +02:00
Noel Grandin 8df7447139 asan: need to use malloc instead of new for tools::JsonWriter
because the LOK API expects memory returned from those calls to be
malloc'ed

Change-Id: If6fbfb60c433bd6e58bc90a9a90a90663e2e1c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96676
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-19 15:38:52 +02:00
Andrea Gelmini 1c07dbe966 Fix typos
Change-Id: I887a86506b700a21b56bbc66d8b3b2e1bcec0da5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96651
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-06-19 09:06:38 +02:00
Stephan Bergmann de32eb539b Avoid unhelpful -Werror=stringop-truncation
...emitted at least by recent GCC 11 trunk (even with --disable-optimized, where
optimization level traditionally has some impact on what warnings of this kind
are emitted exactly):

> tools/source/misc/json_writer.cxx: In member function ‘tools::ScopedJsonWriterNode tools::JsonWriter::startNode(const char*)’:
> tools/source/misc/json_writer.cxx:42:12: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying 5 bytes from a string of the same length [-Werror=stringop-truncation]
>    42 |     strncpy(mPos, "\": { ", 5);
>       |     ~~~~~~~^~~~~~~~~~~~~~~~~~~

etc.

Change-Id: Id96964b178b61879cf2373c5b418f5c9df4a226f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96593
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
2020-06-18 15:08:26 +02:00
Noel Grandin c8bed6445b new json writer for LOK
we shave about 3 memory copies off in the process, and
make the class play nicely with our string types.

Change-Id: I1f614fb35b1de499ac99e3b33ac638ad81054bed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96393
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-06-18 10:54:10 +02:00
Stephan Bergmann b66c5f77d1 loplugin:unsignedcompare (clang-cl)
Change-Id: I69cc1b352221ca053ccd0c5b78e926480a8c9ccd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87884
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-02-03 20:27:29 +01:00
Noel Grandin 0f874472c6 size some stringbuffer to prevent re-alloc
found by the simple expidient of putting asserts in
the resize routine. Where an explicit const size is used,
I started with 32 and kept doubling until that site
did not need resizing anymore.

Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4
Reviewed-on: https://gerrit.libreoffice.org/81138
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-21 08:36:01 +02:00
Mike Kaganski 11d0cc0743 Fix Android build after commit fc0850d278
The second parameter is unused

Change-Id: Iaf82ea24737a162c6aa8ce6b9e237f656a10020a
Reviewed-on: https://gerrit.libreoffice.org/75283
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-07-09 04:43:09 +02:00
Tomaž Vajngerl fc0850d278 fix android build - fallback getCpuId only had one parameter
Change-Id: I91c679506aad727c7f536e79e79a720db860b5ae
2019-07-09 10:49:33 +09:00
Tomaž Vajngerl f43f9b9960 CPU intrinsics detection (SSE, AVX)
Adds CPU intrinsics detection in configure pass for compile time
detection and "cpuid" runtime detection of which CPU instruction
sets are available on the user device.

Change-Id: I0ee4d0b22a7c51f72796d43e7383a31d03b437ad
Reviewed-on: https://gerrit.libreoffice.org/75175
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-07-09 02:46:43 +02:00
Gabor Kelemen 83abdf803a tdf#42949 Fix IWYU warnings in tools/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I47974f5c24819eb60e6724f42d51bb206dc26d21
Reviewed-on: https://gerrit.libreoffice.org/71557
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-04-30 15:02:42 +02:00
jan Iversen 7329b4423c cpuid is only for x86 processors.
clang for macOS did not like cpuid when compiling for arm cpu.

Change-Id: Iede658a524e5c3e1aa2d33137ed399679b021987
2017-11-22 14:49:31 +01:00
Dennis Francis 4defacd1fa halve the number of threads if HT is active
added hasHyperThreading() function to tools::cpuid
to detect hyperthreading.

Change-Id: I13fab4b6c649e681c329b7e3f4c9f36bda879d84
2017-11-21 16:09:43 +05:30
Chris Sherlock ad3e1afe59 Move getProcessWorkingDir from tools to unotools
Change-Id: Ifd86ab3c89c285ad5329fc86cc57967ebd1af91a
Reviewed-on: https://gerrit.libreoffice.org/37100
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2017-04-29 18:38:09 +02:00
Stephan Bergmann 613213240a clang-cl loplugin: tools
Change-Id: I6f02d9607405e144727f925c8f8a1de6041688b9
Reviewed-on: https://gerrit.libreoffice.org/29844
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-15 07:59:10 +00:00
Mark Page f7b1cd6616 Moved SfxModule owner to SfxApplication
::GetAppData replaced with SfxApplication::GetModule
that now returns SfxModule*

SfxModule no longer registers self for ownership
instead it is now registered using SfxApplication::SetModule

Change-Id: Ifbbe1b2b4c5122da8e643b7926d47878d116c6c8
Reviewed-on: https://gerrit.libreoffice.org/26914
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-07-13 06:32:46 +00:00
Noel Grandin 494bd08c48 remove tools/solarmutex.hxx
Deprecated in favour of comphelper::SolarMutex

Change-Id: I159077562660de5df25601fa471447f4b64a2cf1
Reviewed-on: https://gerrit.libreoffice.org/24079
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-15 08:09:01 +00:00
Wastack ce549d2a09 tdf#97966: Remove 'static' keywords
Change-Id: Iced527f48afa828cc9acf5b6461674a2706cbcd7
Reviewed-on: https://gerrit.libreoffice.org/23135
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-03-11 08:59:30 +00:00
Noel Grandin 2087484c65 use consistent #define checks for the Windows platform
stage 2 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

In this stage we focus on replacing usage of the WIN macro

Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84
Reviewed-on: https://gerrit.libreoffice.org/22393
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17 11:33:57 +00:00
Andrea Gelmini 64d624b651 Fix typos
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86
Reviewed-on: https://gerrit.libreoffice.org/21209
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-10 14:17:20 +00:00
Noel Grandin e18b08363a loplugin:unusedmethods
Change-Id: Ifafdaf6da0225f244853a0042a6458643b570623
2015-12-21 10:20:31 +02:00
Tomaž Vajngerl f115b0cf1b underscores are reserved
Change-Id: Iee60389ccc9e348db6ed00e48e32b1e86f17b530
2015-11-13 18:01:04 +01:00
Tomaž Vajngerl 2af4da0ea9 improve compile time SSE2 detection, fix broken android build
Prereq. to enable runtime SSE2 detection is that the compiler
supports it in the first place. MSVS and GCC use different
compiler flags for this so use __LO_SSE2_AVAILABLE__ to make this
build platform independent.

emmintrin.h is unavailable on ARM Android so include this and
compile the SSE2 specific code only when we are sure we can build
SSE2 code (__LO_SSE2_AVAILABLE__ is defined).

Change-Id: I212c4e0b99a314d087b9def822a81325b25f3469
2015-11-13 16:37:29 +01:00
Tomaž Vajngerl 726ce582ab remove SSE detection code (but keep SSE2)
For corner case CPUs out there that support SSE and not SSE2 it
makes more sense to use the "fallback" code path instead of
writing a SSE only version. For this reason detecting SSE is not
relevant anymore - so removing it.

Change-Id: I3f1425af2cb5cdf9fba699e2996014598a15b5c1
2015-11-13 14:56:13 +01:00
Tomaž Vajngerl 154bcd887d tools: runtime SSE/SSE2 detection
Change-Id: I29330061e2986ec2ae899c2f3a63d0eadd9cc194
2015-11-13 14:10:10 +01:00
Stephan Bergmann 1c4f33b5d8 loplugin:nullptr (automatic rewrite)
Change-Id: Ia5acfb564f913d52cd25b5d64d06b5280b94cb72
2015-11-10 10:31:54 +01:00