summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAttila Szűcs <attila.szucs@collabora.com>2023-02-20 00:32:22 +0100
committerAndras Timar <andras.timar@collabora.com>2023-03-12 18:06:21 +0100
commit7ff45cfbeefbff47c88d3cd8b6638ac1748f73fa (patch)
treead208cba422094875d18e578059f039ed507dc1f /tools
parent8fd1dacbc4fdb586ea9c7bc0f405641eb3058e04 (diff)
tdf#82984 tdf#94915 zip64 support (import + export)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/stream/strmwnt.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index f88cbe307606..73658b24d595 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -164,24 +164,29 @@ sal_uInt64 SvFileStream::SeekPos(sal_uInt64 const nPos)
{
// check if a truncated STREAM_SEEK_TO_END was passed
assert(nPos != SAL_MAX_UINT32);
- DWORD nNewPos = 0;
+ LARGE_INTEGER nNewPos, nActPos;
+ nNewPos.QuadPart = 0;
+ nActPos.QuadPart = nPos;
+ bool result = false;
if( IsOpen() )
{
if( nPos != STREAM_SEEK_TO_END )
- // 64-Bit files are not supported
- nNewPos=SetFilePointer(pInstanceData->hFile,nPos,nullptr,FILE_BEGIN);
+ {
+ result = SetFilePointerEx(pInstanceData->hFile, nActPos, &nNewPos, FILE_BEGIN);
+ }
else
- nNewPos=SetFilePointer(pInstanceData->hFile,0L,nullptr,FILE_END);
-
- if( nNewPos == 0xFFFFFFFF )
{
- SetError(::GetSvError( GetLastError() ) );
- nNewPos = 0;
+ result = SetFilePointerEx(pInstanceData->hFile, nNewPos, &nNewPos, FILE_END);
+ }
+ if (!result)
+ {
+ SetError(::GetSvError(GetLastError()));
+ return 0;
}
}
else
SetError( SVSTREAM_GENERALERROR );
- return static_cast<sal_uInt64>(nNewPos);
+ return static_cast<sal_uInt64>(nNewPos.QuadPart);
}
void SvFileStream::FlushData()