diff options
Diffstat (limited to 'indra')
27 files changed, 467 insertions, 1499 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 814e1c9f95..9679650104 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -94,7 +94,7 @@ def get_channel(srctree): for p in paths: if os.path.exists(p): contents = open(p, 'r').read() - channel = re.search("LL_CHANNEL\s=\s\"([\w\s]+)\"", contents).group(1) + channel = re.search("LL_CHANNEL\s=\s\"(.+)\";\s*$", contents, flags = re.M).group(1) return channel diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 22b2c9db82..13bf368334 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -37,15 +37,16 @@ #include <cctype> #ifdef __GNUC__ -#include <cxxabi.h> -#endif +# include <cxxabi.h> +#endif // __GNUC__ #include <sstream> #if !LL_WINDOWS -#include <syslog.h> -#endif +# include <syslog.h> +# include <unistd.h> +#endif // !LL_WINDOWS #if LL_WINDOWS -#include <windows.h> -#endif +# include <windows.h> +#endif // LL_WINDOWS #include <vector> #include "llapp.h" @@ -133,18 +134,58 @@ namespace { class RecordToStderr : public LLError::Recorder { public: - RecordToStderr(bool timestamp) : mTimestamp(timestamp) { } + RecordToStderr(bool timestamp) : mTimestamp(timestamp), mUseANSI(ANSI_PROBE) { } virtual bool wantsTime() { return mTimestamp; } virtual void recordMessage(LLError::ELevel level, - const std::string& message) + const std::string& message) { + if (ANSI_PROBE == mUseANSI) + mUseANSI = (checkANSI() ? ANSI_YES : ANSI_NO); + + if (ANSI_YES == mUseANSI) + { + // Default all message levels to bold so we can distinguish our own messages from those dumped by subprocesses and libraries. + colorANSI("1"); // bold + switch (level) { + case LLError::LEVEL_ERROR: + colorANSI("31"); // red + break; + case LLError::LEVEL_WARN: + colorANSI("34"); // blue + break; + case LLError::LEVEL_DEBUG: + colorANSI("35"); // magenta + break; + default: + break; + } + } fprintf(stderr, "%s\n", message.c_str()); + if (ANSI_YES == mUseANSI) colorANSI("0"); // reset } private: bool mTimestamp; + typedef enum ANSIState {ANSI_PROBE, ANSI_YES, ANSI_NO}; + ANSIState mUseANSI; + void colorANSI(const std::string color) + { + // ANSI color code escape sequence + fprintf(stderr, "\033[%sm", color.c_str() ); + }; + bool checkANSI(void) + { +#if LL_LINUX || LL_DARWIN + // Check whether it's okay to use ANSI; if stderr is + // a tty then we assume yes. Can be turned off with + // the LL_NO_ANSI_COLOR env var. + return (0 != isatty(2)) && + (NULL == getenv("LL_NO_ANSI_COLOR")); +#endif // LL_LINUX + return false; + }; }; class RecordToFixedBuffer : public LLError::Recorder diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index 8d4a3ef6b8..e4f121747c 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -263,20 +263,14 @@ bool get_word(std::string& output_string, std::istream& input_stream, int n) // get everything up to and including the next newline bool get_line(std::string& output_string, std::istream& input_stream) { + output_string.clear(); char c = input_stream.get(); while (input_stream.good()) { - if ('\r' == c) - { - // skip carriage returns - } - else + output_string += c; + if ('\n' == c) { - output_string += c; - if ('\n' == c) - { - break; - } + break; } c = input_stream.get(); } @@ -288,27 +282,21 @@ bool get_line(std::string& output_string, std::istream& input_stream) // add a newline on the end if bail before actual line ending 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(); while (input_stream.good() && char_count < n) { char_count++; output_string += c; - if ('\r' == c) + if ('\n' == c) { - // skip carriage returns + break; } - else + if (char_count >= n) { - if ('\n' == c) - { - break; - } - if (char_count >= n) - { - output_string.append("\n"); - break; - } + output_string.append("\n"); + break; } c = input_stream.get(); } @@ -408,49 +396,6 @@ void replace_newlines_with_whitespace(std::string& line) } } -// returns 1 for solitary "{" -// returns -1 for solitary "}" -// otherwise returns 0 -int get_brace_count(const std::string& line) -{ - int index = 0; - int line_size = line.size(); - char c = 0; - while (index < line_size) - { - c = line[index]; - index++; - if (!isspace(c)) - { - break; - } - } - char brace = c; - // make sure the rest of the line is whitespace - while (index < line_size) - { - c = line[index]; - if (!isspace(c)) - { - break; - } - index++; - } - if ('\n' != c) - { - return 0; - } - if ('{' == brace) - { - return 1; - } - else if ('}' == brace) - { - return -1; - } - return 0; -} - // erases any double-quote characters in 'line' void remove_double_quotes(std::string& line) { @@ -498,7 +443,7 @@ void get_keyword_and_value(std::string& keyword, } // get the keyword - keyword.assign(""); + keyword.clear(); while (line_index < line_size) { c = line[line_index]; @@ -510,6 +455,8 @@ void get_keyword_and_value(std::string& keyword, line_index++; } + // get the value + value.clear(); if (keyword.size() > 0 && '\r' != line[line_index] && '\n' != line[line_index]) @@ -523,8 +470,6 @@ void get_keyword_and_value(std::string& keyword, line_index++; } - // get the value - value.assign(""); while (line_index < line_size) { c = line[line_index]; diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h index b024112f9f..22be3a914a 100644 --- a/indra/llcommon/llstreamtools.h +++ b/indra/llcommon/llstreamtools.h @@ -96,11 +96,6 @@ void escape_string(std::string& line); // replaces each '\n' character with ' ' void replace_newlines_with_whitespace(std::string& line); -// returns 1 for solitary "{" -// returns -1 for solitary "}" -// otherwise returns 0 -int get_brace_count(const std::string& line); - // erases any double-quote characters in line void remove_double_quotes(std::string& line); diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 272e8ffba2..45a927aa7d 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -940,6 +940,7 @@ LLSD LLInventoryItem::asLLSD() const } else { + // *TODO: get rid of this. Phoenix 2008-01-30 LLUUID shadow_id(mAssetUUID); LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); cipher.encrypt(shadow_id.mData, UUID_BYTES); diff --git a/indra/llinventory/llparcelflags.h b/indra/llinventory/llparcelflags.h index 1806142c17..2ed484e1e5 100644 --- a/indra/llinventory/llparcelflags.h +++ b/indra/llinventory/llparcelflags.h @@ -81,7 +81,7 @@ const U32 PF_USE_RESTRICTED_ACCESS = PF_USE_ACCESS_GROUP | PF_DENY_ANONYMOUS | PF_DENY_AGEUNVERIFIED; const U32 PF_NONE = 0x00000000; -const U32 PF_ALL = 0x7FFFFFFF; +const U32 PF_ALL = 0xFFFFFFFF; const U32 PF_DEFAULT = PF_ALLOW_FLY | PF_ALLOW_OTHER_SCRIPTS | PF_ALLOW_GROUP_SCRIPTS diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp index 932eeaa670..3503458a3b 100644 --- a/indra/llmessage/llnamevalue.cpp +++ b/indra/llmessage/llnamevalue.cpp @@ -34,12 +34,12 @@ #include "linden_common.h" -#include <map> - #include "llnamevalue.h" + #include "u64.h" #include "llstring.h" #include "llcamera.h" +#include "string_table.h" // Anonymous enumeration to provide constants in this file. // *NOTE: These values may be used in sscanf statements below as their @@ -51,17 +51,7 @@ enum U64_BUFFER_LEN = 64 }; -struct user_callback_t -{ - user_callback_t() {}; - user_callback_t(TNameValueCallback cb, void** data) : m_Callback(cb), m_Data(data) {} - TNameValueCallback m_Callback; - void ** m_Data; -}; -typedef std::map<char *, user_callback_t> user_callback_map_t; -user_callback_map_t gUserCallbackMap; - -LLStringTable gNVNameTable(16384); +LLStringTable gNVNameTable(256); char NameValueTypeStrings[NVT_EOF][NAME_VALUE_TYPE_STRING_LENGTH] = /*Flawfinder: Ignore*/ { @@ -80,8 +70,7 @@ char NameValueClassStrings[NVC_EOF][NAME_VALUE_CLASS_STRING_LENGTH] = /*Flawfind { "NULL", "R", // read only - "RW", // read write - "CB" // callback + "RW" // read write }; char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] = /*Flawfinder: Ignore*/ @@ -94,13 +83,6 @@ char NameValueSendtoStrings[NVS_EOF][NAME_VALUE_SENDTO_STRING_LENGTH] = /*Flawfi }; /*Flawfinder: Ignore*/ -void add_use_callback(char *name, TNameValueCallback ucb, void **user_data) -{ - char *temp = gNVNameTable.addString(name); - gUserCallbackMap[temp] = user_callback_t(ucb,user_data); -} - - // // Class // @@ -125,12 +107,9 @@ void LLNameValue::baseInit() mSendto = NVS_NULL; mStringSendto = NameValueSendtoStrings[NVS_NULL]; - - mNameValueCB = NULL; - mUserData = NULL; } -void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data) +void LLNameValue::init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto) { mNVNameTable = &gNVNameTable; @@ -254,40 +233,11 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con mClass = NVC_READ_WRITE; mStringClass = mNVNameTable->addString("RW"); } - else if (!strcmp(nvclass, "CB") || - !strcmp(nvclass, "CALLBACK")) // legacy - { - mClass = NVC_CALLBACK; - mStringClass = mNVNameTable->addString("CB"); - mNameValueCB = nvcb; - mUserData = user_data; - } else { // assume it's bad mClass = NVC_NULL; mStringClass = mNVNameTable->addString(nvclass); - mNameValueCB = NULL; - mUserData = NULL; - - // are we a user-defined call back? - for (user_callback_map_t::iterator iter = gUserCallbackMap.begin(); - iter != gUserCallbackMap.end(); iter++) - { - char* tname = iter->first; - if (tname == mStringClass) - { - mClass = NVC_CALLBACK; - mNameValueCB = (iter->second).m_Callback; - mUserData = (iter->second).m_Data; - } - } - - // Warn if we didn't find a callback - if (mClass == NVC_NULL) - { - llwarns << "Unknown user callback in name value init() for " << mName << llendl; - } } // Initialize the sendto variable @@ -326,24 +276,24 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con } -LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass) { baseInit(); // if not specified, send to simulator only - init(name, data, type, nvclass, "SIM", nvcb, user_data); + init(name, data, type, nvclass, "SIM"); } -LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto) { baseInit(); - init(name, data, type, nvclass, nvsendto, nvcb, user_data); + init(name, data, type, nvclass, nvsendto); } // Initialize without any initial data. -LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass, TNameValueCallback nvcb, void **user_data) +LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass) { baseInit(); mName = mNVNameTable->addString(name); @@ -401,11 +351,9 @@ LLNameValue::LLNameValue(const char *name, const char *type, const char *nvclass { mClass = NVC_READ_WRITE; } - else if (!strcmp(mStringClass, "CALLBACK")) + else { - mClass = NVC_READ_WRITE; - mNameValueCB = nvcb; - mUserData = user_data; + mClass = NVC_NULL; } // Initialize the sendto variable @@ -734,46 +682,6 @@ LLVector3 *LLNameValue::getVec3() } -F32 LLNameValue::magnitude() -{ - switch(mType) - { - case NVT_STRING: - return (F32)(strlen(mNameValueReference.string)); /* Flawfinder: ignore */ - break; - case NVT_F32: - return (fabsf(*mNameValueReference.f32)); - break; - case NVT_S32: - return (fabsf((F32)(*mNameValueReference.s32))); - break; - case NVT_VEC3: - return (mNameValueReference.vec3->magVec()); - break; - case NVT_U32: - return (F32)(*mNameValueReference.u32); - break; - default: - llerrs << "No magnitude operation for NV type " << mStringType << llendl; - break; - } - return 0.f; -} - - -void LLNameValue::callCallback() -{ - if (mNameValueCB) - { - (*mNameValueCB)(this, mUserData); - } - else - { - llinfos << mName << " has no callback!" << llendl; - } -} - - BOOL LLNameValue::sendToData() const { return (mSendto == NVS_DATA_SIM || mSendto == NVS_DATA_SIM_VIEWER); @@ -795,13 +703,6 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) if (mClass == NVC_READ_ONLY) return *this; - BOOL b_changed = FALSE; - if ( (mClass == NVC_CALLBACK) - &&(*this != a)) - { - b_changed = TRUE; - } - switch(a.mType) { case NVT_STRING: @@ -835,11 +736,6 @@ LLNameValue &LLNameValue::operator=(const LLNameValue &a) break; } - if (b_changed) - { - callCallback(); - } - return *this; } @@ -847,19 +743,12 @@ void LLNameValue::setString(const char *a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_STRING: if (a) { - if ( (mClass == NVC_CALLBACK) - &&(strcmp(this->mNameValueReference.string,a))) - { - b_changed = TRUE; - } - if (mNameValueReference.string) { delete [] mNameValueReference.string; @@ -870,11 +759,6 @@ void LLNameValue::setString(const char *a) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } - - if (b_changed) - { - callCallback(); - } } else { @@ -889,11 +773,6 @@ void LLNameValue::setString(const char *a) break; } - if (b_changed) - { - callCallback(); - } - return; } @@ -902,19 +781,12 @@ void LLNameValue::setAsset(const char *a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_ASSET: if (a) { - if ( (mClass == NVC_CALLBACK) - &&(strcmp(this->mNameValueReference.string,a))) - { - b_changed = TRUE; - } - if (mNameValueReference.string) { delete [] mNameValueReference.string; @@ -924,11 +796,6 @@ void LLNameValue::setAsset(const char *a) { strcpy(mNameValueReference.string, a); /* Flawfinder: ignore */ } - - if (b_changed) - { - callCallback(); - } } else { @@ -942,10 +809,6 @@ void LLNameValue::setAsset(const char *a) default: break; } - if (b_changed) - { - callCallback(); - } } @@ -953,29 +816,15 @@ void LLNameValue::setF32(const F32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = a; - if (b_changed) - { - callCallback(); - } break; default: break; } - if (b_changed) - { - callCallback(); - } return; } @@ -985,53 +834,21 @@ void LLNameValue::setS32(const S32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_S32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.s32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.s32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_U32: - if ( (mClass == NVC_CALLBACK) - && ((S32) (*this->mNameValueReference.u32) != a)) - { - b_changed = TRUE; - } *mNameValueReference.u32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = (F32)a; - if (b_changed) - { - callCallback(); - } break; default: break; } - if (b_changed) - { - callCallback(); - } return; } @@ -1041,45 +858,17 @@ void LLNameValue::setU32(const U32 a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_S32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.s32 != (S32) a)) - { - b_changed = TRUE; - } *mNameValueReference.s32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_U32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.u32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.u32 = a; - if (b_changed) - { - callCallback(); - } break; case NVT_F32: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.f32 != a)) - { - b_changed = TRUE; - } *mNameValueReference.f32 = (F32)a; - if (b_changed) - { - callCallback(); - } break; default: llerrs << "NameValue: Trying to set U32 into a " << mStringType << ", unknown conversion" << llendl; @@ -1093,21 +882,11 @@ void LLNameValue::setVec3(const LLVector3 &a) { if (mClass == NVC_READ_ONLY) return; - BOOL b_changed = FALSE; switch(mType) { case NVT_VEC3: - if ( (mClass == NVC_CALLBACK) - &&(*this->mNameValueReference.vec3 != a)) - { - b_changed = TRUE; - } *mNameValueReference.vec3 = a; - if (b_changed) - { - callCallback(); - } break; default: llerrs << "NameValue: Trying to set LLVector3 into a " << mStringType << ", unknown conversion" << llendl; @@ -1117,29 +896,6 @@ void LLNameValue::setVec3(const LLVector3 &a) } -BOOL LLNameValue::nonzero() -{ - switch(mType) - { - case NVT_STRING: - if (!mNameValueReference.string) - return 0; - return (mNameValueReference.string[0] != 0); - case NVT_F32: - return (*mNameValueReference.f32 != 0.f); - case NVT_S32: - return (*mNameValueReference.s32 != 0); - case NVT_U32: - return (*mNameValueReference.u32 != 0); - case NVT_VEC3: - return (mNameValueReference.vec3->magVecSquared() != 0.f); - default: - llerrs << "NameValue: Trying to call nonzero on a " << mStringType << ", unknown conversion" << llendl; - break; - } - return FALSE; -} - std::string LLNameValue::printNameValue() { std::string buffer; @@ -1217,951 +973,3 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a) return s; } - -// nota bene: return values aren't static for now to prevent memory leaks - -LLNameValue &operator+(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - - S32 length1 = (S32)strlen(a.mNameValueReference.string); /* Flawfinder: Ignore */ - S32 length2 = (S32)strlen(b.mNameValueReference.string); /* Flawfinder: Ignore */ - delete [] retval.mNameValueReference.string; - retval.mNameValueReference.string = new char[length1 + length2 + 1]; - if(retval.mNameValueReference.string != NULL) - { - strcpy(retval.mNameValueReference.string, a.mNameValueReference.string); /* Flawfinder: Ignore */ - strcat(retval.mNameValueReference.string, b.mNameValueReference.string); /* Flawfinder: Ignore */ - } - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 + *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 + *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 + *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 + *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 + *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 + *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown add of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator-(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 - *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 - *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 - *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 - *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 - *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 - *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown subtract of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator*(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 * *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 * *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 * *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32((*a.mNameValueReference.vec3) * (*b.mNameValueReference.vec3)); - } - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator/(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 / *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 / *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 / *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 / *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 / *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown divide of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - -LLNameValue &operator%(const LLNameValue &a, const LLNameValue &b) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - break; - case NVT_S32: - if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.s32 % *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_S32) - { - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(*a.mNameValueReference.u32 % *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - retval.mType = NVT_U32; - retval.mStringType = NameValueTypeStrings[NVT_U32]; - delete retval.mNameValueReference.u32; - retval.mNameValueReference.u32 = new U32(*a.mNameValueReference.u32 % *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 % *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown % of NV type " << a.mStringType << " to " << b.mStringType << llendl; - break; - } - return retval; -} - - -// Multiplying anything times a float gives you some floats -LLNameValue &operator*(const LLNameValue &a, F32 k) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k); - break; - case NVT_S32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k); - break; - case NVT_U32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k); - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl; - break; - } - return retval; -} - - -LLNameValue &operator*(F32 k, const LLNameValue &a) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.f32 * k); - break; - case NVT_S32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.s32 * k); - break; - case NVT_U32: - retval.mType = NVT_F32; - retval.mStringType = NameValueTypeStrings[NVT_F32]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(*a.mNameValueReference.u32 * k); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(*a.mNameValueReference.vec3 * k); - break; - default: - llerrs << "Unknown multiply of NV type " << a.mStringType << " with F32" << llendl; - break; - } - return retval; -} - - -bool operator==(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - if (!a.mNameValueReference.string) - return FALSE; - if (!b.mNameValueReference.string) - return FALSE; - return (!strcmp(a.mNameValueReference.string, b.mNameValueReference.string)); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 == *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 == (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 == *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 == *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 == *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - return (*a.mNameValueReference.vec3 == *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown == NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - -bool operator<=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if (b.mType == NVT_STRING) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval <= 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 <= *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 <= (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 <= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 <= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 <= *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown <= NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator>=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval >= 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 >= *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 >= (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 >= *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 >= *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 >= *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown >= NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator<(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval < 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 < *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 < (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 < *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 < *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 < *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown < NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -bool operator>(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - S32 retval = strcmp(a.mNameValueReference.string, b.mNameValueReference.string); - return (retval > 0); - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 > *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 > (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 > *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 > *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 > *b.mNameValueReference.u32); - } - break; - default: - llerrs << "Unknown > NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - -bool operator!=(const LLNameValue &a, const LLNameValue &b) -{ - switch(a.mType) - { - case NVT_STRING: - if ( (a.mType == b.mType) - &&(a.mType == NVT_STRING)) - { - return (strcmp(a.mNameValueReference.string, b.mNameValueReference.string)) ? true : false; - } - break; - case NVT_F32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.f32 != *b.mNameValueReference.u32); - } - break; - case NVT_S32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.s32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return (*a.mNameValueReference.s32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.s32 != (S32) *b.mNameValueReference.u32); - } - break; - case NVT_U32: - if (b.mType == NVT_F32) - { - return (*a.mNameValueReference.u32 != *b.mNameValueReference.f32); - } - else if (b.mType == NVT_S32) - { - return ((S32) *a.mNameValueReference.u32 != *b.mNameValueReference.s32); - } - else if (b.mType == NVT_U32) - { - return (*a.mNameValueReference.u32 != *b.mNameValueReference.u32); - } - break; - case NVT_VEC3: - if ( (a.mType == b.mType) - &&(a.mType == NVT_VEC3)) - { - return (*a.mNameValueReference.vec3 != *b.mNameValueReference.vec3); - } - break; - default: - llerrs << "Unknown != NV type " << a.mStringType << " with " << b.mStringType << llendl; - break; - } - return FALSE; -} - - -LLNameValue &operator-(const LLNameValue &a) -{ - static LLNameValue retval; - - switch(a.mType) - { - case NVT_STRING: - break; - case NVT_F32: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.f32; - retval.mNameValueReference.f32 = new F32(-*a.mNameValueReference.f32); - break; - case NVT_S32: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.s32; - retval.mNameValueReference.s32 = new S32(-*a.mNameValueReference.s32); - break; - case NVT_U32: - retval.mType = NVT_S32; - retval.mStringType = NameValueTypeStrings[NVT_S32]; - delete retval.mNameValueReference.s32; - // Can't do unary minus on U32, doesn't work. - retval.mNameValueReference.s32 = new S32(-S32(*a.mNameValueReference.u32)); - break; - case NVT_VEC3: - retval.mType = a.mType; - retval.mStringType = NameValueTypeStrings[a.mType]; - delete retval.mNameValueReference.vec3; - retval.mNameValueReference.vec3 = new LLVector3(-*a.mNameValueReference.vec3); - break; - default: - llerrs << "Unknown - NV type " << a.mStringType << llendl; - break; - } - return retval; -} diff --git a/indra/llmessage/llnamevalue.h b/indra/llmessage/llnamevalue.h index 7a4c80f3f3..4d40328c59 100644 --- a/indra/llmessage/llnamevalue.h +++ b/indra/llmessage/llnamevalue.h @@ -32,15 +32,26 @@ #ifndef LL_LLNAMEVALUE_H #define LL_LLNAMEVALUE_H -#include "string_table.h" +// As of January 2008, I believe we only use the following name-value +// pairs. This is hard to prove because they are initialized from +// strings. JC +// +// FirstName STRING +// LastName STRING +// AttachPt U32 +// AttachmentItemId STRING +// Title STRING +// AttachmentOffset VEC3 +// AttachmentOrientation VEC3 +// SitObject STRING +// SitPosition VEC3 + #include "llmath.h" #include "v3math.h" #include "lldbstrings.h" class LLNameValue; -typedef void (*TNameValueCallback)(LLNameValue *changed, void **user_data); - -void add_use_callback(char *name, TNameValueCallback ucb, void **user_data); +class LLStringTable; typedef enum e_name_value_types { @@ -61,7 +72,6 @@ typedef enum e_name_value_class NVC_NULL, NVC_READ_ONLY, NVC_READ_WRITE, - NVC_CALLBACK, NVC_EOF } ENameValueClass; @@ -110,17 +120,13 @@ class LLNameValue { public: void baseInit(); - void init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, - TNameValueCallback nvcb = NULL, void **user_data = NULL); + void init(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto ); LLNameValue(); LLNameValue(const char *data); - LLNameValue(const char *name, const char *type, const char *nvclass, - TNameValueCallback nvcb = NULL, void **user_data = NULL); - LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, - TNameValueCallback nvcb = NULL, void **user_data = NULL); - LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto, - TNameValueCallback nvcb = NULL, void **user_data = NULL); + LLNameValue(const char *name, const char *type, const char *nvclass ); + LLNameValue(const char *name, const char *data, const char *type, const char *nvclass ); + LLNameValue(const char *name, const char *data, const char *type, const char *nvclass, const char *nvsendto ); ~LLNameValue(); @@ -130,7 +136,6 @@ public: S32 *getS32(); void getVec3(LLVector3 &vec); LLVector3 *getVec3(); - F32 magnitude(); U32 *getU32(); U64 *getU64(); @@ -157,27 +162,8 @@ public: void setVec3(const LLVector3 &a); void setU32(const U32 a); - BOOL nonzero(); - friend std::ostream& operator<<(std::ostream& s, const LLNameValue &a); - friend LLNameValue &operator+(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator-(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator*(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator/(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator%(const LLNameValue &a, const LLNameValue &b); - friend LLNameValue &operator*(const LLNameValue &a, F32 k); - friend LLNameValue &operator*(F32 k, const LLNameValue &a); - - friend bool operator==(const LLNameValue &a, const LLNameValue &b); - friend bool operator<=(const LLNameValue &a, const LLNameValue &b); - friend bool operator>=(const LLNameValue &a, const LLNameValue &b); - friend bool operator<(const LLNameValue &a, const LLNameValue &b); - friend bool operator>(const LLNameValue &a, const LLNameValue &b); - friend bool operator!=(const LLNameValue &a, const LLNameValue &b); - - friend LLNameValue &operator-(const LLNameValue &a); - private: void printNameValue(std::ostream& s); @@ -193,8 +179,6 @@ public: UNameValueReference mNameValueReference; LLStringTable *mNVNameTable; - TNameValueCallback mNameValueCB; - void **mUserData; }; extern LLStringTable gNVNameTable; diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 5f3fad8b8c..65d76bba28 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -172,9 +172,10 @@ const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1 << 6; const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1 << 7; const U32 ESTATE_ACCESS_MANAGER_ADD = 1 << 8; const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1 << 9; +const U32 ESTATE_ACCESS_NO_REPLY = 1 << 10; const S32 ESTATE_MAX_MANAGERS = 10; -const S32 ESTATE_MAX_ACCESS_IDS = 300; // max for access, banned +const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access, banned const S32 ESTATE_MAX_GROUP_IDS = (S32) ESTATE_ACCESS_MAX_ENTRIES_PER_PACKET; // 'Sim Wide Delete' flags diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp index a984b597e4..8be4ddcc74 100644 --- a/indra/mac_updater/mac_updater.cpp +++ b/indra/mac_updater/mac_updater.cpp @@ -416,6 +416,7 @@ int main(int argc, char **argv) if(err == noErr) { ShowWindow(gWindow); + SelectWindow(gWindow); } if(err == noErr) diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index 80d840271b..961e86c6cb 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -458,8 +458,6 @@ PARCEL_FLAG_USE_BAN_LIST Used with llGetParcelFlags to find if a parcel uses a PARCEL_FLAG_USE_LAND_PASS_LIST Used with llGetParcelFlags to find if a parcel allows passes to be purchased PARCEL_FLAG_LOCAL_SOUND_ONLY Used with llGetParcelFlags to find if a parcel restricts spacialized sound to the parcel PARCEL_FLAG_RESTRICT_PUSHOBJECT Used with llGetParcelFlags to find if a parcel restricts llPushObject() calls -PARCEL_FLAG_LOCAL_SOUND_ONLY Used with llGetParcelFlags to find if a parcel restricts spacialized sound to the parcel -PARCEL_FLAG_RESTRICT_PUSHOBJECT Used with llGetParcelFlags to find if a parcel restricts llPushObject() calls PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY Used with llGetParcelFlags to find if a parcel allows all objects to enter PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY Used with llGetParcelFlags to find if a parcel only allows group (and owner) objects to enter diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8c7af9ebf7..04daf7ceb7 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -252,7 +252,6 @@ BOOL gGodConnect = FALSE; BOOL gAcceptTOS = FALSE; BOOL gAcceptCriticalMessage = FALSE; -LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. eLastExecEvent gLastExecEvent = LAST_EXEC_NORMAL; LLSD gDebugInfo; @@ -1014,8 +1013,12 @@ bool LLAppViewer::init() // Build a string representing the current version number. gCurrentVersion = llformat("%s %d.%d.%d.%d", gChannelName.c_str(), LL_VERSION_MAJOR, LL_VERSION_MINOR, LL_VERSION_PATCH, LL_VERSION_BUILD ); - + // + // Various introspection concerning the libs we're using. + // + llinfos << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << llendl; + // Merge with the command line overrides gSavedSettings.applyOverrides(gCommandLineSettings); @@ -1248,17 +1251,6 @@ bool LLAppViewer::init() // Load Custom bindings (override defaults) gViewerKeyboard.loadBindings(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"custom_keys.ini").c_str()); - // Calculate the digest for the executable (takes < 90ms on a fast machine). - FILE* app_file = LLFile::fopen( gDirUtilp->getExecutablePathAndName().c_str(), "rb" ); /* Flawfinder: ignore */ - if( app_file ) - { - LLMD5 app_md5; - app_md5.update( app_file ); // Automatically closes the file - app_md5.finalize(); - app_md5.raw_digest( gViewerDigest.mData ); - } - llinfos << "Viewer Digest: " << gViewerDigest << llendl; - // If we don't have the right GL requirements, exit. if (!gGLManager.mHasRequirements && !gNoRender) { @@ -1368,7 +1360,7 @@ bool LLAppViewer::mainLoop() gViewerWindow->mWindow->gatherInput(); } -#if 1 && !RELEASE_FOR_DOWNLOAD +#if 1 && !LL_RELEASE_FOR_DOWNLOAD // once per second debug info if (debugTime.getElapsedTimeF32() > 1.f) { diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 9518636f87..da3f5d54c1 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -224,7 +224,6 @@ extern BOOL gGodConnect; // llstartup extern BOOL gAcceptTOS; extern BOOL gAcceptCriticalMessage; -extern LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. typedef enum { diff --git a/indra/newview/lldelayedgestureerror.cpp b/indra/newview/lldelayedgestureerror.cpp new file mode 100644 index 0000000000..aaa49b831d --- /dev/null +++ b/indra/newview/lldelayedgestureerror.cpp @@ -0,0 +1,125 @@ +/** + * @file lldelayedgestureerror.cpp + * @brief Delayed gesture error message -- try to wait until name has been retrieved + * @author Dale Glass + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "lldelayedgestureerror.h" +#include <list> +#include "llnotify.h" +#include "llcallbacklist.h" +#include "llinventory.h" +#include "llviewerinventory.h" +#include "llinventorymodel.h" + +const F32 MAX_NAME_WAIT_TIME = 5.0f; + +LLDelayedGestureError::ErrorQueue LLDelayedGestureError::sQueue; + +//static +void LLDelayedGestureError::gestureMissing(const LLUUID &id) +{ + LLErrorEntry ent("GestureMissing", id); + if ( ! doDialog(ent) ) + { + enqueue(ent); + } +} + +//static +void LLDelayedGestureError::gestureFailedToLoad(const LLUUID &id) +{ + LLErrorEntry ent("UnableToLoadGesture", id); + + if ( ! doDialog(ent) ) + { + enqueue(ent); + } +} + +//static +void LLDelayedGestureError::enqueue(const LLErrorEntry &ent) +{ + if ( sQueue.empty() ) + { + gIdleCallbacks.addFunction(onIdle, NULL); + } + + sQueue.push_back(ent); +} + +//static +void LLDelayedGestureError::onIdle(void *userdata) +{ + if ( ! sQueue.empty() ) + { + LLErrorEntry ent = sQueue.front(); + sQueue.pop_front(); + + if ( ! doDialog(ent, false ) ) + { + enqueue(ent); + } + } + else + { + // Nothing to do anymore + gIdleCallbacks.deleteFunction(onIdle, NULL); + } +} + +//static +bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) +{ + LLStringBase<char>::format_map_t args; + LLInventoryItem *item = gInventory.getItem( ent.mItemID ); + + if ( item ) + { + args["[NAME]"] = item->getName(); + } + else + { + if ( uuid_ok || ent.mTimer.getElapsedTimeF32() > MAX_NAME_WAIT_TIME ) + { + args["[NAME]"] = LLString( ent.mItemID.asString() ); + } + else + { + return false; + } + } + + + LLNotifyBox::showXml(ent.mNotifyName, args); + + return true; +} + diff --git a/indra/newview/lldelayedgestureerror.h b/indra/newview/lldelayedgestureerror.h new file mode 100644 index 0000000000..8430a9b848 --- /dev/null +++ b/indra/newview/lldelayedgestureerror.h @@ -0,0 +1,82 @@ +/** + * @file lldelayedgestureerror.h + * @brief Delayed gesture error message -- try to wait until name has been retrieved + * @author Dale Glass + * + * $LicenseInfo:firstyear=2004&license=viewergpl$ + * + * Copyright (c) 2004-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + + +#ifndef LL_DELAYEDGESTUREERROR_H +#define LL_DELAYEDGESTUREERROR_H + +#include <list> +#include "lltimer.h" + +// TODO: Refactor to be more generic - this may be useful for other delayed notifications in the future + +class LLDelayedGestureError +{ +public: + /** + * @brief Generates a missing gesture error + * @param id UUID of missing gesture + * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description + */ + static void gestureMissing(const LLUUID &id); + + /** + * @brief Generates a gesture failed to load error + * @param id UUID of missing gesture + * Delays message for up to 5 seconds if UUID can't be immediately converted to a text description + */ + static void gestureFailedToLoad(const LLUUID &id); + +private: + + + struct LLErrorEntry + { + LLErrorEntry(const LLString& notify, const LLUUID &item) : mTimer(), mNotifyName(notify), mItemID(item) {} + + LLTimer mTimer; + LLString mNotifyName; + LLUUID mItemID; + }; + + + static bool doDialog(const LLErrorEntry &ent, bool uuid_ok = false); + static void enqueue(const LLErrorEntry &ent); + static void onIdle(void *userdata); + + typedef std::list<LLErrorEntry> ErrorQueue; + + static ErrorQueue sQueue; +}; + + +#endif diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 4edf6f3652..bf8b1fd663 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -168,12 +168,6 @@ LLFloaterAbout::LLFloaterAbout() support.append("\n"); } - // MD5 digest of executable - support.append("Viewer Digest: "); - char viewer_digest_string[UUID_STR_LENGTH]; /*Flawfinder: ignore*/ - gViewerDigest.toString( viewer_digest_string ); - support.append(viewer_digest_string); - // Fix views childDisable("credits_editor"); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 375523cc39..00c6f0de73 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -225,14 +225,33 @@ void LLFloaterRegionInfo::onOpen() gFloaterView->getNewFloaterPosition(&left, &top); rect.translate(left,top); - requestRegionInfo(); refreshFromRegion(gAgent.getRegion()); + requestRegionInfo(); LLFloater::onOpen(); } // static void LLFloaterRegionInfo::requestRegionInfo() { + LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); + if(tab) + { + LLPanel* panel; + + panel = LLUICtrlFactory::getPanelByName(tab, "General"); + if (panel) panel->setCtrlsEnabled(FALSE); + + panel = LLUICtrlFactory::getPanelByName(tab, "Debug"); + if (panel) panel->setCtrlsEnabled(FALSE); + + panel = LLUICtrlFactory::getPanelByName(tab, "Terrain"); + if (panel) panel->setCtrlsEnabled(FALSE); + + panel = LLUICtrlFactory::getPanelByName(tab, "Estate"); + if (panel) panel->setCtrlsEnabled(FALSE); + + } + // Must allow anyone to request the RegionInfo data // so non-owners/non-gods can see the values. // Therefore can't use an EstateOwnerMessage JC @@ -278,6 +297,11 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**) //dispatch the message dispatch.dispatch(request, invoice, strings); + + LLViewerRegion* region = gAgent.getRegion(); + BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + panel->setCtrlsEnabled(allow_modify); + } @@ -295,6 +319,9 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) LLTabContainer* tab = LLUICtrlFactory::getTabContainerByName(findInstance(), "region_panels"); if(!tab) return; + LLViewerRegion* region = gAgent.getRegion(); + BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); + // extract message char sim_name[MAX_STRING]; /* Flawfinder: ignore*/ U32 region_flags; @@ -335,13 +362,13 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->childSetValue("access_combo", LLSD(LLViewerRegion::accessToString(sim_access)) ); - // detect teen grid for maturity - LLViewerRegion* region = gAgent.getRegion(); + // detect teen grid for maturity U32 parent_estate_id; msg->getU32("RegionInfo", "ParentEstateID", parent_estate_id); BOOL teen_grid = (parent_estate_id == 5); // *TODO add field to estate table and test that panel->childSetEnabled("access_combo", gAgent.isGodlike() || (region && region->canManageEstate() && !teen_grid)); + panel->setCtrlsEnabled(allow_modify); // DEBUG PANEL @@ -352,6 +379,7 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->childSetValue("disable_scripts_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_SCRIPTS)) ); panel->childSetValue("disable_collisions_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_COLLISIONS)) ); panel->childSetValue("disable_physics_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SKIP_PHYSICS)) ); + panel->setCtrlsEnabled(allow_modify); // TERRAIN PANEL panel = LLUICtrlFactory::getPanelByName(tab, "Terrain"); @@ -363,11 +391,11 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->childSetValue("terrain_lower_spin", LLSD(terrain_lower_limit)); panel->childSetValue("use_estate_sun_check", LLSD(use_estate_sun)); - BOOL allow_modify = gAgent.isGodlike() || (region && region->canManageEstate()); panel->childSetValue("fixed_sun_check", LLSD((BOOL)(region_flags & REGION_FLAGS_SUN_FIXED))); panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); + panel->setCtrlsEnabled(allow_modify); getInstance()->refreshFromRegion( gAgent.getRegion() ); } @@ -584,7 +612,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() initCtrl("block_terraform_check"); initCtrl("block_fly_check"); initCtrl("allow_damage_check"); - initCtrl("allow_land_resell_check"); + initCtrl("allow_land_resell_check"); initCtrl("allow_parcel_changes_check"); initCtrl("agent_limit_spin"); initCtrl("object_bonus_spin"); @@ -1690,11 +1718,12 @@ bool LLPanelEstateInfo::isLindenEstate() return (estate_id <= ESTATE_LAST_LINDEN); } +typedef std::vector<LLUUID> AgentOrGroupIDsVector; struct LLEstateAccessChangeInfo { U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc. LLString mDialogName; - LLUUID mAgentOrGroupID; + AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change }; // Special case callback for groups, since it has different callback format than names @@ -1704,7 +1733,7 @@ void LLPanelEstateInfo::addAllowedGroup2(LLUUID id, void* user_data) LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo; change_info->mOperationFlag = ESTATE_ACCESS_ALLOWED_GROUP_ADD; change_info->mDialogName = "EstateAllowedGroupAdd"; - change_info->mAgentOrGroupID = id; + change_info->mAgentOrGroupIDs.push_back(id); if (isLindenEstate()) { @@ -1749,8 +1778,8 @@ void LLPanelEstateInfo::accessAddCore2(S32 option, void* data) return; } - // avatar picker no multi-select, yes close-on-select - LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, FALSE, TRUE); + // avatar picker yes multi-select, yes close-on-select + LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE); } // static @@ -1766,21 +1795,44 @@ void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, co return; } // User did select a name. - change_info->mAgentOrGroupID = ids[0]; - + change_info->mAgentOrGroupIDs = ids; // Can't put estate owner on ban list LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate(); if (!panel) return; LLViewerRegion* region = gAgent.getRegion(); if (!region) return; - - if ((change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) - && (region->getOwner() == change_info->mAgentOrGroupID)) + + if (change_info->mOperationFlag & ESTATE_ACCESS_ALLOWED_AGENT_ADD) { - gViewerWindow->alertXml("OwnerCanNotBeDenied"); - delete change_info; - change_info = NULL; - return; + LLCtrlListInterface *list = panel->childGetListInterface("allowed_avatar_name_list"); + int currentCount = (list ? list->getItemCount() : 0); + if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) + { + LLString::format_map_t args; + args["[NUM_ADDED]"] = llformat("%d",ids.size()); + args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); + args["[LIST_TYPE]"] = "Allowed Residents"; + args["[NUM_EXCESS]"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); + gViewerWindow->alertXml("MaxAgentOnRegionBatch", args); + delete change_info; + return; + } + } + if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) + { + LLCtrlListInterface *list = panel->childGetListInterface("banned_avatar_name_list"); + int currentCount = (list ? list->getItemCount() : 0); + if (ids.size() + currentCount > ESTATE_MAX_ACCESS_IDS) + { + LLString::format_map_t args; + args["[NUM_ADDED]"] = llformat("%d",ids.size()); + args["[MAX_AGENTS]"] = llformat("%d",ESTATE_MAX_ACCESS_IDS); + args["[LIST_TYPE]"] = "Banned Residents"; + args["[NUM_EXCESS]"] = llformat("%d",(ids.size()+currentCount)-ESTATE_MAX_ACCESS_IDS); + gViewerWindow->alertXml("MaxAgentOnRegionBatch", args); + delete change_info; + return; + } } if (isLindenEstate()) @@ -1804,21 +1856,29 @@ void LLPanelEstateInfo::accessRemoveCore(U32 operation_flag, const char* dialog_ if (!panel) return; LLNameListCtrl* name_list = LLViewerUICtrlFactory::getNameListByName(panel, list_ctrl_name); if (!name_list) return; - LLScrollListItem* item = name_list->getFirstSelected(); - if (!item) return; - LLUUID agent_id = item->getUUID(); + + std::vector<LLScrollListItem*> list_vector = name_list->getAllSelected(); + if (list_vector.size() == 0) + return; LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo; - change_info->mAgentOrGroupID = agent_id; change_info->mOperationFlag = operation_flag; change_info->mDialogName = dialog_name; - + + for (std::vector<LLScrollListItem*>::const_iterator iter = list_vector.begin(); + iter != list_vector.end(); + iter++) + { + LLScrollListItem *item = (*iter); + change_info->mAgentOrGroupIDs.push_back(item->getUUID()); + } + if (isLindenEstate()) { // warn on change linden estate gViewerWindow->alertXml("ChangeLindenAccess", - accessRemoveCore2, - (void*)change_info); + accessRemoveCore2, + (void*)change_info); } else { @@ -1850,9 +1910,9 @@ void LLPanelEstateInfo::accessRemoveCore2(S32 option, void* data) LLString::format_map_t args; args["[ALL_ESTATES]"] = all_estates_text(); gViewerWindow->alertXml(change_info->mDialogName, - args, - accessCoreConfirm, - (void*)change_info); + args, + accessCoreConfirm, + (void*)change_info); } } @@ -1862,35 +1922,54 @@ void LLPanelEstateInfo::accessRemoveCore2(S32 option, void* data) void LLPanelEstateInfo::accessCoreConfirm(S32 option, void* data) { LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data; - U32 flags = change_info->mOperationFlag; - switch(option) + const U32 originalFlags = change_info->mOperationFlag; + AgentOrGroupIDsVector& ids = change_info->mAgentOrGroupIDs; + + LLViewerRegion* region = gAgent.getRegion(); + + for (AgentOrGroupIDsVector::const_iterator iter = ids.begin(); + iter != ids.end(); + iter++) { - case 0: - // This estate - sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); - break; - case 1: + U32 flags = originalFlags; + if (iter + 1 != ids.end()) + flags |= ESTATE_ACCESS_NO_REPLY; + + const LLUUID id = (*iter); + if ((change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD) + && region && (region->getOwner() == id)) { - // All estates, either than I own or manage for this owner. - // This will be verified on simulator. JC - LLViewerRegion* region = gAgent.getRegion(); - if (!region) break; - if (region->getOwner() == gAgent.getID() - || gAgent.isGodlike()) - { - flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES; - sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); - } - else if (region->isEstateManager()) + gViewerWindow->alertXml("OwnerCanNotBeDenied"); + break; + } + switch(option) + { + case 0: + // This estate + sendEstateAccessDelta(flags, id); + break; + case 1: { - flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; - sendEstateAccessDelta(flags, change_info->mAgentOrGroupID); + // All estates, either than I own or manage for this owner. + // This will be verified on simulator. JC + if (!region) break; + if (region->getOwner() == gAgent.getID() + || gAgent.isGodlike()) + { + flags |= ESTATE_ACCESS_APPLY_TO_ALL_ESTATES; + sendEstateAccessDelta(flags, id); + } + else if (region->isEstateManager()) + { + flags |= ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES; + sendEstateAccessDelta(flags, id); + } + break; } - break; + case 2: + default: + break; } - case 2: - default: - break; } delete change_info; change_info = NULL; diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 32c712d926..51e28047f5 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -50,6 +50,7 @@ // newview #include "llagent.h" #include "llchatbar.h" +#include "lldelayedgestureerror.h" #include "llinventorymodel.h" #include "llnotify.h" #include "llviewermessage.h" @@ -1006,20 +1007,14 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs, gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); } - // Get missing gesture's name. Use UUID if name can't be found. - LLStringBase<char>::format_map_t args; - LLInventoryItem *item = gInventory.getItem( item_id ); - args["[NAME]"] = item ? item->getName() : LLString( item_id.asString() ); - - if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { - LLNotifyBox::showXml("GestureMissing", args); + LLDelayedGestureError::gestureMissing( item_id ); } else { - LLNotifyBox::showXml("UnableToLoadGesture", args); + LLDelayedGestureError::gestureFailedToLoad( item_id ); } llwarns << "Problem loading gesture: " << status << llendl; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 4dc5bfddec..3242e7d474 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -80,7 +80,7 @@ LLIMMgr* gIMMgr = NULL; // // Statics // -//*FIXME: make these all either UIStrings or Strings +// *FIXME: make these all either UIStrings or Strings static LLString sOnlyUserMessage; static LLUIString sOfflineMessage; static LLUIString sInviteMessage; @@ -374,7 +374,7 @@ LLIMMgr::LLIMMgr() : mFriendObserver = new LLIMViewFriendObserver(this); LLAvatarTracker::instance().addObserver(mFriendObserver); - //*HACK: use floater to initialize string constants from xml file + // *HACK: use floater to initialize string constants from xml file // then delete it right away LLFloaterIM* dummy_floater = new LLFloaterIM(); delete dummy_floater; @@ -738,7 +738,7 @@ void LLIMMgr::inviteToSession( if (channelp && channelp->callStarted()) { // you have already started a call to the other user, so just accept the invite - inviteUserResponse(0, invite); + inviteUserResponse(0, invite); // inviteUserResponse deletes return; } @@ -752,7 +752,7 @@ void LLIMMgr::inviteToSession( if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly")) { // invite not from a friend, so decline - inviteUserResponse(1, invite); + inviteUserResponse(1, invite); // inviteUserResponse deletes return; } } @@ -771,13 +771,17 @@ void LLIMMgr::inviteToSession( args["[GROUP]"] = session_name; LLNotifyBox::showXml(notify_box_type, - args, - inviteUserResponse, - (void*)invite); + args, + inviteUserResponse, + (void*)invite); // inviteUserResponse deletes } mPendingInvitations[session_id.asString()] = LLSD(); } + else + { + delete invite; + } } //static diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 9ef666b357..432854f62e 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -199,7 +199,7 @@ public: protected: LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : - mInventoryPanel(inventory), mUUID(uuid) {} + mInventoryPanel(inventory), mUUID(uuid), mInvType(LLInventoryType::IT_NONE) {} LLInventoryObject* getInventoryObject() const; BOOL isInTrash() const; @@ -297,7 +297,7 @@ public: protected: LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : - LLInvFVBridge(inventory, uuid) {} + LLInvFVBridge(inventory, uuid), mCallingCards(FALSE), mWearables(FALSE) {} // menu callbacks static void pasteClipboard(void* user_data); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index ba2925d45a..691a786245 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -49,6 +49,7 @@ #include "llbutton.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "lldelayedgestureerror.h" #include "llfloatergesture.h" // for some label constants #include "llgesturemgr.h" #include "llinventorymodel.h" @@ -955,11 +956,6 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, } else { - // Get missing gesture's name. Use UUID if name can't be found. - LLStringBase<char>::format_map_t args; - LLInventoryItem *item = gInventory.getItem( *item_idp ); - args["[NAME]"] = item ? item->getName() : LLString( item_idp->asString() ); - if( gViewerStats ) { gViewerStats->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); @@ -968,11 +964,11 @@ void LLPreviewGesture::onLoadComplete(LLVFS *vfs, if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || LL_ERR_FILE_EMPTY == status) { - LLNotifyBox::showXml("GestureMissing", args); + LLDelayedGestureError::gestureMissing( *item_idp ); } else { - LLNotifyBox::showXml("UnableToLoadGesture", args); + LLDelayedGestureError::gestureFailedToLoad( *item_idp ); } llwarns << "Problem loading gesture: " << status << llendl; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d2bc8f4100..13dfe45f3e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1021,7 +1021,6 @@ BOOL idle_startup() gSkipOptionalUpdate, gAcceptTOS, gAcceptCriticalMessage, - gViewerDigest, gLastExecEvent, requested_options, hashed_mac_string, diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6bd81e76e9..0f478d86d4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5180,7 +5180,7 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) msg->getVector3("Data", "SimPosition", pos); msg->getVector3("Data", "LookAt", look_at); - // gFloaterWorldMap->trackURL(sim_name, (U32)pos.mV[VX], (U32)pos.mV[VY], (U32)pos.mV[VZ]); + // gFloaterWorldMap->trackURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); // LLFloaterWorldMap::show(NULL, TRUE); LLURLDispatcher::dispatch(LLURLDispatcher::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE); diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index c94ee7c54e..4e030c7abc 100644 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -207,39 +207,6 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID } -LLWearable* LLWearableList::createLegacyWearableFromAvatar( EWearableType type ) -{ - llinfos << "LLWearableList::createLegacyWearableFromAvatar" << llendl; - - LLTransactionID tid; - LLAssetID new_asset_id; - tid.generate(); - new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); - - LLWearable* wearable = new LLWearable( tid ); - wearable->setType( type ); - wearable->setName( wearable->getTypeLabel() ); - wearable->setDescription( "Recovered from lost asset." ); - - LLVOAvatar* avatar = gAgent.getAvatarObject(); - LLPermissions perm; - perm.init( avatar->getID(), avatar->getID(), LLUUID::null, LLUUID::null ); - perm.initMasks(PERM_TRANSFER, PERM_TRANSFER, PERM_NONE, PERM_NONE, PERM_MOVE | PERM_TRANSFER); - wearable->setPermissions( perm ); - - // Save info is the default. - - wearable->readFromAvatar(); - - mList[ new_asset_id ] = wearable; - - // Send to the dataserver - wearable->saveNewAsset(); - - return wearable; -} - - // Creates a new wearable just like the old_wearable but with data copied over from item LLWearable* LLWearableList::createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item ) { diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h index c3a7e1bd91..88434842b4 100644 --- a/indra/newview/llwearablelist.h +++ b/indra/newview/llwearablelist.h @@ -51,8 +51,6 @@ public: void(*asset_arrived_callback)(LLWearable*, void* userdata), void* userdata ); - LLWearable* createLegacyWearableFromAvatar( EWearableType type ); - LLWearable* createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item ); LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = std::string() ); LLWearable* createCopy( LLWearable* old_wearable ); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 136612e1a8..f42ec51b5d 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1896,7 +1896,7 @@ void renderPhysicalBeacons(LLDrawable* drawablep) LLViewerObject *vobj = drawablep->getVObj(); if (vobj && !vobj->isAvatar() - && !vobj->getParent() + //&& !vobj->getParent() && vobj->usePhysics()) { if (gPipeline.sRenderBeacons) diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp index 2bd0169453..d1466e923e 100644 --- a/indra/test/llstreamtools_tut.cpp +++ b/indra/test/llstreamtools_tut.cpp @@ -491,7 +491,7 @@ namespace tut is.str(str = "First Second \t \r\n Third Fourth-ShouldThisBePartOfFourth IsThisFifth\n"); actual_result = ""; ret = get_line(actual_result, is); - expected_result = "First Second \t \n"; + expected_result = "First Second \t \r\n"; ensure_equals("get_line: 1", actual_result, expected_result); actual_result = ""; @@ -545,7 +545,6 @@ namespace tut template<> template<> void streamtools_object::test<12>() { - skip_fail("get_line() incorrectly handles lone carriage return."); std::string str; std::string expected_result; std::string actual_result; @@ -554,10 +553,10 @@ namespace tut // need to be check if this test case is wrong or the implementation is wrong. is.clear(); - is.str(str = "Should not skip \r unless they are followed with newline .\r\n"); + is.str(str = "Should not skip lone \r.\r\n"); actual_result = ""; ret = get_line(actual_result, is); - expected_result = "Should not skip \r unless they are followed with newline .\n"; + expected_result = "Should not skip lone \r.\r\n"; ensure_equals("get_line: carriage return skipped even though not followed by newline", actual_result, expected_result); } @@ -804,37 +803,6 @@ namespace tut template<> template<> void streamtools_object::test<21>() { - skip_fail("get_brace_count() has bugs."); - - std::string str; - std::string expected_result; - int count; - - str = " { "; - count = get_brace_count(str); - ensure("get_brace_count: 1 for {", count == 1); - - str = "\t}\t\t \n"; - count = get_brace_count(str); - ensure("get_brace_count: 1 for {", count == -1); - - str = "\t\t\t \n"; - count = get_brace_count(str); - ensure("get_brace_count: 0 for no braces", count == 0); - - str = "{ Remaining line not empty\n"; - count = get_brace_count(str); - ensure("get_brace_count: 0 for remainign line not empty", count == 0); - - /* shouldn't this return 1? */ - str = "{ /*Remaining line in comment*/\n"; - count = get_brace_count(str); - ensure("get_brace_count: 1 for { with remaining line in comment", count == 1); - - /* shouldn't this return -1? */ - str = " } //Remaining line in comment \n"; - count = get_brace_count(str); - ensure("get_brace_count: -1 for } with remaining line in comment", count == -1); } //testcases for get_keyword_and_value() @@ -860,8 +828,6 @@ namespace tut template<> template<> void streamtools_object::test<23>() { - skip_fail("get_keyword_and_value() has bugs."); - std::string s; std::string keyword = "SOME PRIOR KEYWORD"; std::string value = "SOME PRIOR VALUE"; @@ -875,8 +841,6 @@ namespace tut template<> template<> void streamtools_object::test<24>() { - skip_fail("get_keyword_and_value() has bugs."); - std::string s; std::string keyword = "SOME PRIOR KEYWORD"; std::string value = "SOME PRIOR VALUE"; |