Fix more compatibility problems in C++17 wxString::ToLong()
Unlike the traditional C functions, std::from_chars() doesn't skip leading whitespace and doesn't accept the leading "+" sign, so we need to skip them explicitly to preserve the behaviour of ToLong() in the previous wxWidgets versions.
This commit is contained in:
parent
8d6a722ed8
commit
ae2b05be5c
2 changed files with 20 additions and 7 deletions
|
|
@ -580,6 +580,9 @@ static const struct ToLongData
|
|||
{ wxT("-1"), -1, Number_Signed | Number_Long },
|
||||
// this is surprising but consistent with strtoul() behaviour
|
||||
{ wxT("-1"), (TestValue_t)ULONG_MAX, Number_Unsigned | Number_Long },
|
||||
// a couple of edge cases
|
||||
{ wxT(" +1"), 1, Number_Ok },
|
||||
{ wxT(" -1"), (TestValue_t)ULONG_MAX, Number_Unsigned | Number_Long },
|
||||
|
||||
// this must overflow, even with 64 bit long
|
||||
{ wxT("922337203685477580711"), 0, Number_Invalid },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue