fix: fix some small problems in lexer
This commit is contained in:
@ -277,7 +277,10 @@ bool CommandBuyLexer(const std::string &command, std::string &ISBN,
|
|||||||
ISBN = "";
|
ISBN = "";
|
||||||
quantity = 0;
|
quantity = 0;
|
||||||
ss >> ISBN;
|
ss >> ISBN;
|
||||||
ss >> quantity;
|
long long quantity_tmp = 0;
|
||||||
|
ss >> quantity_tmp;
|
||||||
|
if (quantity_tmp > 2147483647) return false;
|
||||||
|
quantity = quantity_tmp;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@ -388,7 +391,10 @@ bool CommandImportLexer(const std::string &command, int &quantity,
|
|||||||
ss >> token;
|
ss >> token;
|
||||||
quantity = 0;
|
quantity = 0;
|
||||||
total_cost = 0;
|
total_cost = 0;
|
||||||
ss >> quantity;
|
long long quantity_tmp = 0;
|
||||||
|
ss >> quantity_tmp;
|
||||||
|
if (quantity_tmp > 2147483647) return false;
|
||||||
|
quantity = quantity_tmp;
|
||||||
ss >> total_cost;
|
ss >> total_cost;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
@ -416,8 +422,10 @@ bool CommandShowfinanceLexer(const std::string &command, int &count) {
|
|||||||
std::stringstream ss(command);
|
std::stringstream ss(command);
|
||||||
std::string token;
|
std::string token;
|
||||||
ss >> token;
|
ss >> token;
|
||||||
count = -1;
|
long long count_tmp = -1;
|
||||||
ss >> count;
|
ss >> count_tmp;
|
||||||
|
if (count_tmp > 2147483647) return false;
|
||||||
|
count = count_tmp;
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
Reference in New Issue
Block a user