From 206993f8439ee83f7d010860f421d1e0106daca0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2022 13:46:19 -0400 Subject: DRTVWR-575: Forbid Xcode 14.1 from implicitly signing every target. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Or rather, attempting to implicitly sign. On TeamCity we must explicitly sign using viewer_manifest.py. On a developer system, without these changes, Xcode produces many errors of the form: error: An empty identity is not valid when signing a binary for the product type 'Command-line Tool'. (in target 'INTEGRATION_TEST_lldir' from project 'SecondLife') and refuses to compile anything at all. Thanks to Rye Mutt and NickyD. Also thanks Geir Nøklebye for additional settings to help tame Xcode 14.1 warnings. --- indra/cmake/Variables.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index e72475cbc4..dd9b1d348f 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -194,9 +194,16 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # development must be done after the build as we do in viewer_manifest.py for # released builds # https://stackoverflow.com/a/54296008 + # With Xcode 14.1, apparently you must take drastic steps to prevent + # implicit signing. + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO) + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO) # "-" represents "Sign to Run Locally" and empty string represents "Do Not Sign" set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") - + set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "") + set(CMAKE_XCODE_ATTRIBUTE_DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING YES) +## Uncomment if the attempt to address this in code gets too pervasive +##set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO) set(CMAKE_OSX_ARCHITECTURES "${ARCH}") string(REPLACE "i686" "i386" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") -- cgit v1.2.3 From 9522a0b7c16414fce2103cf58bfdd63aaf0cb01b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2022 14:58:32 -0400 Subject: DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes. It's a little distressing how often we have historically coded S32 or U32 to pass a length or index. There are more such assumptions in other viewer subdirectories, but this is a start. --- indra/llcommon/llapp.cpp | 6 +- indra/llcommon/llbase64.cpp | 4 +- indra/llcommon/lldefs.h | 54 +++++++-------- indra/llcommon/lldependencies.cpp | 2 +- indra/llcommon/lldependencies.h | 4 +- indra/llcommon/llerror.cpp | 2 +- indra/llcommon/lleventdispatcher.cpp | 24 +++---- indra/llcommon/llinstancetracker.h | 4 +- indra/llcommon/llkeybind.cpp | 12 ++-- indra/llcommon/llkeybind.h | 2 +- indra/llcommon/llmd5.cpp | 34 ++++----- indra/llcommon/llmd5.h | 8 +-- indra/llcommon/llmetricperformancetester.cpp | 4 +- indra/llcommon/llmetricperformancetester.h | 4 +- indra/llcommon/llmortician.cpp | 4 +- indra/llcommon/llmortician.h | 4 +- indra/llcommon/llqueuedthread.cpp | 17 +++-- indra/llcommon/llqueuedthread.h | 10 +-- indra/llcommon/llrun.cpp | 2 +- indra/llcommon/llrun.h | 2 +- indra/llcommon/llsd.cpp | 98 ++++++++++++-------------- indra/llcommon/llsd.h | 12 ++-- indra/llcommon/llsdserialize.cpp | 20 +++--- indra/llcommon/llsdserialize.h | 14 ++-- indra/llcommon/llsdserialize_xml.cpp | 4 +- indra/llcommon/llstreamtools.cpp | 24 +++---- indra/llcommon/llstring.cpp | 10 +-- indra/llcommon/llstring.h | 2 +- indra/llcommon/llsys.cpp | 12 ++-- indra/llcommon/llsys.h | 2 +- indra/llcommon/llsys_objc.mm | 4 +- indra/llcommon/llthreadsafequeue.h | 6 +- indra/llcommon/lltimer.cpp | 2 +- indra/llcommon/lltrace.cpp | 2 +- indra/llcommon/lltrace.h | 4 +- indra/llcommon/lltraceaccumulators.cpp | 4 +- indra/llcommon/lltracerecording.cpp | 64 ++++++++--------- indra/llcommon/lltracerecording.h | 100 +++++++++++++-------------- indra/llcommon/lltracethreadrecorder.cpp | 2 +- indra/llcommon/lltracethreadrecorder.h | 2 +- indra/llcommon/llunittype.h | 8 ++- indra/llcommon/llworkerthread.cpp | 4 +- indra/llcommon/llworkerthread.h | 2 +- indra/llcommon/threadsafeschedule.h | 2 +- 44 files changed, 300 insertions(+), 307 deletions(-) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 8ddd132793..c658075a31 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -905,14 +905,14 @@ bool unix_post_minidump_callback(const char *dump_dir, // heap allocations in a crash handler. // path format: /.dmp - int dirPathLength = strlen(dump_dir); - int idLength = strlen(minidump_id); + auto dirPathLength = strlen(dump_dir); + auto idLength = strlen(minidump_id); // The path must not be truncated. llassert((dirPathLength + idLength + 5) <= LLApp::MAX_MINDUMP_PATH_LENGTH); char * path = LLApp::instance()->getMiniDumpFilename(); - S32 remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; + auto remaining = LLApp::MAX_MINDUMP_PATH_LENGTH; strncpy(path, dump_dir, remaining); remaining -= dirPathLength; path += dirPathLength; diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index 4e82cf7f20..85f22969b8 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size) && input_size > 0) { // Yes, it returns int. - int b64_buffer_length = apr_base64_encode_len(input_size); + int b64_buffer_length = apr_base64_encode_len(int(input_size)); char* b64_buffer = new char[b64_buffer_length]; // This is faster than apr_base64_encode() if you know @@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size) b64_buffer_length = apr_base64_encode_binary( b64_buffer, input, - input_size); + int(input_size)); output.assign(b64_buffer); delete[] b64_buffer; } diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 5a4b8325f4..d9b0cbf71b 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -28,6 +28,7 @@ #define LL_LLDEFS_H #include "stdtypes.h" +#include // Often used array indices const U32 VX = 0; @@ -168,50 +169,51 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc // llclampb(a) // clamps a to [0 .. 255] // -template -inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2) +template +inline auto llmax(T1 d1, T2 d2) { return (d1 > d2) ? d1 : d2; } -template -inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3) +template +inline auto llmax(T1 d1, T2 d2, T3 d3) { - LLDATATYPE r = llmax(d1,d2); + auto r = llmax(d1,d2); return llmax(r, d3); } -template -inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4) +template +inline auto llmax(T1 d1, T2 d2, T3 d3, T4 d4) { - LLDATATYPE r1 = llmax(d1,d2); - LLDATATYPE r2 = llmax(d3,d4); + auto r1 = llmax(d1,d2); + auto r2 = llmax(d3,d4); return llmax(r1, r2); } -template -inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2) +template +inline auto llmin(T1 d1, T2 d2) { return (d1 < d2) ? d1 : d2; } -template -inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3) +template +inline auto llmin(T1 d1, T2 d2, T3 d3) { - LLDATATYPE r = llmin(d1,d2); + auto r = llmin(d1,d2); return (r < d3 ? r : d3); } -template -inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4) +template +inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4) { - LLDATATYPE r1 = llmin(d1,d2); - LLDATATYPE r2 = llmin(d3,d4); + auto r1 = llmin(d1,d2); + auto r2 = llmin(d3,d4); return llmin(r1, r2); } -template -inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const LLDATATYPE& maxval) +template +inline typename std::common_type::type +llclamp(A a, MIN minval, MAX maxval) { if ( a < minval ) { @@ -225,23 +227,21 @@ inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const L } template -inline LLDATATYPE llclampf(const LLDATATYPE& a) +inline LLDATATYPE llclampf(LLDATATYPE a) { - return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)1); + return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(1)); } template -inline LLDATATYPE llclampb(const LLDATATYPE& a) +inline LLDATATYPE llclampb(LLDATATYPE a) { - return llmin(llmax(a, (LLDATATYPE)0), (LLDATATYPE)255); + return llmin(llmax(a, LLDATATYPE(0)), LLDATATYPE(255)); } template inline void llswap(LLDATATYPE& lhs, LLDATATYPE& rhs) { - LLDATATYPE tmp = lhs; - lhs = rhs; - rhs = tmp; + std::swap(lhs, rhs); } #endif // LL_LLDEFS_H diff --git a/indra/llcommon/lldependencies.cpp b/indra/llcommon/lldependencies.cpp index 0d5757effd..db546c5c3b 100644 --- a/indra/llcommon/lldependencies.cpp +++ b/indra/llcommon/lldependencies.cpp @@ -42,7 +42,7 @@ // other Linden headers #include "llexception.h" -LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const +LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(size_t vertices, const EdgeList& edges) const { // Construct a Boost Graph Library graph according to the constraints // we've collected. It seems as though we ought to be able to capture diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h index db2bbab8b0..950af4a4ad 100644 --- a/indra/llcommon/lldependencies.h +++ b/indra/llcommon/lldependencies.h @@ -126,7 +126,7 @@ public: protected: typedef std::vector< std::pair > EdgeList; typedef std::vector VertexList; - VertexList topo_sort(int vertices, const EdgeList& edges) const; + VertexList topo_sort(size_t vertices, const EdgeList& edges) const; /** * refpair is specifically intended to capture a pair of references. This @@ -539,7 +539,7 @@ public: for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end(); nmi != nmend; ++nmi) { - int thisnode = vmap[nmi->first]; + auto thisnode = vmap[nmi->first]; // after dependencies: build edges from the named node to this one for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(), aend = nmi->second.after.end(); diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp index 919d2dabc4..519426e9d1 100644 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -1514,7 +1514,7 @@ namespace LLError const size_t BUF_SIZE = 64; char time_str[BUF_SIZE]; /* Flawfinder: ignore */ - int chars = strftime(time_str, BUF_SIZE, + auto chars = strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now)); diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp index 5b6d4efbe9..cd0ab6bc29 100644 --- a/indra/llcommon/lleventdispatcher.cpp +++ b/indra/llcommon/lleventdispatcher.cpp @@ -178,7 +178,7 @@ private: // store it as a map from name string to position index. Of course that's // easy to generate from the incoming names array, but why do it more than // once? - typedef std::map IndexMap; + typedef std::map IndexMap; IndexMap _indexes; // Generated array of default values, aligned with the array of param names. LLSD _defaults; @@ -197,9 +197,9 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function, { LL_ERRS("LLSDArgsMapper") << function << " names must be an array, not " << names << LL_ENDL; } - LLSD::Integer nparams(_names.size()); + auto nparams(_names.size()); // From _names generate _indexes. - for (LLSD::Integer ni = 0, nend = _names.size(); ni < nend; ++ni) + for (size_t ni = 0, nend = _names.size(); ni < nend; ++ni) { _indexes[_names[ni]] = ni; } @@ -214,7 +214,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function, if (defaults.isUndefined() || defaults.isArray()) { - LLSD::Integer ndefaults = defaults.size(); + auto ndefaults = defaults.size(); // defaults is a (possibly empty) array. Right-align it with names. if (ndefaults > nparams) { @@ -224,10 +224,10 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function, // Offset by which we slide defaults array right to right-align with // _names array - LLSD::Integer offset = nparams - ndefaults; + auto offset = nparams - ndefaults; // Fill rightmost _defaults entries from defaults, and mark them as // filled - for (LLSD::Integer i = 0, iend = ndefaults; i < iend; ++i) + for (size_t i = 0, iend = ndefaults; i < iend; ++i) { _defaults[i + offset] = defaults[i]; _has_dft[i + offset] = 1; @@ -247,7 +247,7 @@ LLSDArgsMapper::LLSDArgsMapper(const std::string& function, continue; } - LLSD::Integer pos = ixit->second; + auto pos = ixit->second; // Store default value at that position in the _defaults array. _defaults[pos] = mi->second; // Don't forget to record the fact that we've filled this @@ -301,7 +301,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const { // Fill args from array. If there are too many args in passed array, // ignore the rest. - LLSD::Integer size(argsmap.size()); + auto size(argsmap.size()); if (size > args.size()) { // We don't just use std::min() because we want to sneak in this @@ -338,7 +338,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const << mi->first << "=" << mi->second << LL_ENDL; continue; } - LLSD::Integer pos = ixit->second; + auto pos = ixit->second; // Store the value at that position in the args array. args[pos] = mi->second; // Don't forget to record the fact that we've filled this @@ -349,7 +349,7 @@ LLSD LLSDArgsMapper::map(const LLSD& argsmap) const // Fill any remaining holes from _defaults. LLSD unfilled(LLSD::emptyArray()); - for (LLSD::Integer i = 0, iend = args.size(); i < iend; ++i) + for (size_t i = 0, iend = args.size(); i < iend; ++i) { if (! filled[i]) { @@ -503,9 +503,9 @@ struct LLEventDispatcher::MapParamsDispatchEntry: public LLEventDispatcher::Para if (defaults.isArray() || defaults.isUndefined()) { // Right-align the params and defaults arrays. - LLSD::Integer offset = params.size() - defaults.size(); + auto offset = params.size() - defaults.size(); // Now the name of every defaults[i] is at params[i + offset]. - for (LLSD::Integer i(0), iend(defaults.size()); i < iend; ++i) + for (size_t i(0), iend(defaults.size()); i < iend; ++i) { // Erase this optional param from mRequired. mRequired.erase(params[i + offset].asString()); diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index 02535a59e7..34f2a5985a 100644 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -99,7 +99,7 @@ public: return mSelf; } - static S32 instanceCount() + static size_t instanceCount() { return LockStatic()->mMap.size(); } @@ -363,7 +363,7 @@ public: return mSelf; } - static S32 instanceCount() + static size_t instanceCount() { return LockStatic()->mSet.size(); } diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp index 38696c2258..f47ba41bae 100644 --- a/indra/llcommon/llkeybind.cpp +++ b/indra/llcommon/llkeybind.cpp @@ -180,10 +180,10 @@ LLKeyBind::LLKeyBind(const LLSD &key_bind) bool LLKeyBind::operator==(const LLKeyBind& rhs) { - U32 size = mData.size(); + auto size = mData.size(); if (size != rhs.mData.size()) return false; - for (U32 i = 0; i < size; i++) + for (size_t i = 0; i < size; i++) { if (mData[i] != rhs.mData[i]) return false; } @@ -193,7 +193,7 @@ bool LLKeyBind::operator==(const LLKeyBind& rhs) bool LLKeyBind::operator!=(const LLKeyBind& rhs) { - U32 size = mData.size(); + auto size = mData.size(); if (size != rhs.mData.size()) return true; for (U32 i = 0; i < size; i++) @@ -215,7 +215,7 @@ bool LLKeyBind::isEmpty() const LLSD LLKeyBind::asLLSD() const { - S32 last = mData.size() - 1; + auto last = mData.size() - 1; while (mData[last].empty()) { last--; @@ -380,7 +380,7 @@ void LLKeyBind::resetKeyData(S32 index) void LLKeyBind::trimEmpty() { - S32 last = mData.size() - 1; + auto last = mData.size() - 1; while (last >= 0 && mData[last].empty()) { mData.erase(mData.begin() + last); @@ -388,7 +388,7 @@ void LLKeyBind::trimEmpty() } } -U32 LLKeyBind::getDataCount() +size_t LLKeyBind::getDataCount() { return mData.size(); } diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index c6b4bd970f..f63ad1d64e 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -95,7 +95,7 @@ public: void clear() { mData.clear(); } // if there any empty LLKeyData in the end of the array, remove them void trimEmpty(); - U32 getDataCount(); + size_t getDataCount(); private: typedef std::vector data_vector_t; diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index f942a976b7..9b2a2bab60 100644 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -96,10 +96,10 @@ LLMD5::LLMD5() // operation, processing another message block, and updating the // context. -void LLMD5::update (const uint1 *input, const uint4 input_length) { +void LLMD5::update (const uint1 *input, const size_t input_length) { - uint4 input_index, buffer_index; - uint4 buffer_space; // how much space is left in buffer + size_t input_index, buffer_index; + size_t buffer_space; // how much space is left in buffer if (finalized){ // so we can't update! std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; @@ -107,14 +107,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) { } // Compute number of bytes mod 64 - buffer_index = (unsigned int)((count[0] >> 3) & 0x3F); + buffer_index = size_t((count >> 3) & 0x3F); // Update number of bits - if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) ) - count[1]++; - - count[1] += ((uint4)input_length >> 29); - + count += input_length << 3; buffer_space = 64 - buffer_index; // how much space is left in buffer @@ -192,7 +188,7 @@ void LLMD5::update(const std::string& s) void LLMD5::finalize (){ unsigned char bits[8]; /* Flawfinder: ignore */ - unsigned int index, padLen; + size_t index, padLen; static uint1 PADDING[64]={ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -204,11 +200,12 @@ void LLMD5::finalize (){ return; } - // Save number of bits - encode (bits, count, 8); + // Save number of bits. + // Treat count, a uint64_t, as uint4[2]. + encode (bits, reinterpret_cast(&count), 8); // Pad out to 56 mod 64. - index = (uint4) ((count[0] >> 3) & 0x3f); + index = size_t((count >> 3) & 0x3f); padLen = (index < 56) ? (56 - index) : (120 - index); update (PADDING, padLen); @@ -340,8 +337,7 @@ void LLMD5::init(){ finalized=0; // we just started! // Nothing counted, so count=0 - count[0] = 0; - count[1] = 0; + count = 0; // Load magic initialization constants. state[0] = 0x67452301; @@ -508,9 +504,9 @@ void LLMD5::transform (const U8 block[64]){ // Encodes input (UINT4) into output (unsigned char). Assumes len is // a multiple of 4. -void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) { +void LLMD5::encode (uint1 *output, const uint4 *input, const size_t len) { - unsigned int i, j; + size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) { output[j] = (uint1) (input[i] & 0xff); @@ -525,9 +521,9 @@ void LLMD5::encode (uint1 *output, const uint4 *input, const uint4 len) { // Decodes input (unsigned char) into output (UINT4). Assumes len is // a multiple of 4. -void LLMD5::decode (uint4 *output, const uint1 *input, const uint4 len){ +void LLMD5::decode (uint4 *output, const uint1 *input, const size_t len){ - unsigned int i, j; + size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) output[i] = ((uint4)input[j]) | (((uint4)input[j+1]) << 8) | diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h index 1526e6ac3c..8530dc0389 100644 --- a/indra/llcommon/llmd5.h +++ b/indra/llcommon/llmd5.h @@ -86,7 +86,7 @@ class LL_COMMON_API LLMD5 { public: // methods for controlled operation: LLMD5 (); // simple initializer - void update (const uint1 *input, const uint4 input_length); + void update (const uint1 *input, const size_t input_length); void update (std::istream& stream); void update (FILE *file); void update (const std::string& str); @@ -110,7 +110,7 @@ private: // next, the private data: uint4 state[4]; - uint4 count[2]; // number of *bits*, mod 2^64 + uint64_t count; // number of *bits*, mod 2^64 uint1 buffer[64]; // input buffer uint1 digest[16]; uint1 finalized; @@ -120,8 +120,8 @@ private: void transform (const uint1 *buffer); // does the real update work. Note // that length is implied to be 64. - static void encode (uint1 *dest, const uint4 *src, const uint4 length); - static void decode (uint4 *dest, const uint1 *src, const uint4 length); + static void encode (uint1 *dest, const uint4 *src, const size_t length); + static void decode (uint4 *dest, const uint1 *src, const size_t length); }; diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 100eb57555..864ecf650b 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -111,8 +111,8 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i { ret[label]["Name"] = iter->second["Name"] ; - S32 num_of_metrics = tester->getNumberOfMetrics() ; - for(S32 index = 0 ; index < num_of_metrics ; index++) + auto num_of_metrics = tester->getNumberOfMetrics() ; + for(size_t index = 0 ; index < num_of_metrics ; index++) { ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; } diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 2e99ed979d..6561a78f03 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -67,12 +67,12 @@ public: /** * @return Returns the number of the test metrics in this tester instance. */ - S32 getNumberOfMetrics() const { return mMetricStrings.size() ;} + auto getNumberOfMetrics() const { return mMetricStrings.size() ;} /** * @return Returns the metric name at index * @param[in] index - Index on the list of metrics managed by this tester instance. */ - std::string getMetricName(S32 index) const { return mMetricStrings[index] ;} + std::string getMetricName(size_t index) const { return mMetricStrings[index] ;} protected: /** diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp index 93c7d520f2..b6ad40c2af 100644 --- a/indra/llcommon/llmortician.cpp +++ b/indra/llcommon/llmortician.cpp @@ -37,9 +37,9 @@ LLMortician::~LLMortician() sGraveyard.remove(this); } -U32 LLMortician::logClass(std::stringstream &str) +size_t LLMortician::logClass(std::stringstream &str) { - U32 size = sGraveyard.size(); + auto size = sGraveyard.size(); str << "Mortician graveyard count: " << size; str << " Zealous: " << (sDestroyImmediate ? "True" : "False"); if (size == 0) diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h index 41cb49fab1..f92c5a11db 100644 --- a/indra/llcommon/llmortician.h +++ b/indra/llcommon/llmortician.h @@ -34,8 +34,8 @@ class LL_COMMON_API LLMortician { public: LLMortician() { mIsDead = FALSE; } - static U32 graveyardCount() { return sGraveyard.size(); }; - static U32 logClass(std::stringstream &str); + static auto graveyardCount() { return sGraveyard.size(); }; + static size_t logClass(std::stringstream &str); static void updateClass(); virtual ~LLMortician(); void die(); diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 8cef4293cd..b06fee0ec2 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -110,7 +110,7 @@ void LLQueuedThread::shutdown() // MAIN THREAD // virtual -S32 LLQueuedThread::update(F32 max_time_ms) +size_t LLQueuedThread::update(F32 max_time_ms) { if (!mStarted) { @@ -123,11 +123,11 @@ S32 LLQueuedThread::update(F32 max_time_ms) return updateQueue(max_time_ms); } -S32 LLQueuedThread::updateQueue(F32 max_time_ms) +size_t LLQueuedThread::updateQueue(F32 max_time_ms) { F64 max_time = (F64)max_time_ms * .001; LLTimer timer; - S32 pending = 1; + size_t pending = 1; // Frame Update if (mThreaded) @@ -164,9 +164,9 @@ void LLQueuedThread::incQueue() //virtual // May be called from any thread -S32 LLQueuedThread::getPending() +size_t LLQueuedThread::getPending() { - S32 res; + size_t res; lockData(); res = mRequestQueue.size(); unlockData(); @@ -399,7 +399,7 @@ bool LLQueuedThread::check() //============================================================================ // Runs on its OWN thread -S32 LLQueuedThread::processNextRequest() +size_t LLQueuedThread::processNextRequest() { QueuedRequest *req; // Get next request from pool @@ -473,8 +473,7 @@ S32 LLQueuedThread::processNextRequest() LLTrace::get_thread_recorder()->pushToParent(); } - S32 pending = getPending(); - return pending; + return getPending(); } // virtual @@ -511,7 +510,7 @@ void LLQueuedThread::run() threadedUpdate(); - int pending_work = processNextRequest(); + auto pending_work = processNextRequest(); if (pending_work == 0) { diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h index 5d3f873646..90fce3dc5d 100644 --- a/indra/llcommon/llqueuedthread.h +++ b/indra/llcommon/llqueuedthread.h @@ -167,19 +167,19 @@ private: protected: handle_t generateHandle(); bool addRequest(QueuedRequest* req); - S32 processNextRequest(void); + size_t processNextRequest(void); void incQueue(); public: bool waitForResult(handle_t handle, bool auto_complete = true); - virtual S32 update(F32 max_time_ms); - S32 updateQueue(F32 max_time_ms); - + virtual size_t update(F32 max_time_ms); + size_t updateQueue(F32 max_time_ms); + void waitOnPending(); void printQueueStats(); - virtual S32 getPending(); + virtual size_t getPending(); bool getThreaded() { return mThreaded ? true : false; } // Request accessors diff --git a/indra/llcommon/llrun.cpp b/indra/llcommon/llrun.cpp index f5d3f302fa..a3b3fccf4b 100644 --- a/indra/llcommon/llrun.cpp +++ b/indra/llcommon/llrun.cpp @@ -47,7 +47,7 @@ LLRunner::~LLRunner() mRunEvery.clear(); } -S32 LLRunner::run() +size_t LLRunner::run() { // We collect all of the runnables which should be run. Since the // runnables are allowed to adjust the run list, we need to copy diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h index a117405366..d610f86234 100644 --- a/indra/llcommon/llrun.h +++ b/indra/llcommon/llrun.h @@ -85,7 +85,7 @@ public: * * @return Returns the number of runnables run. */ - S32 run(); + size_t run(); /** * @brief Add a runnable to the run list. diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 807b3d13f8..8772178b05 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -136,10 +136,10 @@ public: virtual void erase(const String&) { } virtual const LLSD& ref(const String&) const{ return undef(); } - virtual int size() const { return 0; } - virtual LLSD get(Integer) const { return LLSD(); } - virtual void erase(Integer) { } - virtual const LLSD& ref(Integer) const { return undef(); } + virtual size_t size() const { return 0; } + virtual LLSD get(size_t) const { return LLSD(); } + virtual void erase(size_t) { } + virtual const LLSD& ref(size_t) const { return undef(); } virtual LLSD::map_const_iterator beginMap() const { return endMap(); } virtual LLSD::map_const_iterator endMap() const { static const std::map empty; return empty.end(); } @@ -272,7 +272,7 @@ namespace virtual LLSD::UUID asUUID() const { return LLUUID(mValue); } virtual LLSD::Date asDate() const { return LLDate(mValue); } virtual LLSD::URI asURI() const { return LLURI(mValue); } - virtual int size() const { return mValue.size(); } + virtual size_t size() const { return mValue.size(); } virtual const LLSD::String& asStringRef() const { return mValue; } }; @@ -377,9 +377,9 @@ namespace virtual bool has(const LLSD::String&) const; - using LLSD::Impl::get; // Unhiding get(LLSD::Integer) - using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer) - using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer) + using LLSD::Impl::get; // Unhiding get(size_t) + using LLSD::Impl::erase; // Unhiding erase(size_t) + using LLSD::Impl::ref; // Unhiding ref(size_t) virtual LLSD get(const LLSD::String&) const; virtual LLSD getKeys() const; void insert(const LLSD::String& k, const LLSD& v); @@ -387,7 +387,7 @@ namespace LLSD& ref(const LLSD::String&); virtual const LLSD& ref(const LLSD::String&) const; - virtual int size() const { return mData.size(); } + virtual size_t size() const { return mData.size(); } LLSD::map_iterator beginMap() { return mData.begin(); } LLSD::map_iterator endMap() { return mData.end(); } @@ -518,14 +518,14 @@ namespace using LLSD::Impl::get; // Unhiding get(LLSD::String) using LLSD::Impl::erase; // Unhiding erase(LLSD::String) using LLSD::Impl::ref; // Unhiding ref(LLSD::String) - virtual int size() const; - virtual LLSD get(LLSD::Integer) const; - void set(LLSD::Integer, const LLSD&); - void insert(LLSD::Integer, const LLSD&); + virtual size_t size() const; + virtual LLSD get(size_t) const; + void set(size_t, const LLSD&); + void insert(size_t, const LLSD&); LLSD& append(const LLSD&); - virtual void erase(LLSD::Integer); - LLSD& ref(LLSD::Integer); - virtual const LLSD& ref(LLSD::Integer) const; + virtual void erase(size_t); + LLSD& ref(size_t); + virtual const LLSD& ref(size_t) const; LLSD::array_iterator beginArray() { return mData.begin(); } LLSD::array_iterator endArray() { return mData.end(); } @@ -550,85 +550,77 @@ namespace return *this; } } - - int ImplArray::size() const { return mData.size(); } - - LLSD ImplArray::get(LLSD::Integer i) const + + size_t ImplArray::size() const { return mData.size(); } + + LLSD ImplArray::get(size_t i) const { - if (i < 0) { return LLSD(); } DataVector::size_type index = i; - + return (index < mData.size()) ? mData[index] : LLSD(); } - - void ImplArray::set(LLSD::Integer i, const LLSD& v) + + void ImplArray::set(size_t i, const LLSD& v) { - if (i < 0) { return; } DataVector::size_type index = i; - + if (index >= mData.size()) { mData.resize(index + 1); } - + mData[index] = v; } - - void ImplArray::insert(LLSD::Integer i, const LLSD& v) + + void ImplArray::insert(size_t i, const LLSD& v) { - if (i < 0) - { - return; - } DataVector::size_type index = i; - + if (index >= mData.size()) // tbd - sanity check limit for index ? { mData.resize(index + 1); } - + mData.insert(mData.begin() + index, v); } - + LLSD& ImplArray::append(const LLSD& v) { mData.push_back(v); return mData.back(); } - - void ImplArray::erase(LLSD::Integer i) + + void ImplArray::erase(size_t i) { - if (i < 0) { return; } DataVector::size_type index = i; - + if (index < mData.size()) { mData.erase(mData.begin() + index); } } - - LLSD& ImplArray::ref(LLSD::Integer i) + + LLSD& ImplArray::ref(size_t i) { - DataVector::size_type index = i >= 0 ? i : 0; - + DataVector::size_type index = i; + if (index >= mData.size()) { mData.resize(i + 1); } - + return mData[index]; } - const LLSD& ImplArray::ref(LLSD::Integer i) const + const LLSD& ImplArray::ref(size_t i) const { - if (i < 0) { return undef(); } DataVector::size_type index = i; - + if (index >= mData.size()) { return undef(); } - + return mData[index]; } @@ -912,7 +904,7 @@ LLSD LLSD::emptyArray() return v; } -int LLSD::size() const { return safe(impl).size(); } +size_t LLSD::size() const { return safe(impl).size(); } LLSD LLSD::get(Integer i) const { return safe(impl).get(i); } void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); } @@ -926,12 +918,12 @@ LLSD& LLSD::with(Integer i, const LLSD& v) LLSD& LLSD::append(const LLSD& v) { return makeArray(impl).append(v); } void LLSD::erase(Integer i) { makeArray(impl).erase(i); } -LLSD& LLSD::operator[](Integer i) +LLSD& LLSD::operator[](size_t i) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; return makeArray(impl).ref(i); } -const LLSD& LLSD::operator[](Integer i) const +const LLSD& LLSD::operator[](size_t i) const { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; return safe(impl).ref(i); @@ -956,7 +948,7 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) out << LLSDNotationStreamer(llsd); out_string = out.str(); } - int len = out_string.length(); + auto len = out_string.length(); sStorage = new char[len + 1]; memcpy(sStorage, out_string.c_str(), len); sStorage[len] = '\0'; diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 24cb9bbce1..f034470da7 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -313,14 +313,18 @@ public: LLSD& append(const LLSD&); void erase(Integer); LLSD& with(Integer, const LLSD&); - - const LLSD& operator[](Integer) const; - LLSD& operator[](Integer); + + // accept size_t so we can index relative to size() + const LLSD& operator[](size_t) const; + LLSD& operator[](size_t); + // overload to disambiguate [0], [1] et al. + const LLSD& operator[](Integer i) const { return (*this)[size_t(i)]; } + LLSD& operator[](Integer i) { return (*this)[size_t(i)]; } //@} /** @name Iterators */ //@{ - int size() const; + size_t size() const; typedef std::map::iterator map_iterator; typedef std::map::const_iterator map_const_iterator; diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 8b4a0ee6d8..666da717b2 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -99,7 +99,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize } // static -bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) +bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, size_t max_bytes) { LLPointer p = NULL; char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */ @@ -252,7 +252,7 @@ F64 ll_ntohd(F64 netdouble) * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes); +int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes); /** * @brief Parse a delimited string. @@ -280,7 +280,7 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d); int deserialize_string_raw( std::istream& istr, std::string& value, - S32 max_bytes); + size_t max_bytes); /** * @brief helper method for dealing with the different notation boolean format. @@ -329,7 +329,7 @@ LLSDParser::LLSDParser() LLSDParser::~LLSDParser() { } -S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth) +S32 LLSDParser::parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth) { mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true; mMaxBytesLeft = max_bytes; @@ -803,7 +803,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const { // We probably have a valid raw binary stream. determine // the size, and read it. - S32 len = strtol(buf + 2, NULL, 0); + auto len = strtol(buf + 2, NULL, 0); if(mCheckLimits && (len > mMaxBytesLeft)) return false; std::vector value; if(len) @@ -1592,7 +1592,7 @@ void LLSDBinaryFormatter::formatString( /** * local functions */ -int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes) +int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes) { int c = istr.get(); if(istr.fail()) @@ -1728,7 +1728,7 @@ int deserialize_string_delim( int deserialize_string_raw( std::istream& istr, std::string& value, - S32 max_bytes) + size_t max_bytes) { int count = 0; const S32 BUF_LEN = 20; @@ -1743,7 +1743,7 @@ int deserialize_string_raw( // We probably have a valid raw string. determine // the size, and read it. // *FIX: This is memory inefficient. - S32 len = strtol(buf + 1, NULL, 0); + auto len = strtol(buf + 1, NULL, 0); if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE; std::vector buf; if(len) @@ -2110,7 +2110,7 @@ std::string zip_llsd(LLSD& data) U8 out[CHUNK]; - strm.avail_in = source.size(); + strm.avail_in = uint32_t(source.size()); strm.next_in = (U8*) source.data(); U8* output = NULL; @@ -2173,7 +2173,7 @@ std::string zip_llsd(LLSD& data) LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size) { U8* result = NULL; - U32 cur_size = 0; + size_t cur_size = 0; z_stream strm; const U32 CHUNK = 65536; diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index d6079fd9fa..86d34cde9a 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -77,7 +77,7 @@ public: * @return Returns the number of LLSD objects parsed into * data. Returns PARSE_FAILURE (-1) on parse failure. */ - S32 parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth = -1); + S32 parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth = -1); /** Like parse(), but uses a different call (istream.getline()) to read by lines * This API is better suited for XML, where the parse cannot tell @@ -205,7 +205,7 @@ protected: /** * @brief The maximum number of bytes left to be parsed. */ - mutable S32 mMaxBytesLeft; + mutable size_t mMaxBytesLeft; /** * @brief Use line-based reading to get text @@ -756,7 +756,7 @@ public: * @param max_bytes the maximum number of bytes to parse * @return Returns true if the stream appears to contain valid data */ - static bool deserialize(LLSD& sd, std::istream& str, S32 max_bytes); + static bool deserialize(LLSD& sd, std::istream& str, size_t max_bytes); /* * Notation Methods @@ -778,12 +778,12 @@ public: LLSDFormatter::EFormatterOptions(LLSDFormatter::OPTIONS_PRETTY | LLSDFormatter::OPTIONS_PRETTY_BINARY)); } - static S32 fromNotation(LLSD& sd, std::istream& str, S32 max_bytes) + static S32 fromNotation(LLSD& sd, std::istream& str, size_t max_bytes) { LLPointer p = new LLSDNotationParser; return p->parse(str, sd, max_bytes); } - static LLSD fromNotation(std::istream& str, S32 max_bytes) + static LLSD fromNotation(std::istream& str, size_t max_bytes) { LLPointer p = new LLSDNotationParser; LLSD sd; @@ -834,12 +834,12 @@ public: LLPointer f = new LLSDBinaryFormatter; return f->format(sd, str, LLSDFormatter::OPTIONS_NONE); } - static S32 fromBinary(LLSD& sd, std::istream& str, S32 max_bytes, S32 max_depth = -1) + static S32 fromBinary(LLSD& sd, std::istream& str, size_t max_bytes, S32 max_depth = -1) { LLPointer p = new LLSDBinaryParser; return p->parse(str, sd, max_bytes, max_depth); } - static LLSD fromBinary(std::istream& str, S32 max_bytes, S32 max_depth = -1) + static LLSD fromBinary(std::istream& str, size_t max_bytes, S32 max_depth = -1) { LLPointer p = new LLSDBinaryParser; LLSD sd; diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 0da824d694..f47c06a2dc 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -196,12 +196,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, // *FIX: memory inefficient. // *TODO: convert to use LLBase64 ostr << pre << ""; - int b64_buffer_length = apr_base64_encode_len(buffer.size()); + int b64_buffer_length = apr_base64_encode_len(int(buffer.size())); char* b64_buffer = new char[b64_buffer_length]; b64_buffer_length = apr_base64_encode_binary( b64_buffer, &buffer[0], - buffer.size()); + int(buffer.size())); ostr.write(b64_buffer, b64_buffer_length - 1); delete[] b64_buffer; ostr << "" << post; diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index d7a6f47932..1eccfda755 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -118,7 +118,7 @@ bool skip_to_next_word(std::istream& input_stream) bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream) { - int key_length = strlen(keyword); /*Flawfinder: ignore*/ + auto key_length = strlen(keyword); /*Flawfinder: ignore*/ if (0 == key_length) { return false; @@ -315,7 +315,7 @@ bool unget_line(const std::string& line, std::istream& input_stream) // returns true if removed last char bool remove_last_char(char c, std::string& line) { - int line_size = line.size(); + auto line_size = line.size(); if (line_size > 1 && c == line[line_size - 1]) { @@ -330,8 +330,8 @@ bool remove_last_char(char c, std::string& line) // "\\n" ---> '\n' (backslash n becomes carriage return) void unescape_string(std::string& line) { - int line_size = line.size(); - int index = 0; + auto line_size = line.size(); + size_t index = 0; while (index < line_size - 1) { if ('\\' == line[index]) @@ -356,8 +356,8 @@ void unescape_string(std::string& line) // '\n' ---> "\\n" (carriage return becomes backslash n) void escape_string(std::string& line) { - int line_size = line.size(); - int index = 0; + auto line_size = line.size(); + size_t index = 0; while (index < line_size) { if ('\\' == line[index]) @@ -379,8 +379,8 @@ void escape_string(std::string& line) // removes '\n' characters void replace_newlines_with_whitespace(std::string& line) { - int line_size = line.size(); - int index = 0; + auto line_size = line.size(); + size_t index = 0; while (index < line_size) { if ('\n' == line[index]) @@ -394,8 +394,8 @@ void replace_newlines_with_whitespace(std::string& line) // erases any double-quote characters in 'line' void remove_double_quotes(std::string& line) { - int index = 0; - int line_size = line.size(); + size_t index = 0; + auto line_size = line.size(); while (index < line_size) { if ('"' == line[index]) @@ -424,8 +424,8 @@ void get_keyword_and_value(std::string& keyword, const std::string& line) { // skip initial whitespace - int line_size = line.size(); - int line_index = 0; + auto line_size = line.size(); + size_t line_index = 0; char c; while (line_index < line_size) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 7f501f2e77..f6629803ee 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -141,7 +141,7 @@ std::string rawstr_to_utf8(const std::string& raw) return wstring_to_utf8str(wstr); } -S32 wchar_to_utf8chars(llwchar in_char, char* outchars) +std::ptrdiff_t wchar_to_utf8chars(llwchar in_char, char* outchars) { U32 cur_char = (U32)in_char; char* base = outchars; @@ -192,7 +192,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars) return outchars - base; } -S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar) +auto utf16chars_to_wchar(const U16* inchars, llwchar* outchar) { const U16* base = inchars; U16 cur_char = *inchars++; @@ -310,7 +310,7 @@ S32 wstring_utf16_length(const LLWString &wstr, const S32 woffset, const S32 wle // and whose equivalent utf-16 string does not exceeds the given utf16_length. S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, const S32 woffset, const S32 utf16_length, BOOL *unaligned) { - const S32 end = wstr.length(); + const auto end = wstr.length(); BOOL u = FALSE; S32 n = woffset + utf16_length; S32 i = woffset; @@ -426,7 +426,7 @@ LLWString utf8str_to_wstring(const char* utf8str, size_t len) } // Check that this character doesn't go past the end of the string - S32 end = (len < (i + cont_bytes)) ? len : (i + cont_bytes); + auto end = (len < (i + cont_bytes)) ? len : (i + cont_bytes); do { ++i; @@ -471,7 +471,7 @@ std::string wstring_to_utf8str(const llwchar* utf32str, size_t len) while (i < len) { char tchars[8]; /* Flawfinder: ignore */ - S32 n = wchar_to_utf8chars(utf32str[i], tchars); + auto n = wchar_to_utf8chars(utf32str[i], tchars); tchars[n] = 0; out += tchars; i++; diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index d94f549480..1fd6cac14a 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -664,7 +664,7 @@ ll_convert_forms(ll_convert_alias, LLWString, std::string, utf8str_to_ // Same function, better name. JC inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); } -LL_COMMON_API S32 wchar_to_utf8chars(llwchar inchar, char* outchars); +LL_COMMON_API std::ptrdiff_t wchar_to_utf8chars(llwchar inchar, char* outchars); ll_convert_forms(ll_convert_alias, std::string, LLWString, wstring_to_utf8str); ll_convert_forms(ll_convert_u16_alias, std::string, llutf16string, utf16str_to_utf8str); diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index a8b5c7b3a8..1951ca6843 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -454,14 +454,14 @@ LLOSInfo::LLOSInfo() : #ifndef LL_WINDOWS // static -S32 LLOSInfo::getMaxOpenFiles() +long LLOSInfo::getMaxOpenFiles() { - const S32 OPEN_MAX_GUESS = 256; + const long OPEN_MAX_GUESS = 256; #ifdef OPEN_MAX - static S32 open_max = OPEN_MAX; + static long open_max = OPEN_MAX; #else - static S32 open_max = 0; + static long open_max = 0; #endif if (0 == open_max) @@ -909,7 +909,7 @@ void LLMemoryInfo::stream(std::ostream& s) const // Now stream stats BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - s << pfx << std::setw(key_width+1) << (pair.first + ':') << ' '; + s << pfx << std::setw(int(key_width+1)) << (pair.first + ':') << ' '; LLSD value(pair.second); if (value.isInteger()) s << std::setw(12) << value.asInteger(); @@ -1280,7 +1280,7 @@ public: << " seconds "; } - S32 precision = LL_CONT.precision(); + auto precision = LL_CONT.precision(); LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' << LLMemoryInfo(); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 5ffbf5a732..70a03810c5 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -59,7 +59,7 @@ public: S32 mBuild; #ifndef LL_WINDOWS - static S32 getMaxOpenFiles(); + static long getMaxOpenFiles(); #endif static bool is64Bit(); diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index cdb1e320d5..9359503a19 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -27,12 +27,12 @@ #import "llsys_objc.h" #import -static int intAtStringIndex(NSArray *array, int index) +static NSInteger intAtStringIndex(NSArray *array, int index) { return [(NSString *)[array objectAtIndex:index] integerValue]; } -bool LLGetDarwinOSInfo(int &major, int &minor, int &patch) +bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 68d79cdd12..f396a71e6f 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -82,7 +82,7 @@ public: // Limiting the number of pending items prevents unbounded growth of the // underlying queue. - LLThreadSafeQueue(U32 capacity = 1024); + LLThreadSafeQueue(size_t capacity = 1024); virtual ~LLThreadSafeQueue() {} // Add an element to the queue (will block if the queue has reached @@ -179,7 +179,7 @@ public: protected: typedef QueueT queue_type; QueueT mStorage; - U32 mCapacity; + size_t mCapacity; bool mClosed; boost::fibers::timed_mutex mLock; @@ -262,7 +262,7 @@ namespace LL * LLThreadSafeQueue implementation *****************************************************************************/ template -LLThreadSafeQueue::LLThreadSafeQueue(U32 capacity) : +LLThreadSafeQueue::LLThreadSafeQueue(size_t capacity) : mCapacity(capacity), mClosed(false) { diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index aaa6df325c..74ec62d347 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -123,7 +123,7 @@ U32 micro_sleep(U64 us, U32 max_yields) // interrupts at 250 Hz (every 4,000 microseconds). const U64 KERNEL_SLEEP_INTERVAL_US = 4000; - S32 num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; + auto num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; if (num_sleep_intervals > 0) { U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1); diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index f59b207ded..818eb0457b 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -65,7 +65,7 @@ void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent ) llassert_always(parent != mBlock); llassert_always(parent != NULL); - TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(parent->getIndex()); + TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(S32(parent->getIndex())); if (!parent_tree_node) return; if (mParent) diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index fcd8753f75..580cf0a5fd 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -340,7 +340,7 @@ inline void claim_alloc(MemStatHandle& measurement, const T& value) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; #if LL_TRACE_ENABLED - S32 size = MeasureMem::measureFootprint(value); + auto size = MeasureMem::measureFootprint(value); if(size == 0) return; MemAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size); @@ -353,7 +353,7 @@ inline void disclaim_alloc(MemStatHandle& measurement, const T& value) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; #if LL_TRACE_ENABLED - S32 size = MeasureMem::measureFootprint(value); + auto size = MeasureMem::measureFootprint(value); if(size == 0) return; MemAccumulator& accumulator = measurement.getCurrentAccumulator(); accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size); diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index 34299f5a29..84c1ccd9fe 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -96,9 +96,9 @@ void AccumulatorBufferGroup::makeCurrent() ThreadRecorder* thread_recorder = get_thread_recorder().get(); AccumulatorBuffer& timer_accumulator_buffer = mStackTimers; // update stacktimer parent pointers - for (S32 i = 0, end_i = mStackTimers.size(); i < end_i; i++) + for (size_t i = 0, end_i = mStackTimers.size(); i < end_i; i++) { - TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(i); + TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(S32(i)); if (tree_node) { timer_accumulator_buffer[i].mParent = tree_node->mParent; diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 1613af1dcf..1d31d7b9d0 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -606,7 +606,7 @@ void PeriodicRecording::nextPeriod() mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size(); old_recording.splitTo(getCurRecording()); - mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1); + mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1); } void PeriodicRecording::appendRecording(Recording& recording) @@ -625,21 +625,21 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) getCurRecording().update(); other.getCurRecording().update(); - const S32 other_recording_slots = other.mRecordingPeriods.size(); - const S32 other_num_recordings = other.getNumRecordedPeriods(); - const S32 other_current_recording_index = other.mCurPeriod; - const S32 other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots; + const auto other_recording_slots = other.mRecordingPeriods.size(); + const auto other_num_recordings = other.getNumRecordedPeriods(); + const auto other_current_recording_index = other.mCurPeriod; + const auto other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots; // append first recording into our current slot getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]); // from now on, add new recordings for everything after the first - S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots; + auto other_index = (other_oldest_recording_index + 1) % other_recording_slots; if (mAutoResize) { // push back recordings for everything in the middle - S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots; + auto other_index = (other_oldest_recording_index + 1) % other_recording_slots; while (other_index != other_current_recording_index) { mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]); @@ -682,7 +682,7 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) llassert(num_to_copy >= 1); // advance to last recording period copied, and make that our current period mCurPeriod = (mCurPeriod + num_to_copy - 1) % mRecordingPeriods.size(); - mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1); + mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1); } // end with fresh period, otherwise next appendPeriodicRecording() will merge the first @@ -695,10 +695,10 @@ F64Seconds PeriodicRecording::getDuration() const { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; F64Seconds duration; - S32 num_periods = mRecordingPeriods.size(); - for (S32 i = 1; i <= num_periods; i++) + auto num_periods = mRecordingPeriods.size(); + for (size_t i = 1; i <= num_periods; i++) { - S32 index = (mCurPeriod + num_periods - i) % num_periods; + auto index = (mCurPeriod + num_periods - i) % num_periods; duration += mRecordingPeriods[index].getDuration(); } return duration; @@ -734,16 +734,16 @@ const Recording& PeriodicRecording::getCurRecording() const return mRecordingPeriods[mCurPeriod]; } -Recording& PeriodicRecording::getPrevRecording( S32 offset ) +Recording& PeriodicRecording::getPrevRecording( size_t offset ) { - S32 num_periods = mRecordingPeriods.size(); + auto num_periods = mRecordingPeriods.size(); offset = llclamp(offset, 0, num_periods - 1); return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } -const Recording& PeriodicRecording::getPrevRecording( S32 offset ) const +const Recording& PeriodicRecording::getPrevRecording( size_t offset ) const { - S32 num_periods = mRecordingPeriods.size(); + auto num_periods = mRecordingPeriods.size(); offset = llclamp(offset, 0, num_periods - 1); return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods]; } @@ -790,7 +790,7 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other) getCurRecording().splitTo(other.getCurRecording()); } -F64 PeriodicRecording::getPeriodMin( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMin( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -812,7 +812,7 @@ F64 PeriodicRecording::getPeriodMin( const StatType& stat, S32 : NaN; } -F64 PeriodicRecording::getPeriodMax( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMax( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -835,7 +835,7 @@ F64 PeriodicRecording::getPeriodMax( const StatType& stat, S32 } // calculates means using aggregates per period -F64 PeriodicRecording::getPeriodMean( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMean( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -858,7 +858,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType& stat, S3 : NaN; } -F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -883,7 +883,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMin( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -905,7 +905,7 @@ F64 PeriodicRecording::getPeriodMin( const StatType& stat, S3 : NaN; } -F64 PeriodicRecording::getPeriodMax(const StatType& stat, S32 num_periods /*= S32_MAX*/) +F64 PeriodicRecording::getPeriodMax(const StatType& stat, size_t num_periods /*= S32_MAX*/) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -928,7 +928,7 @@ F64 PeriodicRecording::getPeriodMax(const StatType& stat, S32 } -F64 PeriodicRecording::getPeriodMean( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMean( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -951,7 +951,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType& stat, S : NaN; } -F64 PeriodicRecording::getPeriodMedian( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodMedian( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -977,7 +977,7 @@ F64 PeriodicRecording::getPeriodMedian( const StatType& stat, return F64((buf.size() % 2 == 0) ? (buf[buf.size() / 2 - 1] + buf[buf.size() / 2]) / 2 : buf[buf.size() / 2]); } -F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -1003,7 +1003,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodMin( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -1018,12 +1018,12 @@ F64Kilobytes PeriodicRecording::getPeriodMin( const StatType& st return min_val; } -F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, S32 num_periods) +F64Kilobytes PeriodicRecording::getPeriodMin(const MemStatHandle& stat, size_t num_periods) { return getPeriodMin(static_cast&>(stat), num_periods); } -F64Kilobytes PeriodicRecording::getPeriodMax(const StatType& stat, S32 num_periods /*= S32_MAX*/) +F64Kilobytes PeriodicRecording::getPeriodMax(const StatType& stat, size_t num_periods /*= S32_MAX*/) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -1038,12 +1038,12 @@ F64Kilobytes PeriodicRecording::getPeriodMax(const StatType& sta return max_val; } -F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, S32 num_periods) +F64Kilobytes PeriodicRecording::getPeriodMax(const MemStatHandle& stat, size_t num_periods) { return getPeriodMax(static_cast&>(stat), num_periods); } -F64Kilobytes PeriodicRecording::getPeriodMean( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodMean( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -1059,12 +1059,12 @@ F64Kilobytes PeriodicRecording::getPeriodMean( const StatType& s return mean / F64(num_periods); } -F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, S32 num_periods) +F64Kilobytes PeriodicRecording::getPeriodMean(const MemStatHandle& stat, size_t num_periods) { return getPeriodMean(static_cast&>(stat), num_periods); } -F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, S32 num_periods /*= S32_MAX*/ ) +F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType& stat, size_t num_periods /*= S32_MAX*/ ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -1089,7 +1089,7 @@ F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType&>(stat), num_periods); } diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h index 556b7470cf..8b56721f42 100644 --- a/indra/llcommon/lltracerecording.h +++ b/indra/llcommon/lltracerecording.h @@ -334,7 +334,7 @@ namespace LLTrace ~PeriodicRecording(); void nextPeriod(); - S32 getNumRecordedPeriods() + auto getNumRecordedPeriods() { // current period counts if not active return mNumRecordedPeriods + (isStarted() ? 0 : 1); @@ -348,24 +348,24 @@ namespace LLTrace const Recording& getLastRecording() const; Recording& getCurRecording(); const Recording& getCurRecording() const; - Recording& getPrevRecording(S32 offset); - const Recording& getPrevRecording(S32 offset) const; + Recording& getPrevRecording(size_t offset); + const Recording& getPrevRecording(size_t offset) const; Recording snapshotCurRecording() const; template - S32 getSampleCount(const StatType& stat, S32 num_periods = S32_MAX) - { - LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; + auto getSampleCount(const StatType& stat, size_t num_periods = S32_MAX) + { + LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); - S32 num_samples = 0; - for (S32 i = 1; i <= num_periods; i++) + size_t num_samples = 0; + for (size_t i = 1; i <= num_periods; i++) { Recording& recording = getPrevRecording(i); num_samples += recording.getSampleCount(stat); } return num_samples; - } + } // // PERIODIC MIN @@ -373,7 +373,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX) + typename T::value_t getPeriodMin(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -396,33 +396,33 @@ namespace LLTrace } template - T getPeriodMin(const CountStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMin(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMin(const StatType& stat, size_t num_periods = S32_MAX); template - T getPeriodMin(const SampleStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMin(const SampleStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64 getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMin(const StatType& stat, size_t num_periods = S32_MAX); template - T getPeriodMin(const EventStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMin(const EventStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMin(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMin(const StatType& stat, S32 num_periods = S32_MAX); - F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMin(const StatType& stat, size_t num_periods = S32_MAX); + F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMinPerSec(const StatType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -437,7 +437,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMinPerSec(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMinPerSec(static_cast&>(stat), num_periods)); @@ -449,7 +449,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename T::value_t getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX) + typename T::value_t getPeriodMax(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -472,33 +472,33 @@ namespace LLTrace } template - T getPeriodMax(const CountStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMax(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMax(const StatType& stat, size_t num_periods = S32_MAX); template - T getPeriodMax(const SampleStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMax(const SampleStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64 getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMax(const StatType& stat, size_t num_periods = S32_MAX); template - T getPeriodMax(const EventStatHandle& stat, S32 num_periods = S32_MAX) + T getPeriodMax(const EventStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return T(getPeriodMax(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMax(const StatType& stat, S32 num_periods = S32_MAX); - F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMax(const StatType& stat, size_t num_periods = S32_MAX); + F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMaxPerSec(const StatType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -513,7 +513,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMaxPerSec(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMaxPerSec(static_cast&>(stat), num_periods)); @@ -525,7 +525,7 @@ namespace LLTrace // catch all for stats that have a defined sum template - typename RelatedTypes::fractional_t getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -546,32 +546,32 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMean(const StatType& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const SampleStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64 getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMean(const StatType& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMean(const EventStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMean(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodMean(const StatType& stat, S32 num_periods = S32_MAX); - F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodMean(const StatType& stat, size_t num_periods = S32_MAX); + F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const StatType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -593,16 +593,16 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMeanPerSec(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMeanPerSec(static_cast&>(stat), num_periods)); } - F64 getPeriodMedian( const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodMedian( const StatType& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodMedianPerSec(const StatType& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMedianPerSec(const StatType& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; num_periods = llmin(num_periods, getNumRecordedPeriods()); @@ -622,7 +622,7 @@ namespace LLTrace } template - typename RelatedTypes::fractional_t getPeriodMedianPerSec(const CountStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodMedianPerSec(const CountStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodMedianPerSec(static_cast&>(stat), num_periods)); @@ -632,25 +632,25 @@ namespace LLTrace // PERIODIC STANDARD DEVIATION // - F64 getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodStandardDeviation(const StatType& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const SampleStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64 getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); + F64 getPeriodStandardDeviation(const StatType& stat, size_t num_periods = S32_MAX); template - typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, S32 num_periods = S32_MAX) + typename RelatedTypes::fractional_t getPeriodStandardDeviation(const EventStatHandle& stat, size_t num_periods = S32_MAX) { LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS; return typename RelatedTypes::fractional_t(getPeriodStandardDeviation(static_cast&>(stat), num_periods)); } - F64Kilobytes getPeriodStandardDeviation(const StatType& stat, S32 num_periods = S32_MAX); - F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX); + F64Kilobytes getPeriodStandardDeviation(const StatType& stat, size_t num_periods = S32_MAX); + F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods = S32_MAX); private: // implementation for LLStopWatchControlsMixin @@ -662,8 +662,8 @@ namespace LLTrace private: std::vector mRecordingPeriods; const bool mAutoResize; - S32 mCurPeriod; - S32 mNumRecordedPeriods; + size_t mCurPeriod; + size_t mNumRecordedPeriods; }; PeriodicRecording& get_frame_recording(); diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index 090d3297a0..d10312e0ec 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -125,7 +125,7 @@ ThreadRecorder::~ThreadRecorder() #endif } -TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index ) +TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( size_t index ) { #if LL_TRACE_ENABLED if (0 <= index && index < mNumTimeBlockTreeNodes) diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h index a797c6687e..1294d4318f 100644 --- a/indra/llcommon/lltracethreadrecorder.h +++ b/indra/llcommon/lltracethreadrecorder.h @@ -58,7 +58,7 @@ namespace LLTrace void pullFromChildren(); void pushToParent(); - TimeBlockTreeNode* getTimeBlockTreeNode(S32 index); + TimeBlockTreeNode* getTimeBlockTreeNode(size_t index); protected: void init(); diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index 81f244e422..e283e8f79a 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -83,8 +83,10 @@ struct LLUnit typedef void is_unit_t; // value initialization - LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t()) - : mValue(value) + // allow for convertible type + template + LL_FORCE_INLINE explicit LLUnit(T value = T()) + : mValue(storage_t(value)) {} @@ -124,7 +126,7 @@ struct LLUnit // unit initialization and conversion template LL_FORCE_INLINE LLUnit(LLUnit other) - : mValue(convert(other).mValue) + : mValue(storage_t(convert(other).mValue)) {} LL_FORCE_INLINE storage_t value() const diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 4b91b2caca..97838e296e 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -81,9 +81,9 @@ void LLWorkerThread::clearDeleteList() } // virtual -S32 LLWorkerThread::update(F32 max_time_ms) +size_t LLWorkerThread::update(F32 max_time_ms) { - S32 res = LLQueuedThread::update(max_time_ms); + auto res = LLQueuedThread::update(max_time_ms); // Delete scheduled workers std::vector delete_list; std::vector abort_list; diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index 0387e75c65..e3004d7242 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -88,7 +88,7 @@ public: LLWorkerThread(const std::string& name, bool threaded = true, bool should_pause = false); ~LLWorkerThread(); - /*virtual*/ S32 update(F32 max_time_ms); + /*virtual*/ size_t update(F32 max_time_ms); handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL); diff --git a/indra/llcommon/threadsafeschedule.h b/indra/llcommon/threadsafeschedule.h index 3e0da94c02..2d82d6a15e 100644 --- a/indra/llcommon/threadsafeschedule.h +++ b/indra/llcommon/threadsafeschedule.h @@ -82,7 +82,7 @@ namespace LL using TimePoint = ThreadSafeSchedulePrivate::TimePoint; using Clock = TimePoint::clock; - ThreadSafeSchedule(U32 capacity=1024): + ThreadSafeSchedule(size_t capacity=1024): super(capacity) {} -- cgit v1.2.3 From 5a74f7648a7dda28f8634e825cc506de465bd424 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2022 15:18:32 -0400 Subject: DRTVWR-575: A few more tweaks addressing size_t wider than 32 bits. --- indra/llcommon/tests/lleventdispatcher_test.cpp | 2 +- indra/llcorehttp/bufferarray.cpp | 6 +++--- indra/llimage/llimageworker.cpp | 2 +- indra/llimage/llimageworker.h | 2 +- indra/llmath/llvolume.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/llcommon/tests/lleventdispatcher_test.cpp b/indra/llcommon/tests/lleventdispatcher_test.cpp index 9da1ecfd67..966dc2c5aa 100644 --- a/indra/llcommon/tests/lleventdispatcher_test.cpp +++ b/indra/llcommon/tests/lleventdispatcher_test.cpp @@ -335,7 +335,7 @@ namespace tut // Full, partial defaults arrays for params for freena(), freenb() LLSD dft_array_full, dft_array_partial; // Start index of partial defaults arrays - const LLSD::Integer partial_offset; + const size_t partial_offset; // Full, partial defaults maps for params for freena(), freenb() LLSD dft_map_full, dft_map_partial; // Most of the above are indexed by "a" or "b". Useful to have an diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index e0b2876a00..4c680fdb56 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -196,7 +196,7 @@ size_t BufferArray::read(size_t pos, void * dst, size_t len) return 0; size_t result(0), offset(0); - const int block_limit(mBlocks.size()); + const auto block_limit(mBlocks.size()); int block_start(findBlock(pos, &offset)); if (block_start < 0) return 0; @@ -228,7 +228,7 @@ size_t BufferArray::write(size_t pos, const void * src, size_t len) return 0; size_t result(0), offset(0); - const int block_limit(mBlocks.size()); + const auto block_limit(mBlocks.size()); int block_start(findBlock(pos, &offset)); if (block_start >= 0) @@ -288,7 +288,7 @@ int BufferArray::findBlock(size_t pos, size_t * ret_offset) if (pos >= mLen) return -1; // Doesn't exist - const int block_limit(mBlocks.size()); + const auto block_limit(mBlocks.size()); for (int i(0); i < block_limit; ++i) { if (pos < mBlocks[i]->mUsed) diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 0dbb744bcf..ff4336d2de 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -46,7 +46,7 @@ LLImageDecodeThread::~LLImageDecodeThread() // MAIN THREAD // virtual -S32 LLImageDecodeThread::update(F32 max_time_ms) +size_t LLImageDecodeThread::update(F32 max_time_ms) { LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; LLMutexLock lock(mCreationMutex); diff --git a/indra/llimage/llimageworker.h b/indra/llimage/llimageworker.h index 1bfb0ddfd3..54814c24c5 100644 --- a/indra/llimage/llimageworker.h +++ b/indra/llimage/llimageworker.h @@ -78,7 +78,7 @@ public: handle_t decodeImage(LLImageFormatted* image, U32 priority, S32 discard, BOOL needs_aux, Responder* responder); - S32 update(F32 max_time_ms); + size_t update(F32 max_time_ms); // Used by unit tests to check the consistency of the thread instance S32 tut_size(); diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index f43d07ce5e..bac630f626 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -2398,7 +2398,7 @@ bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size) mVolumeFaces.resize(face_count); - for (U32 i = 0; i < face_count; ++i) + for (size_t i = 0; i < face_count; ++i) { LLVolumeFace& face = mVolumeFaces[i]; -- cgit v1.2.3 From a2a723f38345fc530afb0815c5781b7ecc23a12e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 3 Nov 2022 15:19:49 -0400 Subject: DRTVWR-575: Suppress remaining size_t truncation warnings for now. --- indra/cmake/Variables.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index dd9b1d348f..c8807364b9 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -202,8 +202,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "") set(CMAKE_XCODE_ATTRIBUTE_DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING YES) -## Uncomment if the attempt to address this in code gets too pervasive -##set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO) + set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION NO) set(CMAKE_OSX_ARCHITECTURES "${ARCH}") string(REPLACE "i686" "i386" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") string(REPLACE "AMD64" "x86_64" CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}") -- cgit v1.2.3 From cd997f21c272987e954f5890ed14fcc327eb734e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 4 Nov 2022 17:21:30 -0400 Subject: DRTVWR-575: Introduce llssize (signed size_t) and narrow() function. llssize is for a function parameter that should accept a size or index (derived from size_t, which is 64 bits in a 64-bit viewer) but might need to go negative for flag values. We've historically used S32 for that purpose, but Xcode 14.1 complains about trying to pass size_t to S32. narrow() is a template function that casts a wider type (e.g. size_t or llssize) to a narrower type (e.g. S32 or U32), with validation in RelWithDebInfo builds. It verifies (using assert()) that the value being truncated can in fact fit into the target type. --- indra/llcommon/stdtypes.h | 106 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index b07805b628..a030017e3b 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -26,16 +26,23 @@ #ifndef LL_STDTYPES_H #define LL_STDTYPES_H +#include #include #include +#include +#include -typedef signed char S8; +typedef signed char S8; typedef unsigned char U8; typedef signed short S16; typedef unsigned short U16; -typedef signed int S32; +typedef signed int S32; typedef unsigned int U32; +// to express an index that might go negative +// (ssize_t is provided by SOME compilers, don't collide) +typedef typename std::make_signed::type llssize; + #if LL_WINDOWS // https://docs.microsoft.com/en-us/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type // https://docs.microsoft.com/en-us/cpp/cpp/fundamental-types-cpp @@ -45,7 +52,7 @@ typedef unsigned int U32; // The version of clang available with VS 2019 also defines wchar_t as __wchar_t // which is also 16 bits. // In any case, llwchar should be a UTF-32 type. -typedef U32 llwchar; +typedef U32 llwchar; #else typedef wchar_t llwchar; // What we'd actually want is a simple module-scope 'if constexpr' to test @@ -76,7 +83,7 @@ typedef double F64; typedef S32 BOOL; typedef U8 KEY; typedef U32 MASK; -typedef U32 TPACKETID; +typedef U32 TPACKETID; // Use #define instead of consts to avoid conversion headaches #define S8_MAX (SCHAR_MAX) @@ -118,4 +125,95 @@ typedef U8 LLPCode; typedef int intptr_t; #endif +/***************************************************************************** +* Narrowing +*****************************************************************************/ +/** + * narrow() is used to cast a wider type to a narrower type with validation. + * + * In many cases we take the size() of a container and try to pass it to an + * S32 or a U32 parameter. We used to be able to assume that the size of + * anything we could fit into memory could be expressed as a 32-bit int. With + * 64-bit viewers, though, size_t as returned by size() and length() and so + * forth is 64 bits, and the compiler is unhappy about stuffing such values + * into 32-bit types. + * + * It works to force the compiler to truncate, e.g. static_cast(len) or + * S32(len) or (S32)len, but we can do better. + * + * For: + * @code + * std::vector container; + * void somefunc(S32 size); + * @endcode + * call: + * @code + * somefunc(narrow(container.size())); + * @endcode + * + * narrow() truncates but, in RelWithDebInfo builds, it validates (using + * assert()) that the passed value can validly be expressed by the destination + * type. + */ +// narrow_holder is a struct that accepts the passed value as its original +// type and provides templated conversion functions to other types. Once we're +// building with compilers that support Class Template Argument Deduction, we +// can rename this class template 'narrow' and eliminate the narrow() factory +// function below. +template +class narrow_holder +{ +private: + FROM mValue; + +public: + narrow_holder(FROM value): mValue(value) {} + + /*---------------------- Narrowing unsigned to signed ----------------------*/ + template ::value && + std::is_signed::value, + bool>::type = true> + inline + operator TO() const + { + // The reason we skip the + // assert(value >= std::numeric_limits::lowest()); + // in the overload below is that to perform the above comparison, the + // compiler promotes the signed lowest() to the unsigned FROM type, + // making it hugely positive -- so a reasonable 'value' will always + // fail the assert(). + assert(mValue <= std::numeric_limits::max()); + return static_cast(mValue); + } + + /*----------------------- Narrowing all other cases ------------------------*/ + template ::value && + std::is_signed::value), + bool>::type = true> + inline + operator TO() const + { + // two different assert()s so we can tell which condition failed + assert(mValue <= std::numeric_limits::max()); + // Funny, with floating point types min() is "positive epsilon" rather + // than "largest negative" -- that's lowest(). + assert(mValue >= std::numeric_limits::lowest()); + // Do we really expect to use this with floating point types? + // If so, does it matter if a very small value truncates to zero? + //assert(fabs(mValue) >= std::numeric_limits::min()); + return static_cast(mValue); + } +}; + +/// narrow() factory function returns a narrow_holder(), which can be +/// implicitly converted to the target type. +template +inline +narrow_holder narrow(FROM value) +{ + return { value }; +} + #endif -- cgit v1.2.3 From 6ec534e8d89462e42629b953dcfb545d00defa64 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 15:31:46 -0800 Subject: DRTVWR-575 xcode-14.1 compatibility fix. add overloads for stricter integer conversions --- indra/llcommon/llsd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index f034470da7..09aac47d0d 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -320,6 +320,8 @@ public: // overload to disambiguate [0], [1] et al. const LLSD& operator[](Integer i) const { return (*this)[size_t(i)]; } LLSD& operator[](Integer i) { return (*this)[size_t(i)]; } + const LLSD& operator[](U32 i) const { return (*this)[size_t(i)]; } + LLSD& operator[](U32 i) { return (*this)[size_t(i)]; } //@} /** @name Iterators */ -- cgit v1.2.3 From 6bc0614d717166e1e587012c3388445d662775a3 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 16:35:51 -0800 Subject: DRTVWR-575 xcode-14.1 compatibility fix. add more overloads for stricter size_t conversions --- indra/llcommon/llsd.h | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 09aac47d0d..dfdf71d6a9 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -208,6 +208,7 @@ public: LLSD& operator=(Boolean v) { assign(v); return *this; } LLSD& operator=(Integer v) { assign(v); return *this; } + LLSD& operator=(size_t v) { assign(Integer(v)); return *this; } LLSD& operator=(Real v) { assign(v); return *this; } LLSD& operator=(const String& v) { assign(v); return *this; } LLSD& operator=(const UUID& v) { assign(v); return *this; } -- cgit v1.2.3 From 22f6adefb892ab83168e6236e2453b62314d0db6 Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 17:07:52 -0800 Subject: DRTVWR-575 fix LLWorkerThread subclasses to be compatiblie with recent size_t changes in base class --- indra/newview/lltexturecache.cpp | 4 ++-- indra/newview/lltexturecache.h | 2 +- indra/newview/lltexturefetch.cpp | 8 ++++---- indra/newview/lltexturefetch.h | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 9403e73b87..67da311493 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -859,12 +859,12 @@ LLTextureCache::~LLTextureCache() ////////////////////////////////////////////////////////////////////////////// //virtual -S32 LLTextureCache::update(F32 max_time_ms) +size_t LLTextureCache::update(F32 max_time_ms) { static LLFrameTimer timer ; static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds. - S32 res; + size_t res; res = LLWorkerThread::update(max_time_ms); mListMutex.lock(); diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index e1c752b58e..b6ace467c7 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -113,7 +113,7 @@ public: LLTextureCache(bool threaded); ~LLTextureCache(); - /*virtual*/ S32 update(F32 max_time_ms); + /*virtual*/ size_t update(F32 max_time_ms); void purgeCache(ELLPath location, bool remove_dir = true); void setReadOnly(BOOL read_only) ; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0edaf40c66..8923f53cf5 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3104,9 +3104,9 @@ bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority) // Threads: T* //virtual -S32 LLTextureFetch::getPending() +size_t LLTextureFetch::getPending() { - S32 res; + size_t res; lockData(); // +Ct { LLMutexLock lock(&mQueueMutex); // +Mfq @@ -3181,7 +3181,7 @@ void LLTextureFetch::commonUpdate() // Threads: Tmain //virtual -S32 LLTextureFetch::update(F32 max_time_ms) +size_t LLTextureFetch::update(F32 max_time_ms) { static LLCachedControl band_width(gSavedSettings,"ThrottleBandwidthKBPS", 3000.0); @@ -3195,7 +3195,7 @@ S32 LLTextureFetch::update(F32 max_time_ms) mNetworkQueueMutex.unlock(); // -Mfnq } - S32 res = LLWorkerThread::update(max_time_ms); + size_t res = LLWorkerThread::update(max_time_ms); if (!mDebugPause) { diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index bf6732963f..e2d2aa365c 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -65,7 +65,7 @@ public: class TFRequest; // Threads: Tmain - /*virtual*/ S32 update(F32 max_time_ms); + /*virtual*/ size_t update(F32 max_time_ms); // called in the main thread after the TextureCacheThread shuts down. // Threads: Tmain @@ -137,7 +137,7 @@ public: U32 getTotalNumHTTPRequests(); // Threads: T* - S32 getPending(); + size_t getPending(); // Threads: T* void lockQueue() { mQueueMutex.lock(); } -- cgit v1.2.3 From 076737cb6c28e9e5ea47cd4cb6ea9c5c514e578b Mon Sep 17 00:00:00 2001 From: Brad Kittenbrink Date: Fri, 11 Nov 2022 18:09:23 -0800 Subject: DRTVWR-575 fix LLGetDarwinOSInfo for xcode-14.1. NSInteger is now 64 bits --- indra/llcommon/llsys.cpp | 2 +- indra/llcommon/llsys_objc.h | 4 +++- indra/llcommon/llsys_objc.mm | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1951ca6843..f52433af40 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -273,7 +273,7 @@ LLOSInfo::LLOSInfo() : { const char * DARWIN_PRODUCT_NAME = "Mac OS X"; - S32 major_version, minor_version, bugfix_version = 0; + int64_t major_version, minor_version, bugfix_version = 0; if (LLGetDarwinOSInfo(major_version, minor_version, bugfix_version)) { diff --git a/indra/llcommon/llsys_objc.h b/indra/llcommon/llsys_objc.h index 35599a574b..aebc600032 100644 --- a/indra/llcommon/llsys_objc.h +++ b/indra/llcommon/llsys_objc.h @@ -27,7 +27,9 @@ #ifndef LL_LLSYS_OBJC_H #define LL_LLSYS_OBJC_H -bool LLGetDarwinOSInfo(int &major, int &minor, int &patch); +#include + +bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch); #endif // LL_LLSYS_OBJC_H diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index 9359503a19..ccd39a2d46 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -32,7 +32,7 @@ static NSInteger intAtStringIndex(NSArray *array, int index) return [(NSString *)[array objectAtIndex:index] integerValue]; } -bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) +bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { -- cgit v1.2.3 From 4349cb6165e983ff6bdd45ad1b82bb98bfc0436f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 12 Nov 2022 18:59:21 -1000 Subject: DRTVWR-575: Address review comments on Xcode 14.1 type tweaks. Introduce LLSD template constructors and assignment operators to disambiguate construction or assignment from any integer type to Integer, likewise any floating point type to Real. Use new narrow() function to validate conversions. For LLSD method parameters converted from LLSD::Integer to size_t, where the method previously checked for a negative argument, make it now check for size_t converted from negative: in other words, more than S32_MAX. The risk of having a parameter forced from negative to unsigned exceeds the risk of a valid length or index over that max. In lltracerecording.cpp's PeriodicRecording, now that mCurPeriod and mNumRecordedPeriods are size_t instead of S32, defend against subtracting 1 from 0. Use narrow() to validate newly-introduced narrowing conversions. Make llclamp() return the type of the raw input value, even if the types of the boundary values differ. std::ostream::tellp() no longer returns a value we can directly report as a number. Cast to U64. --- indra/llcommon/llbase64.cpp | 4 +-- indra/llcommon/lldefs.h | 7 ++--- indra/llcommon/llleap.cpp | 6 ++-- indra/llcommon/llsd.cpp | 22 ++++++++++++--- indra/llcommon/llsd.h | 50 ++++++++++++++++++++++++---------- indra/llcommon/llsdserialize.cpp | 2 +- indra/llcommon/llsdserialize_xml.cpp | 4 +-- indra/llcommon/llsys.cpp | 2 +- indra/llcommon/llsys_objc.mm | 12 ++++---- indra/llcommon/lltrace.cpp | 2 +- indra/llcommon/lltraceaccumulators.cpp | 2 +- indra/llcommon/lltracerecording.cpp | 7 +++-- indra/llcommon/llunittype.h | 8 ++---- indra/llcommon/stdtypes.h | 8 +++--- indra/newview/lltexturecache.cpp | 2 +- indra/newview/lltexturecache.h | 2 +- indra/newview/lltexturefetch.cpp | 6 ++-- indra/newview/lltexturefetch.h | 4 +-- 18 files changed, 93 insertions(+), 57 deletions(-) diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index 85f22969b8..bb85fe32a3 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size) && input_size > 0) { // Yes, it returns int. - int b64_buffer_length = apr_base64_encode_len(int(input_size)); + int b64_buffer_length = apr_base64_encode_len(narrow(input_size)); char* b64_buffer = new char[b64_buffer_length]; // This is faster than apr_base64_encode() if you know @@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size) b64_buffer_length = apr_base64_encode_binary( b64_buffer, input, - int(input_size)); + narrow(input_size)); output.assign(b64_buffer); delete[] b64_buffer; } diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index d9b0cbf71b..a567fd7c12 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -212,16 +212,15 @@ inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4) } template -inline typename std::common_type::type -llclamp(A a, MIN minval, MAX maxval) +inline A llclamp(A a, MIN minval, MAX maxval) { if ( a < minval ) { - return minval; + return static_cast(minval); } else if ( a > maxval ) { - return maxval; + return static_cast(maxval); } return a; } diff --git a/indra/llcommon/llleap.cpp b/indra/llcommon/llleap.cpp index 2704f8b6de..c87c0758fe 100644 --- a/indra/llcommon/llleap.cpp +++ b/indra/llcommon/llleap.cpp @@ -231,7 +231,8 @@ public: } |*==========================================================================*/ - LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':'; + LL_DEBUGS("EventHost") << "Sending: " + << static_cast(buffer.tellp()) << ':'; std::string::size_type truncate(80); if (buffer.tellp() <= truncate) { @@ -244,7 +245,8 @@ public: LL_CONT << LL_ENDL; LLProcess::WritePipe& childin(mChild->getWritePipe(LLProcess::STDIN)); - childin.get_ostream() << buffer.tellp() << ':' << buffer.str() << std::flush; + childin.get_ostream() << static_cast(buffer.tellp()) + << ':' << buffer.str() << std::flush; return false; } diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 8772178b05..a645e624f8 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -36,6 +36,18 @@ #include "llsdserialize.h" #include "stringize.h" +#include + +// Defend against a caller forcibly passing a negative number into an unsigned +// size_t index param +inline +bool was_negative(size_t i) +{ + return (i > std::numeric_limits::max()); +} +#define NEGATIVE_EXIT(i) if (was_negative(i)) return +#define NEGATIVE_RETURN(i, result) NEGATIVE_EXIT(i) (result) + #ifndef LL_RELEASE_FOR_DOWNLOAD #define NAME_UNNAMED_NAMESPACE #endif @@ -555,6 +567,7 @@ namespace LLSD ImplArray::get(size_t i) const { + NEGATIVE_RETURN(i, LLSD()); DataVector::size_type index = i; return (index < mData.size()) ? mData[index] : LLSD(); @@ -562,6 +575,7 @@ namespace void ImplArray::set(size_t i, const LLSD& v) { + NEGATIVE_EXIT(i); DataVector::size_type index = i; if (index >= mData.size()) @@ -574,6 +588,7 @@ namespace void ImplArray::insert(size_t i, const LLSD& v) { + NEGATIVE_EXIT(i); DataVector::size_type index = i; if (index >= mData.size()) // tbd - sanity check limit for index ? @@ -592,6 +607,7 @@ namespace void ImplArray::erase(size_t i) { + NEGATIVE_EXIT(i); DataVector::size_type index = i; if (index < mData.size()) @@ -602,7 +618,7 @@ namespace LLSD& ImplArray::ref(size_t i) { - DataVector::size_type index = i; + DataVector::size_type index = was_negative(i)? 0 : i; if (index >= mData.size()) { @@ -614,6 +630,7 @@ namespace const LLSD& ImplArray::ref(size_t i) const { + NEGATIVE_RETURN(i, undef()); DataVector::size_type index = i; if (index >= mData.size()) @@ -833,9 +850,6 @@ LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } -// Convenience Constructors -LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); } - // Scalar Assignment void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); } void LLSD::assign(Integer v) { safe(impl).assign(impl, v); } diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index f034470da7..c1406cf73f 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -30,6 +30,7 @@ #include #include #include +#include #include "stdtypes.h" @@ -192,7 +193,17 @@ public: /** @name Convenience Constructors */ //@{ - LLSD(F32); // F32 -> Real + // support construction from size_t et al. + template ::value && + ! std::is_same::value, + bool>::type = true> + LLSD(VALUE v): LLSD(Integer(narrow(v))) {} + // support construction from F32 et al. + template ::value, + bool>::type = true> + LLSD(VALUE v): LLSD(Real(narrow(v))) {} //@} /** @name Scalar Assignment */ @@ -205,15 +216,21 @@ public: void assign(const Date&); void assign(const URI&); void assign(const Binary&); - - LLSD& operator=(Boolean v) { assign(v); return *this; } - LLSD& operator=(Integer v) { assign(v); return *this; } - LLSD& operator=(Real v) { assign(v); return *this; } - LLSD& operator=(const String& v) { assign(v); return *this; } - LLSD& operator=(const UUID& v) { assign(v); return *this; } - LLSD& operator=(const Date& v) { assign(v); return *this; } - LLSD& operator=(const URI& v) { assign(v); return *this; } - LLSD& operator=(const Binary& v) { assign(v); return *this; } + + // support assignment from size_t et al. + template ::value && + ! std::is_same::value, + bool>::type = true> + void assign(VALUE v) { assign(Integer(narrow(v))); } + // support assignment from F32 et al. + template ::value, + bool>::type = true> + void assign(VALUE v) { assign(Real(narrow(v))); } + + template + LLSD& operator=(VALUE v) { assign(v); return *this; } //@} /** @@ -275,7 +292,6 @@ public: //@{ LLSD(const char*); void assign(const char*); - LLSD& operator=(const char* v) { assign(v); return *this; } //@} /** @name Map Values */ @@ -317,9 +333,15 @@ public: // accept size_t so we can index relative to size() const LLSD& operator[](size_t) const; LLSD& operator[](size_t); - // overload to disambiguate [0], [1] et al. - const LLSD& operator[](Integer i) const { return (*this)[size_t(i)]; } - LLSD& operator[](Integer i) { return (*this)[size_t(i)]; } + // template overloads to support int literals, U32 et al. + template ::value, + bool>::type = true> + const LLSD& operator[](IDX i) const { return (*this)[size_t(i)]; } + template ::value, + bool>::type = true> + LLSD& operator[](IDX i) { return (*this)[size_t(i)]; } //@} /** @name Iterators */ diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 666da717b2..b720e6adb6 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -2110,7 +2110,7 @@ std::string zip_llsd(LLSD& data) U8 out[CHUNK]; - strm.avail_in = uint32_t(source.size()); + strm.avail_in = narrow(source.size()); strm.next_in = (U8*) source.data(); U8* output = NULL; diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index f47c06a2dc..b8b827135d 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -196,12 +196,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, // *FIX: memory inefficient. // *TODO: convert to use LLBase64 ostr << pre << ""; - int b64_buffer_length = apr_base64_encode_len(int(buffer.size())); + int b64_buffer_length = apr_base64_encode_len(narrow(buffer.size())); char* b64_buffer = new char[b64_buffer_length]; b64_buffer_length = apr_base64_encode_binary( b64_buffer, &buffer[0], - int(buffer.size())); + narrow(buffer.size())); ostr.write(b64_buffer, b64_buffer_length - 1); delete[] b64_buffer; ostr << "" << post; diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 1951ca6843..7a545843c0 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -909,7 +909,7 @@ void LLMemoryInfo::stream(std::ostream& s) const // Now stream stats BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap)) { - s << pfx << std::setw(int(key_width+1)) << (pair.first + ':') << ' '; + s << pfx << std::setw(narrow(key_width+1)) << (pair.first + ':') << ' '; LLSD value(pair.second); if (value.isInteger()) s << std::setw(12) << value.asInteger(); diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm index 9359503a19..81032658d7 100644 --- a/indra/llcommon/llsys_objc.mm +++ b/indra/llcommon/llsys_objc.mm @@ -27,19 +27,19 @@ #import "llsys_objc.h" #import -static NSInteger intAtStringIndex(NSArray *array, int index) +static int intAtStringIndex(NSArray *array, int index) { - return [(NSString *)[array objectAtIndex:index] integerValue]; + return int([(NSString *)[array objectAtIndex:index] integerValue]); } -bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch) +bool LLGetDarwinOSInfo(int &major, int &minor, int &patch) { if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8) { NSOperatingSystemVersion osVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; - major = osVersion.majorVersion; - minor = osVersion.minorVersion; - patch = osVersion.patchVersion; + major = int(osVersion.majorVersion); + minor = int(osVersion.minorVersion); + patch = int(osVersion.patchVersion); } else { diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 818eb0457b..7ad50d1288 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -65,7 +65,7 @@ void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent ) llassert_always(parent != mBlock); llassert_always(parent != NULL); - TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(S32(parent->getIndex())); + TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(narrow(parent->getIndex())); if (!parent_tree_node) return; if (mParent) diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp index 84c1ccd9fe..7c38cdb7cd 100644 --- a/indra/llcommon/lltraceaccumulators.cpp +++ b/indra/llcommon/lltraceaccumulators.cpp @@ -98,7 +98,7 @@ void AccumulatorBufferGroup::makeCurrent() // update stacktimer parent pointers for (size_t i = 0, end_i = mStackTimers.size(); i < end_i; i++) { - TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(S32(i)); + TimeBlockTreeNode* tree_node = thread_recorder->getTimeBlockTreeNode(narrow(i)); if (tree_node) { timer_accumulator_buffer[i].mParent = tree_node->mParent; diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp index 1d31d7b9d0..8414b234e0 100644 --- a/indra/llcommon/lltracerecording.cpp +++ b/indra/llcommon/lltracerecording.cpp @@ -606,7 +606,8 @@ void PeriodicRecording::nextPeriod() mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size(); old_recording.splitTo(getCurRecording()); - mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1); + mNumRecordedPeriods = mRecordingPeriods.empty()? 0 : + llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1); } void PeriodicRecording::appendRecording(Recording& recording) @@ -652,8 +653,8 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other ) mRecordingPeriods.push_back(other.mRecordingPeriods[other_current_recording_index]); } - mCurPeriod = mRecordingPeriods.size() - 1; - mNumRecordedPeriods = mRecordingPeriods.size() - 1; + mCurPeriod = mRecordingPeriods.empty()? 0 : mRecordingPeriods.size() - 1; + mNumRecordedPeriods = mCurPeriod; } else { diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h index e283e8f79a..81f244e422 100644 --- a/indra/llcommon/llunittype.h +++ b/indra/llcommon/llunittype.h @@ -83,10 +83,8 @@ struct LLUnit typedef void is_unit_t; // value initialization - // allow for convertible type - template - LL_FORCE_INLINE explicit LLUnit(T value = T()) - : mValue(storage_t(value)) + LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t()) + : mValue(value) {} @@ -126,7 +124,7 @@ struct LLUnit // unit initialization and conversion template LL_FORCE_INLINE LLUnit(LLUnit other) - : mValue(storage_t(convert(other).mValue)) + : mValue(convert(other).mValue) {} LL_FORCE_INLINE storage_t value() const diff --git a/indra/llcommon/stdtypes.h b/indra/llcommon/stdtypes.h index a030017e3b..da8512169c 100644 --- a/indra/llcommon/stdtypes.h +++ b/indra/llcommon/stdtypes.h @@ -179,10 +179,10 @@ public: { // The reason we skip the // assert(value >= std::numeric_limits::lowest()); - // in the overload below is that to perform the above comparison, the - // compiler promotes the signed lowest() to the unsigned FROM type, - // making it hugely positive -- so a reasonable 'value' will always - // fail the assert(). + // like the overload below is that to perform the above comparison, + // the compiler promotes the signed lowest() to the unsigned FROM + // type, making it hugely positive -- so a reasonable 'value' will + // always fail the assert(). assert(mValue <= std::numeric_limits::max()); return static_cast(mValue); } diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 9403e73b87..cabc3a3517 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -859,7 +859,7 @@ LLTextureCache::~LLTextureCache() ////////////////////////////////////////////////////////////////////////////// //virtual -S32 LLTextureCache::update(F32 max_time_ms) +size_t LLTextureCache::update(F32 max_time_ms) { static LLFrameTimer timer ; static const F32 MAX_TIME_INTERVAL = 300.f ; //seconds. diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h index e1c752b58e..e6437ef5ea 100644 --- a/indra/newview/lltexturecache.h +++ b/indra/newview/lltexturecache.h @@ -113,7 +113,7 @@ public: LLTextureCache(bool threaded); ~LLTextureCache(); - /*virtual*/ S32 update(F32 max_time_ms); + /*virtual*/ size_t update(F32 max_time_ms); void purgeCache(ELLPath location, bool remove_dir = true); void setReadOnly(BOOL read_only) ; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 0edaf40c66..8cd6ccba85 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -3104,9 +3104,9 @@ bool LLTextureFetch::updateRequestPriority(const LLUUID& id, F32 priority) // Threads: T* //virtual -S32 LLTextureFetch::getPending() +size_t LLTextureFetch::getPending() { - S32 res; + size_t res; lockData(); // +Ct { LLMutexLock lock(&mQueueMutex); // +Mfq @@ -3181,7 +3181,7 @@ void LLTextureFetch::commonUpdate() // Threads: Tmain //virtual -S32 LLTextureFetch::update(F32 max_time_ms) +size_t LLTextureFetch::update(F32 max_time_ms) { static LLCachedControl band_width(gSavedSettings,"ThrottleBandwidthKBPS", 3000.0); diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index bf6732963f..e2d2aa365c 100644 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -65,7 +65,7 @@ public: class TFRequest; // Threads: Tmain - /*virtual*/ S32 update(F32 max_time_ms); + /*virtual*/ size_t update(F32 max_time_ms); // called in the main thread after the TextureCacheThread shuts down. // Threads: Tmain @@ -137,7 +137,7 @@ public: U32 getTotalNumHTTPRequests(); // Threads: T* - S32 getPending(); + size_t getPending(); // Threads: T* void lockQueue() { mQueueMutex.lock(); } -- cgit v1.2.3 From c3ddd7092085a204b6241dc027c70972b08ee202 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 13 Nov 2022 06:10:02 -1000 Subject: DRTVWR-575: Explain that NSInteger is really int64_t. --- indra/llcommon/llsys_objc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/llcommon/llsys_objc.h b/indra/llcommon/llsys_objc.h index aebc600032..b48ff97bdb 100644 --- a/indra/llcommon/llsys_objc.h +++ b/indra/llcommon/llsys_objc.h @@ -29,6 +29,8 @@ #include +// C++ land doesn't define NSInteger, and we don't want to introduce that for +// this one case, so use int64_t instead (which is equivalent). bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch); -- cgit v1.2.3 From 8ff81fc7a5ffe9122dac4ceb705908cbf0361095 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 11:16:55 -0500 Subject: DRTVWR-575: Keep BufferArray::findBlock() in int domain. --- indra/llcorehttp/bufferarray.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcorehttp/bufferarray.cpp b/indra/llcorehttp/bufferarray.cpp index 4c680fdb56..8d2e7c6a63 100644 --- a/indra/llcorehttp/bufferarray.cpp +++ b/indra/llcorehttp/bufferarray.cpp @@ -288,7 +288,7 @@ int BufferArray::findBlock(size_t pos, size_t * ret_offset) if (pos >= mLen) return -1; // Doesn't exist - const auto block_limit(mBlocks.size()); + const int block_limit(narrow(mBlocks.size())); for (int i(0); i < block_limit; ++i) { if (pos < mBlocks[i]->mUsed) -- cgit v1.2.3 From 8f6ffd489df9d6346e04070ad8209f2432ef3416 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 13:04:35 -0500 Subject: DRTVWR-575: Introduce LLKeyBind::endNonEmpty() and use it to replace dubious loops in asLLSD() and trimEmpty(). --- indra/llcommon/llkeybind.cpp | 31 +++++++++++++++---------------- indra/llcommon/llkeybind.h | 2 ++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp index f47ba41bae..12e57ae94b 100644 --- a/indra/llcommon/llkeybind.cpp +++ b/indra/llcommon/llkeybind.cpp @@ -30,6 +30,7 @@ #include "llsd.h" #include "llsdutil.h" +#include LLKeyData::LLKeyData() : @@ -213,19 +214,23 @@ bool LLKeyBind::isEmpty() const return true; } -LLSD LLKeyBind::asLLSD() const +LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const { - auto last = mData.size() - 1; - while (mData[last].empty()) - { - last--; - } + // search backwards for last non-empty entry, then turn back into forwards + // iterator (.base() call) + return std::find_if_not(mData.rbegin(), mData.rend(), + [](const auto& kdata){ return kdata.empty(); }).base(); +} +LLSD LLKeyBind::asLLSD() const +{ LLSD data; - for (S32 i = 0; i <= last; ++i) + auto end{ endNonEmpty() }; + for (auto it = mData.begin(); it < end; ++it) { - // append even if empty to not affect visual representation - data.append(mData[i].asLLSD()); + // append intermediate entries even if empty to not affect visual + // representation + data.append(it->asLLSD()); } return data; } @@ -380,16 +385,10 @@ void LLKeyBind::resetKeyData(S32 index) void LLKeyBind::trimEmpty() { - auto last = mData.size() - 1; - while (last >= 0 && mData[last].empty()) - { - mData.erase(mData.begin() + last); - last--; - } + mData.erase(endNonEmpty(), mData.end()); } size_t LLKeyBind::getDataCount() { return mData.size(); } - diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h index f63ad1d64e..488f509411 100644 --- a/indra/llcommon/llkeybind.h +++ b/indra/llcommon/llkeybind.h @@ -100,6 +100,8 @@ public: private: typedef std::vector data_vector_t; data_vector_t mData; + + data_vector_t::const_iterator endNonEmpty() const; }; -- cgit v1.2.3 From 73aced620fce59d98373cec6e830315bb6781546 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 13:59:06 -0500 Subject: DRTVWR-575: Use llssize (signed size_t) for max_bytes parameters. Since LLSDSerialize::SIZE_UNLIMITED is negative, passing that through unsigned size_t parameters could result in peculiar behavior. --- indra/llcommon/llsdserialize.cpp | 14 +++++++------- indra/llcommon/llsdserialize.h | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index b720e6adb6..08b3e52597 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -99,7 +99,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize } // static -bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, size_t max_bytes) +bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes) { LLPointer p = NULL; char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */ @@ -252,7 +252,7 @@ F64 ll_ntohd(F64 netdouble) * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes); +int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes); /** * @brief Parse a delimited string. @@ -280,7 +280,7 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d); int deserialize_string_raw( std::istream& istr, std::string& value, - size_t max_bytes); + llssize max_bytes); /** * @brief helper method for dealing with the different notation boolean format. @@ -329,7 +329,7 @@ LLSDParser::LLSDParser() LLSDParser::~LLSDParser() { } -S32 LLSDParser::parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth) +S32 LLSDParser::parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth) { mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true; mMaxBytesLeft = max_bytes; @@ -1592,7 +1592,7 @@ void LLSDBinaryFormatter::formatString( /** * local functions */ -int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes) +int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes) { int c = istr.get(); if(istr.fail()) @@ -1728,7 +1728,7 @@ int deserialize_string_delim( int deserialize_string_raw( std::istream& istr, std::string& value, - size_t max_bytes) + llssize max_bytes) { int count = 0; const S32 BUF_LEN = 20; @@ -2173,7 +2173,7 @@ std::string zip_llsd(LLSD& data) LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size) { U8* result = NULL; - size_t cur_size = 0; + llssize cur_size = 0; z_stream strm; const U32 CHUNK = 65536; diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 86d34cde9a..ddcd795e8a 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -77,7 +77,7 @@ public: * @return Returns the number of LLSD objects parsed into * data. Returns PARSE_FAILURE (-1) on parse failure. */ - S32 parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth = -1); + S32 parse(std::istream& istr, LLSD& data, llssize max_bytes, S32 max_depth = -1); /** Like parse(), but uses a different call (istream.getline()) to read by lines * This API is better suited for XML, where the parse cannot tell @@ -205,7 +205,7 @@ protected: /** * @brief The maximum number of bytes left to be parsed. */ - mutable size_t mMaxBytesLeft; + mutable llssize mMaxBytesLeft; /** * @brief Use line-based reading to get text @@ -756,7 +756,7 @@ public: * @param max_bytes the maximum number of bytes to parse * @return Returns true if the stream appears to contain valid data */ - static bool deserialize(LLSD& sd, std::istream& str, size_t max_bytes); + static bool deserialize(LLSD& sd, std::istream& str, llssize max_bytes); /* * Notation Methods @@ -778,12 +778,12 @@ public: LLSDFormatter::EFormatterOptions(LLSDFormatter::OPTIONS_PRETTY | LLSDFormatter::OPTIONS_PRETTY_BINARY)); } - static S32 fromNotation(LLSD& sd, std::istream& str, size_t max_bytes) + static S32 fromNotation(LLSD& sd, std::istream& str, llssize max_bytes) { LLPointer p = new LLSDNotationParser; return p->parse(str, sd, max_bytes); } - static LLSD fromNotation(std::istream& str, size_t max_bytes) + static LLSD fromNotation(std::istream& str, llssize max_bytes) { LLPointer p = new LLSDNotationParser; LLSD sd; @@ -834,12 +834,12 @@ public: LLPointer f = new LLSDBinaryFormatter; return f->format(sd, str, LLSDFormatter::OPTIONS_NONE); } - static S32 fromBinary(LLSD& sd, std::istream& str, size_t max_bytes, S32 max_depth = -1) + static S32 fromBinary(LLSD& sd, std::istream& str, llssize max_bytes, S32 max_depth = -1) { LLPointer p = new LLSDBinaryParser; return p->parse(str, sd, max_bytes, max_depth); } - static LLSD fromBinary(std::istream& str, size_t max_bytes, S32 max_depth = -1) + static LLSD fromBinary(std::istream& str, llssize max_bytes, S32 max_depth = -1) { LLPointer p = new LLSDBinaryParser; LLSD sd; -- cgit v1.2.3 From db1d757aebc3dd23e542f7cd4f468dbcd97edcb7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 14:40:11 -0500 Subject: DRTVWR-575: Update a few more int lengths in llsdserialize.{h,cpp}. --- indra/llcommon/llsdserialize.cpp | 70 +++++++++++++++++----------------- indra/llcommon/llsdserialize.h | 6 +-- indra/llcommon/llsdserialize_xml.cpp | 6 +-- indra/newview/llpathfindingnavmesh.cpp | 2 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 08b3e52597..af57f4ac5e 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -50,7 +50,7 @@ #include "lluri.h" // File constants -static const int MAX_HDR_LEN = 20; +static const size_t MAX_HDR_LEN = 20; static const S32 UNZIP_LLSD_MAX_DEPTH = 96; static const char LEGACY_NON_HEADER[] = ""; const std::string LLSD_BINARY_HEADER("LLSD/Binary"); @@ -252,7 +252,7 @@ F64 ll_ntohd(F64 netdouble) * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes); +llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes); /** * @brief Parse a delimited string. @@ -263,7 +263,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_string_delim(std::istream& istr, std::string& value, char d); +llssize deserialize_string_delim(std::istream& istr, std::string& value, char d); /** * @brief Read a raw string off the stream. @@ -277,7 +277,7 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d); * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_string_raw( +llssize deserialize_string_raw( std::istream& istr, std::string& value, llssize max_bytes); @@ -292,7 +292,7 @@ int deserialize_string_raw( * @return Returns number of bytes read off of the stream. Returns * PARSE_FAILURE (-1) on failure. */ -int deserialize_boolean( +llssize deserialize_boolean( std::istream& istr, LLSD& data, const std::string& compare, @@ -359,7 +359,7 @@ std::istream& LLSDParser::get( char delim) const { istr.get(s, n, delim); - if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount(); + if(mCheckLimits) mMaxBytesLeft -= istr.gcount(); return istr; } @@ -369,7 +369,7 @@ std::istream& LLSDParser::get( char delim) const { istr.get(sb, delim); - if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount(); + if(mCheckLimits) mMaxBytesLeft -= istr.gcount(); return istr; } @@ -393,11 +393,11 @@ std::istream& LLSDParser::read( std::streamsize n) const { istr.read(s, n); - if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount(); + if(mCheckLimits) mMaxBytesLeft -= istr.gcount(); return istr; } -void LLSDParser::account(S32 bytes) const +void LLSDParser::account(llssize bytes) const { if(mCheckLimits) mMaxBytesLeft -= bytes; } @@ -502,7 +502,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c c = istr.peek(); if(isalpha(c)) { - int cnt = deserialize_boolean( + auto cnt = deserialize_boolean( istr, data, NOTATION_FALSE_SERIAL, @@ -532,7 +532,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c c = istr.peek(); if(isalpha(c)) { - int cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true); + auto cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true); if(PARSE_FAILURE == cnt) parse_count = cnt; else account(cnt); } @@ -608,7 +608,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c c = get(istr); // pop the 'l' c = get(istr); // pop the delimiter std::string str; - int cnt = deserialize_string_delim(istr, str, c); + auto cnt = deserialize_string_delim(istr, str, c); if(PARSE_FAILURE == cnt) { parse_count = PARSE_FAILURE; @@ -631,7 +631,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c c = get(istr); // pop the 'd' c = get(istr); // pop the delimiter std::string str; - int cnt = deserialize_string_delim(istr, str, c); + auto cnt = deserialize_string_delim(istr, str, c); if(PARSE_FAILURE == cnt) { parse_count = PARSE_FAILURE; @@ -663,7 +663,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c default: parse_count = PARSE_FAILURE; - LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c + LL_INFOS() << "Unrecognized character while parsing: int(" << int(c) << ")" << LL_ENDL; break; } @@ -694,7 +694,7 @@ S32 LLSDNotationParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) c { putback(istr, c); found_name = true; - int count = deserialize_string(istr, name, mMaxBytesLeft); + auto count = deserialize_string(istr, name, mMaxBytesLeft); if(PARSE_FAILURE == count) return PARSE_FAILURE; account(count); } @@ -776,7 +776,7 @@ S32 LLSDNotationParser::parseArray(std::istream& istr, LLSD& array, S32 max_dept bool LLSDNotationParser::parseString(std::istream& istr, LLSD& data) const { std::string value; - int count = deserialize_string(istr, value, mMaxBytesLeft); + auto count = deserialize_string(istr, value, mMaxBytesLeft); if(PARSE_FAILURE == count) return false; account(count); data = value; @@ -809,7 +809,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const if(len) { value.resize(len); - account((int)fullread(istr, (char *)&value[0], len)); + account(fullread(istr, (char *)&value[0], len)); } c = get(istr); // strip off the trailing double-quote data = value; @@ -1006,7 +1006,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con case '"': { std::string value; - int cnt = deserialize_string_delim(istr, value, c); + auto cnt = deserialize_string_delim(istr, value, c); if(PARSE_FAILURE == cnt) { parse_count = PARSE_FAILURE; @@ -1093,7 +1093,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con if(size > 0) { value.resize(size); - account((int)fullread(istr, (char*)&value[0], size)); + account(fullread(istr, (char*)&value[0], size)); } data = value; } @@ -1107,7 +1107,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con default: parse_count = PARSE_FAILURE; - LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c + LL_INFOS() << "Unrecognized character while parsing: int(" << int(c) << ")" << LL_ENDL; break; } @@ -1141,7 +1141,7 @@ S32 LLSDBinaryParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) con case '\'': case '"': { - int cnt = deserialize_string_delim(istr, name, c); + auto cnt = deserialize_string_delim(istr, name, c); if(PARSE_FAILURE == cnt) return PARSE_FAILURE; account(cnt); break; @@ -1225,7 +1225,7 @@ bool LLSDBinaryParser::parseString( if(size) { buf.resize(size); - account((int)fullread(istr, &buf[0], size)); + account(fullread(istr, &buf[0], size)); value.assign(buf.begin(), buf.end()); } return true; @@ -1429,7 +1429,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr, ostr << std::uppercase; auto oldfill(ostr.fill('0')); auto oldwidth(ostr.width()); - for (int i = 0; i < buffer.size(); i++) + for (size_t i = 0; i < buffer.size(); i++) { // have to restate setw() before every conversion ostr << std::setw(2) << (int) buffer[i]; @@ -1592,7 +1592,7 @@ void LLSDBinaryFormatter::formatString( /** * local functions */ -int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes) +llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes) { int c = istr.get(); if(istr.fail()) @@ -1602,7 +1602,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes return LLSDParser::PARSE_FAILURE; } - int rv = LLSDParser::PARSE_FAILURE; + llssize rv = LLSDParser::PARSE_FAILURE; switch(c) { case '\'': @@ -1622,7 +1622,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes return rv + 1; // account for the character grabbed at the top. } -int deserialize_string_delim( +llssize deserialize_string_delim( std::istream& istr, std::string& value, char delim) @@ -1632,7 +1632,7 @@ int deserialize_string_delim( bool found_hex = false; bool found_digit = false; U8 byte = 0; - int count = 0; + llssize count = 0; while (true) { @@ -1647,7 +1647,7 @@ int deserialize_string_delim( } char next_char = (char)next_byte; // Now that we know it's not EOF - + if(found_escape) { // next character(s) is a special sequence. @@ -1725,16 +1725,16 @@ int deserialize_string_delim( return count; } -int deserialize_string_raw( +llssize deserialize_string_raw( std::istream& istr, std::string& value, llssize max_bytes) { - int count = 0; + llssize count = 0; const S32 BUF_LEN = 20; char buf[BUF_LEN]; /* Flawfinder: ignore */ istr.get(buf, BUF_LEN - 1, ')'); - count += (int)istr.gcount(); + count += istr.gcount(); int c = istr.get(); c = istr.get(); count += 2; @@ -1749,7 +1749,7 @@ int deserialize_string_raw( if(len) { buf.resize(len); - count += (int)fullread(istr, (char *)&buf[0], len); + count += fullread(istr, (char *)&buf[0], len); value.assign(buf.begin(), buf.end()); } c = istr.get(); @@ -2038,7 +2038,7 @@ void serialize_string(const std::string& value, std::ostream& str) } } -int deserialize_boolean( +llssize deserialize_boolean( std::istream& istr, LLSD& data, const std::string& compare, @@ -2055,7 +2055,7 @@ int deserialize_boolean( // * set data to LLSD::null // * return LLSDParser::PARSE_FAILURE (-1) // - int bytes_read = 0; + llssize bytes_read = 0; std::string::size_type ii = 0; char c = istr.peek(); while((++ii < compare.size()) @@ -2294,7 +2294,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, //This unzip function will only work with a gzip header and trailer - while the contents //of the actual compressed data is the same for either format (gzip vs zlib ), the headers //and trailers are different for the formats. -U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size ) +U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size ) { if (size == 0) { diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index ddcd795e8a..bd5ef668c0 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -194,7 +194,7 @@ protected: * Conceptually const since it only modifies mutable members. * @param bytes The number of bytes read. */ - void account(S32 bytes) const; + void account(llssize bytes) const; protected: /** @@ -336,7 +336,7 @@ private: class Impl; Impl& impl; - void parsePart(const char* buf, int len); + void parsePart(const char* buf, llssize len); friend class LLSDSerialize; }; @@ -867,5 +867,5 @@ public: LL_COMMON_API std::string zip_llsd(LLSD& data); -LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size); +LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size); #endif // LL_LLSDSERIALIZE_H diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index b8b827135d..ac128c9f86 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -260,7 +260,7 @@ public: S32 parse(std::istream& input, LLSD& data); S32 parseLines(std::istream& input, LLSD& data); - void parsePart(const char *buf, int len); + void parsePart(const char *buf, llssize len); void reset(); @@ -542,7 +542,7 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs) return NULL; } -void LLSDXMLParser::Impl::parsePart(const char* buf, int len) +void LLSDXMLParser::Impl::parsePart(const char* buf, llssize len) { if ( buf != NULL && len > 0 ) @@ -915,7 +915,7 @@ LLSDXMLParser::~LLSDXMLParser() delete &impl; } -void LLSDXMLParser::parsePart(const char *buf, int len) +void LLSDXMLParser::parsePart(const char *buf, llssize len) { impl.parsePart(buf, len); } diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp index 0287c07f96..c297cac771 100644 --- a/indra/newview/llpathfindingnavmesh.cpp +++ b/indra/newview/llpathfindingnavmesh.cpp @@ -143,7 +143,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes unsigned int binSize = value.size(); std::string newStr(reinterpret_cast(&value[0]), binSize); std::istringstream streamdecomp( newStr ); - unsigned int decompBinSize = 0; + size_t decompBinSize = 0; bool valid = false; U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ; if ( !valid ) -- cgit v1.2.3 From 9a7e638b67cda4bb1174a4d46fb7769290472ebc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 15:46:05 -0500 Subject: DRTVWR-575: Defend unescape_string() against empty line. The unsigned index arithmetic was problematic in that case. --- indra/llcommon/llstreamtools.cpp | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index 1eccfda755..1ff15fcf89 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -331,8 +331,7 @@ bool remove_last_char(char c, std::string& line) void unescape_string(std::string& line) { auto line_size = line.size(); - size_t index = 0; - while (index < line_size - 1) + for (size_t index = 0; line_size >= 1 && index < line_size - 1; ++index) { if ('\\' == line[index]) { @@ -347,7 +346,6 @@ void unescape_string(std::string& line) line_size--; } } - index++; } } @@ -357,8 +355,7 @@ void unescape_string(std::string& line) void escape_string(std::string& line) { auto line_size = line.size(); - size_t index = 0; - while (index < line_size) + for (size_t index = 0; index < line_size; ++index) { if ('\\' == line[index]) { @@ -372,7 +369,6 @@ void escape_string(std::string& line) line_size++; index++; } - index++; } } @@ -380,23 +376,20 @@ void escape_string(std::string& line) void replace_newlines_with_whitespace(std::string& line) { auto line_size = line.size(); - size_t index = 0; - while (index < line_size) + for (size_t index = 0; index < line_size; ++index) { if ('\n' == line[index]) { line.replace(index, 1, " "); } - index++; } } // erases any double-quote characters in 'line' void remove_double_quotes(std::string& line) { - size_t index = 0; auto line_size = line.size(); - while (index < line_size) + for (size_t index = 0; index < line_size; ) { if ('"' == line[index]) { @@ -427,19 +420,18 @@ void get_keyword_and_value(std::string& keyword, auto line_size = line.size(); size_t line_index = 0; char c; - while (line_index < line_size) + for ( ; line_index < line_size; ++line_index) { c = line[line_index]; if (!LLStringOps::isSpace(c)) { break; } - line_index++; } // get the keyword keyword.clear(); - while (line_index < line_size) + for ( ; line_index < line_size; ++line_index) { c = line[line_index]; if (LLStringOps::isSpace(c) || '\r' == c || '\n' == c) @@ -447,7 +439,6 @@ void get_keyword_and_value(std::string& keyword, break; } keyword += c; - line_index++; } // get the value @@ -465,7 +456,7 @@ void get_keyword_and_value(std::string& keyword, line_index++; } - while (line_index < line_size) + for ( ; line_index < line_size; ++line_index) { c = line[line_index]; if ('\r' == c || '\n' == c) @@ -473,7 +464,6 @@ void get_keyword_and_value(std::string& keyword, break; } value += c; - line_index++; } } } -- cgit v1.2.3 From 7d9249d180f7bc228cad3d6f5ed4d5fb13296451 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 6 Dec 2022 17:16:56 -0500 Subject: DRTVWR-575: Try to avoid comparison warnings in llclamp() --- indra/llcommon/lldefs.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index a567fd7c12..5c46f6a796 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -214,13 +214,14 @@ inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4) template inline A llclamp(A a, MIN minval, MAX maxval) { - if ( a < minval ) + A aminval{ static_cast(minval) }, amaxval{ static_cast(maxval) }; + if ( a < aminval ) { - return static_cast(minval); + return aminval; } - else if ( a > maxval ) + else if ( a > amaxval ) { - return static_cast(maxval); + return amaxval; } return a; } -- cgit v1.2.3 From bb718155bddfbe7007029a0c9e69a4a98615f14d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 3 Jan 2023 18:06:45 -0500 Subject: DRTVWR-575: Replace some LLSDArray() usage with llsd::array(). It seems newer compilers have a different interpretation of exactly when to engage LLSDArray's copy constructor. In particular, this assignment: some_LLSD_map[key] = LLSDArray(...)(...)...; used to convert the LLSDArray object directly to LLSD; now it first calls the custom copy constructor, which embeds the intended array within an outer array before assigning it into the containing map. The newer llsd::array() function avoids that problem because what it returns is already an LLSD object. Taking inventory of LLSDArray assignments of that form turned up a number of workarounds like LLSD(LLSDArray(...)). Replacing those with llsd::array() is both simpler and more readable. Tip of the hat to Chorazinallen for surfacing this issue! --- indra/llinventory/llsettingssky.cpp | 119 +++++++++++++++++----------------- indra/llinventory/llsettingswater.cpp | 36 +++++----- indra/newview/llappviewer.cpp | 15 +++-- indra/newview/llsettingsvo.cpp | 32 ++++----- 4 files changed, 98 insertions(+), 104 deletions(-) diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 83a92f08d0..a129f0a6f0 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -152,24 +152,24 @@ LLSettingsSky::validation_list_t legacyHazeValidationList() { legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_AMBIENT, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(3.0f, 3.0f, 3.0f, "*")))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_DENSITY, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(3.0f, 3.0f, 3.0f, "*")))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_BLUE_HORIZON, false, LLSD::TypeArray, boost::bind(&LLSettingsBase::Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(3.0f, 3.0f, 3.0f, "*")))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_DENSITY, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(5.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 5.0f)))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_HAZE_HORIZON, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(5.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 5.0f)))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0001f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0001f, 2.0f)))); legacyHazeValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DISTANCE_MULTIPLIER, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0001f)(1000.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0001f, 1000.0f)))); } return legacyHazeValidation; } @@ -180,19 +180,19 @@ LLSettingsSky::validation_list_t rayleighValidationList() if (rayleighValidation.empty()) { rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(32768.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 32768.0f)))); rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(-1.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(-1.0f, 1.0f)))); rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); rayleighValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); } return rayleighValidation; } @@ -203,19 +203,19 @@ LLSettingsSky::validation_list_t absorptionValidationList() if (absorptionValidation.empty()) { absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(32768.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 32768.0f)))); absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(-1.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(-1.0f, 1.0f)))); absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); absorptionValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); } return absorptionValidation; } @@ -226,22 +226,22 @@ LLSettingsSky::validation_list_t mieValidationList() if (mieValidation.empty()) { mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(32768.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 32768.0f)))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(-1.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(-1.0f, 1.0f)))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(2.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 2.0f)))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); mieValidation.push_back(LLSettingsBase::Validator(LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR, false, LLSD::TypeReal, - boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); } return mieValidation; } @@ -546,89 +546,86 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList() static validation_list_t validation; if (validation.empty()) - { // Note the use of LLSD(LLSDArray()()()...) This is due to an issue with the - // copy constructor for LLSDArray. Directly binding the LLSDArray as - // a parameter without first wrapping it in a pure LLSD object will result - // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] + { validation.push_back(Validator(SETTING_BLOOM_TEXTUREID, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_RAINBOW_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_HALO_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(1.0f, 1.0f, 1.0f, "*")))); validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY1, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.0f)(1.0f)(3.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(1.0f, 1.0f, 3.0f, "*")))); validation.push_back(Validator(SETTING_CLOUD_POS_DENSITY2, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(1.0f)(1.0f)(1.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(1.0f, 1.0f, 1.0f, "*")))); validation.push_back(Validator(SETTING_CLOUD_SCALE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.001f)(3.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.001f, 3.0f)))); validation.push_back(Validator(SETTING_CLOUD_SCROLL_RATE, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(-50.0f)(-50.0f)), - LLSD(LLSDArray(50.0f)(50.0f))))); + llsd::array(-50.0f, -50.0f), + llsd::array(50.0f, 50.0f)))); validation.push_back(Validator(SETTING_CLOUD_SHADOW, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_CLOUD_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_CLOUD_VARIANCE, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_DOME_OFFSET, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_DOME_RADIUS, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(1000.0f)(2000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(1000.0f, 2000.0f)))); validation.push_back(Validator(SETTING_GAMMA, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(20.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 20.0f)))); validation.push_back(Validator(SETTING_GLOW, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.2f)("*")(-10.0f)("*")), - LLSD(LLSDArray(40.0f)("*")(10.0f)("*"))))); + llsd::array(0.2f, "*", -10.0f, "*"), + llsd::array(40.0f, "*", 10.0f, "*")))); validation.push_back(Validator(SETTING_MAX_Y, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(10000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 10000.0f)))); validation.push_back(Validator(SETTING_MOON_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); validation.push_back(Validator(SETTING_MOON_SCALE, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.25f, 20.0f)), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_MOON_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_MOON_BRIGHTNESS, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_STAR_BRIGHTNESS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(500.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 500.0f)))); validation.push_back(Validator(SETTING_SUNLIGHT_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")), - LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*"))))); + llsd::array(0.0f, 0.0f, 0.0f, "*"), + llsd::array(3.0f, 3.0f, 3.0f, "*")))); validation.push_back(Validator(SETTING_SUN_ROTATION, true, LLSD::TypeArray, &Validator::verifyQuaternionNormal)); validation.push_back(Validator(SETTING_SUN_SCALE, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.25f)(20.0f))), LLSD::Real(1.0))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.25f, 20.0f)), LLSD::Real(1.0))); validation.push_back(Validator(SETTING_SUN_TEXTUREID, false, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_PLANET_RADIUS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(1000.0f)(32768.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(1000.0f, 32768.0f)))); validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(1000.0f)(32768.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(1000.0f, 32768.0f)))); validation.push_back(Validator(SETTING_SKY_TOP_RADIUS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(1000.0f)(32768.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(1000.0f, 32768.0f)))); validation.push_back(Validator(SETTING_SUN_ARC_RADIANS, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(0.1f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 0.1f)))); validation.push_back(Validator(SETTING_SKY_MOISTURE_LEVEL, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_SKY_DROPLET_RADIUS, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(5.0f)(1000.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(5.0f, 1000.0f)))); validation.push_back(Validator(SETTING_SKY_ICE_LEVEL, false, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers)); validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers)); @@ -719,7 +716,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000, 0.5260, 1.0000, 0.0).getValue(); dfltsetting[SETTING_CLOUD_SCALE] = LLSD::Real(0.4199); - dfltsetting[SETTING_CLOUD_SCROLL_RATE] = LLSDArray(0.0f)(0.0f); + dfltsetting[SETTING_CLOUD_SCROLL_RATE] = llsd::array(0.0f, 0.0f); dfltsetting[SETTING_CLOUD_SHADOW] = LLSD::Real(0.2699); dfltsetting[SETTING_CLOUD_VARIANCE] = LLSD::Real(0.0); diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp index 90f99e8198..f19beb5be5 100644 --- a/indra/llinventory/llsettingswater.cpp +++ b/indra/llinventory/llsettingswater.cpp @@ -222,42 +222,38 @@ LLSettingsWater::validation_list_t LLSettingsWater::validationList() static validation_list_t validation; if (validation.empty()) - { // Note the use of LLSD(LLSDArray()()()...) This is due to an issue with the - // copy constructor for LLSDArray. Directly binding the LLSDArray as - // a parameter without first wrapping it in a pure LLSD object will result - // in deeply nested arrays like this [[[[[[[[[[v1,v2,v3]]]]]]]]]] - + { validation.push_back(Validator(SETTING_BLUR_MULTIPLIER, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(-0.5f)(0.5f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(-0.5f, 0.5f)))); validation.push_back(Validator(SETTING_FOG_COLOR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)(1.0f)), - LLSD(LLSDArray(1.0f)(1.0f)(1.0f)(1.0f))))); + llsd::array(0.0f, 0.0f, 0.0f, 1.0f), + llsd::array(1.0f, 1.0f, 1.0f, 1.0f)))); validation.push_back(Validator(SETTING_FOG_DENSITY, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(-10.0f)(10.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(-10.0f, 10.0f)))); validation.push_back(Validator(SETTING_FOG_MOD, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(20.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 20.0f)))); validation.push_back(Validator(SETTING_FRESNEL_OFFSET, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_FRESNEL_SCALE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 1.0f)))); validation.push_back(Validator(SETTING_NORMAL_MAP, true, LLSD::TypeUUID)); validation.push_back(Validator(SETTING_NORMAL_SCALE, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(0.0f)(0.0f)(0.0f)), - LLSD(LLSDArray(10.0f)(10.0f)(10.0f))))); + llsd::array(0.0f, 0.0f, 0.0f), + llsd::array(10.0f, 10.0f, 10.0f)))); validation.push_back(Validator(SETTING_SCALE_ABOVE, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(3.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 3.0f)))); validation.push_back(Validator(SETTING_SCALE_BELOW, true, LLSD::TypeReal, - boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(3.0f))))); + boost::bind(&Validator::verifyFloatRange, _1, _2, llsd::array(0.0f, 3.0f)))); validation.push_back(Validator(SETTING_WAVE1_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(-20.0f)(-20.0f)), - LLSD(LLSDArray(20.0f)(20.0f))))); + llsd::array(-20.0f, -20.0f), + llsd::array(20.0f, 20.0f)))); validation.push_back(Validator(SETTING_WAVE2_DIR, true, LLSD::TypeArray, boost::bind(&Validator::verifyVectorMinMax, _1, _2, - LLSD(LLSDArray(-20.0f)(-20.0f)), - LLSD(LLSDArray(20.0f)(20.0f))))); + llsd::array(-20.0f, -20.0f), + llsd::array(20.0f, 20.0f)))); } return validation; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4f3e0b08e4..b31447a72b 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3195,15 +3195,16 @@ LLSD LLAppViewer::getViewerInfo() const // LLFloaterAbout. LLSD info; auto& versionInfo(LLVersionInfo::instance()); - info["VIEWER_VERSION"] = LLSDArray(versionInfo.getMajor())(versionInfo.getMinor())(versionInfo.getPatch())(versionInfo.getBuild()); + info["VIEWER_VERSION"] = llsd::array(versionInfo.getMajor(), versionInfo.getMinor(), + versionInfo.getPatch(), versionInfo.getBuild()); info["VIEWER_VERSION_STR"] = versionInfo.getVersion(); info["CHANNEL"] = versionInfo.getChannel(); - info["ADDRESS_SIZE"] = ADDRESS_SIZE; - std::string build_config = versionInfo.getBuildConfig(); - if (build_config != "Release") - { - info["BUILD_CONFIG"] = build_config; - } + info["ADDRESS_SIZE"] = ADDRESS_SIZE; + std::string build_config = versionInfo.getBuildConfig(); + if (build_config != "Release") + { + info["BUILD_CONFIG"] = build_config; + } // return a URL to the release notes for this viewer, such as: // https://releasenotes.secondlife.com/viewer/2.1.0.123456.html diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 7c762170a7..1930faa1a0 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -568,11 +568,11 @@ void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings) legacy[SETTING_BLUE_DENSITY] = ensure_array_4(legacyhaze[SETTING_BLUE_DENSITY], 1.0); legacy[SETTING_BLUE_HORIZON] = ensure_array_4(legacyhaze[SETTING_BLUE_HORIZON], 1.0); - legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal())(0.0f)(0.0f)(1.0f); + legacy[SETTING_DENSITY_MULTIPLIER] = llsd::array(legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal(), 0.0f, 0.0f, 1.0f); + legacy[SETTING_DISTANCE_MULTIPLIER] = llsd::array(legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal(), 0.0f, 0.0f, 1.0f); - legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); - legacy[SETTING_HAZE_HORIZON] = LLSDArray(legacyhaze[SETTING_HAZE_HORIZON])(0.0f)(0.0f)(1.0f); + legacy[SETTING_HAZE_DENSITY] = llsd::array(legacyhaze[SETTING_HAZE_DENSITY], 0.0f, 0.0f, 1.0f); + legacy[SETTING_HAZE_HORIZON] = llsd::array(legacyhaze[SETTING_HAZE_HORIZON], 0.0f, 0.0f, 1.0f); } } @@ -586,15 +586,15 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA legacy[SETTING_CLOUD_COLOR] = ensure_array_4(settings[SETTING_CLOUD_COLOR], 1.0); legacy[SETTING_CLOUD_POS_DENSITY1] = ensure_array_4(settings[SETTING_CLOUD_POS_DENSITY1], 1.0); legacy[SETTING_CLOUD_POS_DENSITY2] = ensure_array_4(settings[SETTING_CLOUD_POS_DENSITY2], 1.0); - legacy[SETTING_CLOUD_SCALE] = LLSDArray(settings[SETTING_CLOUD_SCALE])(LLSD::Real(0.0))(LLSD::Real(0.0))(LLSD::Real(1.0)); + legacy[SETTING_CLOUD_SCALE] = llsd::array(settings[SETTING_CLOUD_SCALE], LLSD::Real(0.0), LLSD::Real(0.0), LLSD::Real(1.0)); legacy[SETTING_CLOUD_SCROLL_RATE] = settings[SETTING_CLOUD_SCROLL_RATE]; - legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = LLSDArray(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal()))) - (LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal()))); - legacy[SETTING_CLOUD_SHADOW] = LLSDArray(settings[SETTING_CLOUD_SHADOW].asReal())(0.0f)(0.0f)(1.0f); - legacy[SETTING_GAMMA] = LLSDArray(settings[SETTING_GAMMA])(0.0f)(0.0f)(1.0f); + legacy[SETTING_LEGACY_ENABLE_CLOUD_SCROLL] = llsd::array(LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][0].asReal())), + LLSD::Boolean(!is_approx_zero(settings[SETTING_CLOUD_SCROLL_RATE][1].asReal()))); + legacy[SETTING_CLOUD_SHADOW] = llsd::array(settings[SETTING_CLOUD_SHADOW].asReal(), 0.0f, 0.0f, 1.0f); + legacy[SETTING_GAMMA] = llsd::array(settings[SETTING_GAMMA], 0.0f, 0.0f, 1.0f); legacy[SETTING_GLOW] = ensure_array_4(settings[SETTING_GLOW], 1.0); legacy[SETTING_LIGHT_NORMAL] = ensure_array_4(psky->getLightDirection().getValue(), 0.0f); - legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f); + legacy[SETTING_MAX_Y] = llsd::array(settings[SETTING_MAX_Y], 0.0f, 0.0f, 1.0f); legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS].asReal() / 250.0f; // convert from 0-500 -> 0-2 ala pre-FS-compat changes legacy[SETTING_SUNLIGHT_COLOR] = ensure_array_4(settings[SETTING_SUNLIGHT_COLOR], 1.0f); @@ -1062,7 +1062,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n newsettings[SETTING_NAME] = name; - LLSD watertrack = LLSDArray( + LLSD watertrack = llsd::array( LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f)) (SETTING_KEYNAME, "water:Default")); @@ -1077,7 +1077,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyPreset(const std::string &n skytrack.append(entry); } - newsettings[SETTING_TRACKS] = LLSDArray(watertrack)(skytrack); + newsettings[SETTING_TRACKS] = llsd::array(watertrack, skytrack); LLSD frames(LLSD::emptyMap()); @@ -1165,7 +1165,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io watersettings[SETTING_NAME] = watername; frames[watername] = watersettings; - LLSD watertrack = LLSDArray( + LLSD watertrack = llsd::array( LLSDMap(SETTING_KEYKFRAME, LLSD::Real(0.0f)) (SETTING_KEYNAME, watername)); @@ -1179,7 +1179,7 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildFromLegacyMessage(const LLUUID ®io LLSD newsettings = LLSDMap ( SETTING_NAME, "Region (legacy)" ) - ( SETTING_TRACKS, LLSDArray(watertrack)(skytrack)) + ( SETTING_TRACKS, llsd::array(watertrack, skytrack)) ( SETTING_FRAMES, frames ) ( SETTING_TYPE, "daycycle" ); @@ -1360,7 +1360,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) skys[name.str()] = std::static_pointer_cast((*it).second); F32 frame = ((tracksky.size() == 1) && (it == tracksky.begin())) ? -1.0f : (*it).first; - llsdcycle.append( LLSDArray(LLSD::Real(frame))(name.str()) ); + llsdcycle.append( llsd::array(LLSD::Real(frame), name.str()) ); } LLSD llsdskylist(LLSD::emptyMap()); @@ -1373,7 +1373,7 @@ LLSD LLSettingsVODay::convertToLegacy(const LLSettingsVODay::ptr_t &pday) llsdskylist[(*its).first] = llsdsky; } - return LLSDArray(LLSD::emptyMap())(llsdcycle)(llsdskylist)(llsdwater); + return llsd::array(LLSD::emptyMap(), llsdcycle, llsdskylist, llsdwater); } LLSettingsSkyPtr_t LLSettingsVODay::getDefaultSky() const -- cgit v1.2.3 From aa112ef17f4fdfeecc05e5305af93a6d4b9fce70 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 4 Jan 2023 12:04:56 -0500 Subject: DRTVWR-575: Fix bug in macOS micro_sleep(). The compiler was deducing an unsigned type for the difference (U64 desired microseconds - half KERNEL_SLEEP_INTERVAL_US). When the desired sleep was less than that constant, the difference went hugely positive, resulting in a very long snooze. Amusingly, forcing that U64 result into an S32 num_sleep_intervals worked only *because* of integer truncation: the high-order bits were discarded, resulting in a negative result as intended. Ensuring that both integer operands are signed at the outset, though, produces a more formally correct result. --- indra/llcommon/lltimer.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index 74ec62d347..58bedacf43 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -121,9 +121,14 @@ U32 micro_sleep(U64 us, U32 max_yields) U64 start = get_clock_count(); // This is kernel dependent. Currently, our kernel generates software clock // interrupts at 250 Hz (every 4,000 microseconds). - const U64 KERNEL_SLEEP_INTERVAL_US = 4000; - - auto num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; + const S64 KERNEL_SLEEP_INTERVAL_US = 4000; + + // Use signed arithmetic to discover whether a sleep is even necessary. If + // either 'us' or KERNEL_SLEEP_INTERVAL_US is unsigned, the compiler + // promotes the difference to unsigned. If 'us' is less than half + // KERNEL_SLEEP_INTERVAL_US, the unsigned difference will be hugely + // positive, resulting in a crazy long wait. + auto num_sleep_intervals = (S64(us) - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US; if (num_sleep_intervals > 0) { U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1); -- cgit v1.2.3 From 4093d5b1ebe6b0eb50473d5161042ac3a1b7f6b2 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 4 Jan 2023 15:13:02 -0500 Subject: DRTVWR-575: Use llsdutil.h functions for LLFloaterLandHoldings LLSD LLFloaterLandHoldings::postBuild() was constructing an LLSD structure by assigning each map entry and array element one at a time. Chorazinallen identified a crash bug possibly caused by destroying that LLSD structure. Diagnostically try building it using nested llsd::map() and llsd::array() calls instead to see if that improves matters. --- indra/newview/llfloaterlandholdings.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index 8633fe4e5e..a3222d622f 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -39,6 +39,7 @@ #include "llfloaterworldmap.h" #include "llproductinforequest.h" #include "llscrolllistctrl.h" +#include "llsdutil.h" #include "llstatusbar.h" #include "lltextbox.h" #include "llscrolllistctrl.h" @@ -79,24 +80,25 @@ BOOL LLFloaterLandHoldings::postBuild() for(S32 i = 0; i < count; ++i) { LLUUID id(gAgent.mGroups.at(i).mID); - - LLSD element; - element["id"] = id; - element["columns"][0]["column"] = "group"; - element["columns"][0]["value"] = gAgent.mGroups.at(i).mName; - element["columns"][0]["font"] = "SANSSERIF"; - LLUIString areastr = getString("area_string"); areastr.setArg("[AREA]", llformat("%d", gAgent.mGroups.at(i).mContribution)); - element["columns"][1]["column"] = "area"; - element["columns"][1]["value"] = areastr; - element["columns"][1]["font"] = "SANSSERIF"; - grant_list->addElement(element); + grant_list->addElement( + llsd::map( + "id", id, + "columns", llsd::array( + llsd::map( + "column", "group", + "value", gAgent.mGroups.at(i).mName, + "font", "SANSSERIF"), + llsd::map( + "column", "area", + "value", areastr, + "font", "SANSSERIF")))); } - + center(); - + return TRUE; } @@ -108,8 +110,8 @@ LLFloaterLandHoldings::~LLFloaterLandHoldings() void LLFloaterLandHoldings::onOpen(const LLSD& key) { - LLScrollListCtrl *list = getChild("parcel list"); - list->clearRows(); + LLScrollListCtrl *list = getChild("parcel list"); + list->clearRows(); // query_id null is known to be us const LLUUID& query_id = LLUUID::null; -- cgit v1.2.3 From 99c040ea9976e90caec9dedd942badc1c43822e7 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 4 Jan 2023 17:18:31 -0500 Subject: DRTVWR-575: Fix possible bad indexing in LLSD::operator[](size_t). One could argue that passing a negative index to an LLSD array should do something other than shrug and reference element [0], but as that's legacy behavior, it seems all too likely that the viewer sometimes relies on it. This specific problem arises if the index passed to operator[]() is negative -- either with the previous Integer parameter or with size_t (which of course reinterprets the negative index as hugely positive). The non-const ImplArray::ref() overload checks parameter 'i' and, if it appears negative, sets internal 'index' to 0. But in the next stanza, if (index >= existing size()), it calls resize() to scale the internal array up to one more than the requested index. The trouble is that it passed resize(i + 1), not the adjusted resize(index + 1). With a requested index of exactly -1, that would pass resize(0), which would result in the ensuing array[0] reference being invalid. With a requested index less than -1, that would pass resize(hugely positive) -- since, whether operator[]() accepts signed LLSD::Integer or size_t, resize() accepts std::vector::size_type. Given that the footprint of an LLSD array element is at least a pointer, the number of bytes required for resize(hugely positive) is likely to exceed available heap storage. Passing the adjusted resize(index + 1) should defend against that case. --- indra/llcommon/llsd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index a645e624f8..590915e9d2 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -622,7 +622,7 @@ namespace if (index >= mData.size()) { - mData.resize(i + 1); + mData.resize(index + 1); } return mData[index]; -- cgit v1.2.3 From f3cd329b585ef55a66f2a824f010d1a54d67d8d2 Mon Sep 17 00:00:00 2001 From: akleshchev <117672381+akleshchev@users.noreply.github.com> Date: Tue, 10 Jan 2023 19:38:44 +0200 Subject: SL-18911 My Land Holdings floater crashes viewer on the Xcode/+Monterey branches (#47) Revert part of "DRTVWR-575: Address review comments on Xcode 14.1 type tweaks." Crash was reproduced when assigning areastr to llsd, but likely present in other cases of assigning ui strings to llsd (instead of going for lluistring's result directly copy constructor was engaged and either copy or original crashed due to invalid pointers, copy shouldn't have been created). --- indra/llcommon/llsd.h | 26 ++++++++++---------------- indra/llui/llnotifications.cpp | 2 +- indra/newview/llviewermessage.cpp | 2 +- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index c1406cf73f..92a1fc58a5 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -30,7 +30,6 @@ #include #include #include -#include #include "stdtypes.h" @@ -216,21 +215,15 @@ public: void assign(const Date&); void assign(const URI&); void assign(const Binary&); - - // support assignment from size_t et al. - template ::value && - ! std::is_same::value, - bool>::type = true> - void assign(VALUE v) { assign(Integer(narrow(v))); } - // support assignment from F32 et al. - template ::value, - bool>::type = true> - void assign(VALUE v) { assign(Real(narrow(v))); } - - template - LLSD& operator=(VALUE v) { assign(v); return *this; } + + LLSD& operator=(Boolean v) { assign(v); return *this; } + LLSD& operator=(Integer v) { assign(v); return *this; } + LLSD& operator=(Real v) { assign(v); return *this; } + LLSD& operator=(const String& v) { assign(v); return *this; } + LLSD& operator=(const UUID& v) { assign(v); return *this; } + LLSD& operator=(const Date& v) { assign(v); return *this; } + LLSD& operator=(const URI& v) { assign(v); return *this; } + LLSD& operator=(const Binary& v) { assign(v); return *this; } //@} /** @@ -292,6 +285,7 @@ public: //@{ LLSD(const char*); void assign(const char*); + LLSD& operator=(const char* v) { assign(v); return *this; } //@} /** @name Map Values */ diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index 7c381161c9..d736aa6634 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -337,7 +337,7 @@ void LLNotificationForm::addElement(const std::string& type, const std::string& element["name"] = name; element["text"] = name; element["value"] = value; - element["index"] = mFormData.size(); + element["index"] = LLSD::Integer(mFormData.size()); element["enabled"] = enabled; mFormData.append(element); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index d97ed61e11..5266db5b38 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6284,7 +6284,7 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response) // More than OFFER_RECIPIENT_LIMIT targets will overload the message // producing an llerror. LLSD args; - args["OFFERS"] = notification["payload"]["ids"].size(); + args["OFFERS"] = LLSD::Integer(notification["payload"]["ids"].size()); args["LIMIT"] = static_cast(OFFER_RECIPIENT_LIMIT); LLNotificationsUtil::add("TooManyTeleportOffers", args); return false; -- cgit v1.2.3 From 66f59478d09122ddf43c4ba3445754d1698bf016 Mon Sep 17 00:00:00 2001 From: Callum Linden Date: Wed, 25 Jan 2023 10:57:29 -0800 Subject: DRTVWR-489-emoji: declaring this variable as a U16 leads to a warning (and therefore an error) but only on 32bit Windows builds - 64bit is fine. I don't know why that's the case (should be both surely) but in any case, I think the variable should be declared as a size_t --- indra/newview/llpanelemojicomplete.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llpanelemojicomplete.h b/indra/newview/llpanelemojicomplete.h index 2116b350be..aa0f806525 100644 --- a/indra/newview/llpanelemojicomplete.h +++ b/indra/newview/llpanelemojicomplete.h @@ -85,7 +85,7 @@ protected: LLUIImagePtr mSelectedImage; LLWString mEmojis; - U16 mVisibleEmojis = 0; + size_t mVisibleEmojis = 0; size_t mFirstVisible = 0; size_t mScrollPos = 0; size_t mCurSelected = 0; -- cgit v1.2.3 From 3185bdea27b19e155c2ccc03c80624e113d312a6 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 14:45:45 -0800 Subject: DRTVWR-489-emoji: As part of the work to get macOS version of the Viewer working, the flag was introduced to warn (and therefore error out) when a virtual override was not marked with the 'override' keyword. Fixing this up involved a large number of changes and this commit represents just those changes - nothing specially from the DRTVWR-489 viewer --- indra/llappearance/llwearabletype.h | 2 +- indra/llcommon/llcoros.h | 2 +- indra/llcommon/llsingleton.h | 2 +- indra/llinventory/llfoldertype.cpp | 2 +- indra/llinventory/llinventorysettings.cpp | 2 +- indra/llmessage/llexperiencecache.h | 2 +- indra/llmessage/llproxy.h | 2 +- indra/llui/llnotifications.h | 6 +- indra/llui/llspellcheck.h | 2 +- indra/llui/lltextbase.cpp | 21 ---- indra/llui/lltextbase.h | 2 +- indra/llui/lluictrl.h | 2 +- indra/llui/llview.cpp | 4 +- indra/llui/llviewquery.h | 12 +-- indra/newview/llautoreplace.h | 2 +- indra/newview/llchannelmanager.h | 2 +- indra/newview/llchicletbar.h | 4 +- indra/newview/llconversationlog.h | 10 +- indra/newview/llfeaturemanager.h | 2 +- indra/newview/llfriendcard.h | 2 +- indra/newview/llgesturemgr.h | 4 +- indra/newview/llimagefiltersmanager.h | 2 +- indra/newview/llimview.h | 2 +- indra/newview/llmutelist.h | 2 +- indra/newview/llnavigationbar.h | 8 +- indra/newview/lloutfitobserver.h | 2 +- indra/newview/llpaneltopinfobar.h | 6 +- indra/newview/llpathfindingpathtool.h | 18 ++-- indra/newview/llproductinforequest.h | 2 +- indra/newview/llrecentpeople.h | 2 +- indra/newview/llspeakers.h | 4 +- indra/newview/llspeakingindicatormanager.cpp | 2 +- indra/newview/lltoolbrush.h | 20 ++-- indra/newview/lltoolcomp.h | 72 ++++++------- indra/newview/lltooldraganddrop.h | 12 +-- indra/newview/lltoolface.h | 10 +- indra/newview/lltoolfocus.h | 14 +-- indra/newview/lltoolindividual.h | 8 +- indra/newview/lltoolobjpicker.h | 14 +-- indra/newview/lltoolpie.h | 32 +++--- indra/newview/lltoolpipette.h | 8 +- indra/newview/lltoolselectland.h | 16 +-- indra/newview/llversioninfo.h | 2 +- indra/newview/llviewerhelp.h | 10 +- indra/newview/llviewermedia.h | 2 +- indra/newview/llviewermediafocus.h | 16 +-- indra/newview/llviewerparcelaskplay.h | 4 +- indra/newview/llviewerparcelmedia.h | 2 +- indra/newview/llviewerparcelmediaautoplay.h | 2 +- indra/newview/llviewertexturelist.h | 6 +- indra/newview/llvoicechannel.h | 22 ++-- indra/newview/llvoicevivox.h | 146 +++++++++++++-------------- indra/newview/llwearableitemslist.h | 6 +- indra/newview/llwindebug.h | 4 +- 54 files changed, 272 insertions(+), 295 deletions(-) diff --git a/indra/llappearance/llwearabletype.h b/indra/llappearance/llwearabletype.h index 793a33cc87..1fbe19ddd1 100644 --- a/indra/llappearance/llwearabletype.h +++ b/indra/llappearance/llwearabletype.h @@ -37,7 +37,7 @@ class LLWearableType : public LLParamSingleton { LLSINGLETON(LLWearableType, LLTranslationBridge::ptr_t &trans); ~LLWearableType(); - void initSingleton(); + void initSingleton() override; public: enum EType { diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h index dbff921f16..a6da94005b 100644 --- a/indra/llcommon/llcoros.h +++ b/indra/llcommon/llcoros.h @@ -92,7 +92,7 @@ class LL_COMMON_API LLCoros: public LLSingleton LLSINGLETON(LLCoros); ~LLCoros(); - void cleanupSingleton(); + void cleanupSingleton() override; public: /// The viewer's use of the term "coroutine" became deeply embedded before /// the industry term "fiber" emerged to distinguish userland threads from diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 51ef514cf7..cbe5ab6406 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -802,7 +802,7 @@ public: private: \ /* implement LLSingleton pure virtual method whose sole purpose */ \ /* is to remind people to use this macro */ \ - virtual void you_must_use_LLSINGLETON_macro() {} \ + virtual void you_must_use_LLSINGLETON_macro() override {} \ friend class LLSingleton; \ DERIVED_CLASS(__VA_ARGS__) diff --git a/indra/llinventory/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp index 675da65af2..818a8b5cc3 100644 --- a/indra/llinventory/llfoldertype.cpp +++ b/indra/llinventory/llfoldertype.cpp @@ -60,7 +60,7 @@ class LLFolderDictionary : public LLSingleton, { LLSINGLETON(LLFolderDictionary); protected: - virtual LLFolderType::EType notFound() const + virtual LLFolderType::EType notFound() const override { return LLFolderType::FT_NONE; } diff --git a/indra/llinventory/llinventorysettings.cpp b/indra/llinventory/llinventorysettings.cpp index 81485b3a97..bc604097da 100644 --- a/indra/llinventory/llinventorysettings.cpp +++ b/indra/llinventory/llinventorysettings.cpp @@ -62,7 +62,7 @@ class LLSettingsDictionary : public LLSingleton, { LLSINGLETON(LLSettingsDictionary); - void initSingleton(); + void initSingleton() override; }; LLSettingsDictionary::LLSettingsDictionary() diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h index 1c97133723..8be4c64dfc 100644 --- a/indra/llmessage/llexperiencecache.h +++ b/indra/llmessage/llexperiencecache.h @@ -106,7 +106,7 @@ public: private: virtual ~LLExperienceCache(); - virtual void initSingleton(); + virtual void initSingleton() override; typedef boost::function permissionInvoker_fn; diff --git a/indra/llmessage/llproxy.h b/indra/llmessage/llproxy.h index 25f6977e14..8a64cdbfaa 100644 --- a/indra/llmessage/llproxy.h +++ b/indra/llmessage/llproxy.h @@ -226,7 +226,7 @@ class LLProxy: public LLSingleton LLSINGLETON(LLProxy); LOG_CLASS(LLProxy); - /*virtual*/ void initSingleton(); + /*virtual*/ void initSingleton() override; public: // Static check for enabled status for UDP packets. Call from main thread only. diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 921398a693..4d9a33f1d7 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -913,7 +913,7 @@ public: /* virtual */ LLNotificationPtr add(const std::string& name, const LLSD& substitutions, const LLSD& payload, - LLNotificationFunctorRegistry::ResponseFunctor functor); + LLNotificationFunctorRegistry::ResponseFunctor functor) override; LLNotificationPtr add(const LLNotification::Params& p); void add(const LLNotificationPtr pNotif); @@ -964,8 +964,8 @@ public: bool isVisibleByRules(LLNotificationPtr pNotification); private: - /*virtual*/ void initSingleton(); - /*virtual*/ void cleanupSingleton(); + /*virtual*/ void initSingleton() override; + /*virtual*/ void cleanupSingleton() override; void loadPersistentNotifications(); diff --git a/indra/llui/llspellcheck.h b/indra/llui/llspellcheck.h index 3da5e30955..14f9b44fe4 100644 --- a/indra/llui/llspellcheck.h +++ b/indra/llui/llspellcheck.h @@ -47,7 +47,7 @@ public: protected: void addToDictFile(const std::string& dict_path, const std::string& word); void initHunspell(const std::string& dict_language); - void initSingleton(); + void initSingleton() override; public: typedef std::list dict_list_t; diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index b2c0577604..dff4bf9617 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1997,19 +1997,8 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getEditableSegIterContaini LLTextBase::segment_set_t::iterator LLTextBase::getSegIterContaining(S32 index) { - static LLPointer index_segment = new LLIndexSegment(); - S32 text_len = 0; - if (!useLabel()) - { - text_len = getLength(); - } - else - { - text_len = mLabel.getWString().length(); - } - // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } @@ -2023,16 +2012,6 @@ LLTextBase::segment_set_t::const_iterator LLTextBase::getSegIterContaining(S32 i { static LLPointer index_segment = new LLIndexSegment(); - S32 text_len = 0; - if (!useLabel()) - { - text_len = getLength(); - } - else - { - text_len = mLabel.getWString().length(); - } - // when there are no segments, we return the end iterator, which must be checked by caller if (mSegments.size() <= 1) { return mSegments.begin(); } diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 7e1f727607..9b3691e404 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -187,7 +187,7 @@ public: LLEmojiTextSegment(const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); bool canEdit() const override { return false; } - BOOL handleToolTip(S32 x, S32 y, MASK mask); + BOOL handleToolTip(S32 x, S32 y, MASK mask) override; }; // Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment) diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 67dd24341c..d71dc8d859 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -263,7 +263,7 @@ public: class LLTextInputFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLTextInputFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override { return filterResult_t(view->isCtrl() && static_cast(view)->acceptsTextInput(), TRUE); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 74abe54690..2b7f05dcda 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1953,7 +1953,7 @@ private: class SortByTabOrder : public LLQuerySorter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(SortByTabOrder); - /*virtual*/ void sort(LLView * parent, LLView::child_list_t &children) const + /*virtual*/ void sort(LLView * parent, LLView::child_list_t &children) const override { children.sort(CompareByTabOrder(parent->getTabOrder(), parent->getDefaultTabGroup())); } @@ -1977,7 +1977,7 @@ const LLViewQuery & LLView::getTabOrderQuery() class LLFocusRootsFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLFocusRootsFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override { return filterResult_t(view->isCtrl() && view->isFocusRoot(), !view->isFocusRoot()); } diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index 21bb1be26f..4bc9c4a08e 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -55,37 +55,37 @@ public: class LLLeavesFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLLeavesFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; class LLRootsFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLRootsFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; class LLVisibleFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLVisibleFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; class LLEnabledFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLEnabledFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; class LLTabStopFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLTabStopFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; class LLCtrlFilter : public LLQueryFilter, public LLSingleton { LLSINGLETON_EMPTY_CTOR(LLCtrlFilter); - /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const; + /*virtual*/ filterResult_t operator() (const LLView* const view, const viewList_t & children) const override; }; template diff --git a/indra/newview/llautoreplace.h b/indra/newview/llautoreplace.h index 23cc313646..a1eebf9dcb 100644 --- a/indra/newview/llautoreplace.h +++ b/indra/newview/llautoreplace.h @@ -203,7 +203,7 @@ public: void setSettings(const LLAutoReplaceSettings& settings); private: - /*virtual*/ void initSingleton(); + /*virtual*/ void initSingleton() override; LLAutoReplaceSettings mSettings; ///< configuration information diff --git a/indra/newview/llchannelmanager.h b/indra/newview/llchannelmanager.h index 8abe350196..22ae595d66 100644 --- a/indra/newview/llchannelmanager.h +++ b/indra/newview/llchannelmanager.h @@ -46,7 +46,7 @@ class LLChannelManager : public LLSingleton LLSINGLETON(LLChannelManager); virtual ~LLChannelManager(); - void cleanupSingleton(); + void cleanupSingleton() override; public: diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index 6c521dc1d5..c295b99962 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -43,11 +43,11 @@ class LLChicletBar public: - BOOL postBuild(); + BOOL postBuild() override; LLChicletPanel* getChicletPanel() { return mChicletPanel; } - /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent) override; /** diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index 820a5db491..54aeedcf9a 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -125,11 +125,11 @@ public: void removeObserver(LLConversationLogObserver* observer); // LLIMSessionObserver triggers - virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg); - virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; // Stub - virtual void sessionRemoved(const LLUUID& session_id){} // Stub - virtual void sessionVoiceOrIMStarted(const LLUUID& session_id){}; // Stub - virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id){}; // Stub + virtual void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id, BOOL has_offline_msg) override; + virtual void sessionActivated(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) override {}; // Stub + virtual void sessionRemoved(const LLUUID& session_id) override{} // Stub + virtual void sessionVoiceOrIMStarted(const LLUUID& session_id) override{}; // Stub + virtual void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) override{}; // Stub void notifyObservers(); diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h index 42a226cd18..d9269224af 100644 --- a/indra/newview/llfeaturemanager.h +++ b/indra/newview/llfeaturemanager.h @@ -101,7 +101,7 @@ class LLFeatureManager : public LLFeatureList, public LLSingleton mFiltersList; diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 326e8f22e3..353373f3b4 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -506,7 +506,7 @@ public: static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent); private: - void initSingleton(); + void initSingleton() override; void onVoiceChannelChangedInt(const LLUUID &session_id); void onVoiceChannelStateChangedInt(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction, bool ended_by_agent); diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 0d426fbd48..f86c2acd10 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -73,7 +73,7 @@ class LLMuteList : public LLSingleton { LLSINGLETON(LLMuteList); ~LLMuteList(); - /*virtual*/ void cleanupSingleton(); + /*virtual*/ void cleanupSingleton() override; public: // reasons for auto-unmuting a resident enum EAutoReason diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 11c671294a..4649f5bcb0 100755 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -92,10 +92,10 @@ class LLNavigationBar public: - /*virtual*/ void draw(); - /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void draw() override; + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL postBuild() override; + /*virtual*/ void setVisible(BOOL visible) override; void handleLoginComplete(); void clearHistoryCache(); diff --git a/indra/newview/lloutfitobserver.h b/indra/newview/lloutfitobserver.h index 77041db68d..77bb3543aa 100644 --- a/indra/newview/lloutfitobserver.h +++ b/indra/newview/lloutfitobserver.h @@ -41,7 +41,7 @@ class LLOutfitObserver: public LLInventoryObserver, public LLSingleton, public: typedef boost::signals2::signal resize_signal_t; - /*virtual*/ BOOL postBuild(); - /*virtual*/ void draw(); + /*virtual*/ BOOL postBuild() override; + /*virtual*/ void draw() override; /** * Updates location and parcel icons on login complete @@ -83,7 +83,7 @@ private: */ void initParcelIcons(); - BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; /** * Handles clicks on the parcel icons. diff --git a/indra/newview/llpathfindingpathtool.h b/indra/newview/llpathfindingpathtool.h index 88cb3a15f8..f98624e30d 100644 --- a/indra/newview/llpathfindingpathtool.h +++ b/indra/newview/llpathfindingpathtool.h @@ -66,17 +66,17 @@ public: typedef boost::signals2::signal path_event_signal_t; typedef boost::signals2::connection path_event_slot_t; - virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleMiddleMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleMiddleMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleRightMouseDown(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleRightMouseUp(S32 pX, S32 pY, MASK pMask) override; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; - virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask); + virtual BOOL handleHover(S32 pX, S32 pY, MASK pMask) override; - virtual BOOL handleKey(KEY pKey, MASK pMask); + virtual BOOL handleKey(KEY pKey, MASK pMask) override; EPathStatus getPathStatus() const; diff --git a/indra/newview/llproductinforequest.h b/indra/newview/llproductinforequest.h index d1036374e8..0b94c39d11 100644 --- a/indra/newview/llproductinforequest.h +++ b/indra/newview/llproductinforequest.h @@ -46,7 +46,7 @@ public: std::string getDescriptionForSku(const std::string& sku); private: - /* virtual */ void initSingleton(); + /* virtual */ void initSingleton() override; void getLandDescriptionsCoro(std::string url); LLSD mSkuDescriptions; diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h index 1b322f2c0a..0c04222a9f 100644 --- a/indra/newview/llrecentpeople.h +++ b/indra/newview/llrecentpeople.h @@ -106,7 +106,7 @@ public: /** * LLSimpleListener interface. */ - /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata) override; void updateAvatarsArrivalTime(uuid_vec_t& uuids); F32 getArrivalTimeByID(const LLUUID& id); diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index ed795b5155..22c9481687 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -338,7 +338,7 @@ class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton @@ -347,7 +347,7 @@ class LLLocalSpeakerMgr : public LLSpeakerMgr, public LLSingleton speaker_ids_t; diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index c108d83256..6545ee3611 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -49,27 +49,27 @@ class LLToolBrushLand : public LLTool, public LLEditMenuHandler, public LLSingle public: // x,y in window coords, 0,0 = left,bot - virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ); - virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ); - virtual BOOL handleHover( S32 x, S32 y, MASK mask ); - virtual void handleSelect(); - virtual void handleDeselect(); + virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask ) override; + virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask ) override; + virtual BOOL handleHover( S32 x, S32 y, MASK mask ) override; + virtual void handleSelect() override; + virtual void handleDeselect() override; // isAlwaysRendered() - return true if this is a tool that should // always be rendered regardless of selection. - virtual BOOL isAlwaysRendered() { return TRUE; } + virtual BOOL isAlwaysRendered() override { return TRUE; } // Draw the area that will be affected. - virtual void render(); + virtual void render() override; // on Idle is where the land modification actually occurs static void onIdle(void* brush_tool); - void onMouseCaptureLost(); + void onMouseCaptureLost() override; void modifyLandInSelectionGlobal(); - virtual void undo(); - virtual BOOL canUndo() const { return TRUE; } + virtual void undo() override; + virtual BOOL canUndo() const override { return TRUE; } protected: void brush( void ); diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index 86506f725e..f539a045b7 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -108,11 +108,11 @@ class LLToolCompInspect : public LLToolComposite, public LLSingleton public: // Overridden from LLToolComposite - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual void onMouseCaptureLost(); - virtual void handleSelect(); - virtual void handleDeselect(); - virtual LLTool* getOverrideTool(MASK mask) { return NULL; } + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; + virtual void onMouseCaptureLost() override; + virtual void handleSelect() override; + virtual void handleDeselect() override; + virtual LLTool* getOverrideTool(MASK mask) override { return NULL; } protected: LLToolGun* mGun; diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h index 4537d73332..8ec027cb0e 100644 --- a/indra/newview/lltooldraganddrop.h +++ b/indra/newview/lltooldraganddrop.h @@ -48,12 +48,12 @@ public: typedef boost::signals2::signal enddrag_signal_t; // overridden from LLTool - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleKey(KEY key, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); - virtual void onMouseCaptureLost(); - virtual void handleDeselect(); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual BOOL handleKey(KEY key, MASK mask) override; + virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; + virtual void onMouseCaptureLost() override; + virtual void handleDeselect() override; void setDragStart( S32 x, S32 y ); // In screen space BOOL isOverThreshold( S32 x, S32 y ); // In screen space diff --git a/indra/newview/lltoolface.h b/indra/newview/lltoolface.h index e4b8ae12b8..7c8ff20480 100644 --- a/indra/newview/lltoolface.h +++ b/indra/newview/lltoolface.h @@ -39,11 +39,11 @@ class LLToolFace virtual ~LLToolFace(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual void handleSelect(); - virtual void handleDeselect(); - virtual void render(); // draw face highlights + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual void handleSelect() override; + virtual void handleDeselect() override; + virtual void render() override; // draw face highlights static void pickCallback(const LLPickInfo& pick_info); }; diff --git a/indra/newview/lltoolfocus.h b/indra/newview/lltoolfocus.h index cfc235b6c2..c9dd39ff4b 100644 --- a/indra/newview/lltoolfocus.h +++ b/indra/newview/lltoolfocus.h @@ -38,16 +38,16 @@ class LLToolCamera virtual ~LLToolCamera(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual void onMouseCaptureLost(); + virtual void onMouseCaptureLost() override; - virtual void handleSelect(); - virtual void handleDeselect(); + virtual void handleSelect() override; + virtual void handleDeselect() override; - virtual LLTool* getOverrideTool(MASK mask) { return NULL; } + virtual LLTool* getOverrideTool(MASK mask) override { return NULL; } static void pickCallback(const LLPickInfo& pick_info); BOOL mouseSteerMode() { return mMouseSteering; } diff --git a/indra/newview/lltoolindividual.h b/indra/newview/lltoolindividual.h index e7c2060fba..89dd9d9796 100644 --- a/indra/newview/lltoolindividual.h +++ b/indra/newview/lltoolindividual.h @@ -43,11 +43,9 @@ class LLToolIndividual : public LLTool, public LLSingleton virtual ~LLToolIndividual(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual void handleSelect(); - //virtual void handleDeselect(); - //virtual void render(); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + virtual void handleSelect() override; static void pickCallback(const LLPickInfo& pick_info); diff --git a/indra/newview/lltoolobjpicker.h b/indra/newview/lltoolobjpicker.h index 5ad9b67e21..a55cd223de 100644 --- a/indra/newview/lltoolobjpicker.h +++ b/indra/newview/lltoolobjpicker.h @@ -38,16 +38,16 @@ class LLToolObjPicker : public LLTool, public LLSingleton LLSINGLETON(LLToolObjPicker); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; - virtual void handleSelect(); - virtual void handleDeselect(); + virtual void handleSelect() override; + virtual void handleDeselect() override; - virtual void onMouseCaptureLost(); + virtual void onMouseCaptureLost() override; - virtual void setExitCallback(void (*callback)(void *), void *callback_data); + void setExitCallback(void (*callback)(void *), void *callback_data); LLUUID getObjectID() const { return mHitObjectID; } diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 8f6100e4b4..dca0d12cf6 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -42,26 +42,26 @@ class LLToolPie : public LLTool, public LLSingleton public: // Virtual functions inherited from LLMouseHandler - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) override; + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; BOOL handleScrollWheelAny(S32 x, S32 y, S32 clicks_x, S32 clicks_y); - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); + virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) override; + virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) override; + virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; - virtual void render(); + virtual void render() override; - virtual void stopEditing(); + virtual void stopEditing() override; - virtual void onMouseCaptureLost(); - virtual void handleSelect(); - virtual void handleDeselect(); - virtual LLTool* getOverrideTool(MASK mask); + virtual void onMouseCaptureLost() override; + virtual void handleSelect() override; + virtual void handleDeselect() override; + virtual LLTool* getOverrideTool(MASK mask) override; LLPickInfo& getPick() { return mPick; } U8 getClickAction() { return mClickAction; } diff --git a/indra/newview/lltoolpipette.h b/indra/newview/lltoolpipette.h index 7575d8ad18..2636811c66 100644 --- a/indra/newview/lltoolpipette.h +++ b/indra/newview/lltoolpipette.h @@ -47,10 +47,10 @@ class LLToolPipette virtual ~LLToolPipette(); public: - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleHover(S32 x, S32 y, MASK mask); - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + virtual BOOL handleHover(S32 x, S32 y, MASK mask) override; + virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) override; // Note: Don't return connection; use boost::bind + boost::signals2::trackable to disconnect slots typedef boost::signals2::signal signal_t; diff --git a/indra/newview/lltoolselectland.h b/indra/newview/lltoolselectland.h index b5ba72f16d..88bc4e2e3d 100644 --- a/indra/newview/lltoolselectland.h +++ b/indra/newview/lltoolselectland.h @@ -39,15 +39,15 @@ class LLToolSelectLand virtual ~LLToolSelectLand(); public: - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ void render(); // draw the select rectangle - /*virtual*/ BOOL isAlwaysRendered() { return TRUE; } + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ void render() override; // draw the select rectangle + /*virtual*/ BOOL isAlwaysRendered() override { return TRUE; } - /*virtual*/ void handleSelect(); - /*virtual*/ void handleDeselect(); + /*virtual*/ void handleSelect() override; + /*virtual*/ void handleDeselect() override; protected: BOOL outsideSlop(S32 x, S32 y, S32 start_x, S32 start_y); diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 02ff0c094a..37382243f6 100644 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -47,7 +47,7 @@ class LLStoreListener; class LLVersionInfo: public LLSingleton { LLSINGLETON(LLVersionInfo); - void initSingleton(); + void initSingleton() override; public: ~LLVersionInfo(); diff --git a/indra/newview/llviewerhelp.h b/indra/newview/llviewerhelp.h index da50e07a43..bbd20bc07e 100644 --- a/indra/newview/llviewerhelp.h +++ b/indra/newview/llviewerhelp.h @@ -43,21 +43,21 @@ class LLViewerHelp : public LLHelp, public LLSingleton public: /// display the specified help topic in the help viewer - /*virtual*/ void showTopic(const std::string &topic); + /*virtual*/ void showTopic(const std::string &topic) override; - std::string getURL(const std::string& topic); + std::string getURL(const std::string& topic) override; // return topic derived from viewer UI focus, else default topic std::string getTopicFromFocus(); /// return default (fallback) topic name suitable for showTopic() - /*virtual*/ std::string defaultTopic(); + /*virtual*/ std::string defaultTopic() override; // return topic to use before the user logs in - /*virtual*/ std::string preLoginTopic(); + /*virtual*/ std::string preLoginTopic() override; // return topic to use for the top-level help, invoked by F1 - /*virtual*/ std::string f1HelpTopic(); + /*virtual*/ std::string f1HelpTopic() override; }; #endif // header guard diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index f1f42afd81..ad7c4bcefa 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -74,7 +74,7 @@ class LLViewerMedia: public LLSingleton { LLSINGLETON(LLViewerMedia); ~LLViewerMedia(); - void initSingleton(); + void initSingleton() override; LOG_CLASS(LLViewerMedia); public: diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h index effd08a559..2310e4dbfc 100644 --- a/indra/newview/llviewermediafocus.h +++ b/indra/newview/llviewermediafocus.h @@ -54,10 +54,10 @@ public: void setHoverFace(LLPointer objectp, S32 face, viewer_media_t media_impl, LLVector3 pick_normal = LLVector3::zero); void clearHover(); - /*virtual*/ bool getFocus(); - /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); - /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent); - /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent); + bool getFocus(); + /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent) override; + /*virtual*/ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent) override; + /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent) override; BOOL handleScrollWheel(const LLVector2& texture_coords, S32 clicks_x, S32 clicks_y); BOOL handleScrollWheel(S32 x, S32 y, S32 clicks_x, S32 clicks_y); @@ -92,12 +92,12 @@ public: LLUUID getControlsMediaID(); // The MoaP object wants keyup and keydown events. Overridden to return true. - virtual bool wantsKeyUpKeyDown() const; - virtual bool wantsReturnKey() const; + virtual bool wantsKeyUpKeyDown() const override; + virtual bool wantsReturnKey() const override; protected: - /*virtual*/ void onFocusReceived(); - /*virtual*/ void onFocusLost(); + /*virtual*/ void onFocusReceived() override; + /*virtual*/ void onFocusLost() override; private: diff --git a/indra/newview/llviewerparcelaskplay.h b/indra/newview/llviewerparcelaskplay.h index dc711917d2..56faddae66 100644 --- a/indra/newview/llviewerparcelaskplay.h +++ b/indra/newview/llviewerparcelaskplay.h @@ -34,8 +34,8 @@ class LLViewerParcelAskPlay : public LLSingleton { LLSINGLETON(LLViewerParcelAskPlay); ~LLViewerParcelAskPlay(); - void initSingleton(); - void cleanupSingleton(); + void initSingleton() override; + void cleanupSingleton() override; public: // functor expects functor(region_id, parcel_id, url, play/stop) typedef boost::function ask_callback; diff --git a/indra/newview/llviewerparcelmedia.h b/indra/newview/llviewerparcelmedia.h index 779a65bdf8..790b2b71fc 100644 --- a/indra/newview/llviewerparcelmedia.h +++ b/indra/newview/llviewerparcelmedia.h @@ -74,7 +74,7 @@ public: void sendMediaNavigateMessage(const std::string& url); // inherited from LLViewerMediaObserver - virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); + virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) override; private: void processParcelMediaCommandMessage(LLMessageSystem *msg); diff --git a/indra/newview/llviewerparcelmediaautoplay.h b/indra/newview/llviewerparcelmediaautoplay.h index d71fd4c075..e83085dee0 100644 --- a/indra/newview/llviewerparcelmediaautoplay.h +++ b/indra/newview/llviewerparcelmediaautoplay.h @@ -35,7 +35,7 @@ class LLViewerParcelMediaAutoPlay : LLEventTimer, public LLSingleton getUIImageByID(const LLUUID& id, S32 priority); - /*virtual*/ LLPointer getUIImage(const std::string& name, S32 priority); - void cleanUp(); + /*virtual*/ LLPointer getUIImageByID(const LLUUID& id, S32 priority) override; + /*virtual*/ LLPointer getUIImage(const std::string& name, S32 priority) override; + void cleanUp() override; bool initFromFile(); diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 309c3eebdd..e68bfbe1ff 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -170,12 +170,12 @@ class LLVoiceChannelProximal : public LLVoiceChannel, public LLSingleton &participants); - virtual bool isParticipant(const LLUUID& speaker_id); + virtual void getParticipantList(std::set &participants) override; + virtual bool isParticipant(const LLUUID& speaker_id) override; // Send a text message to the specified user, initiating the session if necessary. // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; // close any existing text IM session with the specified user - virtual void endUserIMSession(const LLUUID &uuid); + virtual void endUserIMSession(const LLUUID &uuid) override; // Returns true if calling back the session URI after the session has closed is possible. // Currently this will be false only for PSTN P2P calls. // NOTE: this will return true if the session can't be found. - virtual BOOL isSessionCallBackPossible(const LLUUID &session_id); + virtual BOOL isSessionCallBackPossible(const LLUUID &session_id) override; // Returns true if the session can accepte text IM's. // Currently this will be false only for PSTN P2P calls. // NOTE: this will return true if the session can't be found. - virtual BOOL isSessionTextIMPossible(const LLUUID &session_id); + virtual BOOL isSessionTextIMPossible(const LLUUID &session_id) override; //////////////////////////// @@ -134,21 +134,21 @@ public: //@{ // returns true iff the user is currently in a proximal (local spatial) channel. // Note that gestures should only fire if this returns true. - virtual bool inProximalChannel(); + virtual bool inProximalChannel() override; virtual void setNonSpatialChannel(const std::string &uri, - const std::string &credentials); + const std::string &credentials) override; virtual bool setSpatialChannel(const std::string &uri, - const std::string &credentials); + const std::string &credentials) override; - virtual void leaveNonSpatialChannel(); + virtual void leaveNonSpatialChannel() override; - virtual void leaveChannel(void); + virtual void leaveChannel(void) override; // Returns the URI of the current channel, or an empty string if not currently in a channel. // NOTE that it will return an empty string if it's in the process of joining a channel. - virtual std::string getCurrentChannel(); + virtual std::string getCurrentChannel() override; //@} @@ -156,59 +156,59 @@ public: /// @name invitations //@{ // start a voice channel with the specified user - virtual void callUser(const LLUUID &uuid); - virtual bool isValidChannel(std::string &channelHandle); - virtual bool answerInvite(std::string &channelHandle); - virtual void declineInvite(std::string &channelHandle); + virtual void callUser(const LLUUID &uuid) override; + virtual bool isValidChannel(std::string &channelHandle) override; + virtual bool answerInvite(std::string &channelHandle) override; + virtual void declineInvite(std::string &channelHandle) override; //@} ///////////////////////// /// @name Volume/gain //@{ - virtual void setVoiceVolume(F32 volume); - virtual void setMicGain(F32 volume); + virtual void setVoiceVolume(F32 volume) override; + virtual void setMicGain(F32 volume) override; //@} ///////////////////////// /// @name enable disable voice and features //@{ - virtual bool voiceEnabled(); - virtual void setVoiceEnabled(bool enabled); - virtual BOOL lipSyncEnabled(); - virtual void setLipSyncEnabled(BOOL enabled); - virtual void setMuteMic(bool muted); // Set the mute state of the local mic. + virtual bool voiceEnabled() override; + virtual void setVoiceEnabled(bool enabled) override; + virtual BOOL lipSyncEnabled() override; + virtual void setLipSyncEnabled(BOOL enabled) override; + virtual void setMuteMic(bool muted) override; // Set the mute state of the local mic. //@} ////////////////////////// /// @name nearby speaker accessors //@{ - virtual BOOL getVoiceEnabled(const LLUUID& id); // true if we've received data for this avatar - virtual std::string getDisplayName(const LLUUID& id); - virtual BOOL isParticipantAvatar(const LLUUID &id); - virtual BOOL getIsSpeaking(const LLUUID& id); - virtual BOOL getIsModeratorMuted(const LLUUID& id); - virtual F32 getCurrentPower(const LLUUID& id); // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... - virtual BOOL getOnMuteList(const LLUUID& id); - virtual F32 getUserVolume(const LLUUID& id); - virtual void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal) + virtual BOOL getVoiceEnabled(const LLUUID& id) override; // true if we've received data for this avatar + virtual std::string getDisplayName(const LLUUID& id) override; + virtual BOOL isParticipantAvatar(const LLUUID &id) override; + virtual BOOL getIsSpeaking(const LLUUID& id) override; + virtual BOOL getIsModeratorMuted(const LLUUID& id) override; + virtual F32 getCurrentPower(const LLUUID& id) override; // "power" is related to "amplitude" in a defined way. I'm just not sure what the formula is... + virtual BOOL getOnMuteList(const LLUUID& id) override; + virtual F32 getUserVolume(const LLUUID& id) override; + virtual void setUserVolume(const LLUUID& id, F32 volume) override; // set's volume for specified agent, from 0-1 (where .5 is nominal) //@} // authorize the user virtual void userAuthorized(const std::string& user_id, - const LLUUID &agentID); + const LLUUID &agentID) override; ////////////////////////////// /// @name Status notification //@{ - virtual void addObserver(LLVoiceClientStatusObserver* observer); - virtual void removeObserver(LLVoiceClientStatusObserver* observer); - virtual void addObserver(LLFriendObserver* observer); - virtual void removeObserver(LLFriendObserver* observer); - virtual void addObserver(LLVoiceClientParticipantObserver* observer); - virtual void removeObserver(LLVoiceClientParticipantObserver* observer); + virtual void addObserver(LLVoiceClientStatusObserver* observer) override; + virtual void removeObserver(LLVoiceClientStatusObserver* observer) override; + virtual void addObserver(LLFriendObserver* observer) override; + virtual void removeObserver(LLFriendObserver* observer) override; + virtual void addObserver(LLVoiceClientParticipantObserver* observer) override; + virtual void removeObserver(LLVoiceClientParticipantObserver* observer) override; //@} - virtual std::string sipURIFromID(const LLUUID &id); + virtual std::string sipURIFromID(const LLUUID &id) override; //@} /// @name LLVoiceEffectInterface virtual implementations @@ -218,32 +218,32 @@ public: ////////////////////////// /// @name Accessors //@{ - virtual bool setVoiceEffect(const LLUUID& id); - virtual const LLUUID getVoiceEffect(); - virtual LLSD getVoiceEffectProperties(const LLUUID& id); + virtual bool setVoiceEffect(const LLUUID& id) override; + virtual const LLUUID getVoiceEffect() override; + virtual LLSD getVoiceEffectProperties(const LLUUID& id) override; - virtual void refreshVoiceEffectLists(bool clear_lists); - virtual const voice_effect_list_t& getVoiceEffectList() const; - virtual const voice_effect_list_t& getVoiceEffectTemplateList() const; + virtual void refreshVoiceEffectLists(bool clear_lists) override; + virtual const voice_effect_list_t& getVoiceEffectList() const override; + virtual const voice_effect_list_t& getVoiceEffectTemplateList() const override; //@} ////////////////////////////// /// @name Status notification //@{ - virtual void addObserver(LLVoiceEffectObserver* observer); - virtual void removeObserver(LLVoiceEffectObserver* observer); + virtual void addObserver(LLVoiceEffectObserver* observer) override; + virtual void removeObserver(LLVoiceEffectObserver* observer) override; //@} ////////////////////////////// /// @name Effect preview buffer //@{ - virtual void enablePreviewBuffer(bool enable); - virtual void recordPreviewBuffer(); - virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null); - virtual void stopPreviewBuffer(); + virtual void enablePreviewBuffer(bool enable) override; + virtual void recordPreviewBuffer() override; + virtual void playPreviewBuffer(const LLUUID& effect_id = LLUUID::null) override; + virtual void stopPreviewBuffer() override; - virtual bool isPreviewRecording(); - virtual bool isPreviewPlaying(); + virtual bool isPreviewRecording() override; + virtual bool isPreviewPlaying() override; //@} //@} @@ -754,7 +754,7 @@ private: std::string getAudioSessionURI(); std::string getAudioSessionHandle(); - void setHidden(bool hidden); //virtual + void setHidden(bool hidden) override; //virtual void sendPositionAndVolumeUpdate(void); void sendCaptureAndRenderDevices(); diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h index ba8488b237..602e8f0711 100644 --- a/indra/newview/llwearableitemslist.h +++ b/indra/newview/llwearableitemslist.h @@ -413,7 +413,7 @@ public: { LLSINGLETON(ContextMenu); public: - /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y); + /*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y) override; void show(LLView* spawning_view, LLWearableType::EType w_type, S32 x, S32 y); @@ -426,7 +426,7 @@ public: MASK_UNKNOWN = 0x10, }; - /* virtual */ LLContextMenu* createMenu(); + /* virtual */ LLContextMenu* createMenu() override; void updateItemsVisibility(LLContextMenu* menu); void updateItemsLabels(LLContextMenu* menu); static void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val); @@ -456,7 +456,7 @@ public: virtual ~LLWearableItemsList(); - /*virtual*/ LLPanel* createNewItem(LLViewerInventoryItem* item); + /*virtual*/ LLPanel* createNewItem(LLViewerInventoryItem* item) override; void updateList(const LLUUID& category_id); diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h index 524adba652..31dbfb8ffd 100644 --- a/indra/newview/llwindebug.h +++ b/indra/newview/llwindebug.h @@ -40,9 +40,9 @@ class LLWinDebug: { LLSINGLETON_EMPTY_CTOR(LLWinDebug); public: - void initSingleton(); + void initSingleton() override; static void generateMinidump(struct _EXCEPTION_POINTERS *pExceptionInfo = NULL); - void cleanupSingleton(); + void cleanupSingleton() override; private: static void writeDumpToFile(MINIDUMP_TYPE type, MINIDUMP_EXCEPTION_INFORMATION *ExInfop, const std::string& filename); }; -- cgit v1.2.3 From a804b98e4ed127ce1a11f639babb82574f2e5204 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 17:03:58 -0800 Subject: DRTVWR-489-emoji: A couple of tabs slipped into this file and our new no-tabs coding policy caught it and failed the build --- indra/llui/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 44c61dcdbc..4fc3836248 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -53,8 +53,8 @@ set(llui_SOURCE_FILES lldockcontrol.cpp lldraghandle.cpp lleditmenuhandler.cpp - llemojidictionary.cpp - llemojihelper.cpp + llemojidictionary.cpp + llemojihelper.cpp llf32uictrl.cpp llfiltereditor.cpp llflashtimer.cpp @@ -165,8 +165,8 @@ set(llui_HEADER_FILES lldockablefloater.h lldockcontrol.h lleditmenuhandler.h - llemojidictionary.h - llemojihelper.h + llemojidictionary.h + llemojihelper.h llf32uictrl.h llfiltereditor.h llflashtimer.h -- cgit v1.2.3 From d9e82ab14aaa3e0daceacda8cf72ade379e9caf1 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 17:04:35 -0800 Subject: DRTVWR-489-emoji: Pull in some small changes from Kitty's work to move the macOS build forwards --- indra/cmake/ICU4C.cmake | 4 ++-- indra/llrender/llfontregistry.cpp | 2 +- indra/newview/CMakeLists.txt | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/cmake/ICU4C.cmake b/indra/cmake/ICU4C.cmake index 007a9b6937..b51087e0e7 100644 --- a/indra/cmake/ICU4C.cmake +++ b/indra/cmake/ICU4C.cmake @@ -10,8 +10,8 @@ else (USESYSTEMLIBS) use_prebuilt_binary(icu4c) if (WINDOWS) set(ICU4C_LIBRARY icuuc) - #elseif(DARWIN) - # set(ICU4C_LIBRARY ...) + elseif(DARWIN) + set(ICU4C_LIBRARY icuuc) #elseif(LINUX) # set(ICU4C_LIBRARY ...) else() diff --git a/indra/llrender/llfontregistry.cpp b/indra/llrender/llfontregistry.cpp index 44f2bd4cc5..c9a9ee3a03 100644 --- a/indra/llrender/llfontregistry.cpp +++ b/indra/llrender/llfontregistry.cpp @@ -483,7 +483,7 @@ LLFontGL *LLFontRegistry::createFont(const LLFontDescriptor& desc) #if LL_DARWIN font_search_paths.push_back(MACOSX_FONT_PATH_LIBRARY); font_search_paths.push_back(MACOSX_FONT_PATH_LIBRARY + MACOSX_FONT_SUPPLEMENTAL); - font_search_paths.push_back(sys_path + MACOSX_FONT_SUPPLEMENTAL); + font_search_paths.push_back(LLFontGL::getFontPathSystem() + MACOSX_FONT_SUPPLEMENTAL); #endif // The fontname string may contain multiple font file names separated by semicolons. diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 36f4680c44..ee55657dd8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -449,7 +449,7 @@ set(viewer_SOURCE_FILES llpaneleditsky.cpp llpaneleditwater.cpp llpaneleditwearable.cpp - llpanelemojicomplete.cpp + llpanelemojicomplete.cpp llpanelenvironment.cpp llpanelexperiencelisteditor.cpp llpanelexperiencelog.cpp @@ -1081,7 +1081,7 @@ set(viewer_HEADER_FILES llpaneleditsky.h llpaneleditwater.h llpaneleditwearable.h - llpanelemojicomplete.h + llpanelemojicomplete.h llpanelenvironment.h llpanelexperiencelisteditor.h llpanelexperiencelog.h @@ -1506,12 +1506,6 @@ if (WINDOWS) set(viewer_SOURCE_FILES "${viewer_SOURCE_FILES}" llviewerprecompiledheaders.cpp) endif(USE_PRECOMPILED_HEADERS) - message("Copying fonts") - file(GLOB FONT_FILE_GLOB_LIST - "${AUTOBUILD_INSTALL_DIR}/fonts/*" - ) - file(COPY ${FONT_FILE_GLOB_LIST} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/fonts") - # Replace the icons with the appropriate ones for the channel # ('test' is the default) set(ICON_PATH "test") @@ -2087,6 +2081,12 @@ endif (USE_BUGSPLAT) set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to artwork files.") +message("Copying fonts") +file(GLOB FONT_FILE_GLOB_LIST + "${AUTOBUILD_INSTALL_DIR}/fonts/*" +) +file(COPY ${FONT_FILE_GLOB_LIST} DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/fonts") + if (LINUX) set(product SecondLife-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}) -- cgit v1.2.3 From 99779d97f1e4650c7d46f1d97d5d70e2aacfbdb8 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 17:46:56 -0800 Subject: DRTVWR-489-emoji: Pull in the updated version of GoogleMock that was updated to Python3 so that it builds on macOS in TeamCity --- autobuild.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 6d874b3bdc..c14c37753c 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -860,9 +860,9 @@ archive hash - 11d0794582e91a57f6524ad345f2399d + 772d3ae9d4a1d3e36eadcfb4b81ca47f url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/87791/805924/googlemock-1.7.0.563853-darwin64-563853.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/109950/956085/googlemock-1.7.0.577943-darwin64-577943.tar.bz2 name darwin64 @@ -884,9 +884,9 @@ archive hash - 47303c9bb9a06c6f488f9d7b2b2282c4 + 61df276991917f710d27cb578d9df25b url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/109524/952870/googlemock-1.7.0.577708-windows-577708.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/109953/956105/googlemock-1.7.0.577943-windows-577943.tar.bz2 name windows @@ -896,16 +896,16 @@ archive hash - c166bbd8787a68c1a4ba75179c58dda6 + cc1307e11133755eac29ab04ef240092 url - https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/109525/952878/googlemock-1.7.0.577708-windows64-577708.tar.bz2 + https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/109952/956106/googlemock-1.7.0.577943-windows64-577943.tar.bz2 name windows64 version - 1.7.0.577708 + 1.7.0.577943 gstreamer -- cgit v1.2.3 From 923733e591eb547ad5dfec395ce7d3e8f0468c16 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 18:01:25 -0800 Subject: DRTVWR-489-emoji: missed the override warning/error in the tests... grr... --- indra/llcommon/tests/llsingleton_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp index 15ffe68e67..49cf76b07e 100644 --- a/indra/llcommon/tests/llsingleton_test.cpp +++ b/indra/llcommon/tests/llsingleton_test.cpp @@ -47,8 +47,8 @@ public: \ DEP_INIT /* dependency in initSingleton */ \ } sDepFlag; \ \ - void initSingleton(); \ - void cleanupSingleton(); \ + void initSingleton() override; \ + void cleanupSingleton() override; \ }; \ \ CLS::dep_flag CLS::sDepFlag = DEP_NONE -- cgit v1.2.3 From 6f31fabbc2d082b77c8f09bce30234ec9c506e33 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 26 Jan 2023 19:17:21 -0800 Subject: DRTVWR-489-emoji: less haste. more speed. Missed another test issue. Rebuilt locally with tests and confirmed it works now --- indra/llcommon/tests/llsingleton_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/tests/llsingleton_test.cpp b/indra/llcommon/tests/llsingleton_test.cpp index 49cf76b07e..6f8aaaa0cb 100644 --- a/indra/llcommon/tests/llsingleton_test.cpp +++ b/indra/llcommon/tests/llsingleton_test.cpp @@ -300,7 +300,7 @@ namespace tut { LLSINGLETON_EMPTY_CTOR(CircularPInit); public: - virtual void initSingleton() + virtual void initSingleton() override { // never mind indirection, just go straight for the circularity CircularPInit *pt = getInstance(); -- cgit v1.2.3 From b2f890408e2dc63a0f842273c41c0efed770cb9a Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 2 Feb 2023 00:34:24 +0200 Subject: SL-19089 Changing UI scale crashes viewer This makes no sense, trying to add a glyph now will have no width or height set, neither character width or heigh, yet release viewer does that. Fixed code to match release and set width and height despite char width not being up to date. --- indra/llrender/llfontbitmapcache.cpp | 14 ++++++++++++++ indra/llrender/llfontfreetype.cpp | 4 ++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llfontbitmapcache.cpp b/indra/llrender/llfontbitmapcache.cpp index 8809f9f475..42b0045cf3 100644 --- a/indra/llrender/llfontbitmapcache.cpp +++ b/indra/llrender/llfontbitmapcache.cpp @@ -92,6 +92,20 @@ BOOL LLFontBitmapCache::nextOpenPos(S32 width, S32& pos_x, S32& pos_y, EFontGlyp { // We're out of space in the current image, or no image // has been allocated yet. Make a new one. + + S32 image_width = mMaxCharWidth * 20; + S32 pow_iw = 2; + while (pow_iw < image_width) + { + pow_iw *= 2; + } + image_width = pow_iw; + image_width = llmin(512, image_width); // Don't make bigger than 512x512, ever. + S32 image_height = image_width; + + mBitmapWidth = image_width; + mBitmapHeight = image_height; + S32 num_components = getNumComponents(bitmap_type); mImageRawVec[bitmap_idx].push_back(new LLImageRaw(mBitmapWidth, mBitmapHeight, num_components)); bitmap_num = mImageRawVec[bitmap_idx].size() - 1; diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 5535c07615..e4010579b3 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -798,11 +798,11 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 llassert(!mIsFallback); llassert(image_raw && (image_raw->getComponents() == 2)); - U8 *target = image_raw->getData(); + llassert(target); - if (!data) + if (!data || !target) { return; } -- cgit v1.2.3