getInt: changed the type of the temp variable res from int to long, for it to be able to store the values LONG_MIN and LONG_MAX

master
Emanuel Vintila 2017-11-30 13:14:57 +01:00 committed by Nicholas Brown
parent 9ca30e10de
commit 07ddf03655
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ int CfgBase::getInt(const std::string& name, int def, XMLElement* elem)
std::string str;
try {
str = _get(name, elem);
int res = strtol(str.c_str(), NULL, 10);
long res = strtol(str.c_str(), NULL, 10);
if (res==LONG_MIN || res==LONG_MAX) {
THROWEXCEPTION("failed to read integer %s in element %s in configuration (is it too large? or invalid?)", str.c_str(), name.c_str());
}