mirror of https://github.com/kivy/pyjnius.git
use temporary var to handle unsigned char -> jbyte (signed char)
This commit is contained in:
parent
5fb4667c18
commit
4839674fdd
|
@ -414,6 +414,7 @@ cdef jobject convert_pyarray_to_java(JNIEnv *j_env, definition, pyarray) except
|
||||||
cdef jobject ret = NULL
|
cdef jobject ret = NULL
|
||||||
cdef int array_size = len(pyarray)
|
cdef int array_size = len(pyarray)
|
||||||
cdef int i
|
cdef int i
|
||||||
|
cdef unsigned char c_tmp
|
||||||
cdef jboolean j_boolean
|
cdef jboolean j_boolean
|
||||||
cdef jbyte j_byte
|
cdef jbyte j_byte
|
||||||
cdef jchar j_char
|
cdef jchar j_char
|
||||||
|
@ -460,7 +461,8 @@ cdef jobject convert_pyarray_to_java(JNIEnv *j_env, definition, pyarray) except
|
||||||
ret, 0, array_size, a_bytes._buf)
|
ret, 0, array_size, a_bytes._buf)
|
||||||
else:
|
else:
|
||||||
for i in range(array_size):
|
for i in range(array_size):
|
||||||
j_byte = pyarray[i]
|
c_tmp = pyarray[i]
|
||||||
|
j_byte = <signed char>c_tmp
|
||||||
j_env[0].SetByteArrayRegion(j_env,
|
j_env[0].SetByteArrayRegion(j_env,
|
||||||
ret, i, 1, &j_byte)
|
ret, i, 1, &j_byte)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue