aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zencore/include/zencore/memory.h10
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. */