diff options
| author | Thomas Nelson <rider@lindenlab.com> | 2017-10-17 13:38:39 -0700 | 
|---|---|---|
| committer | Thomas Nelson <rider@lindenlab.com> | 2017-10-17 13:38:39 -0700 | 
| commit | 5754493cdcfeac76d0576abc19bdf5a03717780d (patch) | |
| tree | e6db53ae1cd654f9b2a1a6b9ab47e01ea738ecef /indra/llcommon | |
| parent | cc22ffc6d799544e8f2a9dfed6813081d908c88d (diff) | |
| parent | 9c5becd67d7e6fe5f696dcae8690dd562b7b0449 (diff) | |
Merged lindenlab/viewer64 into default
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llapp.cpp | 72 | ||||
| -rw-r--r-- | indra/llcommon/llapp.h | 16 | ||||
| -rw-r--r-- | indra/llcommon/llevents.cpp | 7 | ||||
| -rw-r--r-- | indra/llcommon/llinitparam.cpp | 7 | ||||
| -rw-r--r-- | indra/llcommon/llmetricperformancetester.cpp | 14 | ||||
| -rw-r--r-- | indra/llcommon/llmetricperformancetester.h | 10 | ||||
| -rw-r--r-- | indra/llcommon/llsys.h | 5 | 
7 files changed, 106 insertions, 25 deletions
| diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 2c76f29020..6cc9e804d4 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -256,6 +256,70 @@ 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; + +#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 +			// 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; + +#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. +		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 +418,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 +579,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.  	 * diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index a3856e4fc4..dce97b5411 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -322,6 +322,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  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;  		} 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; diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 95ef4cf065..5ab97939b9 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; | 
