[sword-svn] r2156 - in trunk: include src/keys
scribe at www.crosswire.org
scribe at www.crosswire.org
Mon May 12 19:58:17 MST 2008
Author: scribe
Date: 2008-05-12 19:58:16 -0700 (Mon, 12 May 2008)
New Revision: 2156
Modified:
trunk/include/versekey.h
trunk/src/keys/versekey.cpp
Log:
Fixed multireference parsing infinite loop bug
Modified: trunk/include/versekey.h
===================================================================
--- trunk/include/versekey.h 2008-05-12 22:09:43 UTC (rev 2155)
+++ trunk/include/versekey.h 2008-05-13 02:58:16 UTC (rev 2156)
@@ -164,7 +164,7 @@
/** Parse a character array into testament|book|chapter|verse
*
*/
- virtual char parse();
+ virtual char parse(bool checkNormalize = true);
public:
#if 0
static long otbks[];
@@ -260,6 +260,7 @@
*/
virtual const char *getText() const;
virtual const char *getShortText() const;
+ virtual void setText(const char *ikey, bool checkNormalize) { SWKey::setText(ikey); parse(checkNormalize); }
virtual void setText(const char *ikey) { SWKey::setText(ikey); parse(); }
virtual void copyFrom(const SWKey &ikey);
Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp 2008-05-12 22:09:43 UTC (rev 2155)
+++ trunk/src/keys/versekey.cpp 2008-05-13 02:58:16 UTC (rev 2156)
@@ -286,7 +286,7 @@
* RET: error status
*/
-char VerseKey::parse()
+char VerseKey::parse(bool checkAutoNormalize)
{
@@ -321,7 +321,9 @@
else error = 1;
} else error = 1;
}
- Normalize(1);
+ if (checkAutoNormalize) {
+ Normalize(1);
+ }
freshtext();
return (this->error) ? this->error : (this->error = error);
@@ -1159,11 +1161,11 @@
// should we always perform bounds checks? Tried but seems to cause infinite recursion
if (_compare(UpperBound()) > 0) {
- setText(UpperBound());
+ setText(UpperBound(), false);
error = KEYERR_OUTOFBOUNDS;
}
if (_compare(LowerBound()) < 0) {
- setText(LowerBound());
+ setText(LowerBound(), false);
error = KEYERR_OUTOFBOUNDS;
}
}
More information about the sword-cvs
mailing list