Coverity fix for libeval (CID #169327)

This commit is contained in:
Michael Geselbracht 2018-02-15 12:38:33 +01:00 committed by Maciej Suminski
parent 4a8a168079
commit 5d738dcb6d
2 changed files with 5 additions and 3 deletions

View File

@ -150,12 +150,12 @@ NumericEvaluator :: process(const char* s)
bClParseFinished = false; bClParseFinished = false;
Token tok; Token tok;
numEval::TokenType parseTok;
do { do {
tok = getToken(); tok = getToken();
parse(tok.token, tok.value); parse(tok.token, tok.value);
if (bClParseFinished || tok.token == ENDS) { if (bClParseFinished || tok.token == ENDS) {
numEval::Parse(pClParser, 0, parseTok, this); // Reset parser by passing zero as token ID, value is ignored.
numEval::Parse(pClParser, 0, tok.value, this);
break; break;
} }
//usleep(200000); //usleep(200000);

View File

@ -114,7 +114,6 @@ public:
void enableTextInputStorage(bool w) { bClTextInputStorage = w; } void enableTextInputStorage(bool w) { bClTextInputStorage = w; }
/* Used by the lemon parser */ /* Used by the lemon parser */
void parse(int token, numEval::TokenType value);
void parseError(const char* s); void parseError(const char* s);
void parseOk(); void parseOk();
void parseSetResult(double); void parseSetResult(double);
@ -162,6 +161,9 @@ protected:
/* Tokenizer: Next token/value taken from input string. */ /* Tokenizer: Next token/value taken from input string. */
Token getToken(); Token getToken();
/* Used by processing loop */
void parse(int token, numEval::TokenType value);
private: private:
void* pClParser; // the current lemon parser state machine void* pClParser; // the current lemon parser state machine