From 36e57486f01fc026fd1e8886b32f91e385befedc Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 3 Feb 2016 14:52:43 +0000 Subject: Bug 696546: Add fast strtof Take on a (slightly tweaked) version of Simon Reinhardt's patch. The actual logic is left entirely unchanged; minor changes have been made to the names of functions/types to avoid clashing in the cmapdump.c repeated inclusion. Currently this should really only affect xps files, as strtof is only used as fz_atof, and that's (effectively) all xps for now. I will look at updating lex_number to call this in future. --- include/mupdf/fitz/string.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/mupdf/fitz/string.h b/include/mupdf/fitz/string.h index 0c1789bc..878610e2 100644 --- a/include/mupdf/fitz/string.h +++ b/include/mupdf/fitz/string.h @@ -103,10 +103,21 @@ int fz_runetochar(char *str, int rune); int fz_runelen(int rune); /* - fz_strtod: Locale-independent implementation of strtod(). + fz_strtod/fz_strtof: Locale-independent decimal to binary + conversion. On overflow return (-)INFINITY and set errno to ERANGE. On + underflow return 0 and set errno to ERANGE. Special inputs (case + insensitive): "NAN", "INF" or "INFINITY". */ double fz_strtod(const char *s, char **es); +float fz_strtof(const char *s, char **es); +/* + fz_strtof_no_exp: Like fz_strtof, but does not recognize exponent + format. So fz_strtof_no_exp("1.5e20", &tail) will return 1.5 and tail + will point to "e20". +*/ + +float fz_strtof_no_exp(const char *string, char **tailptr); /* fz_grisu: Compute decimal integer m, exp such that: f = m * 10^exp -- cgit v1.2.3