[sword-svn] r2511 - in trunk: . src/keys tests tests/testsuite

scribe at crosswire.org scribe at crosswire.org
Mon Mar 29 00:32:43 MST 2010


Author: scribe
Date: 2010-03-29 00:32:43 -0700 (Mon, 29 Mar 2010)
New Revision: 2511

Modified:
   trunk/ChangeLog
   trunk/src/keys/versekey.cpp
   trunk/tests/testsuite/versekeytest.good
   trunk/tests/versekeytest.cpp
Log:
	Set verse to 1 when changing chapter and book in VerseKey
	Fixed a bug where book designations ending in 'f' would
		trigger the verse+'f'/'ff' feature.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-03-24 02:35:46 UTC (rev 2510)
+++ trunk/ChangeLog	2010-03-29 07:32:43 UTC (rev 2511)
@@ -1,11 +1,18 @@
 API ChangeLog 
 
 
+
+29-Mar-2010	Troy A. Griffitts <scribe at crosswire.org>
+	Set verse to 1 when changing chapter and book in VerseKey
+	Fixed a bug where book designations ending in 'f' would
+		trigger the verse+'f'/'ff' feature.
+
+
 * Release 1.6.1 *
 
 01-Jan-2010	Troy A. Griffitts <scribe at crosswire.org>
 	Added locales.d/locales.conf - a special locale which
-		can be queried for localize and English lang names
+		can be queried for localized and English lang names
 	New supported v11n systems: german kjva leningrad luther
 		mt nrsva nrsv synodal vulg <chrislit at crosswire.org>
 

Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp	2010-03-24 02:35:46 UTC (rev 2510)
+++ trunk/src/keys/versekey.cpp	2010-03-29 07:32:43 UTC (rev 2511)
@@ -618,6 +618,9 @@
 					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;
@@ -843,6 +846,9 @@
 			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;
@@ -1409,8 +1415,8 @@
 
 void VerseKey::setBook(char ibook)
 {
-	verse   = ibook ? 1 : 0;
-	chapter = ibook ? 1 : 0;
+	verse   = 1;
+	chapter = 1;
 	book    = ibook;
 	Normalize(1);
 }
@@ -1446,9 +1452,11 @@
 
 void VerseKey::setChapter(int ichapter)
 {
-	verse   = ichapter ? 1 : 0;
+	verse   = 1;
 	chapter = ichapter;
 	Normalize(1);
+	// TODO: easiest fix, but should be in Normalize
+	verse   = 1;
 }
 
 

Modified: trunk/tests/testsuite/versekeytest.good
===================================================================
--- trunk/tests/testsuite/versekeytest.good	2010-03-24 02:35:46 UTC (rev 2510)
+++ trunk/tests/testsuite/versekeytest.good	2010-03-29 07:32:43 UTC (rev 2511)
@@ -39,13 +39,13 @@
 TOP: Genesis 1:1
 BOTTOM: Revelation of John 22:21
 John 3:16: 0
-I Samuel 1:1: Chapter() - 1: Ruth 4:22
+I Samuel 1:1: getChapter() - 1: Ruth 4:1
 
 Book math
 
 Mark.1.1-- = Matthew 28:20
 ++ = Mark 1:1
-.Chapter(.Chapter() - 1) = Matthew 28:1
+.setChapter(.getChapter() - 1) = Matthew 28:1
 Matthew.1.1-- = Malachi 4:6
 ++ = Matthew 1:1
-.Book(.Book() - 1) = Malachi 1:1
+.setBook(.getBook() - 1) = Malachi 1:1

Modified: trunk/tests/versekeytest.cpp
===================================================================
--- trunk/tests/versekeytest.cpp	2010-03-24 02:35:46 UTC (rev 2510)
+++ trunk/tests/versekeytest.cpp	2010-03-29 07:32:43 UTC (rev 2511)
@@ -214,10 +214,10 @@
 	VerseKey tmpkey = "1sam 1:1";
 	vkey.AutoNormalize(1);                          // line 147
 	vkey = tmpkey;
-	int chapter = (vkey.Chapter()-1);
-	vkey.Chapter(chapter);
+	int chapter = (vkey.getChapter()-1);
+	vkey.setChapter(chapter);
 
-	cout << tmpkey << ": Chapter() - 1: " << vkey << endl;
+	cout << tmpkey << ": getChapter() - 1: " << vkey << endl;
 
 	cout << "\nBook math\n\n";
 
@@ -226,16 +226,16 @@
 	cout << "Mark.1.1-- = " << vkey << "\n";
 	vkey++;
 	cout << "++ = " << vkey << "\n";
-	vkey.Chapter(vkey.Chapter() - 1);
-	cout << ".Chapter(.Chapter() - 1) = " << vkey << "\n";
+	vkey.setChapter(vkey.getChapter() - 1);
+	cout << ".setChapter(.getChapter() - 1) = " << vkey << "\n";
 
 	vkey = "Matthew.1.1";
 	vkey--;
 	cout << "Matthew.1.1-- = " << vkey << "\n";
 	vkey++;
 	cout << "++ = " << vkey << "\n";
-	vkey.Book(vkey.Book() - 1);
-	cout << ".Book(.Book() - 1) = " << vkey << "\n";
+	vkey.setBook(vkey.getBook() - 1);
+	cout << ".setBook(.getBook() - 1) = " << vkey << "\n";
 
 	return 0;
 }




More information about the sword-cvs mailing list