[sword-cvs] sword/src/keys versekey.cpp,1.64,1.65
sword at www.crosswire.org
sword at www.crosswire.org
Tue May 25 14:22:26 MST 2004
- Previous message: [sword-cvs] sword/src/utilfuns utilxml.cpp,1.17,1.18
- Next message: [sword-cvs] sword/locales.d af-utf8.conf, 1.4, 1.5 bg_BG-utf8.conf,
1.1, 1.2 cs-utf8.conf, 1.3, 1.4 da-utf8.conf, 1.1,
1.2 de-utf8.conf, 1.3, 1.4 de_abbrev-utf8.conf, 1.1,
1.2 es-utf8.conf, 1.2, 1.3 et-utf8.conf, 1.1,
1.2 et_abbr-utf8.conf, 1.2, 1.3 fi-utf8.conf, 1.1,
1.2 fr-utf8.conf, 1.1, 1.2 hu-utf8.conf, 1.1, 1.2 no-utf8.conf,
1.1, 1.2 pl-utf8.conf, 1.3, 1.4 pt-utf8.conf, 1.1,
1.2 pt_BR-utf8.conf, 1.1, 1.2 ro-utf8.conf, 1.1,
1.2 ru_RU-utf8.conf, 1.2, 1.3 sk-utf8.conf, 1.3,
1.4 sv-utf8.conf, 1.1, 1.2 uk_UA-utf8.conf, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: joachim
Update of /cvs/core/sword/src/keys
In directory www:/tmp/cvs-serv20298/src/keys
Modified Files:
versekey.cpp
Log Message:
fixed a slow part to only be active when logs are wanted. this used about 20-30% of a normal app execution time in some cases. Gettong chapter text is now a lot faster in BibleTime. (joachim)
Index: versekey.cpp
===================================================================
RCS file: /cvs/core/sword/src/keys/versekey.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- versekey.cpp 7 May 2004 17:22:16 -0000 1.64
+++ versekey.cpp 25 May 2004 21:22:24 -0000 1.65
@@ -195,16 +195,19 @@
}
*/
}
- for (int t = 0; t < 2; t++) {
- for (int i = 0; i < BMAX[t]; i++) {
- int bn = getBookAbbrev(books[t][i].name);
- if ((bn-1)%39 != i) {
- SWLog::getSystemLog()->logError("VerseKey::Book: %s does not have a matching toupper abbrevs entry! book number returned was: %d(%d)",
- books[t][i].name, bn, i);
- }
- }
- }
- }
+
+ if (SWLog::getSystemLog()->getLogLevel() > 0) { //make sure log is wanted, this loop stuff costs a lot of time
+ for (int t = 0; t < 2; t++) {
+ for (int i = 0; i < BMAX[t]; i++) {
+ const int bn = getBookAbbrev(books[t][i].name);
+ if ((bn-1)%39 != i) {
+ SWLog::getSystemLog()->logError("VerseKey::Book: %s does not have a matching toupper abbrevs entry! book number returned was: %d(%d)",
+ books[t][i].name, bn, i);
+ }
+ }
+ }
+ }
+ }
else abbrevsCnt = size;
}
@@ -322,22 +325,25 @@
char *abbr = 0;
+ StringMgr* stringMgr = StringMgr::getSystemStringMgr();
+ const bool hasUTF8Support = StringMgr::hasUTF8Support();
+
for (int i = 0; i < 2; i++) {
stdstr(&abbr, iabbr);
strstrip(abbr);
- if (!i && StringMgr::hasUTF8Support()) { //we have support for UTF-8 handling; we expect UTF-8 encoded locales
- toupperstr_utf8(abbr);
+ if (!i && hasUTF8Support) { //we have support for UTF-8 handling; we expect UTF-8 encoded locales
+ abbr = stringMgr->upperUTF8(abbr);
}
else if (!i) {
- toupperstr(abbr);
+ abbr = stringMgr->upperLatin1(abbr);
}
abLen = strlen(abbr);
if (abLen) {
min = 0;
-// max = abbrevsCnt - 1;
max = abbrevsCnt;
+
while(1) {
target = min + ((max - min) / 2);
diff = strncmp(abbr, abbrevs[target].ab, abLen);
@@ -347,6 +353,7 @@
min = target;
else max = target;
}
+
for (; target > 0; target--) {
if (strncmp(abbr, abbrevs[target-1].ab, abLen))
break;
- Previous message: [sword-cvs] sword/src/utilfuns utilxml.cpp,1.17,1.18
- Next message: [sword-cvs] sword/locales.d af-utf8.conf, 1.4, 1.5 bg_BG-utf8.conf,
1.1, 1.2 cs-utf8.conf, 1.3, 1.4 da-utf8.conf, 1.1,
1.2 de-utf8.conf, 1.3, 1.4 de_abbrev-utf8.conf, 1.1,
1.2 es-utf8.conf, 1.2, 1.3 et-utf8.conf, 1.1,
1.2 et_abbr-utf8.conf, 1.2, 1.3 fi-utf8.conf, 1.1,
1.2 fr-utf8.conf, 1.1, 1.2 hu-utf8.conf, 1.1, 1.2 no-utf8.conf,
1.1, 1.2 pl-utf8.conf, 1.3, 1.4 pt-utf8.conf, 1.1,
1.2 pt_BR-utf8.conf, 1.1, 1.2 ro-utf8.conf, 1.1,
1.2 ru_RU-utf8.conf, 1.2, 1.3 sk-utf8.conf, 1.3,
1.4 sv-utf8.conf, 1.1, 1.2 uk_UA-utf8.conf, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the sword-cvs
mailing list