Kaydet (Commit) 570d7f9c authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#111481 package: seek to 0 before truncate()

With this, the ZIP files created by the EPUB export don't trigger this
warning on 'unzip -l':

warning [test.epub]:  2546 extra bytes at beginning or within zipfile

Change-Id: Ic9111d2c97b9337cf39a023def4afe4c64c4a3e5
Reviewed-on: https://gerrit.libreoffice.org/40873Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 200d9509
......@@ -1395,6 +1395,14 @@ void SAL_CALL ZipPackage::commitChanges()
xOutputStream = m_xStream->getOutputStream();
// Make sure we avoid a situation where the current position is
// not zero, but the underlying file is truncated in the
// meantime.
uno::Reference<io::XSeekable> xSeekable(xOutputStream, uno::UNO_QUERY);
if (xSeekable.is())
uno::Reference < XTruncate > xTruncate ( xOutputStream, UNO_QUERY_THROW );
// after successful truncation the original file contents are already lost
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment