summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android/graphics/Movie.cpp5
-rw-r--r--core/jni/android_bluetooth_BluetoothSocket.cpp20
2 files changed, 18 insertions, 7 deletions
diff --git a/core/jni/android/graphics/Movie.cpp b/core/jni/android/graphics/Movie.cpp
index de18f9f..d1a5546 100644
--- a/core/jni/android/graphics/Movie.cpp
+++ b/core/jni/android/graphics/Movie.cpp
@@ -115,6 +115,10 @@ static jobject movie_decodeByteArray(JNIEnv* env, jobject clazz,
return create_jmovie(env, moov);
}
+static void movie_destructor(JNIEnv* env, jobject, SkMovie* movie) {
+ delete movie;
+}
+
//////////////////////////////////////////////////////////////////////////////////////////////
#include <android_runtime/AndroidRuntime.h>
@@ -129,6 +133,7 @@ static JNINativeMethod gMethods[] = {
(void*)movie_draw },
{ "decodeStream", "(Ljava/io/InputStream;)Landroid/graphics/Movie;",
(void*)movie_decodeStream },
+ { "nativeDestructor","(I)V", (void*)movie_destructor },
{ "decodeByteArray", "([BII)Landroid/graphics/Movie;",
(void*)movie_decodeByteArray },
};
diff --git a/core/jni/android_bluetooth_BluetoothSocket.cpp b/core/jni/android_bluetooth_BluetoothSocket.cpp
index b87f7c4..d09c4e9 100644
--- a/core/jni/android_bluetooth_BluetoothSocket.cpp
+++ b/core/jni/android_bluetooth_BluetoothSocket.cpp
@@ -448,7 +448,7 @@ static jint writeNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset,
#ifdef HAVE_BLUETOOTH
LOGV("%s", __FUNCTION__);
- int ret;
+ int ret, total;
jbyte *b;
int sz;
struct asocket *s = get_socketData(env, obj);
@@ -471,15 +471,21 @@ static jint writeNative(JNIEnv *env, jobject obj, jbyteArray jb, jint offset,
return -1;
}
- ret = asocket_write(s, &b[offset], length, -1);
- if (ret < 0) {
- jniThrowIOException(env, errno);
- env->ReleaseByteArrayElements(jb, b, JNI_ABORT);
- return -1;
+ total = 0;
+ while (length > 0) {
+ ret = asocket_write(s, &b[offset], length, -1);
+ if (ret < 0) {
+ jniThrowIOException(env, errno);
+ env->ReleaseByteArrayElements(jb, b, JNI_ABORT);
+ return -1;
+ }
+ offset += ret;
+ total += ret;
+ length -= ret;
}
env->ReleaseByteArrayElements(jb, b, JNI_ABORT); // no need to commit
- return (jint)ret;
+ return (jint)total;
#endif
jniThrowIOException(env, ENOSYS);