diff options
| author | Dan Engelbrecht <[email protected]> | 2024-04-30 10:11:25 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-04-30 10:11:25 +0200 |
| commit | c7a0ddf9f26fdd647574e4031a66362234298e7a (patch) | |
| tree | 5e3eba1856dc160ca0beb2bc5edaf1ea490a0a6f /src/zenutil/packageformat.cpp | |
| parent | miscellaneous minor bugfixes (#66) (diff) | |
| download | zen-c7a0ddf9f26fdd647574e4031a66362234298e7a.tar.xz zen-c7a0ddf9f26fdd647574e4031a66362234298e7a.zip | |
fix get project files loop (#68)
- Bugfix: Remove extra loop causing GetProjectFiles for project store to find all chunks once for each chunk found
- Bugfix: Don't capture ChunkIndex variable in CasImpl::IterateChunks by reference as it causes crash
- Improvement: Make FileCasStrategy::IterateChunks (optionally) multithreaded (improves GetProjectFiles performance)
Diffstat (limited to 'src/zenutil/packageformat.cpp')
| -rw-r--r-- | src/zenutil/packageformat.cpp | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/src/zenutil/packageformat.cpp b/src/zenutil/packageformat.cpp index 3fa602a96..2512351f5 100644 --- a/src/zenutil/packageformat.cpp +++ b/src/zenutil/packageformat.cpp @@ -461,19 +461,21 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint else { MalformedAttachments.push_back(std::make_pair(i, - fmt::format("Invalid format in '{}' (offset {}, size {})", + fmt::format("Invalid format in '{}' (offset {}, size {}) for {}", Path, AttachRefHdr->PayloadByteOffset, - AttachRefHdr->PayloadByteSize))); + AttachRefHdr->PayloadByteSize, + Entry.AttachmentHash))); } } else { MalformedAttachments.push_back(std::make_pair(i, - fmt::format("Unable to resolve chunk at '{}' (offset {}, size {})", + fmt::format("Unable to resolve chunk at '{}' (offset {}, size {}) for {}", Path, AttachRefHdr->PayloadByteOffset, - AttachRefHdr->PayloadByteSize))); + AttachRefHdr->PayloadByteSize, + Entry.AttachmentHash))); } } else if (Entry.Flags & CbAttachmentEntry::kIsCompressed) @@ -490,17 +492,20 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint else { // First payload is always a compact binary object - MalformedAttachments.push_back(std::make_pair( - i, - fmt::format("Invalid format, expected compressed buffer for CbObject (size {})", AttachmentBuffer.GetSize()))); + MalformedAttachments.push_back( + std::make_pair(i, + fmt::format("Invalid format, expected compressed buffer for CbObject (size {}) for {}", + AttachmentBuffer.GetSize(), + Entry.AttachmentHash))); } } else { - MalformedAttachments.push_back( - std::make_pair(i, - fmt::format("Invalid format, compressed object attachments are not currently supported (size {})", - AttachmentBuffer.GetSize()))); + MalformedAttachments.push_back(std::make_pair( + i, + fmt::format("Invalid format, compressed object attachments are not currently supported (size {}) for {}", + AttachmentBuffer.GetSize(), + Entry.AttachmentHash))); } } else @@ -512,9 +517,11 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint } else { - MalformedAttachments.push_back(std::make_pair( - i, - fmt::format("Invalid format, expected compressed buffer for attachment (size {})", AttachmentBuffer.GetSize()))); + MalformedAttachments.push_back( + std::make_pair(i, + fmt::format("Invalid format, expected compressed buffer for attachment (size {}) for {}", + AttachmentBuffer.GetSize(), + Entry.AttachmentHash))); } } } @@ -530,11 +537,12 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint { MalformedAttachments.push_back( std::make_pair(i, - fmt::format("Invalid format, object attachments are not currently supported (size {})", - AttachmentBuffer.GetSize()))); + fmt::format("Invalid format, object attachments are not currently supported (size {}) for {}", + AttachmentBuffer.GetSize(), + Entry.AttachmentHash))); } } - else + else if (AttachmentSize > 0) { // Make a copy of the buffer so the attachments don't reference the entire payload IoBuffer AttachmentBufferCopy = CreateBuffer(Entry.AttachmentHash, AttachmentSize); @@ -544,6 +552,11 @@ ParsePackageMessage(IoBuffer Payload, std::function<IoBuffer(const IoHash&, uint Attachments.emplace_back(SharedBuffer{AttachmentBufferCopy}); } + else + { + MalformedAttachments.push_back( + std::make_pair(i, fmt::format("Invalid format, attachment of size zero detected for {}", Entry.AttachmentHash))); + } } } PartialFileBuffers.clear(); |