summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-24 13:41:58 (GMT)
committerBrad King <brad.king@kitware.com>2015-06-30 14:21:37 (GMT)
commit8bf5a80b9668a31b85aaac00d1682228bbbbac5e (patch)
tree4eb69d8d006c51ae50d6290d401afad0b198e932 /Source/cmSystemTools.cxx
parentdffc307c81220ffc243abc3b87ecfd694bd4cd35 (diff)
downloadCMake-8bf5a80b9668a31b85aaac00d1682228bbbbac5e.zip
CMake-8bf5a80b9668a31b85aaac00d1682228bbbbac5e.tar.gz
CMake-8bf5a80b9668a31b85aaac00d1682228bbbbac5e.tar.bz2
cmSystemTools: Add StringToULong helper
Convert a string to an unsigned integer and reject any extra input.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index e2adabe..7230a64 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2955,3 +2955,12 @@ bool cmSystemTools::StringToLong(const char* str, long* value)
*value = strtol(str, &endp, 10);
return (*endp == '\0') && (endp != str) && (errno == 0);
}
+
+//----------------------------------------------------------------------------
+bool cmSystemTools::StringToULong(const char* str, unsigned long* value)
+{
+ errno = 0;
+ char *endp;
+ *value = strtoul(str, &endp, 10);
+ return (*endp == '\0') && (endp != str) && (errno == 0);
+}