libconfigfile: accept booleans as int32 or int64

for compatibility if config file entry is changed from boolean to int32 or int64

based on patch by martii <m4rtii@gmx.de> in Neutrino-MP Git
This commit is contained in:
Christian Schuett
2014-06-23 21:37:49 +02:00
committed by svenhoefer
parent 253579909f
commit ad498249d1

View File

@@ -204,6 +204,10 @@ int32_t CConfigFile::getInt32(const std::string & key, const int32_t defaultVal)
}
}
if (configData[key] == "false")
return 0;
if (configData[key] == "true")
return 1;
return atoi(configData[key].c_str());
}
@@ -225,6 +229,10 @@ int64_t CConfigFile::getInt64(const std::string & key, const int64_t defaultVal)
}
}
if (configData[key] == "false")
return 0;
if (configData[key] == "true")
return 1;
return atoll(configData[key].c_str());
}