mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-17 15:14:48 +02:00
Fix zip files made with non-seekable output. (issue #335)
This commit is contained in:
parent
327e4eee81
commit
26e3dd273b
@ -54,6 +54,9 @@ ZipFileInfo::ZipFileInfo(const ZipLocalFileHeader& header):
|
|||||||
setUnixAttributes();
|
setUnixAttributes();
|
||||||
|
|
||||||
_rawInfo[GENERAL_PURPOSE_POS+1] |= 0x08; // Set "language encoding flag" to indicate that filenames and paths are in UTF-8.
|
_rawInfo[GENERAL_PURPOSE_POS+1] |= 0x08; // Set "language encoding flag" to indicate that filenames and paths are in UTF-8.
|
||||||
|
|
||||||
|
if (header.searchCRCAndSizesAfterData())
|
||||||
|
_rawInfo[GENERAL_PURPOSE_POS] |= 0x08;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,6 +215,13 @@ void ZipStreamBuf::close()
|
|||||||
poco_assert (*_pOstr);
|
poco_assert (*_pOstr);
|
||||||
// write an extra datablock if required
|
// write an extra datablock if required
|
||||||
// or fix the crc entries
|
// or fix the crc entries
|
||||||
|
|
||||||
|
poco_check_ptr(_pHeader);
|
||||||
|
_pHeader->setCRC(_crc32.checksum());
|
||||||
|
_pHeader->setUncompressedSize(_bytesWritten);
|
||||||
|
_pHeader->setCompressedSize(_ptrOHelper->bytesWritten());
|
||||||
|
_pHeader->setStartPos(_pHeader->getStartPos()); // This resets EndPos now that compressed Size is known
|
||||||
|
|
||||||
if (_pHeader->searchCRCAndSizesAfterData())
|
if (_pHeader->searchCRCAndSizesAfterData())
|
||||||
{
|
{
|
||||||
ZipDataInfo info;
|
ZipDataInfo info;
|
||||||
@ -225,10 +232,6 @@ void ZipStreamBuf::close()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
poco_check_ptr (_pHeader);
|
|
||||||
_pHeader->setCRC(_crc32.checksum());
|
|
||||||
_pHeader->setUncompressedSize(_bytesWritten);
|
|
||||||
_pHeader->setCompressedSize(static_cast<Poco::UInt32>(_ptrOHelper->bytesWritten()));
|
|
||||||
_pOstr->seekp(_pHeader->getStartPos(), std::ios_base::beg);
|
_pOstr->seekp(_pHeader->getStartPos(), std::ios_base::beg);
|
||||||
poco_assert (*_pOstr);
|
poco_assert (*_pOstr);
|
||||||
std::string header = _pHeader->createHeader();
|
std::string header = _pHeader->createHeader();
|
||||||
|
@ -13,6 +13,6 @@ objects = ZipTestSuite Driver \
|
|||||||
|
|
||||||
target = testrunner
|
target = testrunner
|
||||||
target_version = 1
|
target_version = 1
|
||||||
target_libs = PocoZip PocoNet PocoFoundation CppUnit
|
target_libs = PocoZip PocoFoundation CppUnit
|
||||||
|
|
||||||
include $(POCO_BASE)/build/rules/exec
|
include $(POCO_BASE)/build/rules/exec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user