Merge branch 'avoid-impl-string-conv-logstatus'
Avoid implicit string conversions when using wxLog functions. See #24271.
This commit is contained in:
commit
dba79a2d67
2 changed files with 8 additions and 3 deletions
|
|
@ -921,12 +921,15 @@ public:
|
||||||
// indicates that we may have an extra first argument preceding the format
|
// indicates that we may have an extra first argument preceding the format
|
||||||
// string and that if we do have it, we should store it in m_info using the
|
// string and that if we do have it, we should store it in m_info using the
|
||||||
// given key (while by default 0 value will be used)
|
// given key (while by default 0 value will be used)
|
||||||
wxLogger& MaybeStore(const wxString& key, wxUIntPtr value = 0)
|
wxLogger& MaybeStore(const char* key, wxUIntPtr value = 0)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" );
|
wxASSERT_MSG( m_optKey.empty(), "can only have one optional value" );
|
||||||
m_optKey = key;
|
|
||||||
|
|
||||||
m_info.StoreValue(key, value);
|
// We only use keys defined in this file and we can be sure they
|
||||||
|
// contain ASCII characters only.
|
||||||
|
m_optKey = wxString::FromAscii(key);
|
||||||
|
|
||||||
|
m_info.StoreValue(m_optKey, value);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -411,4 +411,6 @@ TEST_CASE("wxNO_IMPLICIT_WXSTRING_ENCODING", "[string]")
|
||||||
// wxNO_IMPLICIT_WXSTRING_ENCODING must be set
|
// wxNO_IMPLICIT_WXSTRING_ENCODING must be set
|
||||||
s = "Hello, implicit encoding";
|
s = "Hello, implicit encoding";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wxLogSysError(wxASCII_STR("Bogus error for testing"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue