diff options
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/parse-xml.c b/parse-xml.c index a5b2f5cee..923df367c 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -207,11 +207,26 @@ enum number_type { static enum number_type parse_float(char *buffer, double *res, char **endp) { double val; + static gboolean first_time = TRUE; errno = 0; val = g_ascii_strtod(buffer, endp); if (errno || *endp == buffer) return NEITHER; + if (**endp == ',') { + if (val == rint(val)) { + /* we really want to send an error if this is a Subsurface native file + * as this is likely indication of a bug - but right now we don't have + * that information available */ + if (first_time) { + fprintf(stderr, "Floating point value with decimal comma (%s)?\n", buffer); + first_time = FALSE; + } + /* Try again */ + **endp = '.'; + val = g_ascii_strtod(buffer, endp); + } + } *res = val; return FLOAT; |