From 28de6689533914888093d32d3075f58e6f32a4a1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 7 Jul 2016 23:50:39 -0400 Subject: Make serd_strtod API const-correct This is an API breakage, but a minor one (particularly since NULL is allowed) that avoids the flaw in the C API. --- src/string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/string.c') diff --git a/src/string.c b/src/string.c index b564a874..7229d6b2 100644 --- a/src/string.c +++ b/src/string.c @@ -101,7 +101,7 @@ read_sign(const char** sptr) } double -serd_strtod(const char* str, char** endptr) +serd_strtod(const char* str, size_t* end) { double result = 0.0; @@ -137,8 +137,8 @@ serd_strtod(const char* str, char** endptr) result *= pow(10, expt * expt_sign); } - if (endptr) { - *endptr = (char*)s; + if (end) { + *end = s - str; } return result * sign; -- cgit v1.2.1