Commit 40b02bf6 authored by Aleksey Konovalov's avatar Aleksey Konovalov

check the representation of wchar_t only if they're used

parent 3a08ac1e
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <cstring> #include <cstring>
static_assert(sizeof(jlong) >= sizeof(void*), "must be able to fit a void* into a jlong"); static_assert(sizeof(jlong) >= sizeof(void*), "must be able to fit a void* into a jlong");
static_assert(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4, "wchar_t must be represented by UTF-16 or UTF-32 encoding");
namespace djinni { namespace djinni {
...@@ -373,7 +372,10 @@ jstring jniStringFromUTF8(JNIEnv * env, const std::string & str) { ...@@ -373,7 +372,10 @@ jstring jniStringFromUTF8(JNIEnv * env, const std::string & str) {
} }
template<int wcharTypeSize> template<int wcharTypeSize>
static std::u16string implWStringToUTF16(const std::wstring & str); static std::u16string implWStringToUTF16(const std::wstring & str)
{
static_assert(wcharTypeSize == 2 || wcharTypeSize == 4, "wchar_t must be represented by UTF-16 or UTF-32 encoding");
}
template<> template<>
inline std::u16string implWStringToUTF16<2>(const std::wstring & str) { inline std::u16string implWStringToUTF16<2>(const std::wstring & str) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment