[sword-cvs] sword/src/mgr stringmgr.cpp,1.2,1.3

sword at www.crosswire.org sword at www.crosswire.org
Tue May 18 12:34:48 MST 2004


Committed by: joachim

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

Modified Files:
	stringmgr.cpp 
Log Message:
fix to StringMgr

Index: stringmgr.cpp
===================================================================
RCS file: /cvs/core/sword/src/mgr/stringmgr.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- stringmgr.cpp	19 Apr 2004 14:27:48 -0000	1.2
+++ stringmgr.cpp	18 May 2004 19:34:46 -0000	1.3
@@ -114,8 +114,15 @@
 * @param The text encoded in utf8 which should be turned into an upper case string
 */	
 char* StringMgr::upperUTF8(char* t, const unsigned int maxlen) {
-	//the default impl does nothing
-// 	SWLog::getSystemLog()->logError("StringMgr::upperUtf8 with %s and %d", t, maxlen);
+        // try to decide if it's worth trying to toupper.  Do we have more
+        // characters that are probably lower latin than not?
+        long performOp = 0;
+        for (const char *ch = t; *ch; ch++)
+                performOp += (*ch > 0) ? 1 : -1;
+
+        if (performOp) {
+		return upperLatin1(t);
+        }
 
 	return t;
 }



More information about the sword-cvs mailing list