From b01c75cb423f07a3d3354f8bd62f265f80062b3b Mon Sep 17 00:00:00 2001
From: Adam Moss <moss@lindenlab.com>
Date: Thu, 16 Apr 2009 23:45:35 +0000
Subject: svn merge -r117314:117337
 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/mv13a-merge-1

QAR-1343 maint-viewer-13a+libcurlexploitfix-3-3 combo merge
---
 indra/llcommon/llerror.cpp       | 30 +++++-------------------------
 indra/llcommon/llerrorlegacy.h   | 11 ++++-------
 indra/llcommon/llsdserialize.cpp |  8 +++++---
 indra/llcommon/llstat.cpp        |  7 ++++---
 indra/llcommon/llstat.h          | 17 ++++++++++++-----
 indra/llcommon/llstreamtools.cpp | 26 +++++++++++++-------------
 indra/llcommon/llsys.cpp         |  4 ++--
 indra/llcommon/roles_constants.h | 14 ++++----------
 8 files changed, 49 insertions(+), 68 deletions(-)

(limited to 'indra/llcommon')

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 5e520afab9..e8c95d0a76 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1083,29 +1083,6 @@ namespace LLError
 	#endif
 		prefix << site.mFunction << ": ";
 
-		if (site.mPrintOnce)
-		{
-			std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
-			if (messageIter != s.uniqueLogMessages.end())
-			{
-				messageIter->second++;
-				unsigned int num_messages = messageIter->second;
-				if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
-				{
-					prefix << "ONCE (" << num_messages << "th time seen): ";
-				} 
-				else
-				{
-					return;
-				}
-			}
-			else 
-			{
-				prefix << "ONCE: ";
-				s.uniqueLogMessages[message] = 1;
-			}
-		}
-
 		if (site.mPrintOnce)
 		{
 			std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
@@ -1210,14 +1187,17 @@ namespace LLError
 	void crashAndLoop(const std::string& message)
 	{
 		// Now, we go kaboom!
-		int* crash = NULL;
+		int* make_me_crash = NULL;
 
-		*crash = 0;
+		*make_me_crash = 0;
 
 		while(true)
 		{
 			// Loop forever, in case the crash didn't work?
 		}
+		
+		// this is an attempt to let Coverity and other semantic scanners know that this function won't be returning ever.
+		exit(EXIT_FAILURE);
 	}
 #if LL_WINDOWS
 		#pragma optimize("", on)
diff --git a/indra/llcommon/llerrorlegacy.h b/indra/llcommon/llerrorlegacy.h
index 143fe20180..7a970b1466 100644
--- a/indra/llcommon/llerrorlegacy.h
+++ b/indra/llcommon/llerrorlegacy.h
@@ -103,17 +103,14 @@ const int LL_ERR_PRICE_MISMATCH = -23018;
 
 #define llwarning(msg, num)		llwarns << "Warning # " << num << ": " << msg << llendl;
 
-#ifdef SHOW_ASSERT
-#define llassert(func)			if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
-#else
-#define llassert(func)
-#endif
 #define llassert_always(func)	if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
 
 #ifdef SHOW_ASSERT
-#define llverify(func)			if (!(func)) llerrs << "ASSERT (" << #func << ")" << llendl;
+#define llassert(func)			llassert_always(func)
+#define llverify(func)			llassert_always(func)
 #else
-#define llverify(func)			(func); // get rid of warning C4189
+#define llassert(func)
+#define llverify(func)			do {if (func) {}} while(0)
 #endif
 
 // handy compile-time assert - enforce those template parameters! 
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 9f4ce64d2c..7a66d70d3f 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -1502,7 +1502,7 @@ void LLSDBinaryFormatter::formatString(
  */
 int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
 {
-	char c = istr.get();
+	int c = istr.get();
 	if(istr.fail())
 	{
 		// No data in stream, bail out but mention the character we
@@ -1544,7 +1544,7 @@ int deserialize_string_delim(
 
 	while (true)
 	{
-		char next_char = istr.get();
+		int next_byte = istr.get();
 		++count;
 
 		if(istr.fail())
@@ -1553,6 +1553,8 @@ int deserialize_string_delim(
 			value = write_buffer.str();
 			return LLSDParser::PARSE_FAILURE;
 		}
+
+		char next_char = (char)next_byte; // Now that we know it's not EOF
 		
 		if(found_escape)
 		{
@@ -1641,7 +1643,7 @@ int deserialize_string_raw(
 	char buf[BUF_LEN];		/* Flawfinder: ignore */
 	istr.get(buf, BUF_LEN - 1, ')');
 	count += istr.gcount();
-	char c = istr.get();
+	int c = istr.get();
 	c = istr.get();
 	count += 2;
 	if(((c == '"') || (c == '\'')) && (buf[0] == '('))
diff --git a/indra/llcommon/llstat.cpp b/indra/llcommon/llstat.cpp
index cbf5a2e1c1..e411a1c798 100644
--- a/indra/llcommon/llstat.cpp
+++ b/indra/llcommon/llstat.cpp
@@ -327,6 +327,7 @@ U64 LLStatAccum::sScaleTimes[NUM_SCALES] =
 LLStatAccum::LLStatAccum(bool useFrameTimer)
 	: mUseFrameTimer(useFrameTimer),
 	  mRunning(FALSE),
+	  mLastTime(0),
 	  mLastSampleValue(0.0),
 	  mLastSampleValid(FALSE)
 {
@@ -347,7 +348,7 @@ void LLStatAccum::reset(U64 when)
 	{
 		mBuckets[i].accum = 0.0;
 		mBuckets[i].endTime = when + sScaleTimes[i];
-		mBuckets[i].lastValid = FALSE;
+		mBuckets[i].lastValid = false;
 	}
 }
 
@@ -395,7 +396,7 @@ void LLStatAccum::sum(F64 value, U64 when)
 			{
 				F64 valueLeft = value * timeLeft / timeSpan;
 
-				bucket.lastValid = TRUE;
+				bucket.lastValid = true;
 				bucket.lastAccum = bucket.accum + (value - valueLeft);
 				bucket.accum = valueLeft;
 				bucket.endTime += timeScale;
@@ -404,7 +405,7 @@ void LLStatAccum::sum(F64 value, U64 when)
 			{
 				U64 timeTail = timeLeft % timeScale;
 
-				bucket.lastValid = TRUE;
+				bucket.lastValid = true;
 				bucket.lastAccum = value * timeScale / timeSpan;
 				bucket.accum = value * timeTail / timeSpan;
 				bucket.endTime += (timeLeft - timeTail) + timeScale;
diff --git a/indra/llcommon/llstat.h b/indra/llcommon/llstat.h
index 66521a31cb..61aaac45bf 100644
--- a/indra/llcommon/llstat.h
+++ b/indra/llcommon/llstat.h
@@ -96,11 +96,18 @@ public:
 	
 	struct Bucket
 	{
-		F64		accum;
-		U64		endTime;
-
-		BOOL	lastValid;
-		F64		lastAccum;
+		Bucket() :
+			accum(0.0),
+			endTime(0),
+			lastValid(false),
+			lastAccum(0.0)
+		{}
+
+		F64	accum;
+		U64	endTime;
+
+		bool	lastValid;
+		F64	lastAccum;
 	};
 
 	Bucket	mBuckets[NUM_SCALES];
diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp
index ee4f46318f..4ed2df58e0 100644
--- a/indra/llcommon/llstreamtools.cpp
+++ b/indra/llcommon/llstreamtools.cpp
@@ -45,7 +45,7 @@
 // skips spaces and tabs
 bool skip_whitespace(std::istream& input_stream)
 {
-	char c = input_stream.peek();
+	int c = input_stream.peek();
 	while (('\t' == c || ' ' == c) && input_stream.good())
 	{
 		input_stream.get();
@@ -57,7 +57,7 @@ bool skip_whitespace(std::istream& input_stream)
 // skips whitespace, newlines, and carriage returns
 bool skip_emptyspace(std::istream& input_stream)
 {
-	char c = input_stream.peek();
+	int c = input_stream.peek();
 	while ( input_stream.good()
 			&& ('\t' == c || ' ' == c || '\n' == c || '\r' == c) )
 	{
@@ -72,7 +72,7 @@ bool skip_comments_and_emptyspace(std::istream& input_stream)
 {
 	while (skip_emptyspace(input_stream))
 	{
-		char c = input_stream.peek();
+		int c = input_stream.peek();
 		if ('#' == c )
 		{
 			while ('\n' != c && input_stream.good())
@@ -90,7 +90,7 @@ bool skip_comments_and_emptyspace(std::istream& input_stream)
 
 bool skip_line(std::istream& input_stream)
 {
-	char c;
+	int c;
 	do
 	{
 		c = input_stream.get();
@@ -100,7 +100,7 @@ bool skip_line(std::istream& input_stream)
 
 bool skip_to_next_word(std::istream& input_stream)
 {
-	char c = input_stream.peek();
+	int c = input_stream.peek();
 	while ( input_stream.good()
 			&& (   (c >= 'a' && c <= 'z')
 		   		|| (c >= 'A' && c <= 'Z')
@@ -132,7 +132,7 @@ bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream
 	while (input_stream.good())
 	{
 		skip_emptyspace(input_stream);
-		char c = input_stream.get();
+		int c = input_stream.get();
 		if (keyword[0] != c)
 		{
 			skip_line(input_stream);
@@ -181,7 +181,7 @@ bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stre
 	while (input_stream.good())
 	{
 		skip_emptyspace(input_stream);
-		char c = input_stream.get();
+		int c = input_stream.get();
 		if (keyword[0] != c)
 		{
 			skip_line(input_stream);
@@ -229,7 +229,7 @@ bool skip_to_start_of_next_keyword(const char* keyword, std::istream& input_stre
 bool get_word(std::string& output_string, std::istream& input_stream)
 {
 	skip_emptyspace(input_stream);
-	char c = input_stream.peek();
+	int c = input_stream.peek();
 	while ( !isspace(c) 
 			&& '\n' != c 
 			&& '\r' != c 
@@ -246,7 +246,7 @@ bool get_word(std::string& output_string, std::istream& input_stream, int n)
 {
 	skip_emptyspace(input_stream);
 	int char_count = 0;
-	char c = input_stream.peek();
+	int c = input_stream.peek();
 	while (!isspace(c) 
 			&& '\n' != c 
 			&& '\r' != c 
@@ -265,7 +265,7 @@ bool get_word(std::string& output_string, std::istream& input_stream, int n)
 bool get_line(std::string& output_string, std::istream& input_stream)
 {
 	output_string.clear();
-	char c = input_stream.get();
+	int c = input_stream.get();
 	while (input_stream.good())
 	{
 		output_string += c;
@@ -285,7 +285,7 @@ bool get_line(std::string& output_string, std::istream& input_stream, int n)
 {
 	output_string.clear();
 	int char_count = 0;
-	char c = input_stream.get();
+	int c = input_stream.get();
 	while (input_stream.good() && char_count < n)
 	{
 		char_count++;
@@ -436,7 +436,7 @@ void get_keyword_and_value(std::string& keyword,
 	while (line_index < line_size)
 	{
 		c = line[line_index];
-		if (!isspace(c))
+		if (!LLStringOps::isSpace(c))
 		{
 			break;
 		}
@@ -448,7 +448,7 @@ void get_keyword_and_value(std::string& keyword,
 	while (line_index < line_size)
 	{
 		c = line[line_index];
-		if (isspace(c) || '\r' == c || '\n' == c)
+		if (LLStringOps::isSpace(c) || '\r' == c || '\n' == c)
 		{
 			break;
 		}
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 2e93b2a3a7..4d03c4d40d 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -226,8 +226,8 @@ LLOSInfo::LLOSInfo() :
 		else if (ostype == "Linux")
 		{
 			// Only care about major and minor Linux versions, truncate at second '.'
-			S32 idx1 = mOSStringSimple.find_first_of(".", 0);
-			S32 idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
+			std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0);
+			std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos;
 			std::string simple = mOSStringSimple.substr(0, idx2);
 			if (simple.length() > 0)
 				mOSStringSimple = simple;
diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h
index 854a153d19..57f2418c0f 100644
--- a/indra/llcommon/roles_constants.h
+++ b/indra/llcommon/roles_constants.h
@@ -141,7 +141,9 @@ const U64 GP_NOTICES_SEND			= 0x1LL << 42;	// Send Notices
 const U64 GP_NOTICES_RECEIVE		= 0x1LL << 43;	// Receive Notices and View Notice History
 
 // Proposals
+// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856:
 const U64 GP_PROPOSAL_START		= 0x1LL << 44;	// Start Proposal
+// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856:
 const U64 GP_PROPOSAL_VOTE		= 0x1LL << 45;	// Vote on Proposal
 
 // Group chat moderation related
@@ -152,20 +154,17 @@ const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session
 const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE
 								| GP_LAND_ALLOW_SET_HOME
 								| GP_NOTICES_RECEIVE
-								| GP_PROPOSAL_START
-								| GP_PROPOSAL_VOTE
-                                | GP_SESSION_JOIN
+								| GP_SESSION_JOIN
 								| GP_SESSION_VOICE
 								;
 
-const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
+const U64 GP_DEFAULT_OFFICER = GP_DEFAULT_MEMBER // Superset of GP_DEFAULT_MEMBER
 								| GP_GROUP_CHANGE_IDENTITY
 								| GP_LAND_ADMIN
 								| GP_LAND_ALLOW_EDIT_LAND
 								| GP_LAND_ALLOW_FLY
 								| GP_LAND_ALLOW_CREATE
 								| GP_LAND_ALLOW_LANDMARK
-								| GP_LAND_ALLOW_SET_HOME
 								| GP_LAND_CHANGE_IDENTITY
 								| GP_LAND_CHANGE_MEDIA
 								| GP_LAND_DEED
@@ -187,17 +186,12 @@ const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
 								| GP_MEMBER_INVITE	
 								| GP_MEMBER_OPTIONS
 								| GP_MEMBER_VISIBLE_IN_DIR
-								| GP_NOTICES_RECEIVE
 								| GP_NOTICES_SEND
 								| GP_OBJECT_DEED
 								| GP_OBJECT_MANIPULATE
 								| GP_OBJECT_SET_SALE
-								| GP_PROPOSAL_START
-								| GP_PROPOSAL_VOTE
 								| GP_ROLE_ASSIGN_MEMBER_LIMITED
 								| GP_ROLE_PROPERTIES
 								| GP_SESSION_MODERATOR
-								| GP_SESSION_JOIN
-								| GP_SESSION_VOICE
 								;
 #endif
-- 
cgit v1.2.3