From db92a8cbea78d0481d1349f9e4e49c29010514b2 Mon Sep 17 00:00:00 2001
From: callum <none@none>
Date: Wed, 17 Aug 2011 11:09:00 -0700
Subject: [PATCH] EXP-700 FIX SLPlugin(s) takes high CPU% Reviewed by Richard.

---
 indra/llcommon/llsdserialize_xml.cpp | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index d8213c44770..bf216d41bf1 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -720,6 +720,7 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
 		case ELEMENT_INTEGER:
 			{
 				S32 i;
+				// sscanf okay here with different locales - ints don't change for different locale settings like floats do.
 				if ( sscanf(mCurrentContent.c_str(), "%d", &i ) == 1 )
 				{	// See if sscanf works - it's faster
 					value = i;
@@ -733,15 +734,19 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name)
 		
 		case ELEMENT_REAL:
 			{
-				F64 r;
-				if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 )
-				{	// See if sscanf works - it's faster
-					value = r;
-				}
-				else
-				{
-					value = LLSD(mCurrentContent).asReal();
-				}
+				value = LLSD(mCurrentContent).asReal();
+				// removed since this breaks when locale has decimal separator that isn't '.'
+				// investigated changing local to something compatible each time but deemed higher
+				// risk that just using LLSD.asReal() each time.
+				//F64 r;
+				//if ( sscanf(mCurrentContent.c_str(), "%lf", &r ) == 1 )
+				//{	// See if sscanf works - it's faster
+				//	value = r;
+				//}
+				//else
+				//{
+				//	value = LLSD(mCurrentContent).asReal();
+				//}
 			}
 			break;
 		
-- 
GitLab