Avoid strtof() since it's C99/POSIX. Go for strtod followed by float

cast since it should be almost identical
This commit is contained in:
LibretroAdmin 2022-08-03 14:07:32 +02:00
parent 16930150f8
commit 02df727cb2

View File

@ -1063,11 +1063,8 @@ int setting_set_with_string_representation(rarch_setting_t* setting,
}
break;
case ST_FLOAT:
#if defined(_MSC_VER) && _MSC_VER < 1800
sscanf(value, "%f", setting->value.target.fraction);
#else
*setting->value.target.fraction = strtof(value, &ptr);
#endif
/* strtof() is C99/POSIX. Just use the more portable kind. */
*setting->value.target.fraction = (float)strtod(value, &ptr);
if (flags & SD_FLAG_HAS_RANGE)
{
if (setting->enforce_minrange && *setting->value.target.fraction < min)