From 5deef3176ee6f932ee5fd4fdf6fbed09cee44178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 22 Nov 2018 10:17:38 +0100 Subject: [PATCH] [sequence] The store checksum takes the storage into account This fixed the following scenario: Create f(x)=120 Create u(n) = f(1) Go to sequence graph, then Home, then change f. Go back to the sequence app: the cursor is not updated. --- apps/sequence/sequence_store.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/sequence/sequence_store.cpp b/apps/sequence/sequence_store.cpp index ffcd0d0f0..4c1e37382 100644 --- a/apps/sequence/sequence_store.cpp +++ b/apps/sequence/sequence_store.cpp @@ -1,22 +1,25 @@ #include "sequence_store.h" +#include extern "C" { #include #include } -#include namespace Sequence { constexpr const char * SequenceStore::k_sequenceNames[MaxNumberOfSequences]; uint32_t SequenceStore::storeChecksum() { - size_t dataLengthInBytes = MaxNumberOfSequences*sizeof(uint32_t); - assert((dataLengthInBytes & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4 + assert((MaxNumberOfSequences*sizeof(uint32_t) & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4 uint32_t checksums[MaxNumberOfSequences]; for (int i = 0; i < MaxNumberOfSequences; i++) { checksums[i] = m_sequences[i].checksum(); } - return Ion::crc32((uint32_t *)checksums, dataLengthInBytes/sizeof(uint32_t)); + constexpr int checksumsStoreStorageSize = 2; + uint32_t checksumsStoreStorage[checksumsStoreStorageSize]; + checksumsStoreStorage[0] = Ion::crc32((uint32_t *)checksums, MaxNumberOfSequences); + checksumsStoreStorage[1] = Ion::Storage::sharedStorage()->checksum(); + return Ion::crc32((uint32_t *)checksumsStoreStorage, checksumsStoreStorageSize); } char SequenceStore::symbol() const {