[poincare] Cast matrix of char before calling getVariables

This commit is contained in:
Émilie Feral
2018-09-27 14:23:35 +02:00
parent 75a1de32ed
commit a4756c1945
2 changed files with 3 additions and 3 deletions

View File

@@ -268,7 +268,7 @@ bool StoreController::privateFillColumnWithFormula(Expression formula, Expressio
char variables[Expression::k_maxNumberOfVariables][k_maxSizeOfStoreSymbols];
variables[0][0] = 0;
AppsContainer * appsContainer = ((TextFieldDelegateApp *)app())->container();
int nbOfVariables = formula.getVariables(*(appsContainer->globalContext()), isVariable, variables, k_maxSizeOfStoreSymbols);
int nbOfVariables = formula.getVariables(*(appsContainer->globalContext()), isVariable, (char **)variables, k_maxSizeOfStoreSymbols);
assert(nbOfVariables >= 0);
int numberOfValuesToCompute = -1;
int index = 0;

View File

@@ -107,7 +107,7 @@ EquationStore::Error EquationStore::exactSolve(Poincare::Context * context) {
if (e.isUninitialized() || e.type() == ExpressionNode::Type::Undefined) {
return Error::EquationUndefined;
}
numberOfVariables = definedModelAtIndex(i)->standardForm(context).getVariables(*context, Symbol::isVariableSymbol, m_variables, Equation::k_maxVariableSize);
numberOfVariables = definedModelAtIndex(i)->standardForm(context).getVariables(*context, Symbol::isVariableSymbol, (char **)m_variables, Equation::k_maxVariableSize);
if (numberOfVariables == -1) {
return Error::TooManyVariables;
}
@@ -124,7 +124,7 @@ EquationStore::Error EquationStore::exactSolve(Poincare::Context * context) {
bool isLinear = true; // Invalid the linear system if one equation is non-linear
Preferences * preferences = Preferences::sharedPreferences();
for (int i = 0; i < numberOfDefinedModels(); i++) {
isLinear = isLinear && definedModelAtIndex(i)->standardForm(context).getLinearCoefficients(m_variables, coefficients[i], &constants[i], *context, preferences->angleUnit());
isLinear = isLinear && definedModelAtIndex(i)->standardForm(context).getLinearCoefficients((char **)m_variables, coefficients[i], &constants[i], *context, preferences->angleUnit());
if (!isLinear) {
// TODO: should we clean pool allocated memory if the system is not linear
#if 0