diff --git a/libsodium b/libsodium index 914033d..b6e1e94 160000 --- a/libsodium +++ b/libsodium @@ -1 +1 @@ -Subproject commit 914033d2c70831b86e94a25f27e61a94bc7d45c8 +Subproject commit b6e1e94cfb3d8dffdb1bb92b6102e5fad5fe6093 diff --git a/src/ILog.h b/src/ILog.h index 68f11ca..01bdc7d 100644 --- a/src/ILog.h +++ b/src/ILog.h @@ -19,11 +19,12 @@ private: public: virtual ~MyException() override = default; MyException() = delete; - explicit MyException(const std::string &m) noexcept :err(m.c_str()),err_number(-1){} explicit MyException(const char* sz) noexcept :err(sz),err_number(-1) {} + explicit MyException(const std::string& m) noexcept :err(m.c_str()), err_number(-1) {} explicit MyException(const char* sz, int i) noexcept :err(sz), err_number(i) {} explicit MyException(const char* sz, int i, const char*, const char*) noexcept; // usage throw MyException("error", __LINE__, __func__, __FILE__); + explicit MyException(const std::string& m, int i, const char* func, const char* file) noexcept : MyException(m.c_str(), i, func, file) {} explicit MyException(int, sqlite3*) noexcept; virtual const char* what() const override { return err.c_str(); diff --git a/src/unit_test.cpp b/src/unit_test.cpp index 9ce7780..327c417 100644 --- a/src/unit_test.cpp +++ b/src/unit_test.cpp @@ -270,28 +270,22 @@ static bool CheckForUtfEnvironment(void) { 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); } } auto FontEncoding{ wxLocale::GetSystemEncoding() }; - utfEnvironment = utfEnvironment && (false - || (FontEncoding == wxFONTENCODING_UTF8) - || (FontEncoding == wxFONTENCODING_UTF16BE) - || (FontEncoding == wxFONTENCODING_UTF16LE) - || (FontEncoding == wxFONTENCODING_UTF32BE) - || (FontEncoding == wxFONTENCODING_UTF32LE) - || (FontEncoding == wxFONTENCODING_SYSTEM) - ); + // 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); - wxLogMessage(wxT("%s"), utfError); + throw MyException(utfError.c_str(), __LINE__, __func__, SrcFilename); } - if (!utfEnvironment) { throw MyException(utfError); } } catch (const MyException& e) { errorCode = e.what_num();