diff --git a/jni/cpp/Random.cpp b/jni/cpp/Random.cpp index de97baff225..384ac2827bf 100644 --- a/jni/cpp/Random.cpp +++ b/jni/cpp/Random.cpp @@ -5,6 +5,8 @@ // file LICENSE at the root of the source code distribution tree. #include +#include +#include #include static JavaVM* cachedJVM; @@ -26,8 +28,10 @@ uint32_t random32() { } void random_buffer(uint8_t *buf, size_t len) { - JNIEnv *env; - cachedJVM->AttachCurrentThread(&env, NULL); + void *env_ptr; + cachedJVM->AttachCurrentThread(&env_ptr, NULL); + + JNIEnv *env = (JNIEnv *) env_ptr; // SecureRandom random = new SecureRandom(); jclass secureRandomClass = env->FindClass("java/security/SecureRandom");