Skip to content

Commit

Permalink
With MinGW builds, make a second try when checking if text is numeric. (
Browse files Browse the repository at this point in the history
#8542)

The MinGW cross-compile used by Julia is probably bugged and fails above test to detect if 'text' is a number. Do a second test (probably weaker) to try to save the situation.
  • Loading branch information
joa-quim authored Jul 10, 2024
1 parent 804d767 commit 157a1ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gmt_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -9433,8 +9433,16 @@ bool gmt_is_float (struct GMT_CTRL *GMT, char *text) {

if (sscanf (text, "%lf %n", &dummy, &len) == 1 && len == (int)strlen(text))
return true;
else
else {
#if defined(__MINGW32__)
/* The MinGW cross-compile used by Julia is probably bugged and fails above test to detect if 'text' is a number.
Use this test (probably weaker) to try to save the situation.
*/
if (strspn(text, ".0123456789eE") == strlen(text))
return true;
#endif
return false;
}
}

/*! . */
Expand Down

0 comments on commit 157a1ea

Please sign in to comment.