[sword-svn] r1932 - in trunk: lib/bcppmake src/keys src/mgr
scribe at crosswire.org
scribe at crosswire.org
Sun Jun 25 17:38:17 MST 2006
Author: scribe
Date: 2006-06-25 17:38:14 -0700 (Sun, 25 Jun 2006)
New Revision: 1932
Modified:
trunk/lib/bcppmake/libsword.bpr
trunk/src/keys/versekey.cpp
trunk/src/mgr/stringmgr.cpp
Log:
fixed some memory bounding issues with stringmgr
Modified: trunk/lib/bcppmake/libsword.bpr
===================================================================
--- trunk/lib/bcppmake/libsword.bpr 2006-06-11 22:23:34 UTC (rev 1931)
+++ trunk/lib/bcppmake/libsword.bpr 2006-06-26 00:38:14 UTC (rev 1932)
@@ -128,7 +128,7 @@
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<LINKER value="TLib"/>
- <USERDEFINES value="UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING"/>
+ <USERDEFINES value="UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;_DEBUG"/>
<SYSDEFINES value="NO_STRICT"/>
<MAINSOURCE value="libsword.bpf"/>
<INCLUDEPATH value="..\..\src\modules\tests;..\..\src\utilfuns\zlib;..\..\src\modules\lexdict\zld;..\..\src\modules\lexdict\rawld4;..\..\src\modules\comments\zcom;..\..\src\modules\genbook\rawgenbook;..\..\src\modules\genbook;..\..\src\modules\texts\ztext;..\..\src\modules\texts\rawtext;..\..\src\modules\texts;..\..\src\modules\lexdict\rawld;..\..\src\modules\lexdict;..\..\src\modules\filters;..\..\src\modules\common;..\..\src\modules\comments\rawfiles;..\..\src\modules\comments\rawcom;..\..\src\modules\comments\hrefcom;..\..\src\modules\comments;..\..\src\modules;..\..\src\frontend;..\..\src\utilfuns;..\..\src\mgr;..\..\src\keys;..\..\..\icu-sword\source\common;..\..\apps\windoze\CBuilder5\InstallMgr\curl\include;..\..\include;$(BCB)\include;$(BCB)\include\vcl;..\..\..\icu-sword\source\i18n;..\..\..\biblecs\clucene\src;..\..\..\biblecs\apps\InstallMgr\curl\include"/>
@@ -154,9 +154,9 @@
-I..\..\..\biblecs\apps\InstallMgr\curl\include -src_suffix cpp -DUNICODE
-D_ICU_ -D_ICUSWORD_ -DUSBINARY -DU_HAVE_PLACEMENT_NEW=0 -DUSELUCENE
-D_WIN32 -D_CL_DISABLE_MULTITHREADING -no_tie -boa"/>
- <CFLAG1 value="-O2 -Vx -X- -a8 -b- -k- -vi -c -tW -tWM"/>
- <PFLAGS value="-$Y- -$L- -$D- -v -JPHNE -M"/>
- <AFLAGS value="/mx /w2 /zn"/>
+ <CFLAG1 value="-vGc -vGt -vGd -Od -Vx -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM"/>
+ <PFLAGS value="-$Y+ -$W -$O- -v -JPHNE -M"/>
+ <AFLAGS value="/mx /w2 /zi"/>
<LFLAGS value="/P512"/>
</OPTIONS>
<LINKER>
@@ -229,28 +229,29 @@
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
-Count=21
-Item0=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item1=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item2=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;UNICODE
-Item3=_UCS2;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item4=_ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item5=__ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
-Item6=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item7=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT;_DEBUG
-Item8=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
-Item9=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
-Item10=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
-Item11=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
-Item12=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
-Item13=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
-Item14=_ICU_;_ICUSWORD_;USBINARY
-Item15=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
-Item16=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
-Item17=;USBINARY;_DEBUG
-Item18=_ICU_;_ICUSWORD_
-Item19=_ICU_;_ICUSWORD_;_DEBUG
-Item20=_DEBUG
+Count=22
+Item0=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;_DEBUG
+Item1=UNICODE;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item2=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item3=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING;UNICODE
+Item4=_UCS2;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item5=_ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item6=__ASCII;_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;_WIN32;_CL_DISABLE_MULTITHREADING
+Item7=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item8=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT;_DEBUG
+Item9=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE;LUCENE_DISABLE_MULTITHREADING;_WIN32;HAVE_DIRENT
+Item10=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG;USELUCENE
+Item11=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0;_DEBUG
+Item12=_ICU_;_ICUSWORD_;USBINARY;U_HAVE_PLACEMENT_NEW=0
+Item13=_ICU_;_ICUSWORD_;USBINARY;_DEBUG;U_HAVE_PLACEMENT_NEW=0
+Item14=_ICU_;_ICUSWORD_;USBINARY;_DEBUG
+Item15=_ICU_;_ICUSWORD_;USBINARY
+Item16=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE;_DEBUG
+Item17=_ICU_;_ICUSWORD_;USBINARY;CURLAVAILABLE
+Item18=;USBINARY;_DEBUG
+Item19=_ICU_;_ICUSWORD_
+Item20=_ICU_;_ICUSWORD_;_DEBUG
+Item21=_DEBUG
[HistoryLists\hlFinalOutputDir]
Count=3
@@ -279,13 +280,8 @@
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
-LinkCGLIB=0
+LinkCGLIB=1
-[CORBA]
-AddServerUnit=0
-AddClientUnit=0
-PrecompiledHeaders=0
-
[Language]
ActiveLang=
ProjectLang=
Modified: trunk/src/keys/versekey.cpp
===================================================================
--- trunk/src/keys/versekey.cpp 2006-06-11 22:23:34 UTC (rev 1931)
+++ trunk/src/keys/versekey.cpp 2006-06-26 00:38:14 UTC (rev 1932)
@@ -322,23 +322,25 @@
StringMgr* stringMgr = StringMgr::getSystemStringMgr();
const bool hasUTF8Support = StringMgr::hasUTF8Support();
-
+
+ // TODO: Why do we loop twice? once upper and once not?
+ // If you wrote this, please comment.
for (int i = 0; i < 2; i++) {
- stdstr(&abbr, iabbr);
+ stdstr(&abbr, iabbr, 2);
strstrip(abbr);
if (!i && hasUTF8Support) { //we have support for UTF-8 handling; we expect UTF-8 encoded locales
- abbr = stringMgr->upperUTF8(abbr);
+ abbr = stringMgr->upperUTF8(abbr, strlen(abbr)*2);
}
else if (!i) {
abbr = stringMgr->upperLatin1(abbr);
}
-
+
abLen = strlen(abbr);
if (abLen) {
min = 0;
- max = abbrevsCnt;
-
+ max = abbrevsCnt;
+
while(1) {
target = min + ((max - min) / 2);
diff = strncmp(abbr, abbrevs[target].ab, abLen);
@@ -348,12 +350,12 @@
min = target;
else max = target;
}
-
+
for (; target > 0; target--) {
if (strncmp(abbr, abbrevs[target-1].ab, abLen))
break;
}
-
+
retVal = (!diff) ? abbrevs[target].book : -1;
}
if (retVal > 0)
@@ -363,6 +365,7 @@
return retVal;
}
+
/******************************************************************************
* VerseKey::ParseVerseList - Attempts to parse a buffer into separate
* verse entries returned in a ListKey
Modified: trunk/src/mgr/stringmgr.cpp
===================================================================
--- trunk/src/mgr/stringmgr.cpp 2006-06-11 22:23:34 UTC (rev 1931)
+++ trunk/src/mgr/stringmgr.cpp 2006-06-26 00:38:14 UTC (rev 1932)
@@ -171,7 +171,7 @@
delete [] upperStr;
return ret;
}
-
+
u_strToUpper(upperStr, max+9, lowerStr, -1, 0, &err);
if (err != U_ZERO_ERROR) {
// SWLog::getSystemLog()->logError("upperCase: %s", u_errorName(err));
@@ -180,7 +180,7 @@
return ret;
}
- ret = u_strToUTF8(ret, max+9, 0, upperStr, -1, &err);
+ ret = u_strToUTF8(ret, max, 0, upperStr, -1, &err);
delete [] lowerStr;
delete [] upperStr;
More information about the sword-cvs
mailing list