git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42573
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#endif
#include <ctype.h>
#endif
#include <ctype.h>
#include <string.h>
#include <stdlib.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
*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
}
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
*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
}
bool wxString::ToDouble(double *val) const
*val = wxStrtod(start, &end);
// return true only if scan was stopped by the terminating NUL and if the
*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);
}
// ---------------------------------------------------------------------------
}
// ---------------------------------------------------------------------------