Update POCO library.

This commit is contained in:
Sandu Liviu Catalin
2023-03-23 20:19:11 +02:00
parent 8d15f4b6e9
commit 233fc103f9
2521 changed files with 257092 additions and 72789 deletions
+4 -4
View File
@@ -127,14 +127,14 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
_eofDetected = true;
_length += offset;
if (offset == 0 && !_postfix.empty())
{
offset = (_postfix.size() > length) ? length : static_cast<std::streamsize>(_postfix.size());
std::memcpy(buffer, _postfix.data(), offset);
_postfix.erase(0, offset);
}
return static_cast<int>(offset);
}
}
@@ -151,14 +151,14 @@ int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
_eofDetected = true;
_length += offset;
if (offset == 0 && !_postfix.empty())
{
offset = (_postfix.size() > length) ? length : static_cast<std::streamsize>(_postfix.size());
std::memcpy(buffer, _postfix.data(), offset);
_postfix.erase(0, offset);
}
return static_cast<int>(offset);
}
}
+10 -4
View File
@@ -83,6 +83,12 @@ void Compress::addEntry(std::istream& in, const Poco::DateTime& lastModifiedAt,
std::streamoff localHeaderOffset = _offset;
ZipLocalFileHeader hdr(fileName, lastModifiedAt, cm, cl, _forceZip64);
std::streampos pos = in.tellg();
in.seekg(0, in.end);
std::streampos length = in.tellg();
in.seekg(pos);
if (length >= ZipCommon::ZIP64_MAGIC)
hdr.setZip64Data();
hdr.setStartPos(localHeaderOffset);
ZipOutputStream zipOut(_out, hdr, _seekableOut);
@@ -321,11 +327,11 @@ ZipArchive Compress::close()
ZipArchive::FileInfos::const_iterator it = _infos.begin();
ZipArchive::FileInfos::const_iterator itEnd = _infos.end();
bool needZip64 = _forceZip64;
needZip64 = needZip64 || _files.size() >= ZipCommon::ZIP64_MAGIC_SHORT || centralDirStart64 >= ZipCommon::ZIP64_MAGIC;
needZip64 = needZip64 || _files.size() >= ZipCommon::ZIP64_MAGIC_SHORT || centralDirStart64 >= ZipCommon::ZIP64_MAGIC;
for (; it != itEnd; ++it)
{
const ZipFileInfo& nfo = it->second;
needZip64 = needZip64 || nfo.needsZip64();
needZip64 = needZip64 || nfo.needsZip64();
std::string info(nfo.createHeader());
_out.write(info.c_str(), static_cast<std::streamsize>(info.size()));
@@ -334,9 +340,9 @@ ZipArchive Compress::close()
_offset += entrySize;
}
if (!_out) throw Poco::IOException("Bad output stream");
Poco::UInt64 numEntries64 = _infos.size();
needZip64 = needZip64 || _offset >= ZipCommon::ZIP64_MAGIC;
needZip64 = needZip64 || _offset >= ZipCommon::ZIP64_MAGIC;
if (needZip64)
{
ZipArchiveInfo64 central;
+1 -1
View File
@@ -66,7 +66,7 @@ void ZipArchiveInfo::parse(std::istream& inp, bool assumeHeaderRead)
{
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
}
// read the rest of the header
inp.read(_rawInfo + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
Poco::UInt16 len = getZipCommentSize();
+2 -1
View File
@@ -243,7 +243,8 @@ void ZipLocalFileHeader::init(const Poco::Path& fName, ZipCommon::CompressionMet
}
else
setCompressionMethod(ZipCommon::CM_STORE);
if (_forceZip64)
if (needsZip64())
setZip64Data();
_rawHeader[GENERAL_PURPOSE_POS+1] |= 0x08; // Set "language encoding flag" to indicate that filenames and paths are in UTF-8.
+2 -2
View File
@@ -64,7 +64,7 @@ void ZipManipulator::renameFile(const std::string& zipPath, const std::string& n
{
const ZipLocalFileHeader& entry = getForChange(zipPath);
// checked later in Compress too but the earlier one gets the error the better
std::string fn = ZipUtil::validZipEntryFileName(newZipPath);
std::string fn = ZipUtil::validZipEntryFileName(newZipPath);
addOperation(zipPath, new Rename(entry, fn));
}
@@ -139,7 +139,7 @@ ZipArchive ZipManipulator::compress(const std::string& outFile)
Poco::FileOutputStream out(outFile);
Compress c(out, true);
c.EDone += Poco::Delegate<ZipManipulator, const ZipLocalFileHeader>(this, &ZipManipulator::onEDone);
ZipArchive::FileHeaders::const_iterator it = _in->headerBegin();
for (; it != _in->headerEnd(); ++it)
{
+5 -5
View File
@@ -38,7 +38,7 @@ Poco::DateTime ZipUtil::parseDateTime(const char* pVal, const Poco::UInt32 timeP
int day = (date & 0x001fu); // 0000 0000 0001 1111
int mon = ((date & 0x01e0u) >> 5); // 0000 0001 1110 0000
int year = 1980+((date & 0xfe00u) >> 9); // 1111 1110 0000 0000
if (Poco::DateTime::isValid(year, mon, day, hour, min, sec))
return Poco::DateTime(year, mon, day, hour, min, sec);
else
@@ -94,7 +94,7 @@ void ZipUtil::sync(std::istream& in)
{
enum
{
PREFIX = 2,
PREFIX = 2,
BUFFER_SIZE = 1024
};
char temp[BUFFER_SIZE];
@@ -102,7 +102,7 @@ void ZipUtil::sync(std::istream& in)
std::size_t tempPos = PREFIX;
while (in.good() && !in.eof())
{
{
// all zip headers start withe same 2byte prefix
if (std::memcmp(ZipLocalFileHeader::HEADER, &temp[tempPos - PREFIX], PREFIX) == 0)
{
@@ -110,8 +110,8 @@ void ZipUtil::sync(std::istream& in)
// read the next 2 bytes
in.read(temp+tempPos, PREFIX);
tempPos += PREFIX;
if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipFileInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipDataInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0)
{