diff options
author | worktycho <work.tycho@gmail.com> | 2015-05-30 11:32:35 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-05-30 11:32:35 +0200 |
commit | 2ce405883ac34f3f2e443d60ba93a94568568f39 (patch) | |
tree | 63de5aa4fdcfe13224e954aa557096a720389401 /src/StringUtils.h | |
parent | Merge pull request #2167 from SafwatHalaby/diags (diff) | |
parent | Fix FreeBSD/clang errors caused by -Werror (diff) | |
download | cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.gz cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.bz2 cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.lz cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.xz cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.zst cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.zip |
Diffstat (limited to 'src/StringUtils.h')
-rw-r--r-- | src/StringUtils.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/StringUtils.h b/src/StringUtils.h index 8f67d8031..62767d007 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -168,6 +168,12 @@ bool StringToInteger(const AString & a_str, T & a_Num) } else { + // Unsigned result cannot be signed! + if (!std::numeric_limits<T>::is_signed) + { + return false; + } + for (size_t size = a_str.size(); i < size; i++) { if ((a_str[i] < '0') || (a_str[i] > '9')) |