summaryrefslogtreecommitdiffstats
path: root/sql
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2009-09-11 16:26:04 -0700
committerElliott Hughes <enh@google.com>2009-09-15 13:25:08 -0700
commit8c55bea0dc81b154be04ab8d1bf46e47e1fdb416 (patch)
treed7b6f15941c6009ba240903b0cd62f317fd37f73 /sql
parent17ae753d638df37e7e0b66ea0435212c2f2b682d (diff)
downloadlibcore-8c55bea0dc81b154be04ab8d1bf46e47e1fdb416.zip
libcore-8c55bea0dc81b154be04ab8d1bf46e47e1fdb416.tar.gz
libcore-8c55bea0dc81b154be04ab8d1bf46e47e1fdb416.tar.bz2
Fix the final [mis]uses of iscopy.
I finally got round to going through all the dalvik/libcore/ calls to the following routines, in cases where the final argument ("iscopy") is non-NULL: Get*ArrayElements GetStringChars GetStringUTFChars GetStringCritical Get*ArrayCritical The calls in sqlite_jni.c were neither assuming that setting "iscopy" requests a copy (a bug we've seen elsewhere), nor were they making use of the result. I've changed these to pass NULL to make their lack of interest explicit. I've also fixed a compiler warning (signed/unsigned comparison). The ones in org_apache_harmony_luni_platform_OSFileSystem.cpp were genuine errors. The author was under the misapprehension that iscopy == JNI_FALSE implies that you do not need to call the corresponding "Release" function. I've fixed those. (I haven't addressed the fact that readvImpl and writevImpl differ by just one token, nor have I addressed the fact that -- in theory though not with our current GC -- any of the GetIntArrayElements could fail.)
Diffstat (limited to 'sql')
-rw-r--r--sql/src/main/native/sqlite_jni.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/src/main/native/sqlite_jni.c b/sql/src/main/native/sqlite_jni.c
index 44c16f3..82aa8a0 100644
--- a/sql/src/main/native/sqlite_jni.c
+++ b/sql/src/main/native/sqlite_jni.c
@@ -1325,11 +1325,10 @@ Java_SQLite_Database__1exec__Ljava_lang_String_2LSQLite_Callback_2_3Ljava_lang_S
}
if (h) {
if (h->sqlite) {
- jboolean b;
jthrowable exc;
int rc = SQLITE_ERROR, nargs, i;
char *err = 0, *p;
- const char *str = (*env)->GetStringUTFChars(env, sql, &b);
+ const char *str = (*env)->GetStringUTFChars(env, sql, NULL);
transstr sqlstr;
struct args {
char *arg;
@@ -3003,10 +3002,9 @@ Java_SQLite_Database_vm_1compile_1args(JNIEnv *env,
hvm *v;
jvalue vv;
jthrowable exc;
- jboolean b;
int rc = SQLITE_ERROR, nargs, i;
char *p;
- const char *str = (*env)->GetStringUTFChars(env, sql, &b);
+ const char *str = (*env)->GetStringUTFChars(env, sql, NULL);
const char *tail;
transstr sqlstr;
struct args {
@@ -3395,7 +3393,7 @@ Java_SQLite_Database_stmt_1prepare(JNIEnv *env, jobject obj, jstring sql,
return;
}
len16 = len16 + sizeof (jchar) - ((char *) tail - (char *) sql16);
- if (len16 < sizeof (jchar)) {
+ if (len16 < (jsize) sizeof (jchar)) {
len16 = sizeof (jchar);
}
v = malloc(sizeof (hvm) + len16);