summaryrefslogtreecommitdiff
path: root/sax
AgeCommit message (Collapse)AuthorFilesLines
2018-08-04Use more basegfx deg<->rad functions, instead of direct formulasMike Kaganski1-1/+1
Also make the functions constexpr. Due to slight changes in floating-point arithmetics (90.0 instead of 180.0, M_PI2 instead of M_PI resp.), results might differ in last digits (usually 17th decimal digit). This has lead to need to tweak char2dump's PieChartTest unit test. Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3 Reviewed-on: https://gerrit.libreoffice.org/58583 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-08-04Fix typosAndrea Gelmini1-1/+1
Change-Id: I7f90b7672665be0d8d5e47c6456433b06f88d5e0 Reviewed-on: https://gerrit.libreoffice.org/58553 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
2018-07-27loplugin:stringloop in basic, framework, sax, svtoolsNoel Grandin1-3/+3
Change-Id: I2bad74a8f103e9dc68c8e0d0e6315697068d2f6d Reviewed-on: https://gerrit.libreoffice.org/58135 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-20tdf#79878 perf loading docx file, pendingCharsNoel Grandin1-27/+36
Use std::vector<char> for pendingCharacters in SAXParser to avoid calling the OUString utf8 conversion routine more than one per character block. We seem to hit multiple characters() callbacks per chunk of text fairly often in loading writer docs. This is only good for about 0.5% performance Change-Id: I354bb4efe9d883c4bebf49bc96dd44be4f2b1610 Reviewed-on: https://gerrit.libreoffice.org/57731 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-17tdf#79878 perf loading docx file, disable SAX threading for writerNoel Grandin1-5/+12
since it seems to cost us 20% performance Change-Id: Ic4796ee3756c8c722feb4851dc48a99e882ba0fe Reviewed-on: https://gerrit.libreoffice.org/57545 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-11tdf#79878 perf loading docx file, improve threading heuristicNoel Grandin1-2/+8
this gives another 2% perf Change-Id: Ia2983339f3f11daef37c48044904c8037a7a0bf6 Reviewed-on: https://gerrit.libreoffice.org/57265 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-11tdf#79878 perf loading docx file, more saxNoel Grandin1-8/+8
(*) in GetTokenWithPrefix, use rtl_str_reverseCompare_WithLength faster than strncmp (*) No need for NamespaceDefine to be stored via std::shared_tr Change-Id: Ibd262a3f4f5a0f518ec6abe1fb19e7803f78fe8b Reviewed-on: https://gerrit.libreoffice.org/57261 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-10pass SvStream around by std::unique_ptrNoel Grandin1-2/+2
and give utl::OStreamWrapper a new constructor so that it knows it is taking ownership of the SvStream, which appears to fix several leaks Change-Id: Idcbcca9b81a4f0345fd8b8c8a2f4e84213686a6b Reviewed-on: https://gerrit.libreoffice.org/57187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-07-08tdf#79878 perf loading docx file, sax improvementsNoel Grandin2-7/+24
these are the smaller improvements, they make about 5% worth of difference - use std::vector instead of std::deque - use std::move on pendingCharacters instead of copying - in FastAttributeList::add, when reallocate the buffer, allocate twice the existing size, instead of increasing to only what we need - in FastAttributeList, create getAttributeIndex and friends, so we can avoid iterating the attribute list more often than necessary Change-Id: I3e3380ea50b77c6845b66e83404e245778ec06eb Reviewed-on: https://gerrit.libreoffice.org/57021 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-30sax: fix overflow in sax::Converter::convertMeasure()Michael Stahl2-3/+4
The problem is that -2^31 is negative after negation in 2's complement. This causes ODF validation error now in CppunitTest_sd_export_tests testFdo84043: Error: attribute "svg:x" has a bad value: ... svg:x="--2147483.-6-4-7cm" The validation error only happens in 32-bit builds; 64-bit builds show a different value svg:x="2139324.72cm", so there must be another problem somewhere else that isn't fixed here. Change-Id: If2040cb6ae914c69b7cc651d3ab2d5d232fc71fb Reviewed-on: https://gerrit.libreoffice.org/56718 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-06-26Avoid potential double-delete in ~XMLFile2UTFConverterStephan Bergmann3-27/+23
...as the implicitly defined copy operations would just copy the m_p* member pointers. Needed some modification of the ParserCleanup class so that Entity (which has a XMLFile2UTFConverter member) can be std::move'd into SaxExpatParser_Impl::pushEntity. Found by new -Wdeprecated-copy of GCC trunk towards GCC 9. Change-Id: I0cb5b5dbcd55249b475ed74b4ac6bcb12f20f2c6 Reviewed-on: https://gerrit.libreoffice.org/56453 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-06-05tdf#42949 remove unused compheler includes ..Jochen Nitschke1-1/+0
and fix the fallout Change-Id: I15bc5d626f4d157cbc69a87392078b41e621d14e Reviewed-on: https://gerrit.libreoffice.org/54882 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-06-01loplugin: look for CPPUNIT_ASSERT_EQUALS with params swappedNoel Grandin1-3/+3
idea originally from either tml or moggi, can't remember which Change-Id: Id78d75035036d3aa1666e33469c6eeb38f9e624d Reviewed-on: https://gerrit.libreoffice.org/55126 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-25Improve re-throwing of UNO exceptionsNoel Grandin1-8/+7
(*) if we are already throwing a Wrapped*Exception, get the exception using cppu::getCaughtexception. (*) when catching and then immediately throwing UNO exceptions, use cppu::getCaughtException to prevent exception slicing (*) if we are going to catch an exception and then immediately throw a RuntimeException, rather throw a WrappedTargetRuntimeException and preserve the original exception information. Change-Id: Ia7a501a50ae0e6f4d05186333c8517fdcb17d558 Reviewed-on: https://gerrit.libreoffice.org/54692 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-25ofz#7110 ensure join is called on std::exceptions as well as uno::ExceptionCaolán McNamara1-6/+6
Change-Id: I1d17301e4d7f951b7176d5a91c0dca0ef051b2a2 Reviewed-on: https://gerrit.libreoffice.org/51830 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-03-16crashtesting: asserts on legal xml names on exportCaolán McNamara1-4/+18
e.g. ooo82358-1.odt which has Chinese characters used in tags inside a parent xforms:instance tag Change-Id: If2edf9cc13e5a4cc969f5a46618a6534c52f2877 Reviewed-on: https://gerrit.libreoffice.org/51352 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-03-06add some color conversion methods to sax::ConverterNoel Grandin1-0/+1
to make the call-sites less verbose Change-Id: Ifddcbb03a454a241bef93f31a8025801b84a66fc Reviewed-on: https://gerrit.libreoffice.org/50578 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-05drop sax::tools::*base64 methodsNoel Grandin2-60/+0
and use the underlying comphelper methods rather. This is so that I can break the dependency that tools has on sax, and can add methods that make sax depend on tools. Change-Id: I8a2d6ce2ffc3529a0020710ade6a1748ee5af7d5 Reviewed-on: https://gerrit.libreoffice.org/50767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-03-02tdf#115429 sax,xmloff: assert on empty attribute names & namespacesMichael Stahl1-0/+1
Surely that's indication of a bug somewhere. Change-Id: Ic6219d8eb7f22301d8c4da98b2132ae3ef0467b5 Reviewed-on: https://gerrit.libreoffice.org/50579 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-03-01tdf#115429 sax: assert if exporting an invalid XML attribute/elementMichael Stahl2-4/+41
Add a cheap check for this in both SaxWriter and FastSaxSerializer so we can find such bugs earlier, e.g. with the weekly crashtesting. Don't do a correct check but a cheap & fast one, let's ignore non-ASCII characters for now as the only filter with such is UOF and that is implemented with XSLT, not this sax code. Change-Id: I4db8f70ffb23684d4cb4211468519edd6c7c465f Reviewed-on: https://gerrit.libreoffice.org/50507 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2018-02-28sax: don't crash during loggingVasily Melenchuk1-1/+1
SaxParser was crashing during load of some MS documents if logging is enabled. Change-Id: I08a57b9a948bb4a35afcb82a29614c2f6a443446 Reviewed-on: https://gerrit.libreoffice.org/50110 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-02-21New loplugin:nestedunnamedStephan Bergmann1-19/+16
Change-Id: Ifb434589ef08428ce609bc7a40b015d4df13224c Reviewed-on: https://gerrit.libreoffice.org/50048 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-24Fix typosAndrea Gelmini1-1/+1
Change-Id: I359c5aff8c90359783588d189de4e5b94224fa9c Reviewed-on: https://gerrit.libreoffice.org/48232 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-24loplugin:constparamsNoel Grandin1-2/+2
Change-Id: I7c695073d9a9d3b7a641d6eb9fe01a47d8c3a504 Reviewed-on: https://gerrit.libreoffice.org/48392 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19SAL_W32 is just an alias for _WIN32Stephan Bergmann1-2/+2
...so consistently use the latter instead of the former Change-Id: I144d5e7c472632f93b2258461510346bc85892d9 Reviewed-on: https://gerrit.libreoffice.org/48135 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-16Fix typosAndrea Gelmini1-1/+1
Change-Id: Ia976371bf52eb1216d8abe728d80bbb87a3c38a2 Reviewed-on: https://gerrit.libreoffice.org/47858 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-12More loplugin:cstylecast: saxStephan Bergmann6-19/+19
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: Ide5941d633fb3bf930b790d644154829b77ad117
2018-01-06ofz#4392 sax: guard access to Entity::maSavedException with mutexMichael Stahl1-3/+30
The problem here is presumably that the parser thread reports a low-level SAX exception and the main thread reports a high-level filter exception at the same time, so both threads modify maSavedException concurrently. Change-Id: Ic8ce9a4992208a24a111c990a67be163858ddaf8 Reviewed-on: https://gerrit.libreoffice.org/47478 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins <ci@libreoffice.org>
2018-01-05sax: remove that odd Entity copy constructorMichael Stahl1-32/+19
Change-Id: I7929ccf751d37f65975d6412e28d34bec4421c07
2018-01-04Modifying the impl. of startUnknownElement of FastParser:Mohammed Abdul Azeem2-34/+43
Modifying it to emit the namespace URI instead of prefix and qualified name instead of local name. This will be useful for handling arbitrary elements in the fast contexts. Change-Id: I0f150b862574612e97491f6c335f3f4c9966da0a Reviewed-on: https://gerrit.libreoffice.org/47055 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2017-12-24loplugin:passstuffbyref even more return improvementsNoel Grandin1-4/+4
Change-Id: I2a752025cd429e4d271626402dce5d8a8b0c76d2 Reviewed-on: https://gerrit.libreoffice.org/47021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-23loplugin:passstuffbyref improved returnsNoel Grandin3-3/+3
improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-21new loplugin: convertlongNoel Grandin1-1/+1
merge the droplong and convertuintptr into one new plugin. Limit the analysis to looking at var decl's, since that seems to be safest proposition, even if that too needs some careful analysis. Change-Id: Id005baaf05cfb157ce44a06a1c81f08559a07d1f Reviewed-on: https://gerrit.libreoffice.org/46851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-11loplugin:salcall fix functionsNoel Grandin4-4/+4
since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-10ofz#4571 Direct-leakCaolán McNamara1-40/+33
Change-Id: I1fbeec6a29854dbc80736ed442941f55bc1bb0a3 Reviewed-on: https://gerrit.libreoffice.org/46179 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-12-10remove unused osl/time.h includes ..Jochen Nitschke1-1/+0
and some more in base64.cxx Change-Id: I31c9f23d3bd11f5482774e976a7c40025ffcfb86 Reviewed-on: https://gerrit.libreoffice.org/46157 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-30loplugin:unnecessaryparen: signed numeric literalsStephan Bergmann1-3/+3
Change-Id: I75c8224452ca9c3711a2ccaca9ecf549fa59cb64 Reviewed-on: https://gerrit.libreoffice.org/45549 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-30ofz: always free with xmlFreeParserCtxtCaolán McNamara1-79/+77
Change-Id: I90aed11ae0a29a0e9fc725b297e10a7ed30c9942 Reviewed-on: https://gerrit.libreoffice.org/45533 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-11-23loplugin:simplifybool for negation of comparison operatorNoel Grandin1-1/+1
Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791 Reviewed-on: https://gerrit.libreoffice.org/45068 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-22Make loplugin:unnecessaryparen warn about (x) ? ... : ... after allStephan Bergmann2-8/+8
...which had been left out because "lots of our code uses this style, which I'm loathe to bulk-fix as yet", but now in <https://gerrit.libreoffice.org/#/c/45060/1/> "use std::unique_ptr" would have caused an otherwise innocent-looking code change to trigger a loplugin:unnecessaryparen warning for pFormat = (pGrfObj) ? ... (barring a change to ignoreAllImplicit in compilerplugins/clang/unnecessaryparen.cxx similar to that in <https://gerrit.libreoffice.org/#/c/45083/2> "Make not warning about !! in loplugin:simplifybool consistent", which should also have caused the warning to disappear for the modified code, IIUC). Change-Id: I8bff0cc11bbb839ef06d07b8d9237f150804fec2 Reviewed-on: https://gerrit.libreoffice.org/45088 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-13Fix typosAndrea Gelmini1-1/+1
Change-Id: I2a10e087a776ac96b3193226610577227d2492a8 Reviewed-on: https://gerrit.libreoffice.org/44655 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-13Fix typosAndrea Gelmini1-1/+1
Change-Id: Ia544298334364ece3b3963a4adc00c5e01189b91 Reviewed-on: https://gerrit.libreoffice.org/44654 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mark Page <aptitude@btconnect.com>
2017-11-03loplugin:constparam in vcl,svtoolsNoel Grandin1-2/+2
Change-Id: I7a3eb2bfda869e9e66db919f929ead60cf8890a4 Reviewed-on: https://gerrit.libreoffice.org/44209 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-31loplugin:constantparam in sal,saxNoel Grandin2-15/+10
Change-Id: I7ca2fd05d1cf61f9038c529a853e72fedb1c9ed0 Reviewed-on: https://gerrit.libreoffice.org/44087 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-26loplugin:constmethods in unotoolsNoel Grandin1-2/+2
Change-Id: I13df4e184a826682f34a1d9e974b601397ba4a3d Reviewed-on: https://gerrit.libreoffice.org/43865 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-25ofz#3752 Integer-overflowCaolán McNamara1-11/+5
Change-Id: I211327928a86f706513ebd78cff979283396e742 Reviewed-on: https://gerrit.libreoffice.org/43777 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-10-25loplugin:constmethod in tools,sax,UnoControlsNoel Grandin5-5/+5
Change-Id: Ie05e44e2a4019e2549843961ebfa04fef7b7aeb4 Reviewed-on: https://gerrit.libreoffice.org/43767 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-25ofz#3769 Integer-overflowCaolán McNamara1-8/+5
Change-Id: Ia245c6042f8c662bab870cf166db94d1cf2db9d3 Reviewed-on: https://gerrit.libreoffice.org/43781 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-10-23loplugin:includeform: saxStephan Bergmann6-9/+9
Change-Id: If54794f72502a11612e85f99713e553f91d4025e
2017-10-23overload std::hash for OUString and OStringNoel Grandin1-2/+1
no need to explicitly specify it anymore Change-Id: I6ad9259cce77201fdd75152533f5151aae83e9ec Reviewed-on: https://gerrit.libreoffice.org/43567 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>