diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-04-11 10:06:28 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-04-11 10:06:28 +0000 |
commit | 5eafb69bdb9ecd22d5634ca9ab9262f02f3f4106 (patch) | |
tree | 9560d4471400e6a527952356cabdf42868fa70fe /java | |
parent | a086e99bae650dc74d36664a5b11860659d5b113 (diff) |
minor updates, still crashes
Diffstat (limited to 'java')
-rw-r--r-- | java/javacurl.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/java/javacurl.c b/java/javacurl.c index 2b93bc677..70978dd61 100644 --- a/java/javacurl.c +++ b/java/javacurl.c @@ -11,8 +11,7 @@ struct javacurl { struct writecallback { jmethodID mid; JNIEnv *java; - jclass cls; - jobject obj; + jobject object; } write; }; @@ -89,18 +88,25 @@ static int javacurl_write_callback(void *ptr, struct javacurl *curl = (struct javacurl *)stream; size_t realsize = size * nmemb; JNIEnv *java = curl->write.java; - jbyteArray jb; - int ret; + jbyteArray jb=NULL; + int ret=0; + + fprintf(stderr, "%d bytes data received in callback, ptr %p, java =%p\n", + realsize, curl, java); jb=(*java)->NewByteArray(java, realsize); (*java)->SetByteArrayRegion(java, jb, 0, realsize, (jbyte *)ptr); + fprintf(stderr, "created byte-array\n"); + ret = (*java)->CallIntMethod(java, - curl->write.obj, + curl->write.object, curl->write.mid, jb); + fprintf(stderr, "java-method returned %d\n", ret); + return realsize; } @@ -109,9 +115,9 @@ static int javacurl_write_callback(void *ptr, */ JNIEXPORT jint JNICALL Java_CurlGlue_jni_1setopt__IILCurlWrite_2 - (JNIEnv *java, jobject myself, jint jcurl, jint option, jobject value) + (JNIEnv *java, jobject myself, jint jcurl, jint option, jobject object) { - jclass cls = (*java)->GetObjectClass(java, value); + jclass cls = (*java)->GetObjectClass(java, object); jmethodID mid; struct javacurl *curl = (struct javacurl *)jcurl; @@ -129,10 +135,10 @@ JNIEXPORT jint JNICALL Java_CurlGlue_jni_1setopt__IILCurlWrite_2 } curl->write.mid = mid; curl->write.java = java; - curl->write.cls = cls; - curl->write.obj = value; + curl->write.object = object; - puts("setopt write callback and write file pointer"); + fprintf(stderr, "setopt write callback and write file pointer %p, java = %p\n", + curl, java); curl_easy_setopt(curl->libcurl, CURLOPT_WRITEFUNCTION, javacurl_write_callback); |