Fix string conversion for FreeBSD (#13648)

This commit is contained in:
Nekobit 2023-07-17 14:46:06 -04:00 committed by GitHub
parent 3552537fc4
commit 50234b8e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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__) || defined(__OpenBSD__)
#elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
// NetBSD does not allow "WCHAR_T" as a charset input to iconv.
#include <sys/endian.h>
#if BYTE_ORDER == BIG_ENDIAN
@ -93,7 +93,7 @@ std::wstring utf8_to_wide(const std::string &input)
std::wstring out;
out.resize(outbuf_size / sizeof(wchar_t));
#if defined(__ANDROID__) || defined(__NetBSD__) || defined(__OpenBSD__)
#if defined(__ANDROID__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
static_assert(sizeof(wchar_t) == 4, "Unexpected wide char size");
#endif