[sword-svn] r3638 - trunk/src/mgr

scribe at crosswire.org scribe at crosswire.org
Tue May 28 16:15:19 MST 2019


Author: scribe
Date: 2019-05-28 16:15:19 -0700 (Tue, 28 May 2019)
New Revision: 3638

Modified:
   trunk/src/mgr/swlocale.cpp
Log:
refactored locale Pref Abbrevs to no use temporaries

Modified: trunk/src/mgr/swlocale.cpp
===================================================================
--- trunk/src/mgr/swlocale.cpp	2019-05-28 23:15:14 UTC (rev 3637)
+++ trunk/src/mgr/swlocale.cpp	2019-05-28 23:15:19 UTC (rev 3638)
@@ -109,22 +109,24 @@
 	entry = p->lookupTable.find(text);
 
 	if (entry == p->lookupTable.end()) {
-		SectionMap::iterator secEntry;
-		ConfigEntMap::iterator confEntry;
+		ConfigEntMap::const_iterator confEntry;
+		SWBuf sectionName = "Text";
+		bool found = false;
+
 		SWBuf textBuf = text;
 		if (textBuf.startsWith("prefAbbr_")) {
 			textBuf.stripPrefix('_');
-			secEntry = localeSource->getSections().find("Pref Abbrevs");
-			if (secEntry == localeSource->getSections().end()) {
-				secEntry = localeSource->getSections().find("Text");
-			}
+			confEntry = localeSource->getSection("Pref Abbrevs").find(textBuf);
+			found = (confEntry != localeSource->getSection("Pref Abbrevs").end());
 		}
-		else {
-			secEntry = localeSource->getSections().find("Text");
+		if (!found) {
+			confEntry = localeSource->getSection("Text").find(textBuf);
+			found =  (confEntry != localeSource->getSection("Text").end());
 		}
-		confEntry = secEntry->second.find(textBuf.c_str());
-		if (confEntry == secEntry->second.end())
+
+		if (!found) {
 			p->lookupTable.insert(LookupMap::value_type(text, textBuf.c_str()));
+		}
 		else {//valid value found
 			/*
 			- If Encoding==Latin1 and we have a StringHelper, convert to UTF-8




More information about the sword-cvs mailing list