mirror of https://github.com/kiwix/libkiwix.git
Use a macro to print error log.
This allow use to compile the JNI wrapper not for android.
This commit is contained in:
parent
7f0d509a88
commit
fe513951d3
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <android/log.h>
|
|
||||||
#include "org_kiwix_kiwixlib_Filter.h"
|
#include "org_kiwix_kiwixlib_Filter.h"
|
||||||
|
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <zim/file.h>
|
#include <zim/file.h>
|
||||||
#include <android/log.h>
|
|
||||||
#include "org_kiwix_kiwixlib_JNIKiwixReader.h"
|
#include "org_kiwix_kiwixlib_JNIKiwixReader.h"
|
||||||
|
|
||||||
#include "tools/base64.h"
|
#include "tools/base64.h"
|
||||||
|
@ -34,14 +33,14 @@ JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getNativeReader(
|
||||||
{
|
{
|
||||||
std::string cPath = jni2c(filename, env);
|
std::string cPath = jni2c(filename, env);
|
||||||
|
|
||||||
__android_log_print(ANDROID_LOG_INFO, "kiwix", "Attempting to create reader with: %s", cPath.c_str());
|
LOG("Attempting to create reader with: %s", cPath.c_str());
|
||||||
Lock l;
|
Lock l;
|
||||||
try {
|
try {
|
||||||
kiwix::Reader* reader = new kiwix::Reader(cPath);
|
kiwix::Reader* reader = new kiwix::Reader(cPath);
|
||||||
return reinterpret_cast<jlong>(new Handle<kiwix::Reader>(reader));
|
return reinterpret_cast<jlong>(new Handle<kiwix::Reader>(reader));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", "Error opening ZIM file");
|
LOG("Error opening ZIM file");
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", e.what());
|
LOG(e.what());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +63,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getMainPage(JNIEnv* env, jobject obj)
|
||||||
std::string cUrl = READER->getMainPage().getPath();
|
std::string cUrl = READER->getMainPage().getPath();
|
||||||
url = c2jni(cUrl, env);
|
url = c2jni(cUrl, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM main page");
|
LOG("Unable to get ZIM main page");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
url = NULL;
|
url = NULL;
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
|
@ -80,8 +79,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getId(JNIEnv* env, jobject obj)
|
||||||
std::string cId = READER->getId();
|
std::string cId = READER->getId();
|
||||||
id = c2jni(cId, env);
|
id = c2jni(cId, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
LOG("Unable to get ZIM id");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
id = NULL;
|
id = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +96,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getFileSize(JNIEnv* env, jobject obj)
|
||||||
int cSize = READER->getFileSize();
|
int cSize = READER->getFileSize();
|
||||||
size = c2jni(cSize, env);
|
size = c2jni(cSize, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM file size");
|
LOG("Unable to get ZIM file size");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
@ -113,8 +112,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getCreator(JNIEnv* env, jobject obj)
|
||||||
std::string cCreator = READER->getCreator();
|
std::string cCreator = READER->getCreator();
|
||||||
creator = c2jni(cCreator, env);
|
creator = c2jni(cCreator, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM creator");
|
LOG("Unable to get ZIM creator");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
creator = NULL;
|
creator = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,8 +129,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getPublisher(JNIEnv* env, jobject obj)
|
||||||
std::string cPublisher = READER->getPublisher();
|
std::string cPublisher = READER->getPublisher();
|
||||||
publisher = c2jni(cPublisher, env);
|
publisher = c2jni(cPublisher, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM publish");
|
LOG("Unable to get ZIM publish");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
publisher = NULL;
|
publisher = NULL;
|
||||||
}
|
}
|
||||||
return publisher;
|
return publisher;
|
||||||
|
@ -146,8 +145,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getName(JNIEnv* env, jobject obj)
|
||||||
std::string cName = READER->getName();
|
std::string cName = READER->getName();
|
||||||
name = c2jni(cName, env);
|
name = c2jni(cName, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM name");
|
LOG("Unable to get ZIM name");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
name = NULL;
|
name = NULL;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
@ -166,8 +165,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getFavicon(JNIEnv* env, jobject obj)
|
||||||
base64_encode(cContent),
|
base64_encode(cContent),
|
||||||
env);
|
env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM favicon");
|
LOG("Unable to get ZIM favicon");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
favicon = NULL;
|
favicon = NULL;
|
||||||
}
|
}
|
||||||
return favicon;
|
return favicon;
|
||||||
|
@ -182,8 +181,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDate(JNIEnv* env, jobject obj)
|
||||||
std::string cDate = READER->getDate();
|
std::string cDate = READER->getDate();
|
||||||
date = c2jni(cDate, env);
|
date = c2jni(cDate, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM date");
|
LOG("Unable to get ZIM date");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
date = NULL;
|
date = NULL;
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
|
@ -198,8 +197,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getLanguage(JNIEnv* env, jobject obj)
|
||||||
std::string cLanguage = READER->getLanguage();
|
std::string cLanguage = READER->getLanguage();
|
||||||
language = c2jni(cLanguage, env);
|
language = c2jni(cLanguage, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM language");
|
LOG("Unable to get ZIM language");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
language = NULL;
|
language = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +216,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getMimeType(
|
||||||
auto cMimeType = entry.getMimetype();
|
auto cMimeType = entry.getMimetype();
|
||||||
mimeType = c2jni(cMimeType, env);
|
mimeType = c2jni(cMimeType, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get mime-type for url: %s", cUrl.c_str());
|
LOG("Unable to get mime-type for url: %s", cUrl.c_str());
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
mimeType = NULL;
|
mimeType = NULL;
|
||||||
}
|
}
|
||||||
return mimeType;
|
return mimeType;
|
||||||
|
@ -268,8 +267,8 @@ JNIEXPORT jbyteArray JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getContent(
|
||||||
data, 0, cSize, reinterpret_cast<const jbyte*>(entry.getBlob().data()));
|
data, 0, cSize, reinterpret_cast<const jbyte*>(entry.getBlob().data()));
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get content for url: %s", cUrl.c_str());
|
LOG("Unable to get content for url: %s", cUrl.c_str());
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -300,8 +299,8 @@ JNIEXPORT jbyteArray JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getContentPa
|
||||||
setIntObjValue(cLen, sizeObj, env);
|
setIntObjValue(cLen, sizeObj, env);
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get partial content for url: %s (%u : %u)", cUrl.c_str(), cOffset, cLen);
|
LOG("Unable to get partial content for url: %s (%u : %u)", cUrl.c_str(), cOffset, cLen);
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -322,8 +321,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDirectAccessInformation(
|
||||||
auto part_info = entry.getDirectAccessInfo();
|
auto part_info = entry.getDirectAccessInfo();
|
||||||
setPairObjValue(part_info.first, part_info.second, pair, env);
|
setPairObjValue(part_info.first, part_info.second, pair, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get direct access info for url: %s", cUrl.c_str());
|
LOG("Unable to get direct access info for url: %s", cUrl.c_str());
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
@ -343,8 +342,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_searchSuggestions(JNIEnv* env,
|
||||||
retVal = JNI_TRUE;
|
retVal = JNI_TRUE;
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", "Unable to get search results for pattern: %s", cPrefix.c_str());
|
LOG("Unable to get search results for pattern: %s", cPrefix.c_str());
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -367,8 +366,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getNextSuggestion(JNIEnv* env,
|
||||||
retVal = JNI_TRUE;
|
retVal = JNI_TRUE;
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", "Unable to get next suggestion");
|
LOG("Unable to get next suggestion");
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
@ -388,8 +387,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getPageUrlFromTitle(JNIEnv* env,
|
||||||
setStringObjValue(entry.getPath(), urlObj, env);
|
setStringObjValue(entry.getPath(), urlObj, env);
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", "Unable to get url for title %s: ", cTitle.c_str());
|
LOG("Unable to get url for title %s: ", cTitle.c_str());
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
|
@ -404,8 +403,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getTitle(
|
||||||
std::string cTitle = READER->getTitle();
|
std::string cTitle = READER->getTitle();
|
||||||
title = c2jni(cTitle, env);
|
title = c2jni(cTitle, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim title");
|
LOG("Unable to get zim title");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
title = NULL;
|
title = NULL;
|
||||||
}
|
}
|
||||||
return title;
|
return title;
|
||||||
|
@ -420,8 +419,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getDescription(JNIEnv* env, jobject obj)
|
||||||
std::string cDescription = READER->getDescription();
|
std::string cDescription = READER->getDescription();
|
||||||
description = c2jni(cDescription, env);
|
description = c2jni(cDescription, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get zim description");
|
LOG("Unable to get zim description");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
description = NULL;
|
description = NULL;
|
||||||
}
|
}
|
||||||
return description;
|
return description;
|
||||||
|
@ -435,8 +434,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getArticleCount(JNIEnv* env, jobject obj)
|
||||||
auto cArticleCount = READER->getArticleCount();
|
auto cArticleCount = READER->getArticleCount();
|
||||||
articleCount = c2jni(cArticleCount, env);
|
articleCount = c2jni(cArticleCount, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get article count.");
|
LOG("Unable to get article count.");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return articleCount;
|
return articleCount;
|
||||||
}
|
}
|
||||||
|
@ -449,8 +448,8 @@ Java_org_kiwix_kiwixlib_JNIKiwixReader_getMediaCount(JNIEnv* env, jobject obj)
|
||||||
auto cMediaCount = READER->getMediaCount();
|
auto cMediaCount = READER->getMediaCount();
|
||||||
mediaCount = c2jni(cMediaCount, env);
|
mediaCount = c2jni(cMediaCount, env);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get media count.");
|
LOG("Unable to get media count.");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return mediaCount;
|
return mediaCount;
|
||||||
}
|
}
|
||||||
|
@ -467,8 +466,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixlib_JNIKiwixReader_getRandomPage(
|
||||||
setStringObjValue(cUrl, urlObj, env);
|
setStringObjValue(cUrl, urlObj, env);
|
||||||
retVal = JNI_TRUE;
|
retVal = JNI_TRUE;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get random page");
|
LOG("Unable to get random page");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <zim/file.h>
|
#include <zim/file.h>
|
||||||
#include <android/log.h>
|
|
||||||
#include "org_kiwix_kiwixlib_JNIKiwixServer.h"
|
#include "org_kiwix_kiwixlib_JNIKiwixServer.h"
|
||||||
|
|
||||||
#include "tools/base64.h"
|
#include "tools/base64.h"
|
||||||
|
@ -32,15 +31,15 @@
|
||||||
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixServer_getNativeServer(
|
JNIEXPORT jlong JNICALL Java_org_kiwix_kiwixlib_JNIKiwixServer_getNativeServer(
|
||||||
JNIEnv* env, jobject obj, jobject jLibrary)
|
JNIEnv* env, jobject obj, jobject jLibrary)
|
||||||
{
|
{
|
||||||
__android_log_print(ANDROID_LOG_INFO, "kiwix", "Attempting to create server");
|
LOG("Attempting to create server");
|
||||||
Lock l;
|
Lock l;
|
||||||
try {
|
try {
|
||||||
auto library = getPtr<kiwix::Library>(env, jLibrary);
|
auto library = getPtr<kiwix::Library>(env, jLibrary);
|
||||||
kiwix::Server* server = new kiwix::Server(library);
|
kiwix::Server* server = new kiwix::Server(library);
|
||||||
return reinterpret_cast<jlong>(new Handle<kiwix::Server>(server));
|
return reinterpret_cast<jlong>(new Handle<kiwix::Server>(server));
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", "Error creating the server");
|
LOG("Error creating the server");
|
||||||
__android_log_print(ANDROID_LOG_WARN, "kiwix", e.what());
|
LOG(e.what());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <android/log.h>
|
|
||||||
#include "org_kiwix_kiwixlib_Library.h"
|
#include "org_kiwix_kiwixlib_Library.h"
|
||||||
|
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
@ -55,9 +54,8 @@ Java_org_kiwix_kiwixlib_Library_addBook(
|
||||||
book.update(reader);
|
book.update(reader);
|
||||||
return LIBRARY->addBook(book);
|
return LIBRARY->addBook(book);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to add the book");
|
LOG("Unable to add the book");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what()); }
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <zim/file.h>
|
#include <zim/file.h>
|
||||||
#include <android/log.h>
|
|
||||||
#include "org_kiwix_kiwixlib_Manager.h"
|
#include "org_kiwix_kiwixlib_Manager.h"
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
|
@ -53,8 +52,8 @@ Java_org_kiwix_kiwixlib_Manager_readFile(
|
||||||
try {
|
try {
|
||||||
return MANAGER->readFile(cPath);
|
return MANAGER->readFile(cPath);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get readFile");
|
LOG("Unable to get readFile");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -69,8 +68,8 @@ Java_org_kiwix_kiwixlib_Manager_readXml(
|
||||||
try {
|
try {
|
||||||
return MANAGER->readXml(cContent, false, cPath);
|
return MANAGER->readXml(cContent, false, cPath);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
LOG("Unable to get ZIM id");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -86,8 +85,8 @@ Java_org_kiwix_kiwixlib_Manager_readOpds(
|
||||||
try {
|
try {
|
||||||
return MANAGER->readOpds(cContent, cUrl);
|
return MANAGER->readOpds(cContent, cUrl);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
LOG("Unable to get ZIM id");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -102,8 +101,8 @@ Java_org_kiwix_kiwixlib_Manager_readBookmarkFile(
|
||||||
try {
|
try {
|
||||||
return MANAGER->readBookmarkFile(cPath);
|
return MANAGER->readBookmarkFile(cPath);
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM id");
|
LOG("Unable to get ZIM id");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,8 +124,8 @@ Java_org_kiwix_kiwixlib_Manager_addBookFromPath(
|
||||||
id = c2jni(cId, env);
|
id = c2jni(cId, env);
|
||||||
}
|
}
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", "Unable to get ZIM file size");
|
LOG("Unable to get ZIM file size");
|
||||||
__android_log_print(ANDROID_LOG_ERROR, "kiwix", e.what());
|
LOG(e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#if __ANDROID__
|
||||||
|
#include <android/log.h>
|
||||||
|
#define LOG(...) __android_log_print(ANDROID_LOG_ERROR, "kiwix", __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define LOG(...)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern pthread_mutex_t globalLock;
|
extern pthread_mutex_t globalLock;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue