Add wxNO_UNSAFE_WXSTRING_CONV2 macro

The macro disallows implicit conversions between wxString and const
char*
This commit is contained in:
Arrigo Marchiori
2019-10-21 11:05:58 +02:00
committed by Vadim Zeitlin
parent 15a4375f93
commit 65cbf40b7e
16 changed files with 502 additions and 33 deletions

View File

@@ -225,8 +225,10 @@ public:
// we have to provide a separate version for C strings as otherwise the
// template Read() would be used
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxString Read(const wxString& key, const char* defVal) const
{ return Read(key, wxString(defVal)); }
#endif
wxString Read(const wxString& key, const wchar_t* defVal) const
{ return Read(key, wxString(defVal)); }
@@ -268,10 +270,12 @@ public:
// we have to provide a separate version for C strings as otherwise they
// would be converted to bool and not to wxString as expected!
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
bool Write(const wxString& key, const char *value)
{ return Write(key, wxString(value)); }
bool Write(const wxString& key, const unsigned char *value)
{ return Write(key, wxString(value)); }
#endif
bool Write(const wxString& key, const wchar_t *value)
{ return Write(key, wxString(value)); }