Skip to content
Open
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
13 changes: 7 additions & 6 deletions copasi/math/CMathContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@ void CMathContainer::createRelocation(const size_t & newSize, const size_t & old
{
if (newSize != oldSize)
{
size_t minSize = std::min(newSize, oldSize);
// Size modifications are made at the end of the current section
if (modifiedAtEnd)
{
currentRelocation.pValueEnd = currentRelocation.pValueEnd + std::min(newSize, oldSize);
currentRelocation.pObjectEnd = currentRelocation.pObjectEnd + std::min(newSize, oldSize);
currentRelocation.pValueEnd = currentRelocation.pValueEnd + minSize;
currentRelocation.pObjectEnd = currentRelocation.pObjectEnd + minSize;

if (currentRelocation.pValueStart != currentRelocation.pValueEnd)
{
relocations.push_back(currentRelocation);
}

currentRelocation.pValueStart = currentRelocation.pValueEnd - std::min(newSize, oldSize) + oldSize;
currentRelocation.pObjectStart = currentRelocation.pObjectEnd - std::min(newSize, oldSize) + oldSize;
currentRelocation.pValueStart = currentRelocation.pValueEnd - minSize + oldSize;
currentRelocation.pObjectStart = currentRelocation.pObjectEnd - minSize + oldSize;
currentRelocation.pValueEnd = currentRelocation.pValueStart;
currentRelocation.pObjectEnd = currentRelocation.pObjectStart;
currentRelocation.offset += (newSize - oldSize);
Expand All @@ -72,8 +73,8 @@ void CMathContainer::createRelocation(const size_t & newSize, const size_t & old

currentRelocation.pValueEnd += oldSize;
currentRelocation.pObjectEnd += oldSize;
currentRelocation.pValueStart = currentRelocation.pValueEnd - std::min(newSize, oldSize);
currentRelocation.pObjectStart = currentRelocation.pObjectEnd - std::min(newSize, oldSize);
currentRelocation.pValueStart = currentRelocation.pValueEnd - minSize;
currentRelocation.pObjectStart = currentRelocation.pObjectEnd - minSize;
currentRelocation.offset += (newSize - oldSize);
}
}
Expand Down