diff options
author | Adam <adam@adam-laptop.(none)> | 2010-05-27 19:41:16 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 21:04:08 -0400 |
commit | c43666e344250e4d559d116a73a9d4a313cf1645 (patch) | |
tree | df06942944601aa76065aae0be48ccee432ace46 /src/misc.cpp | |
parent | 1394c96173cec02d148dfece563bb186cf2f33b6 (diff) |
Rewrote cs_access to be more C++ish, changed NumberList to be more C++ish and fixed some compiler warnings on 64bit systems
Diffstat (limited to 'src/misc.cpp')
-rw-r--r-- | src/misc.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index 735fb619a..1cdaf923d 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -235,9 +235,9 @@ NumberList::NumberList(const std::string &list, bool descending) : desc(descendi token = list; do { - char *h = strchr(token.c_str(), '-'); + size_t t = token.find('-'); - if (!h) + if (t == std::string::npos) { unsigned num = strtol(token.c_str(), &error, 10); if (*error == '\0') @@ -256,9 +256,8 @@ NumberList::NumberList(const std::string &list, bool descending) : desc(descendi else { char *error2; - *h++ = '\0'; - unsigned num1 = strtol(token.c_str(), &error, 10); - unsigned num2 = strtol(h, &error2, 10); + unsigned num1 = strtol(token.substr(0, t).c_str(), &error, 10); + unsigned num2 = strtol(token.substr(t + 1).c_str(), &error2, 10); if (*error == '\0' && *error2 == '\0') { for (unsigned i = num1; i <= num2; ++i) |