mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-21 13:26:08 +08:00
Fix C++17 implementation of wxString::ToCULong()
Do use std::from_chars<unsigned long>() in it as otherwise values greater than LONG_MAX failed to parse. Handle negative numbers explicitly to still parse them in this function as well, as needs to be done for compatibility. Add a test case for the previously failing numbers. Closes #23957.
This commit is contained in:
@@ -607,6 +607,17 @@ static const struct ToLongData
|
||||
{ wxT("0x11"), 17, Number_Ok, 0 },
|
||||
{ wxT("0x11"), 0, Number_Invalid, 8 },
|
||||
{ wxT("0x11"), 17, Number_Ok, 16 },
|
||||
|
||||
{
|
||||
#if SIZEOF_LONG == 4
|
||||
wxT("0xffffffff"),
|
||||
#elif SIZEOF_LONG == 8
|
||||
wxT("0xffffffffffffffff"),
|
||||
#else
|
||||
#error "Unknown sizeof(long)"
|
||||
#endif
|
||||
(TestValue_t)ULONG_MAX, Number_Unsigned, 0
|
||||
},
|
||||
};
|
||||
|
||||
wxGCC_WARNING_RESTORE(missing-field-initializers)
|
||||
|
||||
Reference in New Issue
Block a user