summaryrefslogtreecommitdiff
path: root/package
AgeCommit message (Collapse)Author
2023-03-09cid#1521901 Pointer to local outside scopeCaolán McNamara
Change-Id: I38e76440606afb65a8c1ce419c446e234a513659 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148550 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-09ofz#56826 Heap-use-after-freeCaolán McNamara
since: commit abda72eeac19b18c22f57d5443c3955a463605d7 Date: Mon Feb 20 00:32:22 2023 +0100 tdf#82984 tdf#94915 zip64 support (import + export) Change-Id: Iffc1c54b3ccc5464e217d7f94ecc34b57ec1afb1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148526 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-09Fix typoAndrea Gelmini
Change-Id: I4c48c988667ffd9221a0e226ab9c35e1e857e9d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148489 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
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-01assert that Mutex exists at ctor timeCaolán McNamara
and drop the never can be hit throw Change-Id: I74c92f1ff50ef0f3f6f78a53057f121a3665ec3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148072 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-03-01cid#1521559 pass arg as ref to prove no Dereference before null checkCaolán McNamara
and cid#1521561 Dereference before null check and drop pointless null check Change-Id: I2e99733eb5f1861bb02f6d8ec7a44ace4ded16cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148070 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-02-28flatten OWriteStreamNoel Grandin
no need to use pimpl pattern here Change-Id: Iebc412aaad83c2f1fc149cc320729ce25030cbc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147949 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-28no need to allocate OTypeCollection separately in OStorageNoel Grandin
it is only one pointer big Change-Id: I4af56814be106026515aee6c09caa14e0f3eb09a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147948 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-28no need to allocate OTypeCollection separately in WSInternalData_ImplNoel Grandin
it is only one pointer big Change-Id: I291b1c0aaba2f46aebabefa0341a9e24cf20eeff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147947 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-17osl::Mutex->std::mutex in OHierarchyElement_ImplNoel Grandin
Change-Id: I458cab160f337019402659b5fb738ba85f73ea1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-02-15Drop 'using namespace ::std' in dirs [e-p]*Gabor Kelemen
Change-Id: Ibe6a2f662f5721c594d28a8e0d7340d0f3cffe95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147075 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-01-17XUnoTunnel->dynamic_cast in ZipPackageEntryNoel Grandin
Change-Id: I0c49ebcb0ed16ab5b90c0cfa1417f002b5dad7b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145632 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-17XUnoTunnel->dynamic_cast in ZipPackageNoel Grandin
Change-Id: I4ecfbb0e90cca7e81556fb27fd552669bed0405c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145631 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-15Merge SvXMLAttributeList to comphelper::AttributeListMike Kaganski
And simplify the latter, to always use "CDATA" type (as the former did). "CDATA" was used in all cases but one, where an empty string was used. Change-Id: I1b3bfae40e29628e4094d9a6e58a69a66865874c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145526 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-13Simplify a bitMike Kaganski
Change-Id: Ie2435701078b0e111c1b04b77c857fd1923f2d59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145430 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-01-13XUnoTunnel->dynamic_cast in comphelper::ByteReader and comphelper::ByteWriterNoel Grandin
Change-Id: I1f8c864a939dff1252ba15f517f63b62d1a1e1fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145393 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-09use std::this_thread::sleep_for instead of osl equivalentArnaud VERSINI
Change-Id: I5b4edc5417e5bb5e082688df616e1d5735717d92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142357 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-22loplugin:unusedfieldsNoel Grandin
Change-Id: I726b8b9dee3a424f731078cd6b10027423454bee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143086 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-27cid#1242675 Untrusted value as argumentCaolán McNamara
Change-Id: If8ecad4501d6c555791eae0ae113a34e05f9436f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141670 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-10-21tdf#133767 new service TempFileFastServiceNoel Grandin
to use in places where we know we can use the TempFileFast mechanism. Speeds up export to EPUB from 43s to 17s on my windows machine. This is essentially a copy of OTempFileService, but it does not implement XTempFile (because these temp files have no name on Windows). Also remove a couple of calls to Flush() (which is not necessary now), and TellEnd(), which is a little slow on Windows. Change-Id: Iced300bf8121eae08c7a011d62ec68b93330d84c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141598 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-29split utl::TempFile into fast and named variantsNoel Grandin
which makes it easier to know what each variant requires to stay on it's happy path Change-Id: I3275a2543573367714bc78092e882f6535507285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-27use more string_view in packageNoel Grandin
Change-Id: Ia38b2784222701d669f244523ce9a27c4068c5ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140639 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
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-17cid#1500507 silence Resource leakCaolán McNamara
Change-Id: I738600ee653d68e80dc8a18970e759d97da08970 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138392 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-07-18comphelper::ByteWriter::writeSomeBytes always writes all bytesStephan Bergmann
...so rename it to writeBytes for clarity, and drop the redundant return value. Also clarify that it has a narrow interface and requires nBytesToWrite to be non-negative. Change-Id: I76dee83fecd6350f473f55dcffb950c16aa22d93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137169 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-06-28use utl::TempFile directly in packageNoel Grandin
so we can (a) control the lifetime of the temp file properly and (b) we don't need to use file URLs which means we stay on the efficient path on Windows Change-Id: I2b1eed5f5afc8f89f53bde35ebb44e9922889817 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136557 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-23clang-tidy modernize-pass-by-value in packageNoel Grandin
Change-Id: Id12d7b38d278c9fb18b30c6d921713a53168b048 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136337 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-02Use more appropriate return type for ThreadPool::getPreferredConcurrencyStephan Bergmann
All call sites already effectively asked for an unsigned return type, including: * The ThreadPool ctor took an nWorkers argument of type sal_Int32, but internally stores that as std::size_t mnMaxWorkers. * ZipOutputStream::reduceScheduledThreadTasksToGivenNumberOrLess apparently benefits from an unsigned nThreadTasks parameter, getting rid of various casts in its implementation that were necessary to silence signed vs. unsigned comparison warnings. The only drawback is that comphelper::ThreadPool::getPreferredConcurrency() * 4 in package/source/zippackage/ZipPackageStream.cxx would now silently wrap around instead of causing UB on overflow (which could be detected with appropriate tools). Ideally, it would use some o3tl::saturating_mul if we had that, so add a TODO comment for now. While std::thread::hardware_concurrency returns unsigned, it looked more natural to go with std::size_t here, as some call sites already used that (see above), so the implementation of ThreadPool::getPreferredConcurrency is a natural place to hide clamping std::thread::hardware_concurrency() to std::size_t (in the unlikely case that std::size_t is of smaller rank than unsigned). This required addition of o3tl::clamp_to_unsigned in o3tl/safeint.hxx. Change-Id: I0a04a8b32e63ebfeb39f924c4b38520455a6fb38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135309 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-25elide some OUString allocationNoel Grandin
Change-Id: Idcb296980ea498373a0fb4f8c0c584eef2c5c9f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134922 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-24use comphelper::ByteReader in XBufferedStreamNoel Grandin
to avoid an intermediary buffer Change-Id: Ic59e701491ac041022ca3e328741f170bb5b7ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134842 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-20fix OWriteStream implementing XUnoTunnelNoel Grandin
doh, forgot to return it in the queryInterface in commit 62531ec1091c7b3f6a3577889a18234790ec716d add ByteWriter to reduce memory copying when writing data Change-Id: I460388b55ca38962bf60ef6be6a2b108deee6d73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134678 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-19add ByteWriter to reduce memory copying when writing dataNoel Grandin
similarly to ByteReader move both of them down to comphelper, since we want to use it from comphelper, and comphelper is "below" unotools in the module dependency graph Change-Id: Ic98fa2268e125fd8e4378fb899ad5f97de721713 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134645 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-17elide some OUString allocationNoel Grandin
Change-Id: Iadd73477bf3b0edaa0fb7db10f9ffca88fe737e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134476 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-14tdf#121740 cache hashcode in SequenceAsHashMapNoel Grandin
shaves 2% off load time Change-Id: I5bd4eabf61205df21a27d2822acd2676a7732a3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134315 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-14reserve space in map in ZipFile::readCENNoel Grandin
Change-Id: I4d7764f00b7d05ba5d43a3fb35596f5ec4653da3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134302 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-11avoid some OUString construction on some hot pathsNoel Grandin
Change-Id: I098b017d22b7a4502998a0901ddcfca08a57ee43 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134115 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-06tdf#121740 reduce cost of OStorage_Impl::GetElementNamesNoel Grandin
which shows up on the profile Change-Id: I7e4ef9d71d06562dc1c574fe41d616947e3d67e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133926 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-04Just use Any ctor instead of makeAny in packageStephan Bergmann
Change-Id: I527024f34b88ec764488a3766872f1941f8dbb4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133794 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-26Use o3tl::make_unsigned in some placesStephan Bergmann
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I9665e6c2c4c5557f2d4cf1bb646f9fffc7bd7d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-20loplugin:passstuffbyrefNoel Grandin
Change-Id: I336fd329b577b6fa141265d8bc7ce67784bd7306 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133210 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-13loplugin:stringviewparam whitelist some more functionsNoel Grandin
for which we have o3tl:: equivalents Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-17no need to have duplicate m_bIsRoot fieldsNoel Grandin
Change-Id: I4f8777462d0bb8cb9f1a6065a548a794d842d815 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131678 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-17no need to have duplicate m_nStorageType fieldsNoel Grandin
Change-Id: I65bfce88e2bb1d32ec6c292e7e5f020904405bed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131677 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-17flatten OStorage a littleNoel Grandin
Change-Id: I4a380d036c3e94f2df41d2c583d51f574d2c161d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131675 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-14loplugin:trivialdestructor (-stdlib=libc++)Stephan Bergmann
That these are only flagged when building against libc++ and not against libstdc++ is a consequence of the plugin's dependence on implementation details of the relevant classes, but so be it. Change-Id: I6b96f81939edab2b8e618aa53c9fe23492edfbbd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131562 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-03-11new loplugin:trivialdestructorNoel Grandin
look for potentially trivial destructors that can then be elided Change-Id: I435c251bd4291b5864c20d68f88676faac7c43fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131318 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-02-23cid#1500664 Dereference before null checkCaolán McNamara
this looks sensible at: commit e7c7d6f0e9cf0185188e864f6419667073283dcc Author: Kurt Zenker <kz@openoffice.org> Date: Thu Sep 11 09:16:30 2003 +0000 INTEGRATION: CWS mav05 (1.1.2); FILE ADDED as: if ( (*pElementIter)->m_bIsStorage ) { OSL_ENSURE( (*pElementIter)->m_pStorage && (*pElementIter)->m_pStorage->m_xPackageFolder.is(), "An inserted storage is incomplete!\n" ); if ( !(*pElementIter)->m_pStorage || !(*pElementIter)->m_pStorage->m_xPackageFolder.is() ) throw uno::RuntimeException(); // TODO xNewElement = uno::Reference< lang::XUnoTunnel >( (*pElementIter)->m_pStorage->m_xPackageFolder, uno::UNO_QUERY ); (*pElementIter)->m_pStorage->Commit(); } and then didn't after: commit 8c64f087f88173b3101307176cccdd03e6558c69 Author: Rüdiger Timm <rt@openoffice.org> Date: Thu Oct 30 08:48:27 2003 +0000 INTEGRATION: CWS mav08 (1.2.10); FILE MERGED 2003/10/15 08:07:55 mav 1.2.10.2: #i21121# substorages implement transacted mode 2003/10/13 14:26:33 mav 1.2.10.1: #i21121# Transacted mode for storages Change-Id: Ib05359b282d078cd40b41ed8f2fe9242235c9c83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130417 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-01-30Recheck modules [o-r]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I6b4b05a5e59b256653c4caf5297fffd601b45083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128845 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
2022-01-20WASM make test file loading workArmin Le Grand (Allotropia)
Change-Id: Ic34104534c3e0e73791cf867bfb2e1246dc79cf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128653 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>