MCPcopy Create free account
hub / github.com/OpenSC/OpenSC-Java / jnixThrowExceptionInternal

Function jnixThrowExceptionInternal

jni/src/jnix/jnix.c:24–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include<jnix.h>
23
24static void jnixThrowExceptionInternal(int *sz,
25 JNIEnv *env,
26 const char *class_name,
27 const char *fmt, va_list ap)
28{
29 jclass clazz;
30 int n;
31 char *msg=alloca(*sz);
32
33#ifdef WIN32
34 n = _vsnprintf(msg,*sz,fmt,ap);
35#else
36 va_list aq;
37 va_copy(aq,ap);
38 n = vsnprintf(msg,*sz,fmt,aq);
39 va_end(aq);
40#endif
41
42 if (n < -1)
43 { *sz *= 2; return; }
44
45 if (n >= *sz)
46 { *sz = n+1; return; }
47
48 *sz = 0;
49
50 clazz = (*env)->FindClass(env,class_name);
51
52 if (!clazz) return;
53
54 (*env)->ThrowNew(env,clazz,msg);
55}
56
57int jnixThrowException(JNIEnv *env,
58 const char *class_name,

Callers 2

jnixThrowExceptionFunction · 0.85
jnixThrowExceptionVFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected