[apps/sequence][apps/graph] CRC should be called on sizes multiple of 4

Change-Id: I4a55c14e1418f730051252cabef324833279747f
This commit is contained in:
Émilie Feral
2017-05-23 18:10:01 +02:00
parent d9f2604926
commit ba7d740a10
4 changed files with 8 additions and 8 deletions

View File

@@ -83,13 +83,11 @@ Sequence& Sequence::operator=(const Sequence& other) {
}
uint32_t Sequence::checksum() {
size_t dataLengthInBytes = 3*TextField::maxBufferSize()*sizeof(char);
assert((dataLengthInBytes & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4
char data[3*TextField::maxBufferSize()] = {};
char data[k_dataLengthInBytes/sizeof(char)] = {};
strlcpy(data, text(), TextField::maxBufferSize());
strlcpy(data+TextField::maxBufferSize(), firstInitialConditionText(), TextField::maxBufferSize());
strlcpy(data+2*TextField::maxBufferSize(), secondInitialConditionText(), TextField::maxBufferSize());
return Ion::crc32((uint32_t *)data, dataLengthInBytes>>2);
return Ion::crc32((uint32_t *)data, k_dataLengthInBytes>>2);
}
const char * Sequence::firstInitialConditionText() {