Lines Matching +full:- +full:- +full:env
4 * Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
42 (*java_vm)->DetachCurrentThread(java_vm); in jni_detach_env()
54 JNIEnv *env = NULL; in ff_jni_get_env() local
68 if ((env = pthread_getspecific(current_env)) != NULL) { in ff_jni_get_env()
72 ret = (*java_vm)->GetEnv(java_vm, (void **)&env, JNI_VERSION_1_6); in ff_jni_get_env()
75 if ((*java_vm)->AttachCurrentThread(java_vm, &env, NULL) != 0) { in ff_jni_get_env()
77 env = NULL; in ff_jni_get_env()
79 pthread_setspecific(current_env, env); in ff_jni_get_env()
94 return env; in ff_jni_get_env()
97 char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx) in ff_jni_jstring_to_utf_chars() argument
108 utf_chars = (*env)->GetStringUTFChars(env, string, ©); in ff_jni_jstring_to_utf_chars()
109 if ((*env)->ExceptionCheck(env)) { in ff_jni_jstring_to_utf_chars()
110 (*env)->ExceptionClear(env); in ff_jni_jstring_to_utf_chars()
117 (*env)->ReleaseStringUTFChars(env, string, utf_chars); in ff_jni_jstring_to_utf_chars()
118 if ((*env)->ExceptionCheck(env)) { in ff_jni_jstring_to_utf_chars()
119 (*env)->ExceptionClear(env); in ff_jni_jstring_to_utf_chars()
127 jstring ff_jni_utf_chars_to_jstring(JNIEnv *env, const char *utf_chars, void *log_ctx) in ff_jni_utf_chars_to_jstring() argument
131 ret = (*env)->NewStringUTF(env, utf_chars); in ff_jni_utf_chars_to_jstring()
132 if ((*env)->ExceptionCheck(env)) { in ff_jni_utf_chars_to_jstring()
133 (*env)->ExceptionClear(env); in ff_jni_utf_chars_to_jstring()
141 int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx) in ff_jni_exception_get_summary() argument
160 exception_class = (*env)->GetObjectClass(env, exception); in ff_jni_exception_get_summary()
161 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
162 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
168 class_class = (*env)->GetObjectClass(env, exception_class); in ff_jni_exception_get_summary()
169 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
170 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
176 get_name_id = (*env)->GetMethodID(env, class_class, "getName", "()Ljava/lang/String;"); in ff_jni_exception_get_summary()
177 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
178 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
184 string = (*env)->CallObjectMethod(env, exception_class, get_name_id); in ff_jni_exception_get_summary()
185 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
186 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
193 name = ff_jni_jstring_to_utf_chars(env, string, log_ctx); in ff_jni_exception_get_summary()
194 (*env)->DeleteLocalRef(env, string); in ff_jni_exception_get_summary()
198 … get_message_id = (*env)->GetMethodID(env, exception_class, "getMessage", "()Ljava/lang/String;"); in ff_jni_exception_get_summary()
199 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
200 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
206 string = (*env)->CallObjectMethod(env, exception, get_message_id); in ff_jni_exception_get_summary()
207 if ((*env)->ExceptionCheck(env)) { in ff_jni_exception_get_summary()
208 (*env)->ExceptionClear(env); in ff_jni_exception_get_summary()
215 message = ff_jni_jstring_to_utf_chars(env, string, log_ctx); in ff_jni_exception_get_summary()
216 (*env)->DeleteLocalRef(env, string); in ff_jni_exception_get_summary()
238 (*env)->DeleteLocalRef(env, class_class); in ff_jni_exception_get_summary()
242 (*env)->DeleteLocalRef(env, exception_class); in ff_jni_exception_get_summary()
246 (*env)->DeleteLocalRef(env, string); in ff_jni_exception_get_summary()
252 int ff_jni_exception_check(JNIEnv *env, int log, void *log_ctx) in ff_jni_exception_check() argument
260 if (!(*(env))->ExceptionCheck((env))) { in ff_jni_exception_check()
265 (*(env))->ExceptionClear((env)); in ff_jni_exception_check()
266 return -1; in ff_jni_exception_check()
269 exception = (*env)->ExceptionOccurred(env); in ff_jni_exception_check()
270 (*(env))->ExceptionClear((env)); in ff_jni_exception_check()
272 if ((ret = ff_jni_exception_get_summary(env, exception, &message, log_ctx)) < 0) { in ff_jni_exception_check()
273 (*env)->DeleteLocalRef(env, exception); in ff_jni_exception_check()
277 (*env)->DeleteLocalRef(env, exception); in ff_jni_exception_check()
282 return -1; in ff_jni_exception_check()
285 int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int g… in ff_jni_init_jfields() argument
299 clazz = (*env)->FindClass(env, jfields_mapping[i].name); in ff_jni_init_jfields()
300 if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { in ff_jni_init_jfields()
305 global ? (*env)->NewGlobalRef(env, clazz) : clazz; in ff_jni_init_jfields()
308 (*env)->DeleteLocalRef(env, clazz); in ff_jni_init_jfields()
320 …jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping… in ff_jni_init_jfields()
321 if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { in ff_jni_init_jfields()
329 …jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[i].method, jfields_m… in ff_jni_init_jfields()
330 if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { in ff_jni_init_jfields()
338 …jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapp… in ff_jni_init_jfields()
339 if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { in ff_jni_init_jfields()
347 …jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[i].method, jfield… in ff_jni_init_jfields()
348 if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { in ff_jni_init_jfields()
368 ff_jni_reset_jfields(env, jfields, jfields_mapping, global, log_ctx); in ff_jni_init_jfields()
374 int ff_jni_reset_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int … in ff_jni_reset_jfields() argument
388 (*env)->DeleteGlobalRef(env, clazz); in ff_jni_reset_jfields()
390 (*env)->DeleteLocalRef(env, clazz); in ff_jni_reset_jfields()