summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-18 13:29:32 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-18 13:29:32 -0400
commitc81e4d508099525ff0098a24296cd0278a140abd (patch)
tree2f7c0d01318fe40c57674fc28e26974af2181047 /src/lib/eina
parent9ea26fd88fe54b1dc6a46627c26b1176aaeec899 (diff)
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
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_convert.c1
-rw-r--r--src/lib/eina/eina_convert.h4
2 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/eina/eina_convert.c b/src/lib/eina/eina_convert.c
index 915ed7d..f210d14 100644
--- a/src/lib/eina/eina_convert.c
+++ b/src/lib/eina/eina_convert.c
@@ -476,6 +476,7 @@ eina_convert_strtod_c(const char *nptr, char **endptr)
476 unsigned long long integer_part; 476 unsigned long long integer_part;
477 int minus; 477 int minus;
478 478
479 if (endptr) *endptr = (char*)nptr;
479 EINA_SAFETY_ON_NULL_RETURN_VAL(nptr, 0.0); 480 EINA_SAFETY_ON_NULL_RETURN_VAL(nptr, 0.0);
480 481
481 a = iter = nptr; 482 a = iter = nptr;
diff --git a/src/lib/eina/eina_convert.h b/src/lib/eina/eina_convert.h
index 337cd88..314cd4c 100644
--- a/src/lib/eina/eina_convert.h
+++ b/src/lib/eina/eina_convert.h
@@ -337,9 +337,9 @@ EAPI Eina_Bool eina_convert_atofp(const char *src,
337 * @brief Converts a string to a floating point number. 337 * @brief Converts a string to a floating point number.
338 * 338 *
339 * @param[in] nptr a string to convert. It shouldn't be NULL. 339 * @param[in] nptr a string to convert. It shouldn't be NULL.
340 * @param[out] endptr If endptr is not NULL, a pointer to the character after the last 340 * @param[out] endptr If @p endptr is not NULL, a pointer to the character after the last
341 * character used in the conversion is stored in the location referenced 341 * character used in the conversion is stored in the location referenced
342 * by endptr. 342 * by endptr. If @p nptr is NULL, this will also be set to NULL.
343 * @return a double type floating point number. 343 * @return a double type floating point number.
344 * 344 *
345 * This function returns converted floating point number with locale-independency. 345 * This function returns converted floating point number with locale-independency.