mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Apply NetBSD string conversion workaround to OpenBSD as well (#12618)
This commit is contained in:
parent
de509d05e6
commit
95d7fcb949
@ -70,7 +70,7 @@ static bool convert(const char *to, const char *from, char *outbuf,
|
|||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
// On Android iconv disagrees how big a wchar_t is for whatever reason
|
// On Android iconv disagrees how big a wchar_t is for whatever reason
|
||||||
const char *DEFAULT_ENCODING = "UTF-32LE";
|
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.
|
// NetBSD does not allow "WCHAR_T" as a charset input to iconv.
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#if BYTE_ORDER == BIG_ENDIAN
|
#if BYTE_ORDER == BIG_ENDIAN
|
||||||
@ -93,8 +93,8 @@ std::wstring utf8_to_wide(const std::string &input)
|
|||||||
std::wstring out;
|
std::wstring out;
|
||||||
out.resize(outbuf_size / sizeof(wchar_t));
|
out.resize(outbuf_size / sizeof(wchar_t));
|
||||||
|
|
||||||
#if defined(__ANDROID__) || defined(__NetBSD__)
|
#if defined(__ANDROID__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
SANITY_CHECK(sizeof(wchar_t) == 4);
|
static_assert(sizeof(wchar_t) == 4, "Unexpected wide char size");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *outbuf = reinterpret_cast<char*>(&out[0]);
|
char *outbuf = reinterpret_cast<char*>(&out[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user