diff options
author | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-09-12 11:06:36 +0000 |
---|---|---|
committer | special <special@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-09-12 11:06:36 +0000 |
commit | 68dc3792ee7b91fbc9cd662bd966d5c9cb63824a (patch) | |
tree | 9df4472fedbbcad99f6de259b09d49f1de22d580 | |
parent | 639a462ea42ee360c9aeeb96bd82ed90e978f204 (diff) |
Renamed the needs_unsigned parameter of ConfigReader::ReadInteger to need_positive to better reflect what it does
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8025 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modules.h | 13 | ||||
-rw-r--r-- | src/modules.cpp | 10 |
2 files changed, 12 insertions, 11 deletions
diff --git a/include/modules.h b/include/modules.h index d6a4ecb89..a36b6f0b3 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1376,7 +1376,7 @@ class CoreExport Module : public Extensible #define CONF_NOT_A_NUMBER 0x000010 -#define CONF_NOT_UNSIGNED 0x000080 +#define CONF_INT_NEGATIVE 0x000080 #define CONF_VALUE_NOT_FOUND 0x000100 #define CONF_FILE_NOT_FOUND 0x000200 @@ -1455,11 +1455,12 @@ class CoreExport ConfigReader : public classbase * This method retrieves an integer value from the config file. Where multiple copies of the tag * exist in the config file, index indicates which of the values to retrieve. Any invalid integer * values in the tag will cause the objects error value to be set, and any call to GetError() will - * return CONF_INVALID_NUMBER to be returned. needs_unsigned is set if the number must be unsigned. - * If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError() - * will return CONF_NOT_UNSIGNED + * return CONF_INVALID_NUMBER to be returned. need_positive is set if the number must be non-negative. + * If a negative number is placed into a tag which is specified positive, 0 will be returned and GetError() + * will return CONF_INT_NEGATIVE. Note that need_positive is not suitable to get an unsigned int - you + * should cast the result to achieve that effect. */ - long ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned); + int ReadInteger(const std::string &tag, const std::string &name, int index, bool need_positive); /** Retrieves an integer value from the config file. * This method retrieves an integer value from the config file. Where multiple copies of the tag * exist in the config file, index indicates which of the values to retrieve. Any invalid integer @@ -1468,7 +1469,7 @@ class CoreExport ConfigReader : public classbase * If a signed number is placed into a tag which is specified unsigned, 0 will be returned and GetError() * will return CONF_NOT_UNSIGNED. If the tag is not found, the default value is used instead. */ - long ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool needs_unsigned); + int ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive); /** Returns the last error to occur. * Valid errors can be found by looking in modules.h. Any nonzero value indicates an error condition. diff --git a/src/modules.cpp b/src/modules.cpp index 0ddd6bdab..1bfe37608 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -1012,7 +1012,7 @@ bool ConfigReader::ReadFlag(const std::string &tag, const std::string &name, int } -long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool needs_unsigned) +int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, const std::string &default_value, int index, bool need_positive) { int result; @@ -1022,18 +1022,18 @@ long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, return 0; } - if ((needs_unsigned) && (result < 0)) + if ((need_positive) && (result < 0)) { - this->error = CONF_NOT_UNSIGNED; + this->error = CONF_INT_NEGATIVE; return 0; } return result; } -long ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool needs_unsigned) +int ConfigReader::ReadInteger(const std::string &tag, const std::string &name, int index, bool need_positive) { - return ReadInteger(tag, name, "", index, needs_unsigned); + return ReadInteger(tag, name, "", index, need_positive); } long ConfigReader::GetError() |