Changeset: f3185c7dc672 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f3185c7dc672
Modified Files:
        gdk/gdk_atoms.c
Branch: Jul2015
Log Message:

Work around incorrect implementation of strtof.
Encountered on Intel compiler on Windows.  It incorrectly returns the
pointer at the end of the initial white space if no floating point
number was found.


diffs (31 lines):

diff --git a/gdk/gdk_atoms.c b/gdk/gdk_atoms.c
--- a/gdk/gdk_atoms.c
+++ b/gdk/gdk_atoms.c
@@ -850,8 +850,11 @@ dblFromStr(const char *src, int *len, db
                 * ERANGE.  We accept underflow, but not overflow. */
                char *pe;
                errno = 0;
-               d = strtod(src, &pe);
-               p = pe;
+               d = strtod(p, &pe);
+               if (p == pe)
+                       p = src; /* nothing converted */
+               else
+                       p = pe;
                n = (int) (p - src);
                if (n == 0 || (errno == ERANGE && (d < -1 || d > 1))
 #ifdef isfinite
@@ -913,8 +916,11 @@ fltFromStr(const char *src, int *len, fl
                 * ERANGE.  We accept underflow, but not overflow. */
                char *pe;
                errno = 0;
-               f = strtof(src, &pe);
-               p = pe;
+               f = strtof(p, &pe);
+               if (p == pe)
+                       p = src; /* nothing converted */
+               else
+                       p = pe;
                n = (int) (p - src);
                if (n == 0 || (errno == ERANGE && (f < -1 || f > 1))
 #else /* no strtof, try sscanf */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to