#endif
#include <ctype.h>
+#include <errno.h>
#include <string.h>
#include <stdlib.h>
*val = wxStrtol(start, &end, base);
// return true only if scan was stopped by the terminating NUL and if the
- // string was not empty to start with
- return !*end && (end != start);
+ // string was not empty to start with and no under/overflow occurred
+ return !*end && (end != start) && (errno != ERANGE);
}
bool wxString::ToULong(unsigned long *val, int base) const
*val = wxStrtoul(start, &end, base);
// return true only if scan was stopped by the terminating NUL and if the
- // string was not empty to start with
- return !*end && (end != start);
+ // string was not empty to start with and no overflow occurred
+ return !*end && (end != start) && (errno != ERANGE);
}
bool wxString::ToDouble(double *val) const
*val = wxStrtod(start, &end);
// return true only if scan was stopped by the terminating NUL and if the
- // string was not empty to start with
- return !*end && (end != start);
+ // string was not empty to start with and no under/overflow occurred
+ return !*end && (end != start) && (errno != ERANGE);
}
// ---------------------------------------------------------------------------