Avoid implicit wxString conversions in wxLog{Status,SysError}()

They don't compile when wxNO_IMPLICIT_WXSTRING_ENCODING is defined.

Closes #24267.
This commit is contained in:
Vadim Zeitlin 2024-01-30 18:45:13 +01:00
parent cfb321b175
commit 10f235b43c
2 changed files with 4 additions and 2 deletions

View file

@ -1208,7 +1208,7 @@ WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0);
// and it will have changed already by then (in fact it even changes when // and it will have changed already by then (in fact it even changes when
// wxString::Format() is called because of vsnprintf() inside it so it can // wxString::Format() is called because of vsnprintf() inside it so it can
// change even much sooner) // change even much sooner)
#define wxLOG_KEY_SYS_ERROR_CODE "wx.sys_error" #define wxLOG_KEY_SYS_ERROR_CODE wxASCII_STR("wx.sys_error")
#define wxLogSysError \ #define wxLogSysError \
wxDO_LOG_IF_ENABLED_WITH_FUNC(Error, MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \ wxDO_LOG_IF_ENABLED_WITH_FUNC(Error, MaybeStore(wxLOG_KEY_SYS_ERROR_CODE, \
@ -1224,7 +1224,7 @@ WXDLLIMPEXP_BASE wxString wxSysErrorMsgStr(unsigned long nErrCode = 0);
#if wxUSE_GUI #if wxUSE_GUI
// wxLogStatus() is similar to wxLogSysError() as it allows to optionally // wxLogStatus() is similar to wxLogSysError() as it allows to optionally
// specify the frame to which the message should go // specify the frame to which the message should go
#define wxLOG_KEY_FRAME "wx.frame" #define wxLOG_KEY_FRAME wxASCII_STR("wx.frame")
#define wxLogStatus \ #define wxLogStatus \
wxDO_LOG_IF_ENABLED_WITH_FUNC(Status, MaybeStore(wxLOG_KEY_FRAME).Log) wxDO_LOG_IF_ENABLED_WITH_FUNC(Status, MaybeStore(wxLOG_KEY_FRAME).Log)

View file

@ -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"));
} }