[sword-svn] r3568 - in trunk: bindings/corba/orbitcpp bindings/cordova bindings/cordova/org.crosswire.sword.cordova.SWORD bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android bindings/java-jni/jni bindings/java-jni/src/org/crosswire/android/sword src/mgr

scribe at crosswire.org scribe at crosswire.org
Sun Feb 18 18:56:00 MST 2018


Author: scribe
Date: 2018-02-18 18:56:00 -0700 (Sun, 18 Feb 2018)
New Revision: 3568

Modified:
   trunk/bindings/corba/orbitcpp/webmgr.hpp
   trunk/bindings/cordova/Makefile
   trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml
   trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java
   trunk/bindings/java-jni/jni/swordstub.cpp
   trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
   trunk/src/mgr/swmgr.cpp
Log:
Fixed bug with extraConf being set after it was needed.  Update cordova plugin to use new NDK lib names. Added more debug info.  Added CipherKey to fields returned with modinfo and module

Modified: trunk/bindings/corba/orbitcpp/webmgr.hpp
===================================================================
--- trunk/bindings/corba/orbitcpp/webmgr.hpp	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/corba/orbitcpp/webmgr.hpp	2018-02-19 01:56:00 UTC (rev 3568)
@@ -31,6 +31,7 @@
 #include <osiswordjs.h>
 #include <thmlwordjs.h>
 #include <gbfwordjs.h>
+#include <swlog.h>
 
 using namespace sword;
 
@@ -45,10 +46,24 @@
 	char *extraConf;
 
 public:
-	WebMgr(const char *path, const char *extraConfPath = 0) : SWMgr(path, false, new MarkupFilterMgr(FMT_WEBIF)) { init(); if (extraConfPath) stdstr(&extraConf, extraConfPath); }
-	WebMgr(SWConfig *sysConf) : SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) { init(); }
+	WebMgr(const char *path, const char *extraConfPath = 0)
+			: SWMgr(path, false, new MarkupFilterMgr(FMT_WEBIF)) {
+SWLog::getSystemLog()->logDebug("libsword: WebMgr c-tor(path: %s, extraConfPath: %s)", path, extraConfPath?extraConfPath:"NULL");
+		extraConf         = 0;
+		if (extraConfPath) {
+SWLog::getSystemLog()->logDebug("libsword: WebMgr::c-tor extraConfPath supplied: %s)", extraConfPath);
+			stdstr(&extraConf, extraConfPath);
+		}
+		init();
+	}
+	WebMgr(SWConfig *sysConf)
+			: SWMgr(0, sysConf, false, new MarkupFilterMgr(FMT_WEBIF)) {
+		extraConf         = 0;
+SWLog::getSystemLog()->logDebug("libsword: WebMgr c-tor(sysConf)");
+		init();
+	}
+
 	void init() {
-		extraConf         = 0;
 		defaultGreekLex   = 0;
 		defaultHebLex     = 0;
 		defaultGreekParse = 0;
@@ -76,12 +91,18 @@
 
 	void createAllModules(bool multiMod) {
 
+SWLog::getSystemLog()->logDebug("libsword: WebMgr::createAllModules");
 		if (extraConf) {
+SWLog::getSystemLog()->logDebug("libsword: WebMgr::createAllModules extraConfig supplied: %s)", extraConf);
 			bool exists = FileMgr::existsFile(extraConf);
 			if (exists) {
+SWLog::getSystemLog()->logDebug("libsword: WebMgr::createAllModules extraConfig exists. Augmenting modules config");
 				SWConfig addConfig(extraConf);
 				this->config->augment(addConfig);
 			}
+			else {
+SWLog::getSystemLog()->logDebug("libsword: WebMgr::createAllModules extraConfig not found)");
+			}
 		}
 		SWMgr::createAllModules(multiMod);
 	}

Modified: trunk/bindings/cordova/Makefile
===================================================================
--- trunk/bindings/cordova/Makefile	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/cordova/Makefile	2018-02-19 01:56:00 UTC (rev 3568)
@@ -5,7 +5,7 @@
 
 srcdeps:
 	mkdir -p org.crosswire.sword.cordova.SWORD/libs/ios/
-	cp ../include/defs.h ../include/flatapi.h org.crosswire.sword.cordova.SWORD/src/ios/
+	cp ../../include/defs.h ../../include/flatapi.h org.crosswire.sword.cordova.SWORD/src/ios/
 
 
 clean:

Modified: trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml
===================================================================
--- trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/plugin.xml	2018-02-19 01:56:00 UTC (rev 3568)
@@ -52,13 +52,15 @@
         <source-file src="src/android/AndroidMgr.java" target-dir="src/org/crosswire/android/sword" />
         <source-file src="src/android/SWModule.java" target-dir="src/org/crosswire/android/sword" />
         <source-file src="src/android/InstallMgr.java" target-dir="src/org/crosswire/android/sword" />
-        <source-file src="libs/android/armeabi/libsword.so" target-dir="libs/armeabi" />
         <source-file src="libs/android/arm64-v8a/libsword.so" target-dir="libs/arm64-v8a" />
+        <source-file src="libs/android/armeabi-v7a/libsword.so" target-dir="libs/armeabi-v7a" />
         <source-file src="libs/android/x86/libsword.so" target-dir="libs/x86" />
+        <source-file src="libs/android/x86_64/libsword.so" target-dir="libs/x86_64" />
+<!-- I think these are old names
+        <source-file src="libs/android/armeabi/libsword.so" target-dir="libs/armeabi" />
         <source-file src="libs/android/mips64/libsword.so" target-dir="libs/mips64" />
         <source-file src="libs/android/mips/libsword.so" target-dir="libs/mips" />
-        <source-file src="libs/android/armeabi-v7a/libsword.so" target-dir="libs/armeabi-v7a" />
-        <source-file src="libs/android/x86_64/libsword.so" target-dir="libs/x86_64" />
+-->
     </platform>
 
     <!-- amazon-fireos -->

Modified: trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java
===================================================================
--- trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/cordova/org.crosswire.sword.cordova.SWORD/src/android/SWORD.java	2018-02-19 01:56:00 UTC (rev 3568)
@@ -138,6 +138,7 @@
 				m.put("language", mi.language);
 				m.put("version", mi.version);
 				m.put("delta", mi.delta);
+				m.put("cipherKey", mi.cipherKey);
 				r.put(m);
 			}
 			callbackContext.success(r);
