diff options
| author | Dan Engelbrecht <[email protected]> | 2024-05-08 12:36:58 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-05-08 12:36:58 +0200 |
| commit | e3e1a95d1e754a48f8d348beaed65d5266082659 (patch) | |
| tree | a41701d3ee04e13fc05ef1f03f01c7f9b759c1ed | |
| parent | check partial chunk result (#73) (diff) | |
| download | zen-e3e1a95d1e754a48f8d348beaed65d5266082659.tar.xz zen-e3e1a95d1e754a48f8d348beaed65d5266082659.zip | |
Correctly calculate memory view size from Mid/MidInline function if size is not given (#76)
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zencore/include/zencore/memory.h | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 4959a4f06..c9f628f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## - Bugfix: If we get a request for a partial chunk that can not be fulfilled we warn and send back the full chunk +- Bugfix: Correctly calculate memory view size from Mid/MidInline function if size is not given - Improvement: Asserts gives an immediate ERROR log entry with callstack and reason - Improvement: Asserts flushes the log before sending error report to Sentry diff --git a/src/zencore/include/zencore/memory.h b/src/zencore/include/zencore/memory.h index a1f48555e..6965b76b1 100644 --- a/src/zencore/include/zencore/memory.h +++ b/src/zencore/include/zencore/memory.h @@ -141,7 +141,10 @@ struct MutableMemoryView inline void MidInline(uint64_t InOffset, uint64_t InSize = ~uint64_t(0)) { RightChopInline(InOffset); - LeftInline(InSize); + if (InSize != ~uint64_t(0)) + { + LeftInline(InSize); + } } /** Returns the middle part of the view by taking up to the given number of bytes from the given position. */ @@ -271,7 +274,10 @@ struct MemoryView inline void MidInline(uint64_t InOffset, uint64_t InSize = ~uint64_t(0)) { RightChopInline(InOffset); - LeftInline(InSize); + if (InSize != ~uint64_t(0)) + { + LeftInline(InSize); + } } /** Returns the middle part of the view by taking up to the given number of bytes from the given position. */ |