From ab26a700474aa5480d678da67543c9d0f31bb52a Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 13 Jul 2017 11:01:20 +0300
Subject: MAINT-7593 FIXED "Failed to parse parameter" spam

---
 indra/llcommon/llinitparam.cpp | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp
index 1d104cf55d..aa2f4eb289 100644
--- a/indra/llcommon/llinitparam.cpp
+++ b/indra/llcommon/llinitparam.cpp
@@ -193,12 +193,7 @@ namespace LLInitParam
 		{
 			if (!silent)
 			{
-				std::string file_name = p.getCurrentFileName();
-				if(!file_name.empty())
-				{
-					file_name = "in file: " + file_name;
-				}
-				p.parserWarning(llformat("Failed to parse parameter \"%s\" %s", p.getCurrentElementName().c_str(), file_name.c_str()));
+				p.parserWarning(llformat("Failed to parse parameter \"%s\"", p.getCurrentElementName().c_str()));
 			}
 			return false;
 		}
-- 
cgit v1.2.3


From c21b3bbaccdad847611c5af78f612a3db2f47cc1 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Fri, 25 Aug 2017 20:26:25 +0300
Subject: MAINT-7739 Make LLOSInfo a Singleton

---
 indra/llcommon/llsys.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index 962367f69f..294d0066ca 100644
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -37,13 +37,14 @@
 //
 
 #include "llsd.h"
+#include "llsingleton.h"
 #include <iosfwd>
 #include <string>
 
-class LL_COMMON_API LLOSInfo
+class LL_COMMON_API LLOSInfo : public LLSingleton<LLOSInfo>
 {
+	LLSINGLETON(LLOSInfo);
 public:
-	LLOSInfo();
 	void stream(std::ostream& s) const;
 
 	const std::string& getOSString() const;
-- 
cgit v1.2.3


From f8254a9d787ab6235c8fb076bd65dc7cd978dce9 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Wed, 30 Aug 2017 19:57:02 +0300
Subject: MAINT-7758 Fixed freeze on loading lsl scripts from unicode named
 windows folder.

---
 indra/llcommon/llmetricperformancetester.cpp | 14 +++++++-------
 indra/llcommon/llmetricperformancetester.h   | 10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp
index 16fc365da1..f8a93baf45 100644
--- a/indra/llcommon/llmetricperformancetester.cpp
+++ b/indra/llcommon/llmetricperformancetester.cpp
@@ -132,8 +132,8 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std
 	}
 	
 	// Open baseline and current target, exit if one is inexistent
-	std::ifstream base_is(baseline.c_str());
-	std::ifstream target_is(target.c_str());
+	llifstream base_is(baseline.c_str());
+	llifstream target_is(target.c_str());
 	if (!base_is.is_open() || !target_is.is_open())
 	{
 		LL_WARNS() << "'-analyzeperformance' error : baseline or current target file inexistent" << LL_ENDL;
@@ -151,7 +151,7 @@ void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std
 	target_is.close();
 	
 	//output comparision
-	std::ofstream os(output.c_str());
+	llofstream os(output.c_str());
 	
 	os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; 
 	for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; 
@@ -212,7 +212,7 @@ void LLMetricPerformanceTesterBasic::addMetric(std::string str)
 }
 
 /*virtual*/ 
-void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) 
+void LLMetricPerformanceTesterBasic::analyzePerformance(llofstream* os, LLSD* base, LLSD* current) 
 {
 	resetCurrentCount() ;
 
@@ -254,14 +254,14 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD*
 }
 
 /*virtual*/ 
-void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) 
+void LLMetricPerformanceTesterBasic::compareTestResults(llofstream* os, std::string metric_string, S32 v_base, S32 v_current) 
 {
 	*os << llformat(" ,%s, %d, %d, %d, %.4f\n", metric_string.c_str(), v_base, v_current, 
 						v_current - v_base, (v_base != 0) ? 100.f * v_current / v_base : 0) ;
 }
 
 /*virtual*/ 
-void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) 
+void LLMetricPerformanceTesterBasic::compareTestResults(llofstream* os, std::string metric_string, F32 v_base, F32 v_current) 
 {
 	*os << llformat(" ,%s, %.4f, %.4f, %.4f, %.4f\n", metric_string.c_str(), v_base, v_current,						
 						v_current - v_base, (fabs(v_base) > 0.0001f) ? 100.f * v_current / v_base : 0.f ) ;
@@ -293,7 +293,7 @@ LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession()
 }
 
 /*virtual*/ 
-void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) 
+void LLMetricPerformanceTesterWithSession::analyzePerformance(llofstream* os, LLSD* base, LLSD* current) 
 {
 	// Load the base session
 	resetCurrentCount() ;
diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h
index e6b46be1cf..2e99ed979d 100644
--- a/indra/llcommon/llmetricperformancetester.h
+++ b/indra/llcommon/llmetricperformancetester.h
@@ -60,7 +60,7 @@ public:
 	 * By default, compares the test results against the baseline one by one, item by item, 
 	 * in the increasing order of the LLSD record counter, starting from the first one.
 	 */
-	virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ;
+	virtual void analyzePerformance(llofstream* os, LLSD* base, LLSD* current) ;
 
 	static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ;
 
@@ -93,8 +93,8 @@ protected:
 	 * @param[in] v_base - Base value of the metric.
 	 * @param[in] v_current - Current value of the metric.
 	 */
-	virtual void compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) ;
-	virtual void compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) ;
+	virtual void compareTestResults(llofstream* os, std::string metric_string, S32 v_base, S32 v_current) ;
+	virtual void compareTestResults(llofstream* os, std::string metric_string, F32 v_base, F32 v_current) ;
 
 	/**
 	 * @brief Reset internal record count. Count starts with 1.
@@ -181,7 +181,7 @@ public:
 	 * This will be loading the base and current sessions and compare them using the virtual 
 	 * abstract methods loadTestSession() and compareTestSessions()
 	 */
-	virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ;
+	virtual void analyzePerformance(llofstream* os, LLSD* base, LLSD* current) ;
 
 protected:
 	/**
@@ -205,7 +205,7 @@ protected:
 	 * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded.
 	 * @param[out] os - The comparison result as a standard stream
 	 */
-	virtual void compareTestSessions(std::ofstream* os) = 0;
+	virtual void compareTestSessions(llofstream* os) = 0;
 
 	LLTestSession* mBaseSessionp;
 	LLTestSession* mCurrentSessionp;
-- 
cgit v1.2.3


From 4a4d93d8c0c45248f76d6f27fb523b8ad361a473 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Wed, 6 Sep 2017 16:04:59 +0300
Subject: MAINT-7691 Fixed crash report not generating files in unicode named
 folders

---
 indra/llcommon/llapp.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++----
 indra/llcommon/llapp.h   | 16 ++++++++++++-
 2 files changed, 73 insertions(+), 5 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 2c76f29020..55138e48ee 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -256,6 +256,60 @@ bool LLApp::parseCommandOptions(int argc, char** argv)
 	return true;
 }
 
+bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
+{
+	LLSD commands;
+	std::string name;
+	std::string value;
+	for(int ii = 1; ii < argc; ++ii)
+	{
+		if(wargv[ii][0] != '-')
+		{
+			LL_INFOS() << "Did not find option identifier while parsing token: "
+				<< wargv[ii] << LL_ENDL;
+			return false;
+		}
+		int offset = 1;
+		if(wargv[ii][1] == '-') ++offset;
+		name.assign(utf16str_to_utf8str(&wargv[ii][offset]));
+		if(((ii+1) >= argc) || (wargv[ii+1][0] == '-'))
+		{
+			// we found another option after this one or we have
+			// reached the end. simply record that this option was
+			// found and continue.
+			int flag = name.compare("logfile");
+			if (0 == flag)
+			{
+				commands[name] = "log";
+			}
+			else
+			{
+				commands[name] = true;
+			}
+			
+			continue;
+		}
+		++ii;
+		value.assign(utf16str_to_utf8str(wargv[ii]));
+
+#if LL_WINDOWS
+		//Windows changed command line parsing.  Deal with it.
+		S32 slen = value.length() - 1;
+		S32 start = 0;
+		S32 end = slen;
+		if (wargv[ii][start]=='"')start++;
+		if (wargv[ii][end]=='"')end--;
+		if (start!=0 || end!=slen) 
+		{
+			value = value.substr (start,end);
+		}
+#endif
+
+		commands[name] = value;
+	}
+	setOptionData(PRIORITY_COMMAND_LINE, commands);
+	return true;
+}
 
 void LLApp::manageLiveFile(LLLiveFile* livefile)
 {
@@ -354,7 +408,7 @@ void LLApp::setupErrorHandling(bool second_instance)
 			std::wstring wpipe_name;
 			wpipe_name =  mCrashReportPipeStr + wstringize(getPid());
 
-			const std::wstring wdump_path(wstringize(mDumpPath));
+			const std::wstring wdump_path(utf8str_to_utf16str(mDumpPath));
 
 			int retries = 30;
 			for (; retries > 0; --retries)
@@ -515,9 +569,9 @@ void LLApp::setMiniDumpDir(const std::string &path)
 
 	if(mExceptionHandler == 0) return;
 #ifdef LL_WINDOWS
-	wchar_t buffer[MAX_MINDUMP_PATH_LENGTH];
-	mbstowcs(buffer, mDumpPath.c_str(), MAX_MINDUMP_PATH_LENGTH);
-	mExceptionHandler->set_dump_path(std::wstring(buffer));
+	std::wstring buffer(utf8str_to_utf16str(mDumpPath));
+	if (buffer.size() > MAX_MINDUMP_PATH_LENGTH) buffer.resize(MAX_MINDUMP_PATH_LENGTH);
+	mExceptionHandler->set_dump_path(buffer);
 #elif LL_LINUX
         //google_breakpad::MinidumpDescriptor desc("/tmp");	//path works in debug fails in production inside breakpad lib so linux gets a little less stack reporting until it is patched.
         google_breakpad::MinidumpDescriptor desc(mDumpPath);	//path works in debug fails in production inside breakpad lib so linux gets a little less stack reporting until it is patched.
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index ff9a92b45f..acd829d864 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -106,7 +106,7 @@ public:
 	LLSD getOption(const std::string& name) const;
 
 	/** 
-	 * @brief Parse command line options and insert them into
+	 * @brief Parse ASCII command line options and insert them into
 	 * application command line options.
 	 *
 	 * The name inserted into the option will have leading option
@@ -119,6 +119,20 @@ public:
 	 */
 	bool parseCommandOptions(int argc, char** argv);
 
+	/** 
+	 * @brief Parse Unicode command line options and insert them into
+	 * application command line options.
+	 *
+	 * The name inserted into the option will have leading option
+	 * identifiers (a minus or double minus) stripped. All options
+	 * with values will be stored as a string, while all options
+	 * without values will be stored as true.
+	 * @param argc The argc passed into main().
+	 * @param wargv The wargv passed into main().
+	 * @return Returns true if the parse succeeded.
+	 */
+	bool parseCommandOptions(int argc, wchar_t** wargv);
+
 	/**
 	 * @brief Keep track of live files automatically.
 	 *
-- 
cgit v1.2.3


From e6f3cfe247912b27e9c8087da631a2f9d20b56b4 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 7 Sep 2017 13:08:26 +0300
Subject: mac and linux build fix

---
 indra/llcommon/llapp.cpp | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 55138e48ee..6cc9e804d4 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -271,7 +271,12 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
 		}
 		int offset = 1;
 		if(wargv[ii][1] == '-') ++offset;
-		name.assign(utf16str_to_utf8str(&wargv[ii][offset]));
+
+#if LL_WINDOWS
+	name.assign(utf16str_to_utf8str(&wargv[ii][offset]));
+#else
+	name.assign(wstring_to_utf8str(&wargv[ii][offset]));
+#endif
 		if(((ii+1) >= argc) || (wargv[ii+1][0] == '-'))
 		{
 			// we found another option after this one or we have
@@ -290,7 +295,12 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv)
 			continue;
 		}
 		++ii;
-		value.assign(utf16str_to_utf8str(wargv[ii]));
+
+#if LL_WINDOWS
+	value.assign(utf16str_to_utf8str((wargv[ii])));
+#else
+	value.assign(wstring_to_utf8str((wargv[ii])));
+#endif
 
 #if LL_WINDOWS
 		//Windows changed command line parsing.  Deal with it.
-- 
cgit v1.2.3


From a2f71a242a868cf961c0aba52ec9b644742cd917 Mon Sep 17 00:00:00 2001
From: andreykproductengine <andreykproductengine@lindenlab.com>
Date: Tue, 19 Sep 2017 16:36:00 +0300
Subject: MAINT-7820 Fixed crash in LLEventPump

---
 indra/llcommon/llevents.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index 97270e4931..93db6c0d17 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -316,6 +316,13 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
                                          const NameList& after,
                                          const NameList& before)
 {
+    if (!mSignal)
+    {
+        LL_WARNS() << "Can't connect listener" << LL_ENDL;
+        // connect will fail, return dummy
+        return LLBoundListener();
+    }
+
     float nodePosition = 1.0;
 
     // if the supplied name is empty we are not interested in the ordering mechanism 
-- 
cgit v1.2.3