gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487

This commit is contained in:
Daniel Marjamäki 2010-08-06 19:42:31 +02:00
parent faa713e7b5
commit 271a74a16c
1 changed files with 2 additions and 2 deletions

View File

@ -36,13 +36,13 @@ long MathLib::toLongNumber(const std::string &str)
|| str.compare(0, 3, "+0x") == 0 || str.compare(0, 3, "+0x") == 0
|| str.compare(0, 3, "-0x") == 0) || str.compare(0, 3, "-0x") == 0)
{ {
return std::strtoul(str.c_str(), '\0', 16); return std::strtol(str.c_str(), '\0', 16);
} }
if (str.compare(0, 1, "0") == 0 if (str.compare(0, 1, "0") == 0
|| str.compare(0, 2, "+0") == 0 || str.compare(0, 2, "+0") == 0
|| str.compare(0, 2, "-0") == 0) || str.compare(0, 2, "-0") == 0)
{ {
return std::strtoul(str.c_str(), '\0', 8); return std::strtol(str.c_str(), '\0', 8);
} }
return (str.find("E", 0) != std::string::npos || str.find("e", 0) != std::string::npos) return (str.find("E", 0) != std::string::npos || str.find("e", 0) != std::string::npos)
? static_cast<long>(std::atof(str.c_str())) ? static_cast<long>(std::atof(str.c_str()))