From 654d0cffd006573d7eedba19fbf2e627f04737b3 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. --- serd/serd.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'serd') diff --git a/serd/serd.h b/serd/serd.h index e8aff1e8..ba285255 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -316,13 +316,15 @@ serd_strlen(const char* str, SerdNodeFlags* flags); /** Parse a string to a double. - The API of this function is identical to the standard C strtod function, + The API of this function is similar to the standard C strtod function, except this function is locale-independent and always matches the lexical - format used in the Turtle grammar (the decimal point is always "."). + format used in the Turtle grammar (the decimal point is always "."). The + end parameter is an offset from the start of `str` to avoid the + const-correctness issues of the strtod API. */ SERD_API double -serd_strtod(const char* str, char** endptr); +serd_strtod(const char* str, size_t* end); /** Decode a base64 string. -- cgit v1.2.1