Can't use (double) cast in PHP default value, so rework.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9916 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2007-08-25 16:03:24 +00:00
commit f66899a3bd

View file

@ -1566,13 +1566,17 @@ public:
char *p;
errno = 0;
/* FIXME: strtod is locale dependent... */
(void) strtod(Char(value), &p);
double val = strtod(Char(value), &p);
if (errno || *p) {
Clear(value);
Append(value, "?");
} else {
if (strchr(Char(value), '.') == NULL) {
Insert(value, 0, (void *)"(double)");
} else if (strchr(Char(value), '.') == NULL) {
// Ensure value is a double constant, not an integer one.
Append(value, ".0");
double val2 = strtod(Char(value), &p);
if (errno || *p || val != val2) {
Clear(value);
Append(value, "?");
}
}
break;