1
0
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:
cyberbotx
2009-10-13 01:17:30 +00:00
parent 5bcb780c6d
commit 0d88137738
5 changed files with 494 additions and 348 deletions
+12 -4
View File
@@ -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;
}