[apps] The storage keeps a function's reduced expression, not a text

This commit is contained in:
Léa Saviot
2018-10-03 14:23:33 +02:00
committed by Émilie Feral
parent 4af3d27431
commit e7ca205d33
6 changed files with 25 additions and 20 deletions

View File

@@ -9,15 +9,15 @@ namespace Shared {
uint32_t StorageFunction::checksum() {
char data[k_dataLengthInBytes/sizeof(char)] = {};
strlcpy(data, text(), TextField::maxBufferSize());
data[k_dataLengthInBytes-2] = m_name != nullptr ? m_name[0] : 0;
data[k_dataLengthInBytes-1] = m_active ? 1 : 0;
text(data, TextField::maxBufferSize());
data[k_dataLengthInBytes-2] = m_name != nullptr ? m_name[0] : 0; //TODO
data[k_dataLengthInBytes-1] = m_active ? 1 : 0; //TODO
return Ion::crc32((uint32_t *)data, k_dataLengthInBytes/sizeof(uint32_t));
}
template<typename T>
T StorageFunction::templatedApproximateAtAbscissa(T x, Poincare::Context * context) const {
return expression(context).approximateWithValueForSymbol(symbol(), x, *context, Preferences::sharedPreferences()->angleUnit());
return reducedExpression(context).approximateWithValueForSymbol(symbol(), x, *context, Preferences::sharedPreferences()->angleUnit());
}
}