From 10f235b43c9a5e5c23f94140c03c54b6ce24af50 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2024 18:45:13 +0100 Subject: [PATCH] Avoid implicit wxString conversions in wxLog{Status,SysError}() They don't compile when wxNO_IMPLICIT_WXSTRING_ENCODING is defined. Closes #24267. --- include/wx/log.h | 4 ++-- tests/allheaders.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/wx/log.h b/include/wx/log.h index 83e08f7e10..12e287a542 100644 --- a/include/wx/log.h +++ b/include/wx/log.h @@ -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 // wxString::Format() is called because of vsnprintf() inside it so it can // 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 \ 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 // wxLogStatus() is similar to wxLogSysError() as it allows to optionally // 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 \ wxDO_LOG_IF_ENABLED_WITH_FUNC(Status, MaybeStore(wxLOG_KEY_FRAME).Log) diff --git a/tests/allheaders.cpp b/tests/allheaders.cpp index 0d30d1c4a6..5b5527f455 100644 --- a/tests/allheaders.cpp +++ b/tests/allheaders.cpp @@ -411,4 +411,6 @@ TEST_CASE("wxNO_IMPLICIT_WXSTRING_ENCODING", "[string]") // wxNO_IMPLICIT_WXSTRING_ENCODING must be set s = "Hello, implicit encoding"; #endif + + wxLogSysError(wxASCII_STR("Bogus error for testing")); }