Closed gubatron closed 5 years ago
On the internet people just try avoiding returning String
from C++ world, they instead return a byte[] and then our JNI wrapper should do the byte[]
-> String
conversion in Java land.
This previous fix should help do something similar.
Assuming that's going to be our solution, ignoring libtorrent::generate_fingerprint
and redefining it as our own in swig/libtorrent.i
, then the problem will be making the binaries without maven central in my macOS machine.
NOTES:
// how to return `byte_vector` (std::vector<int8_t>)
std::vector<int8_t> to_bytes() const {
std::string s = $self->to_string();
return std::vector<int8_t>(s.begin(), s.end());
}
In java land libtorrent.generate_fingerprint
should use Vectors.byte_vector2string
public static String byte_vector2string(byte_vector v, String encoding) {
Perhaps after an android studio or android update
generate_fingerprint
is causing a crash whenNewStringUTF
is called.This is the C++ code from
libtorrent_jni.cpp