Skip to content

Commit

Permalink
Apply NetBSD string conversion workaround to OpenBSD as well (minetes…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyshannon committed Jul 31, 2022
1 parent de509d0 commit 95d7fcb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/util/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]);
Expand Down

0 comments on commit 95d7fcb

Please sign in to comment.