mirror of https://github.com/raysan5/raylib
rtext: always multiply by sign in TextToFloat() (#4273)
Co-authored-by: Listeria monocytogenes <listeria@disroot.org>
This commit is contained in:
parent
c8bee7c439
commit
cc88e0b780
|
@ -1467,8 +1467,7 @@ float TextToFloat(const char *text)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++) value = value*10.0f + (float)(text[i] - '0');
|
||||||
|
|
||||||
if (text[i++] != '.') value *= sign;
|
if (text[i++] == '.')
|
||||||
else
|
|
||||||
{
|
{
|
||||||
float divisor = 10.0f;
|
float divisor = 10.0f;
|
||||||
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
for (; ((text[i] >= '0') && (text[i] <= '9')); i++)
|
||||||
|
@ -1478,7 +1477,7 @@ float TextToFloat(const char *text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value*sign;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SUPPORT_TEXT_MANIPULATION)
|
#if defined(SUPPORT_TEXT_MANIPULATION)
|
||||||
|
|
Loading…
Reference in New Issue