1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

no Book.save() call in native code

This commit is contained in:
Nikolay Pultsin 2013-01-20 05:14:20 +04:00
parent aaded888d4
commit 5c01bea10a
7 changed files with 10 additions and 11 deletions

View file

@ -29,7 +29,7 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := NativeFormats-v2 LOCAL_MODULE := NativeFormats-v3
LOCAL_CFLAGS := -Wall LOCAL_CFLAGS := -Wall
LOCAL_LDLIBS := -lz -llog LOCAL_LDLIBS := -lz -llog
LOCAL_STATIC_LIBRARIES := expat LOCAL_STATIC_LIBRARIES := expat

View file

@ -83,7 +83,7 @@ static void fillMetaInfo(JNIEnv* env, jobject javaBook, Book &book) {
} }
} }
void fillLanguageAndEncoding(JNIEnv* env, jobject javaBook, Book &book) { static void fillLanguageAndEncoding(JNIEnv* env, jobject javaBook, Book &book) {
jstring javaString; jstring javaString;
javaString = AndroidUtil::createJavaString(env, book.language()); javaString = AndroidUtil::createJavaString(env, book.language());
@ -97,8 +97,6 @@ void fillLanguageAndEncoding(JNIEnv* env, jobject javaBook, Book &book) {
AndroidUtil::Method_Book_setEncoding->call(javaBook, javaString); AndroidUtil::Method_Book_setEncoding->call(javaBook, javaString);
env->DeleteLocalRef(javaString); env->DeleteLocalRef(javaString);
} }
AndroidUtil::Method_Book_save->call(javaBook);
} }
extern "C" extern "C"
@ -119,7 +117,7 @@ JNIEXPORT jboolean JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPl
} }
extern "C" extern "C"
JNIEXPORT void JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPlugin_detectLanguageAndEncoding(JNIEnv* env, jobject thiz, jobject javaBook) { JNIEXPORT void JNICALL Java_org_geometerplus_fbreader_formats_NativeFormatPlugin_detectLanguageAndEncodingNative(JNIEnv* env, jobject thiz, jobject javaBook) {
shared_ptr<FormatPlugin> plugin = findCppPlugin(thiz); shared_ptr<FormatPlugin> plugin = findCppPlugin(thiz);
if (plugin.isNull()) { if (plugin.isNull()) {
return; return;

View file

@ -104,7 +104,6 @@ shared_ptr<VoidMethod> AndroidUtil::Method_Book_setLanguage;
shared_ptr<VoidMethod> AndroidUtil::Method_Book_setEncoding; shared_ptr<VoidMethod> AndroidUtil::Method_Book_setEncoding;
shared_ptr<VoidMethod> AndroidUtil::Method_Book_addAuthor; shared_ptr<VoidMethod> AndroidUtil::Method_Book_addAuthor;
shared_ptr<VoidMethod> AndroidUtil::Method_Book_addTag; shared_ptr<VoidMethod> AndroidUtil::Method_Book_addTag;
shared_ptr<BooleanMethod> AndroidUtil::Method_Book_save;
shared_ptr<StaticObjectMethod> AndroidUtil::StaticMethod_Tag_getTag; shared_ptr<StaticObjectMethod> AndroidUtil::StaticMethod_Tag_getTag;
@ -180,7 +179,6 @@ bool AndroidUtil::init(JavaVM* jvm) {
Method_Book_setEncoding = new VoidMethod(Class_Book, "setEncoding", "(Ljava/lang/String;)"); Method_Book_setEncoding = new VoidMethod(Class_Book, "setEncoding", "(Ljava/lang/String;)");
Method_Book_addAuthor = new VoidMethod(Class_Book, "addAuthor", "(Ljava/lang/String;Ljava/lang/String;)"); Method_Book_addAuthor = new VoidMethod(Class_Book, "addAuthor", "(Ljava/lang/String;Ljava/lang/String;)");
Method_Book_addTag = new VoidMethod(Class_Book, "addTag", "(Lorg/geometerplus/fbreader/book/Tag;)"); Method_Book_addTag = new VoidMethod(Class_Book, "addTag", "(Lorg/geometerplus/fbreader/book/Tag;)");
Method_Book_save = new BooleanMethod(Class_Book, "save", "()");
StaticMethod_Tag_getTag = new StaticObjectMethod(Class_Tag, "getTag", Class_Tag, "(Lorg/geometerplus/fbreader/book/Tag;Ljava/lang/String;)"); StaticMethod_Tag_getTag = new StaticObjectMethod(Class_Tag, "getTag", Class_Tag, "(Lorg/geometerplus/fbreader/book/Tag;Ljava/lang/String;)");

View file

@ -126,7 +126,6 @@ public:
static shared_ptr<VoidMethod> Method_Book_setEncoding; static shared_ptr<VoidMethod> Method_Book_setEncoding;
static shared_ptr<VoidMethod> Method_Book_addAuthor; static shared_ptr<VoidMethod> Method_Book_addAuthor;
static shared_ptr<VoidMethod> Method_Book_addTag; static shared_ptr<VoidMethod> Method_Book_addTag;
static shared_ptr<BooleanMethod> Method_Book_save;
static shared_ptr<StaticObjectMethod> StaticMethod_Tag_getTag; static shared_ptr<StaticObjectMethod> StaticMethod_Tag_getTag;

View file

@ -80,7 +80,6 @@
public void setEncoding(**); public void setEncoding(**);
public void addAuthor(**,**); public void addAuthor(**,**);
public void addTag(**); public void addTag(**);
public boolean save();
} }
-keep class org.geometerplus.fbreader.book.Tag -keep class org.geometerplus.fbreader.book.Tag
-keepclassmembers class org.geometerplus.fbreader.book.Tag { -keepclassmembers class org.geometerplus.fbreader.book.Tag {

View file

@ -56,7 +56,12 @@ public class NativeFormatPlugin extends FormatPlugin {
private native boolean readMetaInfoNative(Book book); private native boolean readMetaInfoNative(Book book);
@Override @Override
public native void detectLanguageAndEncoding(Book book); public void detectLanguageAndEncoding(Book book) {
detectLanguageAndEncodingNative(book);
book.save();
}
public native void detectLanguageAndEncodingNative(Book book);
@Override @Override
synchronized public void readModel(BookModel model) throws BookReadingException { synchronized public void readModel(BookModel model) throws BookReadingException {

View file

@ -30,7 +30,7 @@ import org.geometerplus.fbreader.formats.pdb.MobipocketPlugin;
public class PluginCollection { public class PluginCollection {
static { static {
System.loadLibrary("NativeFormats-v2"); System.loadLibrary("NativeFormats-v3");
} }
private static PluginCollection ourInstance; private static PluginCollection ourInstance;