Closed Clement-Devevey closed 2 months ago
Or
return JavaCPP_createStringFromUTF16(env, ptr, std::char_traits<char16_t>::length(reinterpret_cast<const char16_t*>(ptr)));
not sure what's best
That doesn't sound like a correct fix. We need to know the length of the string in UTF-16.
char16_t is only available since C++11, so we need to use something else.
Maybe we could just put an ifdef else endif in there that uses char16_t for C++11 compilers and keep using unsigned short if not?
@Clement-Devevey Since we've decided to make C++11 a requirement for future versions of JavaCPP, let's just replace unsigned short with char16_t. Thanks!
@Clement-Devevey Since we've decided to make C++11 a requirement for future versions of JavaCPP, let's just replace unsigned short with char16_t. Thanks!
what an exciting news, thanks a lot :)
You'll open another PR with the change?
Duplicate of #753
Issue was the following:
`jniNativeLibrary.cpp:314:57: warning: 'char_traits' is deprecated: char_traits for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations]
return JavaCPP_createStringFromUTF16(env, ptr, std::char_traits::length(ptr));
^
char_traits.h:79:8: note: 'char_traits' has been explicitly marked deprecated here
struct _LIBCPPDEPRECATED("char_traits for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it.")
^
c++/v1/__config:772:53: note: expanded from macro '_LIBCPPDEPRECATED'
define _LIBCPPDEPRECATED(m) attribute((deprecated(m)))`