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:
Vadim Zeitlin
2017-02-12 00:47:35 +01:00
parent 4cc45797a1
commit e125c3b657
14 changed files with 159 additions and 1 deletions

View File

@@ -373,6 +373,14 @@
# endif
#endif /* !defined(wxUSE_UNICODE) */
#ifndef wxUSE_UNSAFE_WXSTRING_CONV
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_UNSAFE_WXSTRING_CONV must be defined, please read comment near the top of this file."
# else
# define wxUSE_UNSAFE_WXSTRING_CONV 0
# endif
#endif /* !defined(wxUSE_UNSAFE_WXSTRING_CONV) */
#ifndef wxUSE_URL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_URL must be defined, please read comment near the top of this file."