@@ -241,6 +242,7 @@
 				m.put("language", mi.language);
 				m.put("version", mi.version);
 				m.put("delta", mi.delta);
+				m.put("cipherKey", mi.cipherKey);
 				r.put(m);
 			}
 			callbackContext.success(r);
@@ -259,6 +261,7 @@
 			m.put("font", mod.getConfigEntry("Font"));
 			m.put("shortCopyright", mod.getConfigEntry("ShortCopyright"));
 			m.put("shortPromo", mod.getConfigEntry("ShortPromo"));
+			m.put("cipherKey", mod.getConfigEntry("CipherKey"));
 			callbackContext.success(m);
 		}
 		else if (action.equals("SWModule_setKeyText")) {

Modified: trunk/bindings/java-jni/jni/swordstub.cpp
===================================================================
--- trunk/bindings/java-jni/jni/swordstub.cpp	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/java-jni/jni/swordstub.cpp	2018-02-19 01:56:00 UTC (rev 3568)
@@ -325,7 +325,7 @@
 
 	int size = 0;
 	for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
-		if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey"))))
+//		if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey"))))
 			size++;
 	}
 
@@ -338,6 +338,7 @@
 	jfieldID langID     = env->GetFieldID(clazzModInfo, "language",    "Ljava/lang/String;");
 	jfieldID versionID  = env->GetFieldID(clazzModInfo, "version",     "Ljava/lang/String;");
 	jfieldID deltaID    = env->GetFieldID(clazzModInfo, "delta",       "Ljava/lang/String;");
+	jfieldID cipherKeyID= env->GetFieldID(clazzModInfo, "cipherKey",   "Ljava/lang/String;");
 
 	jobjectArray ret = (jobjectArray) env->NewObjectArray(size, clazzModInfo, NULL);
 
@@ -345,7 +346,7 @@
 	for (sword::ModMap::iterator it = mgr->Modules.begin(); it != mgr->Modules.end(); ++it) {
 		SWModule *module = it->second;
 
-		if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) {
+//		if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) {
 			SWBuf type = module->getType();
 			SWBuf cat = module->getConfigEntry("Category");
 			SWBuf version = module->getConfigEntry("Version");
@@ -354,18 +355,23 @@
 			jobject modInfo = env->AllocObject(clazzModInfo); 
 
 			jstring val;
-			val = env->NewStringUTF(assureValidUTF8(module->getName()));        env->SetObjectField(modInfo, nameID   , val); env->DeleteLocalRef(val);
-			val = env->NewStringUTF(assureValidUTF8(module->getDescription())); env->SetObjectField(modInfo, descID   , val); env->DeleteLocalRef(val);
-			val = env->NewStringUTF(assureValidUTF8(type.c_str()));          env->SetObjectField(modInfo, catID    , val); env->DeleteLocalRef(val);
-			val = env->NewStringUTF(assureValidUTF8(module->getLanguage()));        env->SetObjectField(modInfo, langID   , val); env->DeleteLocalRef(val);
-			val = env->NewStringUTF(assureValidUTF8(version.c_str()));       env->SetObjectField(modInfo, versionID, val); env->DeleteLocalRef(val);
-			val = env->NewStringUTF(assureValidUTF8(""));                    env->SetObjectField(modInfo, deltaID  , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(module->getName()));        env->SetObjectField(modInfo, nameID     , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(module->getDescription())); env->SetObjectField(modInfo, descID     , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(type.c_str()));             env->SetObjectField(modInfo, catID      , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(module->getLanguage()));    env->SetObjectField(modInfo, langID     , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(version.c_str()));          env->SetObjectField(modInfo, versionID  , val); env->DeleteLocalRef(val);
+			val = env->NewStringUTF(assureValidUTF8(""));                       env->SetObjectField(modInfo, deltaID    , val); env->DeleteLocalRef(val);
+			const char *cipherKey = module->getConfigEntry("CipherKey");
+			if (cipherKey) {
+				val = env->NewStringUTF(assureValidUTF8(cipherKey));        env->SetObjectField(modInfo, cipherKeyID, val); env->DeleteLocalRef(val);
+			}
+			else                                                                env->SetObjectField(modInfo, cipherKeyID, NULL);
 
 			env->SetObjectArrayElement(ret, i++, modInfo);
 
 			env->DeleteLocalRef(modInfo);
 
-		}
+//		}
 	}
 	return ret;
 }
