[sword-svn] r3215 - in trunk: include src/modules/common src/modules/lexdict/rawld utilities

scribe at crosswire.org scribe at crosswire.org
Wed Apr 30 22:13:22 MST 2014


Author: scribe
Date: 2014-04-30 22:13:22 -0700 (Wed, 30 Apr 2014)
New Revision: 3215

Modified:
   trunk/include/swld.h
   trunk/src/modules/common/rawstr.cpp
   trunk/src/modules/common/rawstr4.cpp
   trunk/src/modules/lexdict/rawld/rawld.cpp
   trunk/utilities/imp2ld.cpp
Log:
remove unnecessary changes

Modified: trunk/include/swld.h
===================================================================
--- trunk/include/swld.h	2014-05-01 05:12:56 UTC (rev 3214)
+++ trunk/include/swld.h	2014-05-01 05:13:22 UTC (rev 3215)
@@ -36,10 +36,9 @@
 class SWDLLEXPORT SWLD : public SWModule {
 protected:
 	mutable char *entkeytxt;
+	static void strongsPad(char *buf);
 	bool strongsPadding;
-
 public:
-
 	/** Initializes data for instance of SWLD
 	*/
 	SWLD(const char *imodname = 0, const char *imoddesc = 0,
@@ -66,13 +65,6 @@
 	
 	virtual bool hasEntry(const SWKey *k) const;
 
-
-	/** Pads a key if (it-1) is 100% digits to 5 places allows for final to be alpha, e.g. '123B'
-	*
-	* @param[in,out] buffer to check and pad
-	*/
-	static void strongsPad(char *buffer);
-
 	// OPERATORS -----------------------------------------------------------------
 	
 	SWMODULE_OPERATORS

Modified: trunk/src/modules/common/rawstr.cpp
===================================================================
--- trunk/src/modules/common/rawstr.cpp	2014-05-01 05:12:56 UTC (rev 3214)
+++ trunk/src/modules/common/rawstr.cpp	2014-05-01 05:13:22 UTC (rev 3215)
@@ -165,7 +165,7 @@
  *		away		- number of entries before of after to jump
  *					(default = 0)
  *
- * RET: error status -1 general error; -2 new file; -3 inconsecutive index
+ * RET: error status -1 general error; -2 new file
  */
 
 signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long away, __u32 *idxoff) const
@@ -274,11 +274,6 @@
 			if (idxoff)
 				*idxoff = tryoff;
 
-			if(away > 0 && tmpStart < *start) {
-				SWLog::getSystemLog()->logError("inconsequtive index for module at path %s", path);
-				retval = -3;
-			}
-
 			*start = swordtoarch32(tmpStart);
 			*size  = swordtoarch16(tmpSize);
 

Modified: trunk/src/modules/common/rawstr4.cpp
===================================================================
--- trunk/src/modules/common/rawstr4.cpp	2014-05-01 05:12:56 UTC (rev 3214)
+++ trunk/src/modules/common/rawstr4.cpp	2014-05-01 05:13:22 UTC (rev 3215)
@@ -174,7 +174,7 @@
  *		away		- number of entries before of after to jump
  *					(default = 0)
  *
- * RET: error status -1 general error; -2 new file; -3 inconsecutive index
+ * RET: error status -1 general error; -2 new file
  */
 
 signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, long away, __u32 *idxoff) const
@@ -283,11 +283,6 @@
 			if (idxoff)
 				*idxoff = tryoff;
 
-			if(away > 0 && tmpStart < *start) {
-				SWLog::getSystemLog()->logError("inconsequtive index for module at path %s", path);
-				retval = -3;
-			}
-
 			*start = swordtoarch32(tmpStart);
 			*size  = swordtoarch32(tmpSize);
 

Modified: trunk/src/modules/lexdict/rawld/rawld.cpp
===================================================================
--- trunk/src/modules/lexdict/rawld/rawld.cpp	2014-05-01 05:12:56 UTC (rev 3214)
+++ trunk/src/modules/lexdict/rawld/rawld.cpp	2014-05-01 05:13:22 UTC (rev 3215)
@@ -147,12 +147,26 @@
 
 
 void RawLD::setEntry(const char *inbuf, long len) {
-	doSetText(*key, inbuf, len);
+	char *buf = new char [ strlen(key) + 6 ];
+	strcpy(buf, key);
+
+	if (strongsPadding) strongsPad(buf);
+
+	doSetText(buf, inbuf, len);
+
+	delete [] buf;
 }
 
 
 void RawLD::linkEntry(const SWKey *inkey) {
-	doLinkEntry(*key, *inkey);
+	char *buf = new char [ strlen(key) + 6 ];
+	strcpy(buf, key);
+
+	if (strongsPadding) strongsPad(buf);
+
+	doLinkEntry(buf, *inkey);
+
+	delete [] buf;
 }
 
 
@@ -163,7 +177,14 @@
  */
 
 void RawLD::deleteEntry() {
-	doSetText(*key, "");
+	char *buf = new char [ strlen(key) + 6 ];
+	strcpy(buf, key);
+
+	if (strongsPadding) strongsPad(buf);
+
+	doSetText(buf, "");
+
+	delete [] buf;
 }
 
 

Modified: trunk/utilities/imp2ld.cpp
===================================================================
--- trunk/utilities/imp2ld.cpp	2014-05-01 05:12:56 UTC (rev 3214)
+++ trunk/utilities/imp2ld.cpp	2014-05-01 05:13:22 UTC (rev 3215)
@@ -60,8 +60,7 @@
 	fprintf(stderr, "  -4\t\t\t use 4 byte size entries (default: 2).\n");
 	fprintf(stderr, "  -b <entry_count>\t\t compression block size (default 30 entries)\n");
 	fprintf(stderr, "  -s\t\t\t case sensitive keys (default is not case sensitive)\n");
-	fprintf(stderr, "  -P\t\t\t disable Strong's number padding check for digit entries. "
-		"Incorrect padding without StrongsPadding=false in you conf file will cause eternal loop.\n");
+	fprintf(stderr, "  -P\t\t\t disable key Strong's number padding (by defalut keys will be padded).");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "'imp' format is a simple standard for importing data into SWORD modules.\n"
 		"Required is a plain text file containing $$$key lines followed by content.\n\n"
@@ -89,7 +88,7 @@
 	SWCompress *compressor = 0;
 	SWBuf compType         = "";
 	bool fourByteSize      = false;
-    bool paddingCheck      = true;
+    bool strongsPadding    = true;
 
 	if (argc < 2) usage(*argv);
 
@@ -120,9 +119,9 @@
 		else if (!strcmp(argv[i], "-4")) {
 			fourByteSize = true;
 		}
-        else if (!strcmp(argv[i], "-P")) {
-            paddingCheck = false;
-        }
+		else if (!strcmp(argv[i], "-P")) {
+			strongsPadding = false;
+		}
 		else if (!strcmp(argv[i], "-b")) {
 			if (i+1 < argc) {
 				blockCount = atoi(argv[++i]);
@@ -202,12 +201,12 @@
 	if (compressor) {
 		// Create a compressed text module allowing very large entries
 		// Taking defaults except for first, fourth, fifth and last argument
-		mod = new zLD(outPath, 0, 0, blockCount, compressor, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive);
+		mod = new zLD(outPath, 0, 0, blockCount, compressor, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive, strongsPadding);
 	}
 	else {
 		mod = (!fourByteSize)
-			? (SWModule *)new RawLD (outPath, 0, 0, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive)
-			: (SWModule *)new RawLD4(outPath, 0, 0, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive);
+			? (SWModule *)new RawLD (outPath, 0, 0, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive, strongsPadding)
+			: (SWModule *)new RawLD4(outPath, 0, 0, 0, ENC_UNKNOWN, DIRECTION_LTR, FMT_UNKNOWN, 0, caseSensitive, strongsPadding);
 	}
 
 
@@ -225,15 +224,6 @@
 				std::cout << keybuffer << std::endl;
 				*key = keybuffer.c_str();
 
-				if(paddingCheck) {
-					char *buf = new char [ strlen(*key) + 6 ];
-					strcpy(buf, *key);
-					SWLD::strongsPad(buf);
-					if(strcmp(buf, *key))
-						std::cout << "Warning: entry " << *key << " is a number but not padded correctly. ";
-					delete buf;
-				}
-
 				mod->setEntry(entbuffer.c_str(), entbuffer.size());
 				for (i = 0; i < links; i++) {
 					std::cout << "Linking: " << linkbuffer[i] << std::endl;
@@ -262,15 +252,6 @@
 		std::cout << keybuffer << std::endl;
 		*key = keybuffer.c_str();
 
-		if(paddingCheck) {
-			char *buf = new char [ strlen(*key) + 6 ];
-			strcpy(buf, *key);
-			SWLD::strongsPad(buf);
-			if(strcmp(buf, *key))
-				std::cout << "Warning: entry " << *key << " is a number but not padded correctly. ";
-			delete buf;
-		}
-		
 		mod->setEntry(entbuffer.c_str(), entbuffer.size());
 		for (i = 0; i < links; i++) {
 			std::cout << "Linking: " << linkbuffer[i] << std::endl;




More information about the sword-cvs mailing list