Merge pull request #326 from kiwix/fix_pair_size

[JAVA] Use a long to store the offset of a article in the zim file.
This commit is contained in:
Matthieu Gautier 2020-02-19 14:58:43 +01:00 committed by GitHub
commit 7c49dc6af9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -22,5 +22,5 @@ package org.kiwix.kiwixlib;
public class Pair public class Pair
{ {
public String filename; public String filename;
public int offset; public long offset;
} }

View File

@ -258,14 +258,14 @@ inline void setBoolObjValue(const bool value, const jobject obj, JNIEnv* env)
env->SetIntField(obj, objFid, c2jni(value, env)); env->SetIntField(obj, objFid, c2jni(value, env));
} }
inline void setPairObjValue(const std::string& filename, const int offset, inline void setPairObjValue(const std::string& filename, const long offset,
const jobject obj, JNIEnv* env) const jobject obj, JNIEnv* env)
{ {
jclass objClass = env->GetObjectClass(obj); jclass objClass = env->GetObjectClass(obj);
jfieldID filenameFid = env->GetFieldID(objClass, "filename", "Ljava/lang/String;"); jfieldID filenameFid = env->GetFieldID(objClass, "filename", "Ljava/lang/String;");
env->SetObjectField(obj, filenameFid, c2jni(filename, env)); env->SetObjectField(obj, filenameFid, c2jni(filename, env));
jfieldID offsetFid = env->GetFieldID(objClass, "offset", "I"); jfieldID offsetFid = env->GetFieldID(objClass, "offset", "J");
env->SetIntField(obj, offsetFid, offset); env->SetLongField(obj, offsetFid, offset);
} }
#endif // _ANDROID_JNI_UTILS_H #endif // _ANDROID_JNI_UTILS_H