From 3e42921c657bc93094f0c7d96855aae9b0be5a7e Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 8 Jan 2013 15:39:16 -0800 Subject: Improve warnings; fix const_db.txt bug. --- src/common/extract.hpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/common/extract.hpp') diff --git a/src/common/extract.hpp b/src/common/extract.hpp index 52df9df..24456be 100644 --- a/src/common/extract.hpp +++ b/src/common/extract.hpp @@ -29,14 +29,9 @@ bool extract(const_string str, T *iv) { if (!str || str.size() > 20) return false; - switch (str.front()) - { - case '-': - case '0' ... '9': - break; - default: - return false; - } + if (!((str.front() == '-' && std::is_signed::value) + || ('0' <= str.front() && str.front() <= '9'))) + return false; char buf[20 + 1]; std::copy(str.begin(), str.end(), buf); buf[str.size()] = '\0'; @@ -53,8 +48,6 @@ bool extract(const_string str, T *iv) } else { - if (str.front() == '-') - return false; unsigned long long v = strtoull(buf, &end, 10); if (errno || *end) return false; -- cgit v1.2.3-60-g2f50