[sword-cvs] sword/src/mgr swlocale.cpp,1.7,1.8

sword@www.crosswire.org sword@www.crosswire.org
Fri, 9 Apr 2004 10:41:49 -0700


Update of /cvs/core/sword/src/mgr
In directory www:/tmp/cvs-serv24248/src/mgr

Modified Files:
	swlocale.cpp 
Log Message:

dglassey: more of the initial work


Index: swlocale.cpp
===================================================================
RCS file: /cvs/core/sword/src/mgr/swlocale.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- swlocale.cpp	18 Jan 2004 20:27:08 -0000	1.7
+++ swlocale.cpp	9 Apr 2004 17:41:47 -0000	1.8
@@ -64,8 +64,10 @@
 		delete [] bookAbbrevs;
 
 	if (BMAX) {
+		#ifndef VK2
 		for (int i = 0; i < 2; i++)
 			delete [] books[i];
+		#endif
 		delete [] BMAX;
 		delete [] books;
 	}
@@ -125,7 +127,24 @@
 	return bookAbbrevs;
 }
 
+#ifdef VK2
+void SWLocale::getBooks(char **iBMAX, struct sbook ***ibooks, VerseKey *vk) {
+	if (!BMAX) {
+		BMAX = new char[1];
+		BMAX[0] = vk->getMaxBooks();
+
+		books = new struct sbook*[1];
+		books[0] = new struct sbook[*BMAX];
+		for (int j = 0; j < *BMAX; j++) {
+				books[0][j].name = translate(vk->getNameOfBook(j));
+				books[0][j].prefAbbrev = translate(vk->getPrefAbbrev(j));
+		}
+	}
 
+	iBMAX  = &BMAX;
+	ibooks = &books;
+}
+#else
 void SWLocale::getBooks(char **iBMAX, struct sbook ***ibooks) {
 	if (!BMAX) {
 		BMAX = new char [2];
@@ -147,5 +166,6 @@
 	*iBMAX  = BMAX;
 	*ibooks = books;
 }
+#endif
 
 SWORD_NAMESPACE_END