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:
parent
2ff3276e5f
commit
f66899a3bd
1 changed files with 8 additions and 4 deletions
|
|
@ -1566,13 +1566,17 @@ public:
|
||||||
char *p;
|
char *p;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
/* FIXME: strtod is locale dependent... */
|
/* FIXME: strtod is locale dependent... */
|
||||||
(void) strtod(Char(value), &p);
|
double val = strtod(Char(value), &p);
|
||||||
if (errno || *p) {
|
if (errno || *p) {
|
||||||
Clear(value);
|
Clear(value);
|
||||||
Append(value, "?");
|
Append(value, "?");
|
||||||
} else {
|
} else if (strchr(Char(value), '.') == NULL) {
|
||||||
if (strchr(Char(value), '.') == NULL) {
|
// Ensure value is a double constant, not an integer one.
|
||||||
Insert(value, 0, (void *)"(double)");
|
Append(value, ".0");
|
||||||
|
double val2 = strtod(Char(value), &p);
|
||||||
|
if (errno || *p || val != val2) {
|
||||||
|
Clear(value);
|
||||||
|
Append(value, "?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue