Index: src/keys/versekey.cpp =================================================================== --- src/keys/versekey.cpp (revision 2551) +++ src/keys/versekey.cpp (working copy) @@ -33,7 +33,6 @@ #include #include #include - SWORD_NAMESPACE_START static const char *classes[] = {"VerseKey", "SWKey", "SWObject", 0}; @@ -491,7 +490,6 @@ char lastPartial = 0; bool inTerm = true; int notAllDigits = 0; - bool doubleF = false; // assert we have a buffer if (!buf) return internalListKey; @@ -539,6 +537,7 @@ if (buf[1] != ' ') { // for silly "Mat 1:1: this verse...." number[tonumber] = 0; tonumber = 0; + suffix = 0; if (*number) chap = atoi(number); *number = 0; @@ -618,9 +617,6 @@ strcpy(book, lastKey->getBookName()); } bookno = getBookAbbrev(book); - if ((bookno > -1) && (suffix == 'f') && (book[strlen(book)-1] == 'f')) { - suffix = 0; - } } if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) { char partial = 0; @@ -647,7 +643,7 @@ // if (comma) { curKey->Chapter(lastKey->Chapter()); curKey->Verse(chap); // chap because this is the first number captured - if (suffix) { + if (suffix && suffix != 'f') { curKey->setSuffix(suffix); } } @@ -667,7 +663,7 @@ } if (verse >= 0) { curKey->Verse(verse); - if (suffix) { + if (suffix && suffix != 'f') { curKey->setSuffix(suffix); } } @@ -700,13 +696,17 @@ tmpListKey.GetElement()->userData = (void *)(bufStart+(buf-iBuf.c_str())); } else { - bool f = false; - if (curKey->getSuffix() == 'f') { + int f = 0; + if (buf - orig > 0 && *(buf-1) == 'f') { + if (buf - 1 - orig > 0 && *(buf-2) == 'f') { + f = 2; + } else { + f = 1; + } curKey->setSuffix(0); - f = true; } lastKey->LowerBound(*curKey); - if (f && doubleF) (*curKey) = MAXVERSE; + if (f == 2) (*curKey) = MAXVERSE; else if (f) (*curKey)++; lastKey->UpperBound(*curKey); *lastKey = TOP; @@ -760,6 +760,7 @@ number[tonumber] = 0; tonumber = 0; + suffix = 0; if (*number) chap = atoi(number); *number = 0; @@ -776,9 +777,7 @@ break; default: // suffixes (and oddly 'f'-- ff.) - if (((*buf >= 'a' && *buf <= 'z') && (chap >=0)) || *buf == 'f') { - // if suffix is already an 'f', then we need to mark if we're doubleF. - doubleF = (*buf == 'f' && suffix == 'f'); + if (((*buf >= 'a' && *buf <= 'z') && (chap>=0 || comma || dash))) { suffix = *buf; } else { @@ -846,9 +845,6 @@ strcpy(book, lastKey->getBookName()); } bookno = getBookAbbrev(book); - if ((bookno > -1) && (suffix == 'f') && (book[strlen(book)-1] == 'f')) { - suffix = 0; - } } if (((bookno > -1) || (!*book)) && ((*book) || (chap >= 0) || (verse >= 0))) { char partial = 0; @@ -873,7 +869,7 @@ if (((comma)||((verse < 0)&&(bookno < 0)))&&(!lastPartial)) { curKey->Chapter(lastKey->Chapter()); curKey->Verse(chap); // chap because this is the first number captured - if (suffix) { + if (suffix && suffix != 'f') { curKey->setSuffix(suffix); } } @@ -893,7 +889,7 @@ } if (verse >= 0) { curKey->Verse(verse); - if (suffix) { + if (suffix && suffix != 'f') { curKey->setSuffix(suffix); } } @@ -923,13 +919,17 @@ tmpListKey.GetElement()->userData = (void *)(bufStart+(buf-iBuf.c_str())); } else { - bool f = false; - if (curKey->getSuffix() == 'f') { + int f = 0; + if (buf - orig > 0 && *(buf-1) == 'f') { + if (buf - 1 - orig > 0 && *(buf-2) == 'f') { + f = 2; + } else { + f = 1; + } curKey->setSuffix(0); - f = true; } lastKey->LowerBound(*curKey); - if (f && doubleF) (*curKey) = MAXVERSE; + if (f == 2) (*curKey) = MAXVERSE; else if (f) (*curKey)++; lastKey->UpperBound(*curKey); *lastKey = TOP; @@ -944,7 +944,7 @@ *curKey = MAXCHAPTER; if (partial > 0) *curKey = MAXVERSE; - newElement->UpperBound(*curKey); + newElement->UpperBound(*curKey); *newElement = TOP; tmpListKey.GetElement()->userData = (void *)(bufStart+(buf-iBuf.c_str())); }