Merge branch 'zip64-fix'

Notably fix ZIP64 creation with individual files larger than 4GB.

See https://github.com/wxWidgets/wxWidgets/pull/730
This commit is contained in:
Vadim Zeitlin
2018-02-16 16:03:32 +01:00
3 changed files with 128 additions and 25 deletions

View File

@@ -80,6 +80,19 @@ enum wxZipFlags
wxZIP_RESERVED = 0xF000
};
/**
Zip archive format
@since 3.1.1
*/
enum wxZipArchiveFormat
{
/// Default zip format: use ZIP64 if it is determined to be necessary.
wxZIP_FORMAT_DEFAULT,
/// ZIP64 format: force the use of ZIP64 format.
wxZIP_FORMAT_ZIP64
};
/**
@class wxZipNotifier
@@ -558,11 +571,17 @@ public:
//@{
/**
Takes ownership of @a entry and uses it to create a new entry in the zip.
If you do not specify a size and plan to put more than 4GB data into the
entry see SetFormat()
*/
bool PutNextEntry(wxZipEntry* entry);
/**
Create a new entry with the given name, timestamp and size.
If you do not specify a size and plan to put more than 4GB data into the
entry see SetFormat()
*/
bool PutNextEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now(),
@@ -574,5 +593,33 @@ public:
It is written at the end of the zip.
*/
void SetComment(const wxString& comment);
/**
Set the format of the archive.
The normal zip format is limited to single files and the complete
archive smaller than 4GB with less then 65k files. If any of these
limits are exceeded, this class will automatically create a ZIP64 file,
so in most situations calling SetFormat() is not necessary.
However to support single entries with more than 4GB of data
(compressed or original) whose sizes are unknown when adding the
entry with PutNextEntry(), the format has to be set to
wxZIP_FORMAT_ZIP64 before adding such entries.
@since 3.1.1
*/
void SetFormat(wxZipArchiveFormat format);
/**
Get the format of the archive.
This returns the value passed to SetFormat() and not necessarily the
actual archive format (e.g. this method could return
wxZIP_FORMAT_DEFAULT even if a ZIP64 will end up being created).
@since 3.1.1
wxZipArchiveFormat GetFormat() const;
};