Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests/unit/core] : DataElement improvements #1682

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/core/DataElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ namespace Core {
{
ASSERT(IsValid());
ASSERT(buffer != nullptr);
ASSERT(std::numeric_limits<uint64_t>::max() - size >= offset);

// Check if we cross a boundary for the read..
if ((offset + size) <= Size()) {
// Nope, one plain copy !!!
::memmove(buffer, &(Buffer()[offset]), size);
} else {
// If we want to read more than 4Gb ASSERT !!
ASSERT(Size() >= offset);
ASSERT(Size() - offset < 0xFFFFFFFF);

// oops partial read untill we got it all
Expand All @@ -119,13 +121,15 @@ namespace Core {
{
ASSERT(IsValid());
ASSERT(buffer != nullptr);
ASSERT(std::numeric_limits<uint64_t>::max() - size >= offset);

// Check if we cross a boundary for the write..
if ((offset + size) <= Size()) {
// Nope, one plain copy !!!
::memmove(&(Buffer()[offset]), buffer, size);
} else {
// If we want to write more than 4Gb ASSERT !!
ASSERT(Size() >= offset);
ASSERT(Size() - offset < 0xFFFFFFFF);

// oops partial read untill we got it all
Expand Down
Loading