[sword-svn] r3209 - in trunk: include src/modules/common utilities
scribe at crosswire.org
scribe at crosswire.org
Wed Apr 30 22:11:44 MST 2014
Author: scribe
Date: 2014-04-30 22:11:44 -0700 (Wed, 30 Apr 2014)
New Revision: 3209
Modified:
trunk/include/swld.h
trunk/src/modules/common/rawstr.cpp
trunk/src/modules/common/rawstr4.cpp
trunk/utilities/imp2ld.cpp
Log:
fix lds
Modified: trunk/include/swld.h
===================================================================
--- trunk/include/swld.h 2014-05-01 02:53:13 UTC (rev 3208)
+++ trunk/include/swld.h 2014-05-01 05:11:44 UTC (rev 3209)
@@ -36,9 +36,10 @@
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,
@@ -65,6 +66,13 @@
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 02:53:13 UTC (rev 3208)
+++ trunk/src/modules/common/rawstr.cpp 2014-05-01 05:11:44 UTC (rev 3209)
@@ -165,7 +165,7 @@
* away - number of entries before of after to jump
* (default = 0)
*
- * RET: error status -1 general error; -2 new file
+ * RET: error status -1 general error; -2 new file; -3 inconsecutive index
*/
signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long away, __u32 *idxoff) const
@@ -274,6 +274,11 @@
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 02:53:13 UTC (rev 3208)
+++ trunk/src/modules/common/rawstr4.cpp 2014-05-01 05:11:44 UTC (rev 3209)
@@ -174,7 +174,7 @@
* away - number of entries before of after to jump
* (default = 0)
*
- * RET: error status -1 general error; -2 new file
+ * RET: error status -1 general error; -2 new file; -3 inconsecutive index
*/
signed char RawStr4::findOffset(const char *ikey, __u32 *start, __u32 *size, long away, __u32 *idxoff) const
@@ -283,6 +283,11 @@
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/utilities/imp2ld.cpp
===================================================================
--- trunk/utilities/imp2ld.cpp 2014-05-01 02:53:13 UTC (rev 3208)
+++ trunk/utilities/imp2ld.cpp 2014-05-01 05:11:44 UTC (rev 3209)
@@ -56,10 +56,12 @@
fprintf(stderr, " -a\t\t\t augment module if exists (default is to create new)\n");
fprintf(stderr, " -z <l|z|b|x>\t\t use compression (default: none)\n");
fprintf(stderr, "\t\t\t\t l - LZSS; z - ZIP; b - bzip2; x - xz\n");
- fprintf(stderr, " -o <output_path>\t where to write data files.\n");
+ fprintf(stderr, " -o <output_path>\t\t where to write data files.\n");
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, "\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"
@@ -87,6 +89,7 @@
SWCompress *compressor = 0;
SWBuf compType = "";
bool fourByteSize = false;
+ bool paddingCheck = true;
if (argc < 2) usage(*argv);
@@ -117,6 +120,9 @@
else if (!strcmp(argv[i], "-4")) {
fourByteSize = true;
}
+ else if (!strcmp(argv[i], "-P")) {
+ paddingCheck = false;
+ }
else if (!strcmp(argv[i], "-b")) {
if (i+1 < argc) {
blockCount = atoi(argv[++i]);
@@ -219,6 +225,14 @@
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. ";
+ }
+
mod->setEntry(entbuffer.c_str(), entbuffer.size());
for (i = 0; i < links; i++) {
std::cout << "Linking: " << linkbuffer[i] << std::endl;
@@ -247,6 +261,13 @@
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. ";
+ }
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