mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2d34e4db1e
@ -438,8 +438,8 @@ for arch in ARCHS:
|
||||
shutil.copy('libz.a', os.path.join(platform, 'lib', 'gcc', arch_full, COMPILER_VERSION, 'libz.a'))
|
||||
os.chdir('../e2fsprogs-1.42')
|
||||
print("Fetching latest compile.sub...")
|
||||
shutil.copy(os.path.join("..", "xapian-core-1.4.0", "config.guess"), os.path.join("config", "config.guess"))
|
||||
shutil.copy(os.path.join("..", "xapian-core-1.4.0", "config.sub"), os.path.join("config", "config.sub"))
|
||||
shutil.copy(os.path.join("..", "xapian-core-1.4.1", "config.guess"), os.path.join("config", "config.guess"))
|
||||
shutil.copy(os.path.join("..", "xapian-core-1.4.1", "config.sub"), os.path.join("config", "config.sub"))
|
||||
if os.path.exists("Makefile"):
|
||||
syscall('make clean')
|
||||
syscall('./configure --host=%s --prefix=%s' % (arch_full, platform))
|
||||
@ -460,7 +460,7 @@ for arch in ARCHS:
|
||||
shutil.copy('uuid.h', os.path.join(platform, 'include', 'c++', COMPILER_VERSION, 'uuid', 'uuid.h'))
|
||||
shutil.copy('libuuid.a', os.path.join(platform, 'lib', 'gcc', arch_full, COMPILER_VERSION, 'libuuid.a'))
|
||||
shutil.copy('libuuid.a', os.path.join(platform, 'lib', 'libuuid.a'))
|
||||
os.chdir('../../../xapian-core-1.4.0')
|
||||
os.chdir('../../../xapian-core-1.4.1')
|
||||
if os.path.exists("Makefile"):
|
||||
syscall('make clean')
|
||||
|
||||
@ -502,7 +502,7 @@ for arch in ARCHS:
|
||||
pass
|
||||
|
||||
syscall('make')
|
||||
shutil.copy(os.path.join(curdir, '..', 'src', 'dependencies', 'xapian-core-1.4.0', '.libs', 'libxapian.a'), os.path.join(platform, 'lib', 'libxapian.a'))
|
||||
shutil.copy(os.path.join(curdir, '..', 'src', 'dependencies', 'xapian-core-1.4.1', '.libs', 'libxapian.a'), os.path.join(platform, 'lib', 'libxapian.a'))
|
||||
os.chdir(curdir)
|
||||
|
||||
# check that the step went well
|
||||
|
78
kiwix.cpp
78
kiwix.cpp
@ -86,8 +86,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getMainPage(JNIEnv
|
||||
try {
|
||||
std::string cUrl = reader->getMainPageUrl();
|
||||
url = c2jni(cUrl, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM main page" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -103,8 +103,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getId(JNIEnv *env,
|
||||
try {
|
||||
std::string cId = reader->getId();
|
||||
id = c2jni(cId, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM id" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -120,8 +120,8 @@ JNIEXPORT jint JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getFileSize(JNIEnv *e
|
||||
try {
|
||||
int cSize = reader->getFileSize();
|
||||
size = c2jni(cSize);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM file size" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -137,8 +137,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getCreator(JNIEnv
|
||||
try {
|
||||
std::string cCreator = reader->getCreator();
|
||||
creator = c2jni(cCreator, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM creator" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -154,8 +154,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getPublisher(JNIEn
|
||||
try {
|
||||
std::string cPublisher = reader->getPublisher();
|
||||
publisher = c2jni(cPublisher, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM creator" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -173,8 +173,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getFavicon(JNIEnv
|
||||
std::string cMime;
|
||||
reader->getFavicon(cContent, cMime);
|
||||
favicon = c2jni(base64_encode(reinterpret_cast<const unsigned char*>(cContent.c_str()), cContent.length()), env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM favicon" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -190,8 +190,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getDate(JNIEnv *en
|
||||
try {
|
||||
std::string cDate = reader->getDate();
|
||||
date = c2jni(cDate, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM date" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -207,8 +207,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getLanguage(JNIEnv
|
||||
try {
|
||||
std::string cLanguage = reader->getLanguage();
|
||||
language = c2jni(cLanguage, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM language" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -226,8 +226,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getMimeType(JNIEnv
|
||||
std::string cMimeType;
|
||||
reader->getMimeTypeByUrl(cUrl, cMimeType);
|
||||
mimeType = c2jni(cMimeType, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get mime-type for url " << cUrl << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -243,8 +243,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_loadZIM(JNIEnv *e
|
||||
try {
|
||||
if (reader != NULL) delete reader;
|
||||
reader = new kiwix::Reader(cPath);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to load ZIM " << cPath << std::endl;
|
||||
reader = NULL;
|
||||
retVal = JNI_FALSE;
|
||||
}
|
||||
@ -275,9 +275,8 @@ JNIEXPORT jbyteArray JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getContent(JNIE
|
||||
setStringObjValue(cMimeType, mimeTypeObj, env);
|
||||
setIntObjValue(cSize, sizeObj, env);
|
||||
}
|
||||
} catch (exception &e) {
|
||||
LOGI(e.what());
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get content for url " << cUrl << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
}
|
||||
@ -298,8 +297,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_searchSuggestions
|
||||
retVal = JNI_TRUE;
|
||||
}
|
||||
}
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to search suggestions for pattern " << cPrefix << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
@ -319,8 +318,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getNextSuggestion
|
||||
retVal = JNI_TRUE;
|
||||
}
|
||||
}
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get next suggestion" << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
@ -341,8 +340,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getPageUrlFromTit
|
||||
retVal = JNI_TRUE;
|
||||
}
|
||||
}
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get URL for title " << cTitle << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
@ -361,8 +360,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getTitle
|
||||
setStringObjValue(cTitle, titleObj, env);
|
||||
retVal = JNI_TRUE;
|
||||
}
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM title" << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
@ -378,8 +377,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getDescription(JNI
|
||||
try {
|
||||
std::string cDescription = reader->getDescription();
|
||||
description = c2jni(cDescription, env);
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get ZIM description" << std::endl;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
@ -399,8 +398,8 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_getRandomPage
|
||||
setStringObjValue(cUrl, urlObj, env);
|
||||
retVal = JNI_TRUE;
|
||||
}
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to get random page" << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
|
||||
@ -414,8 +413,8 @@ JNIEXPORT void JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_setDataDirectory
|
||||
pthread_mutex_lock(&readerLock);
|
||||
try {
|
||||
u_setDataDirectory(cPath.c_str());
|
||||
} catch (exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to set data directory " << cPath << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&readerLock);
|
||||
}
|
||||
@ -432,6 +431,7 @@ JNIEXPORT jboolean JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_loadFulltextIndex
|
||||
} catch (...) {
|
||||
searcher = NULL;
|
||||
retVal = JNI_FALSE;
|
||||
std::cerr << "Unable to load full text index " << cPath << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&searcherLock);
|
||||
|
||||
@ -457,8 +457,8 @@ JNIEXPORT jstring JNICALL Java_org_kiwix_kiwixmobile_JNIKiwix_indexedQuery
|
||||
result += title + "\n";
|
||||
}
|
||||
}
|
||||
} catch (const Xapian::Error &e) {
|
||||
LOGI(e.get_description().c_str());
|
||||
} catch (...) {
|
||||
std::cerr << "Unable to make indexed query " << cQuery << std::endl;
|
||||
}
|
||||
pthread_mutex_unlock(&searcherLock);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user