summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAttila Szűcs <attila.szucs@collabora.com>2023-02-20 00:32:22 +0100
committerMichael Meeks <michael.meeks@collabora.com>2023-03-08 14:53:57 +0000
commitabda72eeac19b18c22f57d5443c3955a463605d7 (patch)
treea6ac56d800179a06330b834e29c31894716f929f /tools
parentf1306e1d0f52716cf44a9052654af4133fa2c6eb (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 57f7c8b50c07..d7d3a73ed2ce 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -152,24 +152,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(mxFileHandle,nPos,nullptr,FILE_BEGIN);
+ {
+ result = SetFilePointerEx(mxFileHandle, nActPos, &nNewPos, FILE_BEGIN);
+ }
else
- nNewPos=SetFilePointer(mxFileHandle,0L,nullptr,FILE_END);
-
- if( nNewPos == 0xFFFFFFFF )
{
- SetError(::GetSvError( GetLastError() ) );
- nNewPos = 0;
+ result = SetFilePointerEx(mxFileHandle, 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()