From 4839674fdd16da4daa8fcb1bfe0ace7565ccc89f Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Tue, 27 Jan 2015 10:28:14 -0600 Subject: [PATCH] use temporary var to handle unsigned char -> jbyte (signed char) --- jnius/jnius_conversion.pxi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jnius/jnius_conversion.pxi b/jnius/jnius_conversion.pxi index e41a8d2..00daf96 100644 --- a/jnius/jnius_conversion.pxi +++ b/jnius/jnius_conversion.pxi @@ -414,6 +414,7 @@ cdef jobject convert_pyarray_to_java(JNIEnv *j_env, definition, pyarray) except cdef jobject ret = NULL cdef int array_size = len(pyarray) cdef int i + cdef unsigned char c_tmp cdef jboolean j_boolean cdef jbyte j_byte 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) else: for i in range(array_size): - j_byte = pyarray[i] + c_tmp = pyarray[i] + j_byte = c_tmp j_env[0].SetByteArrayRegion(j_env, ret, i, 1, &j_byte)