diff options
author | Mantar <jeremylshannon@gmail.com> | 2022-07-31 06:18:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-31 15:18:19 +0200 |
commit | 95d7fcb9499d7f51a660847a5b5671925206883f (patch) | |
tree | e829e5dfa521ad63988209e91001e1dee7ac76af | |
parent | de509d05e629566daa6953b4845077e8ad07d98a (diff) | |
download | minetest-95d7fcb9499d7f51a660847a5b5671925206883f.tar.gz minetest-95d7fcb9499d7f51a660847a5b5671925206883f.tar.bz2 minetest-95d7fcb9499d7f51a660847a5b5671925206883f.zip |
Apply NetBSD string conversion workaround to OpenBSD as well (#12618)
-rw-r--r-- | src/util/string.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp index d70c26015..778e4d1e1 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -70,7 +70,7 @@ static bool convert(const char *to, const char *from, char *outbuf, #ifdef __ANDROID__ // On Android iconv disagrees how big a wchar_t is for whatever reason const char *DEFAULT_ENCODING = "UTF-32LE"; -#elif defined(__NetBSD__) +#elif defined(__NetBSD__) || defined(__OpenBSD__) // NetBSD does not allow "WCHAR_T" as a charset input to iconv. #include <sys/endian.h> #if BYTE_ORDER == BIG_ENDIAN @@ -93,8 +93,8 @@ std::wstring utf8_to_wide(const std::string &input) std::wstring out; out.resize(outbuf_size / sizeof(wchar_t)); -#if defined(__ANDROID__) || defined(__NetBSD__) - SANITY_CHECK(sizeof(wchar_t) == 4); +#if defined(__ANDROID__) || defined(__NetBSD__) || defined(__OpenBSD__) + static_assert(sizeof(wchar_t) == 4, "Unexpected wide char size"); #endif char *outbuf = reinterpret_cast<char*>(&out[0]); |