Allow disabling unsafe implicit conversions in wxString
While we have to keep these conversions enabled by default, they are very dangerous as they can result in silent data loss on any system not using a locale with UTF-8 encoding, i.e. always under MSW. Allow mitigating this by defining wxNO_UNSAFE_WXSTRING_CONV when compiling the application code using the library, which makes these conversions invisible to the user code, and so can be used without recompiling the library. Also add wxUSE_UNSAFE_WXSTRING_CONV which can be set to 0 when compiling the library to disable these conversions globally for all applications using it. Closes #11830.
This commit is contained in:
@@ -54,6 +54,18 @@
|
||||
// Recommended setting: 0
|
||||
#define wxDIALOG_UNIT_COMPATIBILITY 0
|
||||
|
||||
// Provide unsafe implicit conversions in wxString to "const char*" or
|
||||
// "std::string" (depending on wxUSE_STD_STRING_CONV_IN_WXSTRING value).
|
||||
//
|
||||
// Default is 1 but only for compatibility reasons, it is recommended to set
|
||||
// this to 0 because converting wxString to a narrow (non-Unicode) string may
|
||||
// fail unless a locale using UTF-8 encoding is used, which is never the case
|
||||
// under MSW, for example, hence such conversions can result in silent data
|
||||
// loss.
|
||||
//
|
||||
// Recommended setting: 0
|
||||
#define wxUSE_UNSAFE_WXSTRING_CONV 1
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// debugging settings
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user