From e03bb0606a10f29c8b94909a713a5bb5c69e88b7 Mon Sep 17 00:00:00 2001 From: Kelly Washington Date: Thu, 21 Jun 2007 22:40:22 +0000 Subject: merge -r62831:64079 branches/maintenance to release --- indra/llcommon/llapr.h | 2 +- indra/llcommon/llavatarconstants.h | 2 +- indra/llcommon/llchat.h | 3 +- indra/llcommon/lldefs.h | 33 +++++++-------- indra/llcommon/llfile.cpp | 1 + indra/llcommon/llmortician.cpp | 1 + indra/llcommon/llprocessor.cpp | 12 +++--- indra/llcommon/llsd.cpp | 1 + indra/llcommon/llsdserialize_xml.cpp | 5 ++- indra/llcommon/llsdutil.cpp | 2 +- indra/llcommon/llstreamtools.cpp | 2 + indra/llcommon/llstring.cpp | 20 +++++++++ indra/llcommon/llstring.h | 3 ++ indra/llcommon/lluri.cpp | 78 ++++++++++++++++++++++++++++++++++++ indra/llcommon/lluri.h | 15 ++++++- indra/llcommon/string_table.h | 2 +- indra/llcommon/timer.h | 2 +- indra/llcommon/timing.cpp | 2 +- 18 files changed, 154 insertions(+), 32 deletions(-) (limited to 'indra/llcommon') 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 // Need PATH_MAX in APR headers... #endif -#include "boost/noncopyable.hpp" +#include #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< 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 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 #include 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 std::ostream& operator<<(std::ostream &s, const LLStringBase &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$ */ -- cgit v1.2.3