aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2006-04-15 13:58:01 +0000
committerMax Horn2006-04-15 13:58:01 +0000
commitebea155b8ebe6a92701aa40155e548bc59f12dbb (patch)
treeff21ac834f5f8144934818fef3a53fec264d02c5 /common
parentc07fc494d2d4d06459b7381ce028d0ad2a387b4e (diff)
downloadscummvm-rg350-ebea155b8ebe6a92701aa40155e548bc59f12dbb.tar.gz
scummvm-rg350-ebea155b8ebe6a92701aa40155e548bc59f12dbb.tar.bz2
scummvm-rg350-ebea155b8ebe6a92701aa40155e548bc59f12dbb.zip
Always use base 0 in strtol when parsing integer command line options / config file entries (this makes it possible to optionally use hex values)
svn-id: r21911
Diffstat (limited to 'common')
-rw-r--r--common/config-manager.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index ca30f5bb1e..b0de2d5ee6 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -425,7 +425,10 @@ int ConfigManager::getInt(const String &key, const String &domName) const {
if (value.empty())
return 0;
- int ivalue = (int)strtol(value.c_str(), &errpos, 10);
+ // We zse the special value '0' for the base passed to strtol. Doing that
+ // makes it possible to enter hex values as "0x1234", but also decimal
+ // values ("123") are still valid.
+ int ivalue = (int)strtol(value.c_str(), &errpos, 0);
if (value.c_str() == errpos)
error("ConfigManager::getInt(%s,%s): '%s' is not a valid integer",
key.c_str(), domName.c_str(), errpos);