eina/convert: init endptr in failure case of eina_convert_strtod_c

Summary:
there is not any way to determine that this function has failed other
than to check this pointer, so ensure that it always has a value which
is meaningful in failure cases

Reviewers: cedric

Reviewed By: cedric

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10445
This commit is contained in:
Mike Blumenkrantz 2019-10-18 13:29:32 -04:00
parent 9ea26fd88f
commit c81e4d5080
2 changed files with 3 additions and 2 deletions

View File

@ -476,6 +476,7 @@ eina_convert_strtod_c(const char *nptr, char **endptr)
unsigned long long integer_part;
int minus;
if (endptr) *endptr = (char*)nptr;
EINA_SAFETY_ON_NULL_RETURN_VAL(nptr, 0.0);
a = iter = nptr;

View File

@ -337,9 +337,9 @@ EAPI Eina_Bool eina_convert_atofp(const char *src,
* @brief Converts a string to a floating point number.
*
* @param[in] nptr a string to convert. It shouldn't be NULL.
* @param[out] endptr If endptr is not NULL, a pointer to the character after the last
* @param[out] endptr If @p endptr is not NULL, a pointer to the character after the last
* character used in the conversion is stored in the location referenced
* by endptr.
* by endptr. If @p nptr is NULL, this will also be set to NULL.
* @return a double type floating point number.
*
* This function returns converted floating point number with locale-independency.