[sword-svn] r2278 - in trunk: include src/keys src/mgr src/modules/filters src/modules/genbook/rawgenbook tests

scribe at crosswire.org scribe at crosswire.org
Fri Mar 6 16:29:48 MST 2009


Author: scribe
Date: 2009-03-06 16:29:48 -0700 (Fri, 06 Mar 2009)
New Revision: 2278

Modified:
   trunk/include/utf8transliterator.h
   trunk/src/keys/versetreekey.cpp
   trunk/src/mgr/versemgr.cpp
   trunk/src/modules/filters/utf8transliterator.cpp
   trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
   trunk/tests/Makefile.am
Log:
Added more functionality for a working VerseTreeKey.  gb Bibles should work with an existing v11n system now, they don't yet register themselves if they specify an unknown v11n system.
Did some memory profiling.
Added a c-tor to utf8tranliterator in hopes to figure out what ICU is holding on to so we can free it. mem profiler shows outstanding memory still in ICU allocated from UTF8Transliterator


Modified: trunk/include/utf8transliterator.h
===================================================================
--- trunk/include/utf8transliterator.h	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/include/utf8transliterator.h	2009-03-06 23:29:48 UTC (rev 2278)
@@ -84,6 +84,7 @@
 
 public:
 	UTF8Transliterator();
+	~UTF8Transliterator();
 	virtual char processText(SWBuf &text, const SWKey *key = 0, const SWModule *module = 0);
 	virtual const char *getOptionName() { return optName; }
 	virtual const char *getOptionTip() { return optTip; }

Modified: trunk/src/keys/versetreekey.cpp
===================================================================
--- trunk/src/keys/versetreekey.cpp	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/src/keys/versetreekey.cpp	2009-03-06 23:29:48 UTC (rev 2278)
@@ -74,7 +74,7 @@
 void VerseTreeKey::init(TreeKey *treeKey)
 {
 	myclass = &classdef;
-	this->treeKey = treeKey;
+	this->treeKey = (TreeKey *)treeKey->clone();
 	this->treeKey->setPositionChangeListener(this);
 	internalPosChange = false;
 }
@@ -120,6 +120,7 @@
  */
 
 VerseTreeKey::~VerseTreeKey() {
+	delete treeKey;
 }
 
 
@@ -242,11 +243,9 @@
 
 void VerseTreeKey::setPosition(SW_POSITION p) {
 
-/*
-	if (boundSet) {
+	if (isBoundSet()) {
 		return VerseKey::setPosition(p);
 	}
-*/
 
 	switch (p) {
 	case POS_TOP:

Modified: trunk/src/mgr/versemgr.cpp
===================================================================
--- trunk/src/mgr/versemgr.cpp	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/src/mgr/versemgr.cpp	2009-03-06 23:29:48 UTC (rev 2278)
@@ -99,10 +99,10 @@
 
 
 VerseMgr::System::System(const System &other) {
+	init();
 	name = other.name;
 	BMAX[0] = other.BMAX[0];
 	BMAX[1] = other.BMAX[1];
-	init();
 	(*p) = *(other.p);
 	ntStartOffset = other.ntStartOffset;
 }
@@ -111,7 +111,6 @@
 	name = other.name;
 	BMAX[0] = other.BMAX[0];
 	BMAX[1] = other.BMAX[1];
-	init();
 	(*p) = *(other.p);
 	ntStartOffset = other.ntStartOffset;
 	return *this;
@@ -334,7 +333,7 @@
 }
 
 void VerseMgr::registerVersificationSystem(const char *name, const sbook *ot, const sbook *nt, int *chMax) {
-	p->systems[name] = System(name);
+	p->systems[name] = name;
 	System &s = p->systems[name];
 	s.loadFromSBook(ot, nt, chMax);
 }

Modified: trunk/src/modules/filters/utf8transliterator.cpp
===================================================================
--- trunk/src/modules/filters/utf8transliterator.cpp	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/src/modules/filters/utf8transliterator.cpp	2009-03-06 23:29:48 UTC (rev 2278)
@@ -141,6 +141,11 @@
 #endif
 }
 
+
+UTF8Transliterator::~UTF8Transliterator() {
+}
+
+
 void UTF8Transliterator::Load(UErrorCode &status)
 {
 #ifndef _ICUSWORD_

Modified: trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp
===================================================================
--- trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/src/modules/genbook/rawgenbook/rawgenbook.cpp	2009-03-06 23:29:48 UTC (rev 2278)
@@ -231,9 +231,9 @@
 
 
 SWKey *RawGenBook::CreateKey() {
-	SWKey *newKey = new TreeKeyIdx(path);
-	if (verseKey) newKey = new VerseTreeKey((TreeKeyIdx *)newKey);
-	return newKey;
+	TreeKey *tKey = new TreeKeyIdx(path);
+	if (verseKey) { SWKey *vtKey = new VerseTreeKey(tKey); delete tKey; return vtKey; }
+	return tKey;
 }
 
 SWORD_NAMESPACE_END

Modified: trunk/tests/Makefile.am
===================================================================
--- trunk/tests/Makefile.am	2009-03-06 01:49:21 UTC (rev 2277)
+++ trunk/tests/Makefile.am	2009-03-06 23:29:48 UTC (rev 2278)
@@ -4,7 +4,7 @@
 
 SUBDIRS = cppunit
 
-noinst_PROGRAMS = ciphertest keytest mgrtest parsekey versekeytest versemgrtest listtest casttest \
+noinst_PROGRAMS = ciphertest keytest mgrtest parsekey versekeytest vtreekeytest versemgrtest listtest casttest \
 modtest compnone complzss localetest introtest indextest configtest keycast \
 romantest testblocks filtertest rawldidxtest lextest swaptest \
  swbuftest xmltest webiftest
@@ -41,6 +41,7 @@
 ciphertest_SOURCES = ciphertest.cpp
 parsekey_SOURCES = parsekey.cpp
 versekeytest_SOURCES = versekeytest.cpp
+vtreekeytest_SOURCES = vtreekeytest.cpp
 versemgrtest_SOURCES = versemgrtest.cpp
 listtest_SOURCES = listtest.cpp
 casttest_SOURCES = casttest.cpp




More information about the sword-cvs mailing list