Commit 8b7093a2 authored by peastman's avatar peastman
Browse files

Merge pull request #517 from chrisdembia/fix-lepton-size_t-warnings-with-cast

Fix lepton size_t VS2013 warnings by casting to int.
parents a72e364f 6a5c7d5e
......@@ -84,13 +84,13 @@ void CompiledExpression::compileExpression(const ExpressionTreeNode& node, vecto
// Process this node.
if (node.getOperation().getId() == Operation::VARIABLE) {
variableIndices[node.getOperation().getName()] = workspace.size();
variableIndices[node.getOperation().getName()] = (int) workspace.size();
variableNames.insert(node.getOperation().getName());
}
else {
int stepIndex = arguments.size();
int stepIndex = (int) arguments.size();
arguments.push_back(vector<int>());
target.push_back(workspace.size());
target.push_back((int) workspace.size());
operation.push_back(node.getOperation().clone());
if (args.size() == 0)
arguments[stepIndex].push_back(0); // The value won't actually be used. We just need something there.
......
......@@ -71,13 +71,13 @@ ExpressionProgram& ExpressionProgram::operator=(const ExpressionProgram& program
}
void ExpressionProgram::buildProgram(const ExpressionTreeNode& node) {
for (int i = node.getChildren().size()-1; i >= 0; i--)
for (int i = (int) node.getChildren().size()-1; i >= 0; i--)
buildProgram(node.getChildren()[i]);
operations.push_back(node.getOperation().clone());
}
int ExpressionProgram::getNumOperations() const {
return operations.size();
return (int) operations.size();
}
const Operation& ExpressionProgram::getOperation(int index) const {
......
......@@ -60,7 +60,7 @@ double ParsedExpression::evaluate(const map<string, double>& variables) const {
}
double ParsedExpression::evaluate(const ExpressionTreeNode& node, const map<string, double>& variables) {
int numArgs = node.getChildren().size();
int numArgs = (int) node.getChildren().size();
vector<double> args(max(numArgs, 1));
for (int i = 0; i < numArgs; i++)
args[i] = evaluate(node.getChildren()[i], variables);
......
......@@ -70,7 +70,7 @@ string Parser::trim(const string& expression) {
int start, end;
for (start = 0; start < (int) expression.size() && isspace(expression[start]); start++)
;
for (end = expression.size()-1; end > start && isspace(expression[end]); end--)
for (end = (int) expression.size()-1; end > start && isspace(expression[end]); end--)
;
if (start == end && isspace(expression[end]))
return "";
......@@ -140,7 +140,7 @@ vector<ParseToken> Parser::tokenize(const string& expression) {
ParseToken token = getNextToken(expression, pos);
if (token.getType() != ParseToken::Whitespace)
tokens.push_back(token);
pos += token.getText().size();
pos += (int) token.getText().size();
}
return tokens;
}
......@@ -257,7 +257,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
while (pos < (int) tokens.size() && tokens[pos].getType() == ParseToken::Operator) {
token = tokens[pos];
int opIndex = Operators.find(token.getText());
int opIndex = (int) Operators.find(token.getText());
int opPrecedence = Precedence[opIndex];
if (opPrecedence < precedence)
return result;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment