mirror of
https://github.com/anope/anope.git
synced 2026-06-29 06:26:36 +02:00
Code style cleanup, replace static_cast<std::string>() with std::string(), slight updates to config reader from InspIRCd.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2555 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+12
-4
@@ -21,7 +21,7 @@ ConfigReader::~ConfigReader()
|
||||
{
|
||||
if (this->errorlog)
|
||||
delete this->errorlog;
|
||||
if(this->privatehash)
|
||||
if (this->privatehash)
|
||||
delete this->data;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,10 @@ std::string ConfigReader::ReadValue(const std::string &tag, const std::string &n
|
||||
{
|
||||
/* Don't need to strlcpy() tag and name anymore, ReadConf() takes const char* */
|
||||
std::string result;
|
||||
if (!serverConfig.ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds)) this->error = CONF_VALUE_NOT_FOUND;
|
||||
|
||||
if (!serverConfig.ConfValue(*this->data, tag, name, default_value, index, result, allow_linefeeds))
|
||||
this->error = CONF_VALUE_NOT_FOUND;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -56,14 +59,19 @@ bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int
|
||||
int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive)
|
||||
{
|
||||
int result;
|
||||
if (!serverConfig.ConfValueInteger(*this->data, tag, name, default_value, index, result)) {
|
||||
|
||||
if (!serverConfig.ConfValueInteger(*this->data, tag, name, default_value, index, result))
|
||||
{
|
||||
this->error = CONF_VALUE_NOT_FOUND;
|
||||
return 0;
|
||||
}
|
||||
if (need_positive && result < 0) {
|
||||
|
||||
if (need_positive && result < 0)
|
||||
{
|
||||
this->error = CONF_INT_NEGATIVE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user