diff options
| author | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 | 
|---|---|---|
| committer | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 | 
| commit | e03bb0606a10f29c8b94909a713a5bb5c69e88b7 (patch) | |
| tree | 6d8d07894579438c8cc70e08f5730c3c95dfe768 /indra/llcommon | |
| parent | 2638f12f95eea692502836cf6548b4a0b234d009 (diff) | |
merge -r62831:64079 branches/maintenance to release
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/llapr.h | 2 | ||||
| -rw-r--r-- | indra/llcommon/llavatarconstants.h | 2 | ||||
| -rw-r--r-- | indra/llcommon/llchat.h | 3 | ||||
| -rw-r--r-- | indra/llcommon/lldefs.h | 33 | ||||
| -rw-r--r-- | indra/llcommon/llfile.cpp | 1 | ||||
| -rw-r--r-- | indra/llcommon/llmortician.cpp | 1 | ||||
| -rw-r--r-- | indra/llcommon/llprocessor.cpp | 12 | ||||
| -rw-r--r-- | indra/llcommon/llsd.cpp | 1 | ||||
| -rw-r--r-- | indra/llcommon/llsdserialize_xml.cpp | 5 | ||||
| -rw-r--r-- | indra/llcommon/llsdutil.cpp | 2 | ||||
| -rw-r--r-- | indra/llcommon/llstreamtools.cpp | 2 | ||||
| -rw-r--r-- | indra/llcommon/llstring.cpp | 20 | ||||
| -rw-r--r-- | indra/llcommon/llstring.h | 3 | ||||
| -rw-r--r-- | indra/llcommon/lluri.cpp | 78 | ||||
| -rw-r--r-- | indra/llcommon/lluri.h | 15 | ||||
| -rw-r--r-- | indra/llcommon/string_table.h | 2 | ||||
| -rw-r--r-- | indra/llcommon/timer.h | 2 | ||||
| -rw-r--r-- | indra/llcommon/timing.cpp | 2 | 
18 files changed, 154 insertions, 32 deletions
| diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index e89912279e..6e8912c461 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -15,7 +15,7 @@  #include <sys/param.h>  // Need PATH_MAX in APR headers...  #endif -#include "boost/noncopyable.hpp" +#include <boost/noncopyable.hpp>  #include "apr-1/apr_thread_proc.h"  #include "apr-1/apr_thread_mutex.h" diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h index d66627c4b0..7f231014aa 100644 --- a/indra/llcommon/llavatarconstants.h +++ b/indra/llcommon/llavatarconstants.h @@ -1,5 +1,5 @@  /**  - * @file indra_constants.h + * @file llavatarconstants.h   * @brief some useful short term constants for Indra   *   * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index 61bdc81907..eb9419de60 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -30,7 +30,8 @@ typedef enum e_chat_type  	CHAT_TYPE_START = 4,  	CHAT_TYPE_STOP = 5,  	CHAT_TYPE_DEBUG_MSG = 6, -	CHAT_TYPE_REGION = 7 +	CHAT_TYPE_REGION = 7, +	CHAT_TYPE_OWNER = 8  } EChatType;  typedef enum e_chat_audible_level diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 45fb8b9f84..f55616479d 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -35,13 +35,15 @@ const U32	SOUTHWEST	= 6;  const U32	SOUTHEAST	= 7;  const U32	MIDDLE		= 8; -const U8 LL_SOUND_FLAG_NONE = 0x00; -const U8 LL_SOUND_FLAG_LOOP = 0x01; -const U8 LL_SOUND_FLAG_SYNC_MASTER = 0x02; -const U8 LL_SOUND_FLAG_SYNC_SLAVE = 0x04; -const U8 LL_SOUND_FLAG_SYNC_PENDING = 0x08; -const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; -const U8 LL_SOUND_FLAG_QUEUE = 0x10; +const U8	EAST_MASK		= 0x1<<EAST; +const U8	NORTH_MASK		= 0x1<<NORTH; +const U8	WEST_MASK		= 0x1<<WEST; +const U8	SOUTH_MASK		= 0x1<<SOUTH; + +const U8	NORTHEAST_MASK	= NORTH_MASK | EAST_MASK; +const U8	NORTHWEST_MASK	= NORTH_MASK | WEST_MASK; +const U8	SOUTHWEST_MASK	= SOUTH_MASK | WEST_MASK; +const U8	SOUTHEAST_MASK	= SOUTH_MASK | EAST_MASK;  const U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5};  const U32 gDirAdjacent[8][2] =  { @@ -67,15 +69,6 @@ const S32 gDirAxes[8][2] = {  							{ 1,-1}, // se  							}; -const U8	EAST_MASK		= 1; -const U8	NORTH_MASK		= 2; -const U8	WEST_MASK		= 4; -const U8	SOUTH_MASK		= 8; -const U8	NORTHEAST_MASK	= NORTH_MASK | EAST_MASK; -const U8	NORTHWEST_MASK	= NORTH_MASK | WEST_MASK; -const U8	SOUTHWEST_MASK	= SOUTH_MASK | WEST_MASK; -const U8	SOUTHEAST_MASK	= SOUTH_MASK | EAST_MASK; -  const S32 gDirMasks[8] = {   							EAST_MASK,  							NORTH_MASK, @@ -113,6 +106,14 @@ const U32 RIGHT_SIDE 	= 4;  const U32 TOP_SIDE 		= 5;  const U32 BOTTOM_SIDE 	= 6; +const U8 LL_SOUND_FLAG_NONE =         0x0; +const U8 LL_SOUND_FLAG_LOOP =         1<<0; +const U8 LL_SOUND_FLAG_SYNC_MASTER =  1<<1; +const U8 LL_SOUND_FLAG_SYNC_SLAVE =   1<<2; +const U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3; +const U8 LL_SOUND_FLAG_QUEUE =        1<<4; +const U8 LL_SOUND_FLAG_STOP =         1<<5; +const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING;  //  // *NOTE: These values may be used as hard-coded numbers in scanf() variants. diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index f43e57f467..8d0125f0c1 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -9,6 +9,7 @@   * $License$   */ +#include "linden_common.h"  #include "llfile.h"  #include "llstring.h"  #include "llerror.h" diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp index a144ac6d93..f475b83203 100644 --- a/indra/llcommon/llmortician.cpp +++ b/indra/llcommon/llmortician.cpp @@ -5,6 +5,7 @@   * $License$   */ +#include "linden_common.h"  #include "llmortician.h"  #include <list> diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index a6b859ad41..00f4a13c39 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -433,7 +433,7 @@ bool CProcessor::AnalyzeIntelProcessor()  						case 3:			// Model = 8, Brand id = 3:  Pentium III Xeon (on-die L2 cache) processor model                              			strncat(strCPUName, "Intel Pentium III Xeon (0.18 micron process) with internal L2 cache", sizeof(strCPUName)-(strlen(strCPUName)-1)); /*Flawfinder: ignore*/  							break; -						default:		// ...˛ +						default:		// ...  							strncat(strCPUName, "Intel Pentium III core (unknown model, 0.18 micron process) with internal L2 cache", sizeof(strCPUName)-(strlen(strCPUName)-1)); /*Flawfinder: ignore*/  							break;  					} @@ -644,8 +644,8 @@ bool CProcessor::AnalyzeAMDProcessor()  			mov dword ptr [tmp+44], edx  		}  		// And copy it to the brand id string -		strncpy(CPUInfo.strBrandID, tmp,sizeof(CPUInfo.strBrandID-1));	/* Flawfinder: ignore */		 -		CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID-1)]='\0'; +		strncpy(CPUInfo.strBrandID, tmp,sizeof(CPUInfo.strBrandID)-1); +		CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID)-1]='\0';  	}  	else  	{ @@ -1260,17 +1260,17 @@ void CProcessor::DecodeProcessorConfiguration(unsigned int cfg)  			CPUInfo._L1.Data.uiAssociativeWays = 4;  			CPUInfo._L1.Data.uiLineSize = 64;  			break; -		case 0x70:		// cfg = 0x70:  trace L1 cache present, 12 KµOPs, 4 ways +		case 0x70:		// cfg = 0x70:  trace L1 cache present, 12 KuOPs, 4 ways  			CPUInfo._Trace.bPresent = true;  			strcpy(CPUInfo._Trace.strSize, "12 K-micro-ops");	/* Flawfinder: ignore */  			CPUInfo._Trace.uiAssociativeWays = 4;  			break; -		case 0x71:		// cfg = 0x71:  trace L1 cache present, 16 KµOPs, 4 ways +		case 0x71:		// cfg = 0x71:  trace L1 cache present, 16 KuOPs, 4 ways  			CPUInfo._Trace.bPresent = true;  			strcpy(CPUInfo._Trace.strSize, "16 K-micro-ops");	/* Flawfinder: ignore */  			CPUInfo._Trace.uiAssociativeWays = 4;  			break; -		case 0x72:		// cfg = 0x72:  trace L1 cache present, 32 KµOPs, 4 ways +		case 0x72:		// cfg = 0x72:  trace L1 cache present, 32 KuOPs, 4 ways  			CPUInfo._Trace.bPresent = true;  			strcpy(CPUInfo._Trace.strSize, "32 K-micro-ops");	/* Flawfinder: ignore */  			CPUInfo._Trace.uiAssociativeWays = 4; diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index e5f366c4a4..2fb9a0ab9c 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -6,6 +6,7 @@   * $License$   */ +#include "linden_common.h"  #include "llsd.h"  #include <sstream> diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index c5ab369d0f..de4f3197e6 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -378,7 +378,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data)  	status = XML_ParseBuffer(mParser, 0, true);  	if (status == XML_STATUS_ERROR && !mGracefullStop)  	{ -		((char*) buffer)[count? count - 1 : 0] = '\0'; +		if (buffer) +		{ +			((char*) buffer)[count ? count - 1 : 0] = '\0'; +		}  		llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl;  		data = LLSD();  		return -1; diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 5a0a76b3f3..e6d9396f7d 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -277,4 +277,4 @@ char* ll_pretty_print_sd(const LLSD& sd)  	strncpy(buffer, stream.str().c_str(), bufferSize);  	buffer[bufferSize - 1] = '\0';  	return buffer; -}
\ No newline at end of file +} diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index a92f1c9388..447f80e617 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -6,6 +6,8 @@   * $License$   */ +#include "linden_common.h" +  #include <iostream>  #include <string> diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c6f436a5bb..0b799b94ae 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -653,6 +653,26 @@ std::string mbcsstring_makeASCII(const std::string& wstr)  	}  	return out_str;  } +std::string utf8str_removeCRLF(const std::string& utf8str) +{ +	if (0 == utf8str.length()) +	{ +		return std::string(); +	} +	const char CR = 13; + +	std::string out; +	out.reserve(utf8str.length()); +	const S32 len = (S32)utf8str.length(); +	for( S32 i = 0; i < len; i++ ) +	{ +		if( utf8str[i] != CR ) +		{ +			out.push_back(utf8str[i]); +		} +	} +	return out; +}  #if LL_WINDOWS  /* If the size of the passed in buffer is not large enough to hold the string, diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index c8c6e9ce7a..3c798b25aa 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -437,6 +437,9 @@ std::string utf8str_makeASCII(const std::string& utf8str);  // Hack - used for evil notecards.  std::string mbcsstring_makeASCII(const std::string& str);  +std::string utf8str_removeCRLF(const std::string& utf8str); + +  template <class T>  std::ostream& operator<<(std::ostream &s, const LLStringBase<T> &str)  { diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index fc29e760be..5cb6067990 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -168,6 +168,55 @@ LLURI::LLURI(const std::string& escaped_str)  	}  } +static BOOL isDefault(const std::string& scheme, U16 port) +{ +	if (scheme == "http") +		return port == 80; +	if (scheme == "https") +		return port == 443; +	if (scheme == "ftp") +		return port == 21; + +	return FALSE; +} + +LLURI::LLURI(const std::string& scheme, +			 const std::string& userName, +			 const std::string& password, +			 const std::string& hostName, +			 U16 port, +			 const std::string& escapedPath, +			 const std::string& escapedQuery) +	: mScheme(scheme), +	  mEscapedPath(escapedPath), +	  mEscapedQuery(escapedQuery) +{ +	std::ostringstream auth; +	std::ostringstream opaque; + +	opaque << "//"; +	 +	if (!userName.empty()) +	{ +		auth << escape(userName); +		if (!password.empty()) +		{ +			auth << ':' << escape(password); +		} +		auth << '@'; +	} +	auth << hostName; +	if (!isDefault(scheme, port)) +	{ +		auth << ':' << port; +	} +	mEscapedAuthority = auth.str(); + +	opaque << mEscapedAuthority << escapedPath << escapedQuery; + +	mEscapedOpaque = opaque.str(); +} +  LLURI::~LLURI()  {  } @@ -427,6 +476,35 @@ std::string LLURI::hostName() const  	return unescape(host);  } +std::string LLURI::userName() const +{ +	std::string user, userPass, host, port; +	findAuthorityParts(mEscapedAuthority, userPass, host, port); +	std::string::size_type pos = userPass.find(':'); +	if (pos != std::string::npos) +	{ +		user = userPass.substr(0, pos); +	} +	return unescape(user); +} + +std::string LLURI::password() const +{ +	std::string pass, userPass, host, port; +	findAuthorityParts(mEscapedAuthority, userPass, host, port); +	std::string::size_type pos = userPass.find(':'); +	if (pos != std::string::npos) +	{ +		pass = userPass.substr(pos + 1); +	} +	return unescape(pass); +} + +BOOL LLURI::defaultPort() const +{ +	return isDefault(mScheme, hostPort()); +} +  U16 LLURI::hostPort() const  {  	std::string user, host, port; diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index 0665255676..9ec51b4b1a 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -28,6 +28,14 @@ class LLURI  public:    LLURI();    LLURI(const std::string& escaped_str); +  LLURI(const std::string& scheme, +		const std::string& userName, +		const std::string& password, +		const std::string& hostName, +		U16 hostPort, +		const std::string& escapedPath, +		const std::string& escapedQuery); +	      // construct from escaped string, as would be transmitted on the net    ~LLURI(); @@ -48,8 +56,6 @@ public:  			 const U32& port,  			 const LLSD& path,  			 const LLSD& query); -			  -	      std::string asString() const;    // the whole URI, escaped as needed @@ -64,10 +70,15 @@ public:    // for schemes that follow path like syntax (http, https, ftp)    std::string authority() const;	// ex.: "host.com:80"    std::string hostName() const;	// ex.: "host.com" +  std::string userName() const; +  std::string password() const;    U16 hostPort() const;			// ex.: 80, will include implicit port +  BOOL defaultPort() const;		// true if port is default for scheme +  const std::string& escapedPath() const { return mEscapedPath; }    std::string path() const;		// ex.: "/abc/def", includes leading slash    //    LLSD pathArray() const;			// above decoded into an array of strings    std::string query() const;		// ex.: "x=34", section after "?" +  const std::string& escapedQuery() const { return mEscapedQuery; }    LLSD queryMap() const;			// above decoded into a map    static LLSD queryMap(std::string escaped_query_string);    static std::string mapToQueryString(const LLSD& queryMap); diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h index 02ea4c34aa..4914e532a1 100644 --- a/indra/llcommon/string_table.h +++ b/indra/llcommon/string_table.h @@ -2,7 +2,7 @@   * @file string_table.h   * @brief Legacy wrapper header.   * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc.   * $License$   */  #include "llstringtable.h" diff --git a/indra/llcommon/timer.h b/indra/llcommon/timer.h index e4b799ee30..925b4c1a4e 100644 --- a/indra/llcommon/timer.h +++ b/indra/llcommon/timer.h @@ -2,7 +2,7 @@   * @file timer.h   * @brief Legacy wrapper header.   * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc.   * $License$   */  #include "lltimer.h" diff --git a/indra/llcommon/timing.cpp b/indra/llcommon/timing.cpp index 2c8a214b01..b8141fd4aa 100644 --- a/indra/llcommon/timing.cpp +++ b/indra/llcommon/timing.cpp @@ -2,6 +2,6 @@   * @file timing.cpp   * @brief This file will be deprecated in the future.   * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc.   * $License$   */ | 
