aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/compositebuffer.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-02-25 15:48:43 +0100
committerGitHub Enterprise <[email protected]>2025-02-25 15:48:43 +0100
commit5bc5b0dd59c0f02afe553e5074dfe57951b19044 (patch)
tree625d46a9ef656cd6dd5f2879182f686b0299f44b /src/zencore/compositebuffer.cpp
parent5.5.18 (diff)
downloadzen-5bc5b0dd59c0f02afe553e5074dfe57951b19044.tar.xz
zen-5bc5b0dd59c0f02afe553e5074dfe57951b19044.zip
improvements and infrastructure for upcoming builds api command line (#284)
* add modification tick to filesystem traversal * add ShowDetails option to ProgressBar * log callstack if we terminate process * handle chunking if MaxSize > 1MB * BasicFile write helpers and WriteToTempFile simplifications * bugfix for CompositeBuffer::IterateRange when using DecompressToComposite for actually comrpessed data revert of earlier optimization * faster compress/decompress for large disk-based files * enable progress feedback in IoHash::HashBuffer * add payload validation in HttpClient::Get * fix range requests (range is including end byte) * remove BuildPartId for blob/block related operations in builds api
Diffstat (limited to 'src/zencore/compositebuffer.cpp')
-rw-r--r--src/zencore/compositebuffer.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/src/zencore/compositebuffer.cpp b/src/zencore/compositebuffer.cpp
index 49870a304..252ac9045 100644
--- a/src/zencore/compositebuffer.cpp
+++ b/src/zencore/compositebuffer.cpp
@@ -275,36 +275,18 @@ CompositeBuffer::IterateRange(uint64_t Offset,
Visitor(View, Segment);
break;
}
- if (Offset < SegmentSize)
+ else if (Offset <= SegmentSize)
{
- if (Offset == 0 && Size >= SegmentSize)
+ const MemoryView View = Segment.GetView().Mid(Offset, Size);
+ Offset = 0;
+ if (Size == 0 || !View.IsEmpty())
{
- const MemoryView View = Segment.GetView();
- if (!View.IsEmpty())
- {
- Visitor(View, Segment);
- }
- Size -= View.GetSize();
- if (Size == 0)
- {
- break;
- }
+ Visitor(View, Segment);
}
- else
+ Size -= View.GetSize();
+ if (Size == 0)
{
- // If we only want a section of the segment, do a subrange so we don't have to materialize the entire iobuffer
- IoBuffer SubRange(Segment.AsIoBuffer(), Offset, Min(Size, SegmentSize - Offset));
- const MemoryView View = SubRange.GetView();
- if (!View.IsEmpty())
- {
- Visitor(View, Segment);
- }
- Size -= View.GetSize();
- if (Size == 0)
- {
- break;
- }
- Offset = 0;
+ break;
}
}
else