Revert to use std::strtof insted of std::stof to make travis happy
This commit is contained in:
+5
-23
@@ -1877,38 +1877,20 @@ void MakeLower( wchar_t *p, size_t iLen )
|
|||||||
|
|
||||||
float StringToFloat( const RString &sString )
|
float StringToFloat( const RString &sString )
|
||||||
{
|
{
|
||||||
try
|
float fOut = std::strtof(sString, nullptr);
|
||||||
{
|
|
||||||
float fOut = std::stof(sString);
|
|
||||||
if (!isfinite(fOut))
|
if (!isfinite(fOut))
|
||||||
{
|
{
|
||||||
fOut = 0.0f;
|
fOut = 0.0f;
|
||||||
}
|
}
|
||||||
return fOut;
|
return fOut;
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
return 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StringToFloat( const RString &sString, float &fOut )
|
bool StringToFloat( const RString &sString, float &fOut )
|
||||||
{
|
{
|
||||||
try
|
char *endPtr = nullptr;
|
||||||
{
|
|
||||||
fOut = std::stof(sString);
|
fOut = std::strtof(sString, &endPtr);
|
||||||
if (!isfinite(fOut))
|
return sString.size() && *endPtr == '\0' && isfinite(fOut);
|
||||||
{
|
|
||||||
fOut = 0.0f;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
fOut = 0.0f;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RString FloatToString( const float &num )
|
RString FloatToString( const float &num )
|
||||||
|
|||||||
Reference in New Issue
Block a user