diff --git a/lib/src/main/cpp/libzim/archive.cpp b/lib/src/main/cpp/libzim/archive.cpp index 4a93f53..8ca09d1 100644 --- a/lib/src/main/cpp/libzim/archive.cpp +++ b/lib/src/main/cpp/libzim/archive.cpp @@ -116,8 +116,7 @@ Java_org_kiwix_libzim_Archive_dispose(JNIEnv* env, jobject thisObj) } #define THIS GET_PTR(zim::Archive) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_Archive_##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_Archive, name) \ { \ return TO_JNI(THIS->name()); \ } @@ -130,15 +129,15 @@ GETTER(jint, getEntryCount) GETTER(jint, getArticleCount) GETTER(jint, getMediaCount) -METHOD0(jstring, Archive, getUuid) { +METHOD0(jstring, libzim_Archive, getUuid) { return TO_JNI(std::string(THIS->getUuid())); } -METHOD(jstring, Archive, getMetadata, jstring name) { +METHOD(jstring, libzim_Archive, getMetadata, jstring name) { return TO_JNI(THIS->getMetadata(TO_C(name))); } -METHOD(jobject, Archive, getMetadataItem, jstring name) { +METHOD(jobject, libzim_Archive, getMetadataItem, jstring name) { auto obj = NEW_OBJECT("org/kiwix/libzim/Item"); SET_HANDLE(zim::Item, obj, THIS->getMetadataItem(TO_C(name))); return obj; @@ -146,71 +145,71 @@ METHOD(jobject, Archive, getMetadataItem, jstring name) { GETTER(jobjectArray, getMetadataKeys) -METHOD(jobject, Archive, getIllustrationItem, jint size) { +METHOD(jobject, libzim_Archive, getIllustrationItem, jint size) { auto obj = NEW_OBJECT("org/kiwix/libzim/Item"); SET_HANDLE(zim::Item, obj, THIS->getIllustrationItem(TO_C(size))); return obj; } -METHOD(jboolean, Archive, hasIllustration, jint size) { +METHOD(jboolean, libzim_Archive, hasIllustration, jint size) { return TO_JNI(THIS->hasIllustration(TO_C(size))); } GETTER(jlongArray, getIllustrationSizes) -METHOD(jobject, Archive, getEntryByPath, jlong index) { +METHOD(jobject, libzim_Archive, getEntryByPath, jlong index) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getEntryByPath(TO_C(index))); return obj; } -METHOD(jobject, Archive, getEntryByPath, jstring path) { +METHOD(jobject, libzim_Archive, getEntryByPath, jstring path) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getEntryByPath(TO_C(path))); return obj; } -METHOD(jobject, Archive, getEntryByTitle, jlong index) { +METHOD(jobject, libzim_Archive, getEntryByTitle, jlong index) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getEntryByTitle(TO_C(index))); return obj; } -METHOD(jobject, Archive, getEntryByTitle, jstring title) { +METHOD(jobject, libzim_Archive, getEntryByTitle, jstring title) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getEntryByTitle(TO_C(title))); return obj; } -METHOD(jobject, Archive, getEntryByClusterOrder, jlong index) { +METHOD(jobject, libzim_Archive, getEntryByClusterOrder, jlong index) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getEntryByClusterOrder(TO_C(index))); return obj; } -METHOD0(jobject, Archive, getMainEntry) { +METHOD0(jobject, libzim_Archive, getMainEntry) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getMainEntry()); return obj; } -METHOD0(jobject, Archive, getRandomEntry) { +METHOD0(jobject, libzim_Archive, getRandomEntry) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getRandomEntry()); return obj; } -METHOD(jboolean, Archive, hasEntryByPath, jstring path) { +METHOD(jboolean, libzim_Archive, hasEntryByPath, jstring path) { return TO_JNI(THIS->hasEntryByPath(TO_C(path))); } -METHOD(jboolean, Archive, hasEntryByTitle, jstring title) { +METHOD(jboolean, libzim_Archive, hasEntryByTitle, jstring title) { return TO_JNI(THIS->hasEntryByPath(TO_C(title))); } GETTER(jboolean, hasMainEntry) -METHOD(jboolean, Archive, hasIllustration, jlong size) { +METHOD(jboolean, libzim_Archive, hasIllustration, jlong size) { return TO_JNI(THIS->hasIllustration(TO_C(size))); } @@ -226,7 +225,7 @@ GETTER(jboolean, hasNewNamespaceScheme) #define ITER_BY_PATH 0 #define ITER_BY_TITLE 1 #define ITER_EFFICIENT 2 -METHOD0(jobject, Archive, iterByPath) { +METHOD0(jobject, libzim_Archive, iterByPath) { auto range = THIS->iterByPath(); jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator"); jmethodID initMethod = env->GetMethodID(objClass, "", "(I)V"); @@ -238,7 +237,7 @@ METHOD0(jobject, Archive, iterByPath) { return obj; } -METHOD0(jobject, Archive, iterByTitle) { +METHOD0(jobject, libzim_Archive, iterByTitle) { auto range = THIS->iterByTitle(); jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator"); jmethodID initMethod = env->GetMethodID(objClass, "", "(I)V"); @@ -250,7 +249,7 @@ METHOD0(jobject, Archive, iterByTitle) { return obj; } -METHOD0(jobject, Archive, iterEfficient) { +METHOD0(jobject, libzim_Archive, iterEfficient) { auto range = THIS->iterEfficient(); jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator"); jmethodID initMethod = env->GetMethodID(objClass, "", "(I)V"); @@ -262,7 +261,7 @@ METHOD0(jobject, Archive, iterEfficient) { return obj; } -METHOD(jobject, Archive, findByPath, jstring path) { +METHOD(jobject, libzim_Archive, findByPath, jstring path) { auto range = THIS->findByPath(TO_C(path)); jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator"); jmethodID initMethod = env->GetMethodID(objClass, "", "(I)V"); @@ -274,7 +273,7 @@ METHOD(jobject, Archive, findByPath, jstring path) { return obj; } -METHOD(jobject, Archive, findByTitle, jstring title) { +METHOD(jobject, libzim_Archive, findByTitle, jstring title) { auto range = THIS->findByTitle(TO_C(title)); jclass objClass = env->FindClass("org/kiwix/libzim/EntryIterator"); jmethodID initMethod = env->GetMethodID(objClass, "", "(I)V"); diff --git a/lib/src/main/cpp/libzim/blob.cpp b/lib/src/main/cpp/libzim/blob.cpp index 39bed81..70ce387 100644 --- a/lib/src/main/cpp/libzim/blob.cpp +++ b/lib/src/main/cpp/libzim/blob.cpp @@ -36,13 +36,12 @@ Java_org_kiwix_kiwixlib_libzim_Blob_dispose(JNIEnv* env, jobject thisObj) dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_Blob__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_Blob, name) \ { \ return TO_JNI(THIS->name()); \ } -METHOD0(jstring, Blob, getData) { +METHOD0(jstring, libzim_Blob, getData) { return TO_JNI(std::string(*THIS)); } GETTER(jlong, size) diff --git a/lib/src/main/cpp/libzim/entry.cpp b/lib/src/main/cpp/libzim/entry.cpp index 6e5ce73..52da201 100644 --- a/lib/src/main/cpp/libzim/entry.cpp +++ b/lib/src/main/cpp/libzim/entry.cpp @@ -38,8 +38,7 @@ Java_org_kiwix_kiwixlib_libzim_Entry_dispose(JNIEnv* env, jobject thisObj) } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_Entry__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_Entry, name) \ { \ return TO_JNI(THIS->name()); \ } @@ -48,19 +47,19 @@ Java_org_kiwix_libzim_Entry__##name (JNIEnv* env, jobject thisObj) \ GETTER(jboolean, isRedirect) GETTER(jstring, getTitle) GETTER(jstring, getPath) -METHOD(jobject, Entry, getItem, jboolean follow) { +METHOD(jobject, libzim_Entry, getItem, jboolean follow) { auto obj = NEW_OBJECT("org/kiwix/libzim/Item"); SET_HANDLE(zim::Item, obj, THIS->getItem(TO_C(follow))); return obj; } -METHOD0(jobject, Entry, getRedirect) { +METHOD0(jobject, libzim_Entry, getRedirect) { auto obj = NEW_OBJECT("org/kiwix/libzim/Item"); SET_HANDLE(zim::Item, obj, THIS->getRedirect()); return obj; } -METHOD0(jobject, Entry, getRedirectEntry) { +METHOD0(jobject, libzim_Entry, getRedirectEntry) { auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); SET_HANDLE(zim::Entry, obj, THIS->getRedirectEntry()); return obj; diff --git a/lib/src/main/cpp/libzim/entry_iterator.cpp b/lib/src/main/cpp/libzim/entry_iterator.cpp index 88a904e..1984a2b 100644 --- a/lib/src/main/cpp/libzim/entry_iterator.cpp +++ b/lib/src/main/cpp/libzim/entry_iterator.cpp @@ -39,8 +39,7 @@ inline int get_order(JNIEnv* env, jobject thisObj) { return TO_C(env->GetIntField(thisObj, fieldId)); } -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_EntryIterotar_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_EntryIterotar, dispose) { // Delete end iterator switch (get_order(env, thisObj)) { @@ -60,7 +59,7 @@ Java_org_kiwix_kiwixlib_libzim_EntryIterotar_dispose(JNIEnv* env, jobject thisOb } -METHOD0(jboolean, EntryIterator, hasNext) { +METHOD0(jboolean, libzim_EntryIterator, hasNext) { switch (get_order(env, thisObj)) { case 0: { PATH_NATIVE_TYPE next(*GET_PTR(PATH_NATIVE_TYPE)); @@ -83,7 +82,7 @@ METHOD0(jboolean, EntryIterator, hasNext) { } } -METHOD0(jobject, EntryIterator, next) { +METHOD0(jobject, libzim_EntryIterator, next) { switch (get_order(env, thisObj)) { case 0: { (*GET_PTR(PATH_NATIVE_TYPE))++; diff --git a/lib/src/main/cpp/libzim/item.cpp b/lib/src/main/cpp/libzim/item.cpp index 81d7aaf..90bc493 100644 --- a/lib/src/main/cpp/libzim/item.cpp +++ b/lib/src/main/cpp/libzim/item.cpp @@ -37,8 +37,7 @@ Java_org_kiwix_kiwixlib_libzim_Item_dispose(JNIEnv* env, jobject thisObj) } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_Item__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_Item, name) \ { \ return TO_JNI(THIS->name()); \ } @@ -47,7 +46,7 @@ GETTER(jstring, getTitle) GETTER(jstring, getPath) GETTER(jstring, getMimetype) -METHOD0(jobject, Item, getData) { +METHOD0(jobject, libzim_Item, getData) { auto obj = NEW_OBJECT("org/kiwix/libzim/Blob"); SET_HANDLE(zim::Blob, obj, THIS->getData()); return obj; diff --git a/lib/src/main/cpp/libzim/query.cpp b/lib/src/main/cpp/libzim/query.cpp index c39e0cd..575844a 100644 --- a/lib/src/main/cpp/libzim/query.cpp +++ b/lib/src/main/cpp/libzim/query.cpp @@ -53,12 +53,12 @@ Java_org_kiwix_kiwixlib_libzim_Query_dispose(JNIEnv* env, jobject thisObj) #define THIS GET_PTR(NATIVE_TYPE) -METHOD(jobject, Query, setQuery, jstring query) { +METHOD(jobject, libzim_Query, setQuery, jstring query) { THIS->setQuery(TO_C(query)); return thisObj; } -METHOD(jobject, Query, setGeorange, jfloat latitude, jfloat longitude, jfloat distance) { +METHOD(jobject, libzim_Query, setGeorange, jfloat latitude, jfloat longitude, jfloat distance) { THIS->setGeorange(TO_C(latitude), TO_C(longitude), TO_C(distance)); return thisObj; } diff --git a/lib/src/main/cpp/libzim/search.cpp b/lib/src/main/cpp/libzim/search.cpp index 057aa06..a791321 100644 --- a/lib/src/main/cpp/libzim/search.cpp +++ b/lib/src/main/cpp/libzim/search.cpp @@ -30,15 +30,14 @@ #define NATIVE_TYPE zim::Search -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_Search_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_Search, dispose) { dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -METHOD(jobject, Search, getResults, jint start, jint maxResults) { +METHOD(jobject, libzim_Search, getResults, jint start, jint maxResults) { auto results = THIS->getResults(TO_C(start), TO_C(maxResults)); auto obj = NEW_OBJECT("ork/kiwix/libzim/SearchIterator"); SET_HANDLE(zim::SearchIterator, obj, results.begin()); @@ -49,7 +48,7 @@ METHOD(jobject, Search, getResults, jint start, jint maxResults) { return obj; } -METHOD0(jlong, Search, getEstimatedMatches) { +METHOD0(jlong, libzim_Search, getEstimatedMatches) { return TO_JNI(THIS->getEstimatedMatches()); } diff --git a/lib/src/main/cpp/libzim/search_iterator.cpp b/lib/src/main/cpp/libzim/search_iterator.cpp index 9b1fa18..3375366 100644 --- a/lib/src/main/cpp/libzim/search_iterator.cpp +++ b/lib/src/main/cpp/libzim/search_iterator.cpp @@ -31,8 +31,7 @@ #define NATIVE_TYPE zim::SearchIterator -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_SearchIterotar_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_SearchIterator, dispose) { // Delete end iterator dispose(env, thisObj, "nativeHandleEnd"); @@ -40,8 +39,7 @@ Java_org_kiwix_kiwixlib_libzim_SearchIterotar_dispose(JNIEnv* env, jobject thisO } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_SearchIterator__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_SearchIterator, name) \ { \ return TO_JNI(THIS->name()); \ } @@ -54,18 +52,18 @@ GETTER(jint, getWordCount) GETTER(jint, getFileIndex) GETTER(jint, getSize) -METHOD0(jstring, SearchIterator, getZimId) { +METHOD0(jstring, libzim_SearchIterator, getZimId) { return TO_JNI(std::string(THIS->getZimId())); } -METHOD0(jboolean, SearchIterator, hasNext) { +METHOD0(jboolean, libzim_SearchIterator, hasNext) { zim::SearchIterator next(*THIS); next++; auto end = getPtr(env, thisObj, "nativeHandleEnd"); return next == *end; } -METHOD0(jobject, SearchIterator, next) { +METHOD0(jobject, libzim_SearchIterator, next) { (*THIS)++; zim::Entry entry = **THIS; auto obj = NEW_OBJECT("org/kiwix/libzim/Entry"); diff --git a/lib/src/main/cpp/libzim/searcher.cpp b/lib/src/main/cpp/libzim/searcher.cpp index 2ce9cd4..071782b 100644 --- a/lib/src/main/cpp/libzim/searcher.cpp +++ b/lib/src/main/cpp/libzim/searcher.cpp @@ -46,33 +46,31 @@ JNIEXPORT void JNICALL Java_org_kiwix_libzim_Searcher_setNativeSearcher( } -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_Searcher_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_Searcher, dispose) { dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_Searcher__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_Searcher, name) \ { \ return TO_JNI(THIS->name()); \ } -METHOD(jobject, Searcher, addArchive, jobject archive) { +METHOD(jobject, libzim_Searcher, addArchive, jobject archive) { auto cArchive = getPtr(env, archive); THIS->addArchive(*cArchive); return thisObj; } -METHOD(jobject, Searcher, search, jobject query) { +METHOD(jobject, libzim_Searcher, search, jobject query) { auto cQuery = getPtr(env, query); auto obj = NEW_OBJECT("org/kiwix/libzim/Search"); SET_HANDLE(zim::Search, obj, THIS->search(*cQuery)); return obj; } -METHOD(void, Searcher, setVerbose, jboolean verbose) { +METHOD(void, libzim_Searcher, setVerbose, jboolean verbose) { THIS->setVerbose(TO_C(verbose)); } diff --git a/lib/src/main/cpp/libzim/suggestion_item.cpp b/lib/src/main/cpp/libzim/suggestion_item.cpp index 254d8bc..d0f051c 100644 --- a/lib/src/main/cpp/libzim/suggestion_item.cpp +++ b/lib/src/main/cpp/libzim/suggestion_item.cpp @@ -30,15 +30,13 @@ #define NATIVE_TYPE zim::SuggestionItem -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_SuggestionItem_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_SuggestionItem, dispose) { dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_SuggestionItem__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionItem, name) \ { \ return TO_JNI(THIS->name()); \ } diff --git a/lib/src/main/cpp/libzim/suggestion_iterator.cpp b/lib/src/main/cpp/libzim/suggestion_iterator.cpp index 9c1bff0..b0e1be1 100644 --- a/lib/src/main/cpp/libzim/suggestion_iterator.cpp +++ b/lib/src/main/cpp/libzim/suggestion_iterator.cpp @@ -30,8 +30,7 @@ #define NATIVE_TYPE zim::SuggestionIterator -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_SuggestionIterator_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_SuggestionIterator, dispose) { // Delete end iterator dispose(env, thisObj, "nativeHandleEnd"); @@ -39,20 +38,19 @@ Java_org_kiwix_kiwixlib_libzim_SuggestionIterator_dispose(JNIEnv* env, jobject t } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_SuggestionIterator__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionIterator, name) \ { \ return TO_JNI(THIS->name()); \ } -METHOD0(jboolean, SearchIterator, hasNext) { +METHOD0(jboolean, libzim_SearchIterator, hasNext) { NATIVE_TYPE next(*THIS); next++; auto end = getPtr(env, thisObj, "nativeHandleEnd"); return next == *end; } -METHOD0(jobject, SearchIterator, next) { +METHOD0(jobject, libzim_SearchIterator, next) { (*THIS)++; zim::SuggestionItem item = **THIS; auto obj = NEW_OBJECT("org/kiwix/libzim/SuggestionItem"); diff --git a/lib/src/main/cpp/libzim/suggestion_search.cpp b/lib/src/main/cpp/libzim/suggestion_search.cpp index 0b545d7..78000d6 100644 --- a/lib/src/main/cpp/libzim/suggestion_search.cpp +++ b/lib/src/main/cpp/libzim/suggestion_search.cpp @@ -30,15 +30,14 @@ #define NATIVE_TYPE zim::SuggestionSearch -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_SuggestionSearch_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_SuggestionSearch, dispose) { dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -METHOD(jobject, SuggestionSearch, getResults, jint start, jint maxResults) { +METHOD(jobject, libzim_SuggestionSearch, getResults, jint start, jint maxResults) { auto results = THIS->getResults(TO_C(start), TO_C(maxResults)); auto obj = NEW_OBJECT("ork/kiwix/libzim/SuggestionIterator"); SET_HANDLE(zim::SuggestionIterator, obj, results.begin()); @@ -49,7 +48,7 @@ METHOD(jobject, SuggestionSearch, getResults, jint start, jint maxResults) { return obj; } -METHOD0(jlong, SuggestionSearch, getEstimatedMatches) { +METHOD0(jlong, libzim_SuggestionSearch, getEstimatedMatches) { return TO_JNI(THIS->getEstimatedMatches()); } diff --git a/lib/src/main/cpp/libzim/suggestion_searcher.cpp b/lib/src/main/cpp/libzim/suggestion_searcher.cpp index 7c8ad2e..15cad3e 100644 --- a/lib/src/main/cpp/libzim/suggestion_searcher.cpp +++ b/lib/src/main/cpp/libzim/suggestion_searcher.cpp @@ -46,26 +46,24 @@ JNIEXPORT void JNICALL Java_org_kiwix_libzim_SuggestionSearcher_setNativeSearche } -JNIEXPORT void JNICALL -Java_org_kiwix_kiwixlib_libzim_SuggestionSearcher_dispose(JNIEnv* env, jobject thisObj) +METHOD0(void, libzim_SuggestionSearcher, dispose) { dispose(env, thisObj); } #define THIS GET_PTR(NATIVE_TYPE) -#define GETTER(retType, name) JNIEXPORT retType JNICALL \ -Java_org_kiwix_libzim_SuggestionSearcher__##name (JNIEnv* env, jobject thisObj) \ +#define GETTER(retType, name) METHOD0(retType, libzim_SuggestionSearcher, name) \ { \ return TO_JNI(THIS->name()); \ } -METHOD(jobject, SuggestionSearcher, suggest, jstring query) { +METHOD(jobject, libzim_SuggestionSearcher, suggest, jstring query) { auto obj = NEW_OBJECT("org/kiwix/libzim/SuggestionSearch"); SET_HANDLE(zim::SuggestionSearch, obj, THIS->suggest(TO_C(query))); return obj; } -METHOD(void, SuggestionSearcher, setVerbose, jboolean verbose) { +METHOD(void, libzim_SuggestionSearcher, setVerbose, jboolean verbose) { THIS->setVerbose(TO_C(verbose)); } diff --git a/lib/src/main/cpp/utils.h b/lib/src/main/cpp/utils.h index 7557637..301d6bc 100644 --- a/lib/src/main/cpp/utils.h +++ b/lib/src/main/cpp/utils.h @@ -109,11 +109,11 @@ void dispose(JNIEnv* env, jobject thisObj, const char* handleName = "nativeHandl } #define METHOD0(retType, class, name) \ -JNIEXPORT retType JNICALL Java_org_kiwix_libzim_##class##_##name( \ +JNIEXPORT retType JNICALL Java_org_kiwix_##class##_##name( \ JNIEnv* env, jobject thisObj) #define METHOD(retType, class, name, ...) \ -JNIEXPORT retType JNICALL Java_org_kiwix_libzim_##class##_##name( \ +JNIEXPORT retType JNICALL Java_org_kiwix_##class##_##name( \ JNIEnv* env, jobject thisObj, __VA_ARGS__) inline jfieldID getHandleField(JNIEnv* env, jobject obj, const char* handleName)