MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / zipStreamSize

Function zipStreamSize

common/transferprotocol.cpp:260–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258 }
259
260 std::optional<uint64_t> zipStreamSize(const std::vector<SendFile>& files, const std::vector<std::string>& dirs)
261 {
262 uint64_t total = 22; // end of central directory
263 for (const auto& dir : dirs) {
264 total += 30 + dir.size(); // local header
265 total += 46 + dir.size(); // central directory
266 }
267 for (const auto& entry : files) {
268 total += 30 + entry.relPath.size() + (uint64_t)entry.size + 16; // local header + data + data descriptor
269 total += 46 + entry.relPath.size(); // central directory
270 }
271 if (total > kZipMaxSize) {
272 return std::nullopt;
273 }
274 return total;
275 }
276
277 bool parseMultipart(const std::string& head, uint64_t bodyLen, const std::string& boundary, std::string& outMeta, uint64_t& outFileOffset,
278 uint64_t& outFileLen, std::string& outError)

Callers 3

sendBackupMethod · 0.85
sendBackupMethod · 0.85
zipDirFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected