From 07c3c06f59348c5558c909b2aa10734bf95e62e7 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 a1d46507..01ed25a0 100644 --- a/src/string.c +++ b/src/string.c @@ -100,7 +100,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; @@ -136,8 +136,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