summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.h
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
committerworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
commit2ce405883ac34f3f2e443d60ba93a94568568f39 (patch)
tree63de5aa4fdcfe13224e954aa557096a720389401 /src/StringUtils.h
parentMerge pull request #2167 from SafwatHalaby/diags (diff)
parentFix FreeBSD/clang errors caused by -Werror (diff)
downloadcuberite-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.h6
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'))