commit a059190ee06263e77f18934130f84d0adff96256
parent bf14e28b68f3999b0f583d1dff3f29f1f651f7ee
Author: Erik Agsjö <erik.agsjo@gmail.com>
Date: Mon, 6 Dec 2021 23:41:22 +0100
Android builds again
Diffstat:
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/naett.c b/naett.c
@@ -1307,7 +1307,7 @@ static jint intCall(JNIEnv* env, jobject instance, const char* method, const cha
}
void naettPlatformInit(naettInitData initData) {
- globalVM = initData.vm;
+ globalVM = initData;
}
int naettPlatformInitRequest(InternalRequest* req) {
@@ -1440,7 +1440,7 @@ static void* processRequest(void* data) {
if (bytesRead < 0) {
break;
}
- (*env)->GetByteArrayRegion(env, buffer, 0, bytesRead, byteBuffer);
+ (*env)->GetByteArrayRegion(env, buffer, 0, bytesRead, (jbyte*) byteBuffer);
req->options.bodyWriter(byteBuffer, bytesRead, req->options.bodyWriterData);
} while (!res->closeRequested);
@@ -1454,7 +1454,7 @@ finally:
JavaVM* vm = getVM();
(*env)->ExceptionClear(env);
(*vm)->DetachCurrentThread(vm);
- res->workerThread = NULL;
+ res->workerThread = 0;
return NULL;
}
@@ -1477,10 +1477,10 @@ void naettPlatformFreeRequest(InternalRequest* req) {
void naettPlatformCloseResponse(InternalResponse* res) {
res->closeRequested = 1;
- if (res->workerThread != NULL) {
+ if (res->workerThread != 0) {
int joinResult = pthread_join(res->workerThread, NULL);
if (joinResult != 0) {
- LOGE("Failed to join: %s", strerror(res));
+ LOGE("Failed to join: %s", strerror(joinResult));
}
}
}
diff --git a/src/naett_android.c b/src/naett_android.c
@@ -84,7 +84,7 @@ static jint intCall(JNIEnv* env, jobject instance, const char* method, const cha
}
void naettPlatformInit(naettInitData initData) {
- globalVM = initData.vm;
+ globalVM = initData;
}
int naettPlatformInitRequest(InternalRequest* req) {
@@ -217,7 +217,7 @@ static void* processRequest(void* data) {
if (bytesRead < 0) {
break;
}
- (*env)->GetByteArrayRegion(env, buffer, 0, bytesRead, byteBuffer);
+ (*env)->GetByteArrayRegion(env, buffer, 0, bytesRead, (jbyte*) byteBuffer);
req->options.bodyWriter(byteBuffer, bytesRead, req->options.bodyWriterData);
} while (!res->closeRequested);
@@ -231,7 +231,7 @@ finally:
JavaVM* vm = getVM();
(*env)->ExceptionClear(env);
(*vm)->DetachCurrentThread(vm);
- res->workerThread = NULL;
+ res->workerThread = 0;
return NULL;
}
@@ -254,10 +254,10 @@ void naettPlatformFreeRequest(InternalRequest* req) {
void naettPlatformCloseResponse(InternalResponse* res) {
res->closeRequested = 1;
- if (res->workerThread != NULL) {
+ if (res->workerThread != 0) {
int joinResult = pthread_join(res->workerThread, NULL);
if (joinResult != 0) {
- LOGE("Failed to join: %s", strerror(res));
+ LOGE("Failed to join: %s", strerror(joinResult));
}
}
}