diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-10-20 17:47:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-21 12:01:05 +0200 |
commit | 848f9b2c56ce4c4620f62f1fbf9d12d84ec4da96 (patch) | |
tree | e9c81fcc12b292358d5d70010e7794fa2149fa00 /package/source/zipapi | |
parent | 6383362999b72160eab6abdfc6ea6bdbd231b100 (diff) |
tdf#133767 new service TempFileFastService
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>
Diffstat (limited to 'package/source/zipapi')
-rw-r--r-- | package/source/zipapi/ByteGrabber.cxx | 3 | ||||
-rw-r--r-- | package/source/zipapi/ZipFile.cxx | 11 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputEntry.cxx | 4 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputStream.cxx | 1 |
4 files changed, 3 insertions, 16 deletions
diff --git a/package/source/zipapi/ByteGrabber.cxx b/package/source/zipapi/ByteGrabber.cxx index b58a7087f468..5a491de6509b 100644 --- a/package/source/zipapi/ByteGrabber.cxx +++ b/package/source/zipapi/ByteGrabber.cxx @@ -70,9 +70,6 @@ void ByteGrabber::seek( sal_Int64 location ) if (!xSeek.is() ) throw io::IOException(THROW_WHERE ); - sal_Int64 nLen = xSeek->getLength(); - if ( location < 0 || location > nLen ) - throw lang::IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 1 ); xSeek->seek( location ); } diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 63ba823e240e..c59035919bb8 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -820,16 +820,9 @@ void ZipFile::readLOC( ZipEntry &rEntry ) try { - sal_Int16 nPathLenToRead = nPathLen; - const sal_Int64 nBytesAvailable = aGrabber.getLength() - aGrabber.getPosition(); - if (nPathLenToRead > nBytesAvailable) - nPathLenToRead = nBytesAvailable; - else if (nPathLenToRead < 0) - nPathLenToRead = 0; - // read always in UTF8, some tools seem not to set UTF8 bit - uno::Sequence<sal_Int8> aNameBuffer(nPathLenToRead); - sal_Int32 nRead = aGrabber.readBytes(aNameBuffer, nPathLenToRead); + uno::Sequence<sal_Int8> aNameBuffer(nPathLen); + sal_Int32 nRead = aGrabber.readBytes(aNameBuffer, nPathLen); if (nRead < aNameBuffer.getLength()) aNameBuffer.realloc(nRead); diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx index 2eb5f9db4391..86c8a9782df7 100644 --- a/package/source/zipapi/ZipOutputEntry.cxx +++ b/package/source/zipapi/ZipOutputEntry.cxx @@ -250,9 +250,7 @@ void ZipOutputEntryInThread::createBufferFile() { assert(!m_xOutStream && !m_xTempFile && "should only be called in the threaded mode where there is no existing stream yet"); - m_xTempFile.set( - io::TempFile::create(m_xContext), - uno::UNO_SET_THROW ); + m_xTempFile = new utl::TempFileFastService; m_xOutStream = m_xTempFile->getOutputStream(); } diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx index 33321627b6f9..9b582c4691e8 100644 --- a/package/source/zipapi/ZipOutputStream.cxx +++ b/package/source/zipapi/ZipOutputStream.cxx @@ -178,7 +178,6 @@ void ZipOutputStream::finish() delete p; } writeEND( nOffset, static_cast < sal_Int32 > (m_aChucker.GetPosition()) - nOffset); - m_xStream->flush(); m_aZipList.clear(); if (m_aDeflateException) |