mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
fixed GH #1462: AbstractConfiguration::getUInt does not parse hex numbers
This commit is contained in:
@@ -147,7 +147,7 @@ unsigned AbstractConfiguration::getUInt(const std::string& key) const
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parseUnsigned(internalExpand(value));
|
||||
return parseUInt(internalExpand(value));
|
||||
else
|
||||
throw NotFoundException(key);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ unsigned AbstractConfiguration::getUInt(const std::string& key, unsigned default
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parseUnsigned(internalExpand(value));
|
||||
return parseUInt(internalExpand(value));
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ Int64 AbstractConfiguration::getInt64(const std::string& key) const
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parse64(internalExpand(value));
|
||||
return parseInt64(internalExpand(value));
|
||||
else
|
||||
throw NotFoundException(key);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ Int64 AbstractConfiguration::getInt64(const std::string& key, Int64 defaultValue
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parse64(internalExpand(value));
|
||||
return parseInt64(internalExpand(value));
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ UInt64 AbstractConfiguration::getUInt64(const std::string& key) const
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parseUnsigned64(internalExpand(value));
|
||||
return parseUInt64(internalExpand(value));
|
||||
else
|
||||
throw NotFoundException(key);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ UInt64 AbstractConfiguration::getUInt64(const std::string& key, UInt64 defaultVa
|
||||
|
||||
std::string value;
|
||||
if (getRaw(key, value))
|
||||
return NumberParser::parseUnsigned64(internalExpand(value));
|
||||
return parseUInt64(internalExpand(value));
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
@@ -462,13 +462,13 @@ std::string AbstractConfiguration::uncheckedExpand(const std::string& value) con
|
||||
int AbstractConfiguration::parseInt(const std::string& value)
|
||||
{
|
||||
if ((value.compare(0, 2, "0x") == 0) || (value.compare(0, 2, "0X") == 0))
|
||||
return NumberParser::parseHex(value);
|
||||
return static_cast<int>(NumberParser::parseHex(value));
|
||||
else
|
||||
return NumberParser::parse(value);
|
||||
}
|
||||
|
||||
|
||||
int AbstractConfiguration::parseUInt(const std::string& value)
|
||||
unsigned AbstractConfiguration::parseUInt(const std::string& value)
|
||||
{
|
||||
if ((value.compare(0, 2, "0x") == 0) || (value.compare(0, 2, "0X") == 0))
|
||||
return NumberParser::parseHex(value);
|
||||
@@ -480,7 +480,7 @@ int AbstractConfiguration::parseUInt(const std::string& value)
|
||||
Int64 AbstractConfiguration::parseInt64(const std::string& value)
|
||||
{
|
||||
if ((value.compare(0, 2, "0x") == 0) || (value.compare(0, 2, "0X") == 0))
|
||||
return NumberParser::parseHex64(value);
|
||||
return static_cast<Int64>(NumberParser::parseHex64(value));
|
||||
else
|
||||
return NumberParser::parse64(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user