Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ReyunSecureSdk
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanglei
ReyunSecureSdk
Commits
d4edad2b
Commit
d4edad2b
authored
Apr 01, 2021
by
leiguo1029
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
4/1
parent
c06620d7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
6 deletions
+138
-6
jni_helper.h
wandun/src/main/cpp/include/jni_helper.h
+17
-1
jni_helper.cpp
wandun/src/main/cpp/jni_helper.cpp
+121
-5
No files found.
wandun/src/main/cpp/include/jni_helper.h
View file @
d4edad2b
...
...
@@ -18,7 +18,23 @@ jobject wdNewObject(JNIEnv* env, const char* clsName, const char* methodSig, ...
jvalue
wdCallStaticMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jvalue
wdCallMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jboolean
wdCallStaticBooleanMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jbyte
wdCallStaticByteMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jchar
wdCallStaticCharMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jshort
wdCallStaticShortMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jint
wdCallStaticIntMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jlong
wdCallStaticLongMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jfloat
wdCallStaticFloatMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jdouble
wdCallStaticDoubleMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
void
wdCallStaticVoidMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jboolean
wdCallBooleanMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jbyte
wdCallByteMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jchar
wdCallCharMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jshort
wdCallShortMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jint
wdCallIntMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jlong
wdCallLongMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jfloat
wdCallFloatMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
jdouble
wdCallDoubleMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
void
wdCallVoidMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...);
inline
jboolean
wdGetStaticBooleanField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
)
{
return
wdGetStaticField
(
env
,
clsName
,
fieldName
,
fieldSig
).
z
;
...
...
wandun/src/main/cpp/jni_helper.cpp
View file @
d4edad2b
...
...
@@ -28,7 +28,7 @@ jvalue wdGetStaticField(JNIEnv* env, const char* clsName, const char* fieldName,
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGet
MethodRet
Type
(
fieldSig
))
{
switch
(
wdGet
Field
Type
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetStaticObjectField
(
cls
,
fieldId
);
...
...
@@ -69,7 +69,7 @@ jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* f
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
jvalue
value
;
memset
(
value
,
0
,
sizeof
(
jvalue
));
switch
(
wdGet
MethodRet
Type
(
fieldSig
))
{
switch
(
wdGet
Field
Type
(
fieldSig
))
{
case
'['
:
case
'L'
:
value
.
l
=
env
->
GetObjectField
(
cls
,
fieldId
);
...
...
@@ -108,7 +108,7 @@ jvalue wdGetField(JNIEnv* env, jobject obj, const char* fieldName, const char* f
void
wdSetStaticField
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
FindClass
(
clsName
);
jfieldID
fieldId
=
env
->
GetStaticFieldID
(
cls
,
fieldName
,
fieldSig
);
switch
(
wdGet
MethodRet
Type
(
fieldSig
))
{
switch
(
wdGet
Field
Type
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetStaticObjectField
(
cls
,
fieldId
,
value
.
l
);
...
...
@@ -146,7 +146,7 @@ void wdSetStaticField(JNIEnv* env, const char* clsName, const char* fieldName, c
void
wdSetField
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
fieldName
,
const
char
*
fieldSig
,
jvalue
value
)
{
jclass
cls
=
env
->
GetObjectClass
(
cls
);
jfieldID
fieldId
=
env
->
GetFieldID
(
cls
,
fieldName
,
fieldSig
);
switch
(
wdGet
MethodRet
Type
(
fieldSig
))
{
switch
(
wdGet
Field
Type
(
fieldSig
))
{
case
'['
:
case
'L'
:
env
->
SetObjectField
(
obj
,
fieldId
,
value
.
l
);
...
...
@@ -231,6 +231,7 @@ jvalue wdCallStaticMethod(JNIEnv* env, const char* clsName, const char* methodNa
case
'D'
:
value
.
d
=
env
->
CallStaticDoubleMethodV
(
cls
,
methodId
,
args
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
...
...
@@ -274,6 +275,7 @@ jvalue wdCallMethod(JNIEnv* env, jobject obj, const char* methodName, const char
case
'D'
:
value
.
d
=
env
->
CallDoubleMethodV
(
obj
,
methodId
,
args
);
break
;
default:
break
;
}
wdCheckException
(
env
);
env
->
DeleteLocalRef
(
cls
);
...
...
@@ -320,7 +322,7 @@ jint wdCallStaticIntMethod(JNIEnv* env, const char* clsName, const char* methodN
return
res
;
}
jlong
wdCallStatic
l
ongMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
jlong
wdCallStatic
L
ongMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jlong
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
j
;
...
...
@@ -328,6 +330,120 @@ jlong wdCallStaticlongMethod(JNIEnv* env, const char* clsName, const char* metho
return
res
;
}
jfloat
wdCallStaticFloatMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jfloat
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
f
;
va_end
(
args
);
return
res
;
}
jdouble
wdCallStaticDoubleMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jdouble
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
d
;
va_end
(
args
);
return
res
;
}
jobject
wdCallStaticObjectMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jobject
res
=
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
).
l
;
va_end
(
args
);
return
res
;
}
void
wdCallStaticVoidMethod
(
JNIEnv
*
env
,
const
char
*
clsName
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
wdCallStaticMethod
(
env
,
clsName
,
methodName
,
methodSig
,
args
);
va_end
(
args
);
}
jboolean
wdCallBooleanMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jboolean
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
z
;
va_end
(
args
);
return
res
;
}
jbyte
wdCallByteMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jboolean
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
b
;
va_end
(
args
);
return
res
;
}
jchar
wdCallCharMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jchar
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
c
;
va_end
(
args
);
return
res
;
}
jshort
wdCallShortMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jshort
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
s
;
va_end
(
args
);
return
res
;
}
jint
wdCallIntMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jint
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
i
;
va_end
(
args
);
return
res
;
}
jlong
wdCallLongMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jlong
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
j
;
va_end
(
args
);
return
res
;
}
jfloat
wdCallFloatMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jfloat
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
f
;
va_end
(
args
);
return
res
;
}
jdouble
wdCallDoubleMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jdouble
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
d
;
va_end
(
args
);
return
res
;
}
jobject
wdCallObjectMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
jobject
res
=
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
).
l
;
va_end
(
args
);
return
res
;
}
void
wdCallVoidMethod
(
JNIEnv
*
env
,
jobject
obj
,
const
char
*
methodName
,
const
char
*
methodSig
,
...)
{
va_list
args
;
va_start
(
args
,
methodSig
);
wdCallMethod
(
env
,
obj
,
methodName
,
methodSig
,
args
);
va_end
(
args
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment