From fefb99bb33f05e3b349158243f7ba8f70c203b03 Mon Sep 17 00:00:00 2001 From: Cheng Date: Mon, 25 Sep 2023 10:23:11 +1000 Subject: [PATCH] Discovered that modifying the wxWidgets manifest has no effect Restored the wallet manifest. Discovered that local wxString variables are apt to get wiped during a throw. Dangerous to pass a wXstring.utf8() to an exception --- msvc/wallet.vcxproj | 10 +++++++--- src/ISqlit3Impl.cpp | 2 +- src/unit_test.cpp | 15 +++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/msvc/wallet.vcxproj b/msvc/wallet.vcxproj index d9dda3a..1a390cf 100644 --- a/msvc/wallet.vcxproj +++ b/msvc/wallet.vcxproj @@ -80,13 +80,14 @@ mpir.lib;mpirxx.lib;libsodium.lib;%(AdditionalDependencies) - wallet.manifest %(AdditionalManifestFiles) + + - false + true - PerMonitorHighDPIAware + false @@ -123,6 +124,9 @@ + + true + diff --git a/src/ISqlit3Impl.cpp b/src/ISqlit3Impl.cpp index 20ec69f..c42d8e0 100644 --- a/src/ISqlit3Impl.cpp +++ b/src/ISqlit3Impl.cpp @@ -25,7 +25,7 @@ void sqlite3_init() { errorCode = 7; szError = "Fatal Error: Sqlite library did not init."; // Cannot log the error, because logging not set up yet, so logging itself causes an exception - throw FatalException(szError.c_str()); + throw FatalException(szError); } } diff --git a/src/unit_test.cpp b/src/unit_test.cpp index 225a09e..e4ec4e0 100644 --- a/src/unit_test.cpp +++ b/src/unit_test.cpp @@ -264,27 +264,26 @@ static bool checkDataConversionsProduceExpected(void){ } static bool CheckForUtfEnvironment(void) { - ILogMessage("\tChecking for UTF locale."); + ILogMessage("\tChecking for UTF locale. ☹"); try { bool utfEnvironment{ true }; - wxString utfError{ wxT("") }; if constexpr (b_WINDOWS) { auto ACP{ GetACP() }; // Check that windows thinks this is UTF8 utfEnvironment = utfEnvironment && (ACP == 65001); if (!utfEnvironment) { - utfError += wxString::Format(wxT("current code page %d—should be 65001☹, "), ACP); + szError = std::format("current code page {}, —should be 65001☹, ", ACP); } } auto FontEncoding{ wxLocale::GetSystemEncoding() }; // check that wxWidgets thinks this is UTF8 utfEnvironment = utfEnvironment && (FontEncoding == wxFONTENCODING_UTF8); if (!utfEnvironment) { - utfError = wxString::Format(wxT("%swxFontEncoding %d—should be %d☹"), - utfError, - FontEncoding, - wxFONTENCODING_UTF8); - throw MyException(utfError.c_str(), __LINE__, __func__, SrcFilename); + szError += std::format("swxFontEncoding {}, – should be {} ☹", + (int)FontEncoding, + (int)wxFONTENCODING_UTF8 + ); + throw MyException(szError, __LINE__, __func__, SrcFilename); } } catch (const MyException& e) {