sscanf("%f") -> strtof()
This commit is contained in:
@@ -155,7 +155,7 @@ bool IniFile::GetValue(const CString &keyname, const CString &valuename, float&
|
|||||||
CString sValue;
|
CString sValue;
|
||||||
if( !GetValue(keyname,valuename,sValue) )
|
if( !GetValue(keyname,valuename,sValue) )
|
||||||
return false;
|
return false;
|
||||||
sscanf( sValue.c_str(), "%f", &value );
|
value = strtof( sValue, NULL );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -216,16 +216,17 @@ void Model::LoadMaterialsFromMilkshapeAscii( CString sPath )
|
|||||||
// shininess
|
// shininess
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW
|
THROW
|
||||||
float fShininess;
|
char *p;
|
||||||
if (sscanf (sLine, "%f", &fShininess) != 1)
|
float fShininess = strtof( sLine, &p );
|
||||||
|
if ( p == sLine )
|
||||||
THROW
|
THROW
|
||||||
Material.fShininess = fShininess;
|
Material.fShininess = fShininess;
|
||||||
|
|
||||||
// transparency
|
// transparency
|
||||||
if( f.GetLine( sLine ) <= 0 )
|
if( f.GetLine( sLine ) <= 0 )
|
||||||
THROW
|
THROW
|
||||||
float fTransparency;
|
float fTransparency = strtof( sLine, &p );
|
||||||
if (sscanf (sLine, "%f", &fTransparency) != 1)
|
if ( p == sLine )
|
||||||
THROW
|
THROW
|
||||||
Material.fTransparency = fTransparency;
|
Material.fTransparency = fTransparency;
|
||||||
|
|
||||||
|
|||||||
@@ -198,8 +198,9 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
if( mult.Compare(sBit, matches) )
|
if( mult.Compare(sBit, matches) )
|
||||||
{
|
{
|
||||||
m_fTimeSpacing = 0.0f;
|
m_fTimeSpacing = 0.0f;
|
||||||
int ret = sscanf( matches[0], "%f", &m_fScrollSpeed );
|
char *p = NULL;
|
||||||
ASSERT( ret == 1 );
|
m_fScrollSpeed = strtof( matches[0], &p );
|
||||||
|
ASSERT( p != matches[0] );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,8 +232,7 @@ void PlayerOptions::FromString( CString sOptions )
|
|||||||
if( asParts[j].Right(1) == "*" )
|
if( asParts[j].Right(1) == "*" )
|
||||||
RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?",
|
RageException::Throw("Invalid player options '%i*'; did you mean '*%i'?",
|
||||||
atoi(asParts[j]), atoi(asParts[j]) );
|
atoi(asParts[j]), atoi(asParts[j]) );
|
||||||
sscanf( asParts[j], "%f", &level );
|
level = strtof( asParts[j], NULL ) / 100.0f;
|
||||||
level /= 100.0f;
|
|
||||||
}
|
}
|
||||||
else if( asParts[j][0]=='*' )
|
else if( asParts[j][0]=='*' )
|
||||||
sscanf( asParts[j], "*%f", &speed );
|
sscanf( asParts[j], "*%f", &speed );
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ void SongOptions::FromString( CString sOptions )
|
|||||||
vector<CString> matches;
|
vector<CString> matches;
|
||||||
if( mult.Compare(sBit, matches) )
|
if( mult.Compare(sBit, matches) )
|
||||||
{
|
{
|
||||||
int ret = sscanf( matches[0], "%f", &m_fMusicRate );
|
char *p = NULL;
|
||||||
ASSERT( ret == 1 );
|
m_fMusicRate = strtof( matches[0], &p );
|
||||||
|
ASSERT( p != matches[0] );
|
||||||
}
|
}
|
||||||
|
|
||||||
matches.clear();
|
matches.clear();
|
||||||
|
|||||||
Reference in New Issue
Block a user