@@ -1749,6 +1755,7 @@
 	jfieldID langID     = env->GetFieldID(clazzModInfo, "language",    "Ljava/lang/String;");
 	jfieldID versionID  = env->GetFieldID(clazzModInfo, "version",     "Ljava/lang/String;");
 	jfieldID deltaID    = env->GetFieldID(clazzModInfo, "delta",       "Ljava/lang/String;");
+	jfieldID cipherKeyID= env->GetFieldID(clazzModInfo, "cipherKey",   "Ljava/lang/String;");
 
 	InstallSourceMap::iterator source = installMgr->sources.find(sourceName);
 	if (source == installMgr->sources.end()) {
@@ -1772,7 +1779,7 @@
 		SWModule *module = it->first;
 		int status = it->second;
 
-		SWBuf version = module->getConfigEntry("Version");
+		SWBuf version   = module->getConfigEntry("Version");
 		SWBuf statusString = " ";
 		if (status & InstallMgr::MODSTAT_NEW) statusString = "*";
 		if (status & InstallMgr::MODSTAT_OLDER) statusString = "-";
@@ -1784,12 +1791,17 @@
 		jobject modInfo = env->AllocObject(clazzModInfo); 
 
 		jstring val;
-		val = env->NewStringUTF(assureValidUTF8(module->getName()));        env->SetObjectField(modInfo, nameID   , val); env->DeleteLocalRef(val);
-		val = env->NewStringUTF(assureValidUTF8(module->getDescription())); env->SetObjectField(modInfo, descID   , val); env->DeleteLocalRef(val);
-		val = env->NewStringUTF(assureValidUTF8(type.c_str()));          env->SetObjectField(modInfo, catID    , val); env->DeleteLocalRef(val);
-		val = env->NewStringUTF(assureValidUTF8(module->getLanguage()));        env->SetObjectField(modInfo, langID   , val); env->DeleteLocalRef(val);
-		val = env->NewStringUTF(assureValidUTF8(version.c_str()));       env->SetObjectField(modInfo, versionID, val); env->DeleteLocalRef(val);
-		val = env->NewStringUTF(assureValidUTF8(statusString.c_str()));  env->SetObjectField(modInfo, deltaID  , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(module->getName()));        env->SetObjectField(modInfo, nameID     , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(module->getDescription())); env->SetObjectField(modInfo, descID     , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(type.c_str()));             env->SetObjectField(modInfo, catID      , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(module->getLanguage()));    env->SetObjectField(modInfo, langID     , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(version.c_str()));          env->SetObjectField(modInfo, versionID  , val); env->DeleteLocalRef(val);
+		val = env->NewStringUTF(assureValidUTF8(statusString.c_str()));     env->SetObjectField(modInfo, deltaID    , val); env->DeleteLocalRef(val);
+		const char *cipherKey = module->getConfigEntry("CipherKey");
+		if (cipherKey) {
+			val = env->NewStringUTF(assureValidUTF8(cipherKey));            env->SetObjectField(modInfo, cipherKeyID, val); env->DeleteLocalRef(val);
+		}
+		else                                                                env->SetObjectField(modInfo, cipherKeyID, NULL);
 
 		env->SetObjectArrayElement(ret, i++, modInfo);
 

Modified: trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java
===================================================================
--- trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/bindings/java-jni/src/org/crosswire/android/sword/SWMgr.java	2018-02-19 01:56:00 UTC (rev 3568)
@@ -35,6 +35,7 @@
 		public String language;
 		public String version;
 		public String delta;
+		public String cipherKey;
 	}
 
 	public SWMgr() {

Modified: trunk/src/mgr/swmgr.cpp
===================================================================
--- trunk/src/mgr/swmgr.cpp	2018-02-19 01:55:49 UTC (rev 3567)
+++ trunk/src/mgr/swmgr.cpp	2018-02-19 01:56:00 UTC (rev 3568)
@@ -1464,6 +1464,7 @@
 // also old deprecated virtuals so client overrides still are called
 
 void SWMgr::createAllModules(bool multiMod) {
+SWLog::getSystemLog()->logDebug("libsword: SWMgr::createAllModules");
 	SectionMap::iterator it;
 	ConfigEntMap::iterator entry;
 	SWModule *newmod;




More information about the sword-cvs mailing list