forked from Bananymous/banan-os
LibC: set endp in string to float conversion error
This commit is contained in:
@@ -211,6 +211,8 @@ static T strtoT(const char* str, char** endp, int& error)
|
|||||||
// no conversion can be performed -- not ([digit] || .[digit])
|
// no conversion can be performed -- not ([digit] || .[digit])
|
||||||
if (!(isdigit(*str) || (str[0] == '.' && isdigit(str[1]))))
|
if (!(isdigit(*str) || (str[0] == '.' && isdigit(str[1]))))
|
||||||
{
|
{
|
||||||
|
if (endp)
|
||||||
|
*endp = const_cast<char*>(str);
|
||||||
error = EINVAL;
|
error = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user