mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #159 from kiwix/mhutti1/kiwixlib-fixes
Various kiwixlib fixes
This commit is contained in:
commit
d46aff00d1
|
@ -64,6 +64,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getMainPage(JNIEnv* env, jobject obj)
|
||||||
url = c2jni(cUrl, env);
|
url = c2jni(cUrl, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM main page");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM main page");
|
||||||
|
url = NULL;
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getId(JNIEnv* env, jobject obj)
|
||||||
id = c2jni(cId, env);
|
id = c2jni(cId, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
||||||
|
id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
@ -108,6 +110,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getCreator(JNIEnv* env, jobject obj)
|
||||||
creator = c2jni(cCreator, env);
|
creator = c2jni(cCreator, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM creator");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM creator");
|
||||||
|
creator = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return creator;
|
return creator;
|
||||||
|
@ -123,6 +126,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getPublisher(JNIEnv* env, jobject obj)
|
||||||
publisher = c2jni(cPublisher, env);
|
publisher = c2jni(cPublisher, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM publish");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM publish");
|
||||||
|
publisher = NULL;
|
||||||
}
|
}
|
||||||
return publisher;
|
return publisher;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +141,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getName(JNIEnv* env, jobject obj)
|
||||||
name = c2jni(cName, env);
|
name = c2jni(cName, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM name");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM name");
|
||||||
|
name = NULL;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -156,6 +161,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getFavicon(JNIEnv* env, jobject obj)
|
||||||
env);
|
env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM favicon");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM favicon");
|
||||||
|
favicon = NULL;
|
||||||
}
|
}
|
||||||
return favicon;
|
return favicon;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +176,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDate(JNIEnv* env, jobject obj)
|
||||||
date = c2jni(cDate, env);
|
date = c2jni(cDate, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM date");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM date");
|
||||||
|
date = NULL;
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +191,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getLanguage(JNIEnv* env, jobject obj)
|
||||||
language = c2jni(cLanguage, env);
|
language = c2jni(cLanguage, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM language");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM language");
|
||||||
|
language = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return language;
|
return language;
|
||||||
|
@ -201,6 +209,7 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getMimeType(
|
||||||
mimeType = c2jni(cMimeType, env);
|
mimeType = c2jni(cMimeType, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get mime-type for url: %s", cUrl.c_str());
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get mime-type for url: %s", cUrl.c_str());
|
||||||
|
mimeType = NULL;
|
||||||
}
|
}
|
||||||
return mimeType;
|
return mimeType;
|
||||||
}
|
}
|
||||||
|
@ -359,6 +368,7 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getTitle(
|
||||||
title = c2jni(cTitle, env);
|
title = c2jni(cTitle, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim title");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim title");
|
||||||
|
title = NULL;
|
||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
@ -373,6 +383,7 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDescription(JNIEnv* env, jobject obj)
|
||||||
description = c2jni(cDescription, env);
|
description = c2jni(cDescription, env);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim description");
|
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim description");
|
||||||
|
description = NULL;
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,6 +265,7 @@ bool Reader::getFavicon(string& content, string& mimeType) const
|
||||||
for (auto &path: paths) {
|
for (auto &path: paths) {
|
||||||
try {
|
try {
|
||||||
auto entry = getEntryFromPath(path);
|
auto entry = getEntryFromPath(path);
|
||||||
|
entry = entry.getFinalEntry();
|
||||||
content = entry.getContent();
|
content = entry.getContent();
|
||||||
mimeType = entry.getMimetype();
|
mimeType = entry.getMimetype();
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue