mirror of
https://github.com/kiwix/java-libkiwix.git
synced 2025-09-13 09:07:48 -04:00
Fixed the Windows build
Opening ZIM archives by file descriptor (as well as embedded ZIM archives) is not supported under Windows.
This commit is contained in:
parent
ae58f42b6c
commit
cc0abc7101
@ -68,6 +68,7 @@ int jni2fd(const jobject& fdObj, JNIEnv* env)
|
|||||||
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderByFD(
|
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderByFD(
|
||||||
JNIEnv* env, jobject obj, jobject fdObj)
|
JNIEnv* env, jobject obj, jobject fdObj)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
int fd = jni2fd(fdObj, env);
|
int fd = jni2fd(fdObj, env);
|
||||||
|
|
||||||
LOG("Attempting to create reader with fd: %d", fd);
|
LOG("Attempting to create reader with fd: %d", fd);
|
||||||
@ -80,11 +81,17 @@ JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderBy
|
|||||||
LOG(e.what());
|
LOG(e.what());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
jclass exception = env->FindClass("java/lang/UnsupportedOperationException");
|
||||||
|
env->ThrowNew(exception, "org.kiwix.kiwixlib.JNIKiwixReader.getNativeReaderByFD() is not supported under Windows");
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderEmbedded(
|
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderEmbedded(
|
||||||
JNIEnv* env, jobject obj, jobject fdObj, jlong offset, jlong size)
|
JNIEnv* env, jobject obj, jobject fdObj, jlong offset, jlong size)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
int fd = jni2fd(fdObj, env);
|
int fd = jni2fd(fdObj, env);
|
||||||
|
|
||||||
LOG("Attempting to create reader with fd: %d", fd);
|
LOG("Attempting to create reader with fd: %d", fd);
|
||||||
@ -97,6 +104,11 @@ JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReaderEm
|
|||||||
LOG(e.what());
|
LOG(e.what());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
jclass exception = env->FindClass("java/lang/UnsupportedOperationException");
|
||||||
|
env->ThrowNew(exception, "org.kiwix.kiwixlib.JNIKiwixReader.getNativeReaderEmbedded() is not supported under Windows");
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user