# Conflicts:
#	indra/llcommon/llqueuedthread.cpp
#	indra/llcommon/llsdserialize.cpp
#	indra/llcommon/llsdserialize.h
#	indra/llcommon/llthreadsafequeue.h
#	indra/llinventory/llsettingssky.cpp
#	indra/llui/llfolderviewitem.cpp
#	indra/llui/llview.h
#	indra/newview/llaisapi.cpp
#	indra/newview/llappviewer.cpp
#	indra/newview/llfloaterproperties.cpp
#	indra/newview/llfloaterproperties.h
#	indra/newview/llinventorybridge.cpp
#	indra/newview/llinventoryfunctions.cpp
#	indra/newview/llinventorypanel.cpp
#	indra/newview/llpanelmaininventory.cpp
#	indra/newview/llpanelmaininventory.h
#	indra/newview/llpanelmarketplaceinbox.cpp
#	indra/newview/llpanelprofile.cpp
#	indra/newview/llpanelprofile.h
#	indra/newview/llpathfindingnavmesh.cpp
#	indra/newview/llselectmgr.cpp
#	indra/newview/llsidepanelinventory.cpp
#	indra/newview/llsidepanelinventory.h
#	indra/newview/llsidepaneliteminfo.cpp
#	indra/newview/llsidepaneltaskinfo.cpp
#	indra/newview/llviewerfloaterreg.cpp
#	indra/newview/skins/default/xui/da/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/de/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
#	indra/newview/skins/default/xui/en/panel_main_inventory.xml
#	indra/newview/skins/default/xui/en/panel_profile_firstlife.xml
#	indra/newview/skins/default/xui/en/panel_profile_secondlife.xml
#	indra/newview/skins/default/xui/en/sidepanel_inventory.xml
#	indra/newview/skins/default/xui/en/sidepanel_item_info.xml
#	indra/newview/skins/default/xui/en/sidepanel_task_info.xml
#	indra/newview/skins/default/xui/es/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/fr/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/it/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/pl/floater_inventory_item_properties.xml
#	indra/newview/skins/default/xui/ru/floater_inventory_item_properties.xml
master
Ansariel 2023-02-13 23:35:21 +01:00
commit 2bc4fb2bf0
139 changed files with 2692 additions and 2168 deletions

View File

@ -891,6 +891,7 @@ Kitty Barnett
STORM-2149
MAINT-7581
MAINT-7081
SL-18988
Kolor Fall
Komiko Okamoto
Korvel Noh

View File

@ -194,9 +194,15 @@ 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)
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}")

View File

@ -40,7 +40,6 @@ set(llappearance_SOURCE_FILES
lltexglobalcolor.cpp
lltexlayer.cpp
lltexlayerparams.cpp
lltexturemanagerbridge.cpp
llwearable.cpp
llwearabledata.cpp
llwearabletype.cpp
@ -63,7 +62,6 @@ set(llappearance_HEADER_FILES
lltexglobalcolor.h
lltexlayer.h
lltexlayerparams.h
lltexturemanagerbridge.h
llwearable.h
llwearabledata.h
llwearabletype.h

View File

@ -865,14 +865,14 @@ bool unix_post_minidump_callback(const char *dump_dir,
// heap allocations in a crash handler.
// path format: <dump_dir>/<minidump_id>.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;

View File

@ -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(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,
input_size);
narrow(input_size));
output.assign(b64_buffer);
delete[] b64_buffer;
}

View File

@ -28,6 +28,7 @@
#define LL_LLDEFS_H
#include "stdtypes.h"
#include <type_traits>
// Often used array indices
const U32 VX = 0;
@ -168,80 +169,79 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc
// llclampb(a) // clamps a to [0 .. 255]
//
template <class LLDATATYPE>
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2)
template <typename T1, typename T2>
inline auto llmax(T1 d1, T2 d2)
{
return (d1 > d2) ? d1 : d2;
}
template <class LLDATATYPE>
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
template <typename T1, typename T2, typename T3>
inline auto llmax(T1 d1, T2 d2, T3 d3)
{
LLDATATYPE r = llmax(d1,d2);
auto r = llmax(d1,d2);
return llmax(r, d3);
}
template <class LLDATATYPE>
inline LLDATATYPE llmax(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
template <typename T1, typename T2, typename T3, typename T4>
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 <class LLDATATYPE>
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2)
template <typename T1, typename T2>
inline auto llmin(T1 d1, T2 d2)
{
return (d1 < d2) ? d1 : d2;
}
template <class LLDATATYPE>
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3)
template <typename T1, typename T2, typename T3>
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 <class LLDATATYPE>
inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATATYPE& d3, const LLDATATYPE& d4)
template <typename T1, typename T2, typename T3, typename T4>
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 <class LLDATATYPE>
inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const LLDATATYPE& maxval)
template <typename A, typename MIN, typename MAX>
inline A llclamp(A a, MIN minval, MAX maxval)
{
if ( a < minval )
A aminval{ static_cast<A>(minval) }, amaxval{ static_cast<A>(maxval) };
if ( a < aminval )
{
return minval;
return aminval;
}
else if ( a > maxval )
else if ( a > amaxval )
{
return maxval;
return amaxval;
}
return a;
}
template <class LLDATATYPE>
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 <class LLDATATYPE>
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 <class LLDATATYPE>
inline void llswap(LLDATATYPE& lhs, LLDATATYPE& rhs)
{
LLDATATYPE tmp = lhs;
lhs = rhs;
rhs = tmp;
std::swap(lhs, rhs);
}
#endif // LL_LLDEFS_H

View File

@ -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

View File

@ -126,7 +126,7 @@ public:
protected:
typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
typedef std::vector<std::size_t> 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();

View File

@ -1532,7 +1532,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));

View File

@ -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<LLSD::String, LLSD::Integer> IndexMap;
typedef std::map<LLSD::String, size_t> 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());

View File

@ -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();
}

View File

@ -30,6 +30,7 @@
#include "llsd.h"
#include "llsdutil.h"
#include <algorithm>
LLKeyData::LLKeyData()
:
@ -180,10 +181,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 +194,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++)
@ -213,19 +214,23 @@ bool LLKeyBind::isEmpty() const
return true;
}
LLKeyBind::data_vector_t::const_iterator LLKeyBind::endNonEmpty() const
{
// 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
{
S32 last = mData.size() - 1;
while (mData[last].empty())
{
last--;
}
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()
{
S32 last = mData.size() - 1;
while (last >= 0 && mData[last].empty())
{
mData.erase(mData.begin() + last);
last--;
}
mData.erase(endNonEmpty(), mData.end());
}
U32 LLKeyBind::getDataCount()
size_t LLKeyBind::getDataCount()
{
return mData.size();
}

View File

@ -95,11 +95,13 @@ 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<LLKeyData> data_vector_t;
data_vector_t mData;
data_vector_t::const_iterator endNonEmpty() const;
};

View File

@ -231,7 +231,8 @@ public:
}
|*==========================================================================*/
LL_DEBUGS("EventHost") << "Sending: " << buffer.tellp() << ':';
LL_DEBUGS("EventHost") << "Sending: "
<< static_cast<U64>(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<U64>(buffer.tellp())
<< ':' << buffer.str() << std::flush;
return false;
}

View File

@ -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<uint4*>(&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) |

View File

@ -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);
};

View File

@ -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) ] ;
}

View File

@ -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:
/**

View File

@ -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)

View File

@ -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();

View File

@ -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)
{
LL_PROFILE_ZONE_SCOPED
@ -125,13 +125,13 @@ 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)
{
LL_PROFILE_ZONE_SCOPED
F64 max_time = (F64)max_time_ms * .001;
LLTimer timer;
S32 pending = 1;
size_t pending = 1;
// Frame Update
if (mThreaded)
@ -171,11 +171,11 @@ void LLQueuedThread::incQueue()
//virtual
// May be called from any thread
S32 LLQueuedThread::getPending()
size_t LLQueuedThread::getPending()
{
LL_PROFILE_ZONE_SCOPED
S32 res;
size_t res;
lockData();
res = mRequestQueue.size();
unlockData();
@ -431,7 +431,7 @@ bool LLQueuedThread::check()
//============================================================================
// Runs on its OWN thread
S32 LLQueuedThread::processNextRequest()
size_t LLQueuedThread::processNextRequest()
{
LL_PROFILE_ZONE_SCOPED
@ -515,8 +515,7 @@ S32 LLQueuedThread::processNextRequest()
LLTrace::get_thread_recorder()->pushToParent();
}
S32 pending = getPending();
return pending;
return getPending();
}
// virtual
@ -554,7 +553,7 @@ void LLQueuedThread::run()
LL_PROFILER_THREAD_BEGIN(mName.c_str())
threadedUpdate();
int pending_work = processNextRequest();
auto pending_work = processNextRequest();
LL_PROFILER_THREAD_END(mName.c_str())
if (pending_work == 0)

View File

@ -168,19 +168,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

View File

@ -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

View File

@ -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.

View File

@ -36,6 +36,18 @@
#include "llsdserialize.h"
#include "stringize.h"
#include <limits>
// 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<int>::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
@ -136,10 +148,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<String, LLSD> empty; return empty.end(); }
@ -272,7 +284,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 +389,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 +399,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 +530,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 +562,82 @@ 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(); }
NEGATIVE_RETURN(i, 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; }
NEGATIVE_EXIT(i);
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;
}
NEGATIVE_EXIT(i);
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; }
NEGATIVE_EXIT(i);
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 = was_negative(i)? 0 : i;
if (index >= mData.size())
{
mData.resize(i + 1);
mData.resize(index + 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(); }
NEGATIVE_RETURN(i, undef());
DataVector::size_type index = i;
if (index >= mData.size())
{
return undef();
}
return mData[index];
}
@ -841,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); }
@ -912,7 +918,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 +932,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 +962,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';

View File

@ -192,7 +192,17 @@ public:
/** @name Convenience Constructors */
//@{
LLSD(F32); // F32 -> Real
// support construction from size_t et al.
template <typename VALUE,
typename std::enable_if<std::is_integral<VALUE>::value &&
! std::is_same<VALUE, Boolean>::value,
bool>::type = true>
LLSD(VALUE v): LLSD(Integer(narrow(v))) {}
// support construction from F32 et al.
template <typename VALUE,
typename std::enable_if<std::is_floating_point<VALUE>::value,
bool>::type = true>
LLSD(VALUE v): LLSD(Real(narrow(v))) {}
//@}
/** @name Scalar Assignment */
@ -275,7 +285,7 @@ public:
//@{
LLSD(const char*);
void assign(const char*);
LLSD& operator=(const char* v) { assign(v); return *this; }
LLSD& operator=(const char* v) { assign(v); return *this; }
//@}
/** @name Map Values */
@ -313,14 +323,24 @@ 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);
// template overloads to support int literals, U32 et al.
template <typename IDX,
typename std::enable_if<std::is_convertible<IDX, size_t>::value,
bool>::type = true>
const LLSD& operator[](IDX i) const { return (*this)[size_t(i)]; }
template <typename IDX,
typename std::enable_if<std::is_convertible<IDX, size_t>::value,
bool>::type = true>
LLSD& operator[](IDX i) { return (*this)[size_t(i)]; }
//@}
/** @name Iterators */
//@{
int size() const;
size_t size() const;
typedef std::map<String, LLSD>::iterator map_iterator;
typedef std::map<String, LLSD>::const_iterator map_const_iterator;

View File

@ -53,7 +53,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[] = "<llsd>";
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
@ -102,7 +102,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, llssize max_bytes)
{
LLPointer<LLSDParser> p = NULL;
char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */
@ -255,7 +255,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);
llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes);
/**
* @brief Parse a delimited string.
@ -266,7 +266,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 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.
@ -280,10 +280,10 @@ 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,
S32 max_bytes);
llssize max_bytes);
/**
* @brief helper method for dealing with the different notation boolean format.
@ -295,7 +295,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,
@ -332,7 +332,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, llssize max_bytes, S32 max_depth)
{
mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true;
mMaxBytesLeft = max_bytes;
@ -362,7 +362,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;
}
@ -372,7 +372,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;
}
@ -396,11 +396,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;
}
@ -505,7 +505,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,
@ -535,7 +535,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);
}
@ -611,7 +611,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;
@ -634,7 +634,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;
@ -666,7 +666,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;
}
@ -697,7 +697,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);
}
@ -779,7 +779,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;
@ -806,13 +806,13 @@ 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<U8> value;
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;
@ -1009,7 +1009,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;
@ -1096,7 +1096,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;
}
@ -1110,7 +1110,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;
}
@ -1144,7 +1144,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;
@ -1228,7 +1228,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;
@ -1432,7 +1432,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];
@ -1595,7 +1595,7 @@ void LLSDBinaryFormatter::formatString(
/**
* local functions
*/
int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes)
{
int c = istr.get();
if(istr.fail())
@ -1605,7 +1605,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
return LLSDParser::PARSE_FAILURE;
}
int rv = LLSDParser::PARSE_FAILURE;
llssize rv = LLSDParser::PARSE_FAILURE;
switch(c)
{
case '\'':
@ -1625,7 +1625,7 @@ int deserialize_string(std::istream& istr, std::string& value, S32 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)
@ -1635,7 +1635,7 @@ int deserialize_string_delim(
bool found_hex = false;
bool found_digit = false;
U8 byte = 0;
int count = 0;
llssize count = 0;
while (true)
{
@ -1650,7 +1650,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.
@ -1728,16 +1728,16 @@ int deserialize_string_delim(
return count;
}
int deserialize_string_raw(
llssize deserialize_string_raw(
std::istream& istr,
std::string& value,
S32 max_bytes)
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;
@ -1746,13 +1746,13 @@ 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<char> buf;
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();
@ -2041,7 +2041,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,
@ -2058,7 +2058,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())
@ -2113,7 +2113,7 @@ std::string zip_llsd(LLSD& data)
U8 out[CHUNK];
strm.avail_in = source.size();
strm.avail_in = narrow(source.size());
strm.next_in = (U8*) source.data();
U8* output = NULL;
@ -2298,7 +2298,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, const U8* in, S32
//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 )
{
// <FS:Beq pp Rye> Add non-allocating variants of unzip_llsd
// if (size == 0)
@ -2434,7 +2434,7 @@ U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, std::istream& is, S32
return unzip_llsdNavMesh(valid, outsize, in.get(), size);
}
U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size)
U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, const U8* in, S32 size)
{
if (size == 0)
{
@ -2442,7 +2442,7 @@ U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size
return nullptr;
}
U8* result = nullptr;
U32 cur_size = 0;
size_t cur_size = 0;
z_stream strm;
const U32 CHUNK = 0x4000;

View File

@ -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, 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
@ -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:
/**
@ -205,7 +205,7 @@ protected:
/**
* @brief The maximum number of bytes left to be parsed.
*/
mutable S32 mMaxBytesLeft;
mutable llssize mMaxBytesLeft;
/**
* @brief Use line-based reading to get text
@ -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;
};
@ -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, 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, S32 max_bytes)
static S32 fromNotation(LLSD& sd, std::istream& str, llssize max_bytes)
{
LLPointer<LLSDNotationParser> 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, llssize max_bytes)
{
LLPointer<LLSDNotationParser> p = new LLSDNotationParser;
LLSD sd;
@ -834,12 +834,12 @@ public:
LLPointer<LLSDBinaryFormatter> 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, llssize max_bytes, S32 max_depth = -1)
{
LLPointer<LLSDBinaryParser> 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, llssize max_bytes, S32 max_depth = -1)
{
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
LLSD sd;
@ -870,9 +870,9 @@ 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);
// <FS:Beq pp Rye> Add non-allocating variants of unzip_llsd
LL_COMMON_API U8* unzip_llsdNavMesh(bool& valid, unsigned int& outsize, const U8* in, S32 size);
LL_COMMON_API U8* unzip_llsdNavMesh(bool& valid, size_t& outsize, const U8* in, S32 size);
// returns a pointer to the array or past the array if the deprecated header exists
LL_COMMON_API char* strip_deprecated_header(char* in, U32& cur_size, U32* header_size = nullptr);

View File

@ -197,12 +197,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
// *FIX: memory inefficient.
// *TODO: convert to use LLBase64
ostr << pre << "<binary encoding=\"base64\">";
int b64_buffer_length = apr_base64_encode_len(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],
buffer.size());
narrow(buffer.size()));
ostr.write(b64_buffer, b64_buffer_length - 1);
delete[] b64_buffer;
ostr << "</binary>" << post;
@ -270,7 +270,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();
@ -555,7 +555,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 )
@ -950,7 +950,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);
}

View File

@ -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,9 +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;
while (index < line_size - 1)
auto line_size = line.size();
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++;
}
}
@ -356,9 +354,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;
while (index < line_size)
auto line_size = line.size();
for (size_t index = 0; index < line_size; ++index)
{
if ('\\' == line[index])
{
@ -372,31 +369,27 @@ void escape_string(std::string& line)
line_size++;
index++;
}
index++;
}
}
// removes '\n' characters
void replace_newlines_with_whitespace(std::string& line)
{
int line_size = line.size();
int index = 0;
while (index < line_size)
auto line_size = 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)
{
int index = 0;
int line_size = line.size();
while (index < line_size)
auto line_size = line.size();
for (size_t index = 0; index < line_size; )
{
if ('"' == line[index])
{
@ -424,22 +417,21 @@ 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)
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++;
}
}
}

View File

@ -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++;

View File

@ -673,7 +673,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);

View File

@ -284,7 +284,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))
{
@ -465,14 +465,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)
@ -921,7 +921,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(narrow(key_width+1)) << (pair.first + ':') << ' ';
LLSD value(pair.second);
if (value.isInteger())
s << std::setw(12) << value.asInteger();
@ -1316,7 +1316,7 @@ public:
<< " seconds ";
}
S32 precision = LL_CONT.precision();
auto precision = LL_CONT.precision();
LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n'
<< LLMemoryInfo();

View File

@ -59,7 +59,7 @@ public:
S32 mBuild;
#ifndef LL_WINDOWS
static S32 getMaxOpenFiles();
static long getMaxOpenFiles();
#endif
static bool is64Bit();

View File

@ -27,7 +27,11 @@
#ifndef LL_LLSYS_OBJC_H
#define LL_LLSYS_OBJC_H
bool LLGetDarwinOSInfo(int &major, int &minor, int &patch);
#include <cstdint>
// 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);
#endif // LL_LLSYS_OBJC_H

View File

@ -27,12 +27,12 @@
#import "llsys_objc.h"
#import <AppKit/AppKit.h>
static int intAtStringIndex(NSArray *array, int index)
static auto intAtStringIndex(NSArray *array, int index)
{
return [(NSString *)[array objectAtIndex:index] integerValue];
}
bool LLGetDarwinOSInfo(int &major, int &minor, int &patch)
bool LLGetDarwinOSInfo(int64_t &major, int64_t &minor, int64_t &patch)
{
if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8)
{

View File

@ -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;
std::atomic<bool> mClosed; // <FS:Beq/> Try harder to stop the compiler optimising the mClosed state inside the loops
boost::fibers::timed_mutex mLock;
@ -262,7 +262,7 @@ namespace LL
* LLThreadSafeQueue implementation
*****************************************************************************/
template<typename ElementT, typename QueueT>
LLThreadSafeQueue<ElementT, QueueT>::LLThreadSafeQueue(U32 capacity) :
LLThreadSafeQueue<ElementT, QueueT>::LLThreadSafeQueue(size_t capacity) :
mCapacity(capacity),
mClosed(false)
{

View File

@ -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;
const S64 KERNEL_SLEEP_INTERVAL_US = 4000;
S32 num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US;
// 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);

View File

@ -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(narrow(parent->getIndex()));
if (!parent_tree_node) return;
if (mParent)

View File

@ -358,7 +358,7 @@ inline void claim_alloc(MemStatHandle& measurement, const T& value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
#if LL_TRACE_ENABLED
S32 size = MeasureMem<T>::measureFootprint(value);
auto size = MeasureMem<T>::measureFootprint(value);
if(size == 0) return;
MemAccumulator& accumulator = measurement.getCurrentAccumulator();
accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() + (F64)size : (F64)size);
@ -371,7 +371,7 @@ inline void disclaim_alloc(MemStatHandle& measurement, const T& value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
#if LL_TRACE_ENABLED
S32 size = MeasureMem<T>::measureFootprint(value);
auto size = MeasureMem<T>::measureFootprint(value);
if(size == 0) return;
MemAccumulator& accumulator = measurement.getCurrentAccumulator();
accumulator.mSize.sample(accumulator.mSize.hasValue() ? accumulator.mSize.getLastValue() - (F64)size : -(F64)size);

View File

@ -96,9 +96,9 @@ void AccumulatorBufferGroup::makeCurrent()
ThreadRecorder* thread_recorder = get_thread_recorder();
AccumulatorBuffer<TimeBlockAccumulator>& 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(narrow(i));
if (tree_node)
{
timer_accumulator_buffer[i].mParent = tree_node->mParent;

View File

@ -606,7 +606,8 @@ void PeriodicRecording::nextPeriod()
mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size();
old_recording.splitTo(getCurRecording());
mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
mNumRecordedPeriods = mRecordingPeriods.empty()? 0 :
llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
}
void PeriodicRecording::appendRecording(Recording& recording)
@ -625,21 +626,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]);
@ -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
{
@ -682,7 +683,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 +696,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 +735,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 +791,7 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
getCurRecording().splitTo(other.getCurRecording());
}
F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -812,7 +813,7 @@ F64 PeriodicRecording::getPeriodMin( const StatType<EventAccumulator>& stat, S32
: NaN;
}
F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -835,7 +836,7 @@ F64 PeriodicRecording::getPeriodMax( const StatType<EventAccumulator>& stat, S32
}
// calculates means using aggregates per period
F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -858,7 +859,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType<EventAccumulator>& stat, S3
: NaN;
}
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -883,7 +884,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<EventAccumulat
: NaN;
}
F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -905,7 +906,7 @@ F64 PeriodicRecording::getPeriodMin( const StatType<SampleAccumulator>& stat, S3
: NaN;
}
F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -928,7 +929,7 @@ F64 PeriodicRecording::getPeriodMax(const StatType<SampleAccumulator>& stat, S32
}
F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -951,7 +952,7 @@ F64 PeriodicRecording::getPeriodMean( const StatType<SampleAccumulator>& stat, S
: NaN;
}
F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -977,7 +978,7 @@ F64 PeriodicRecording::getPeriodMedian( const StatType<SampleAccumulator>& 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<SampleAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1003,7 +1004,7 @@ F64 PeriodicRecording::getPeriodStandardDeviation( const StatType<SampleAccumula
}
F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1018,12 +1019,12 @@ F64Kilobytes PeriodicRecording::getPeriodMin( const StatType<MemAccumulator>& 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<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/)
F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1038,12 +1039,12 @@ F64Kilobytes PeriodicRecording::getPeriodMax(const StatType<MemAccumulator>& 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<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1059,12 +1060,12 @@ F64Kilobytes PeriodicRecording::getPeriodMean( const StatType<MemAccumulator>& 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<const StatType<MemAccumulator>&>(stat), num_periods);
}
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, S32 num_periods /*= S32_MAX*/ )
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAccumulator>& stat, size_t num_periods /*= S32_MAX*/ )
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
num_periods = llmin(num_periods, getNumRecordedPeriods());
@ -1089,7 +1090,7 @@ F64Kilobytes PeriodicRecording::getPeriodStandardDeviation( const StatType<MemAc
: NaN);
}
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods)
F64Kilobytes PeriodicRecording::getPeriodStandardDeviation(const MemStatHandle& stat, size_t num_periods)
{
return getPeriodStandardDeviation(static_cast<const StatType<MemAccumulator>&>(stat), num_periods);
}

View File

@ -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 <typename T>
S32 getSampleCount(const StatType<T>& stat, S32 num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
auto getSampleCount(const StatType<T>& 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>
typename T::value_t getPeriodMin(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename T::value_t getPeriodMin(const StatType<T>& 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<typename T>
T getPeriodMin(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMin(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMin(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMin(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
T getPeriodMin(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMin(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMin(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMin(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
T getPeriodMin(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMin(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMin(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMin(const MemStatHandle& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMin(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMin(const MemStatHandle& stat, size_t num_periods = S32_MAX);
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMinPerSec(const StatType<T>& 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 T>
typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMinPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMinPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
@ -449,7 +449,7 @@ namespace LLTrace
// catch all for stats that have a defined sum
template <typename T>
typename T::value_t getPeriodMax(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename T::value_t getPeriodMax(const StatType<T>& 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<typename T>
T getPeriodMax(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMax(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMax(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMax(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
T getPeriodMax(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMax(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMax(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMax(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
T getPeriodMax(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
T getPeriodMax(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return T(getPeriodMax(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMax(const MemStatHandle& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMax(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMax(const MemStatHandle& stat, size_t num_periods = S32_MAX);
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMaxPerSec(const StatType<T>& 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 T>
typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMaxPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMaxPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
@ -525,7 +525,7 @@ namespace LLTrace
// catch all for stats that have a defined sum
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMean(const StatType<T >& 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 T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMean(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMean(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodMean(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMean(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMean(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMean(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMean(const MemStatHandle& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodMean(const StatType<MemAccumulator>& stat, size_t num_periods = S32_MAX);
F64Kilobytes getPeriodMean(const MemStatHandle& stat, size_t num_periods = S32_MAX);
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMeanPerSec(const StatType<T>& 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 T>
typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMeanPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMeanPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
}
F64 getPeriodMedian( const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodMedian( const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
template <typename T>
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMedianPerSec(const StatType<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<typename T::value_t>::fractional_t getPeriodMedianPerSec(const StatType<T>& 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 T>
typename RelatedTypes<T>::fractional_t getPeriodMedianPerSec(const CountStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodMedianPerSec(const CountStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodMedianPerSec(static_cast<const StatType<CountAccumulator>&>(stat), num_periods));
@ -632,25 +632,25 @@ namespace LLTrace
// PERIODIC STANDARD DEVIATION
//
F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodStandardDeviation(const StatType<SampleAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const SampleStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<SampleAccumulator>&>(stat), num_periods));
}
F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, S32 num_periods = S32_MAX);
F64 getPeriodStandardDeviation(const StatType<EventAccumulator>& stat, size_t num_periods = S32_MAX);
template<typename T>
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, S32 num_periods = S32_MAX)
typename RelatedTypes<T>::fractional_t getPeriodStandardDeviation(const EventStatHandle<T>& stat, size_t num_periods = S32_MAX)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
return typename RelatedTypes<T>::fractional_t(getPeriodStandardDeviation(static_cast<const StatType<EventAccumulator>&>(stat), num_periods));
}
F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodStandardDeviation(const MemStatHandle& stat, S32 num_periods = S32_MAX);
F64Kilobytes getPeriodStandardDeviation(const StatType<MemAccumulator>& 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<Recording> mRecordingPeriods;
const bool mAutoResize;
S32 mCurPeriod;
S32 mNumRecordedPeriods;
size_t mCurPeriod;
size_t mNumRecordedPeriods;
};
PeriodicRecording& get_frame_recording();

View File

@ -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)

View File

@ -57,7 +57,7 @@ namespace LLTrace
void pullFromChildren();
void pushToParent();
TimeBlockTreeNode* getTimeBlockTreeNode(S32 index);
TimeBlockTreeNode* getTimeBlockTreeNode(size_t index);
protected:
void init();

View File

@ -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<LLWorkerClass*> delete_list;
std::vector<LLWorkerClass*> abort_list;

View File

@ -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);

View File

@ -26,16 +26,23 @@
#ifndef LL_STDTYPES_H
#define LL_STDTYPES_H
#include <cassert>
#include <cfloat>
#include <climits>
#include <limits>
#include <type_traits>
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<size_t>::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<S32>(len) or
* S32(len) or (S32)len, but we can do better.
*
* For:
* @code
* std::vector<Object> 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 <typename FROM>
class narrow_holder
{
private:
FROM mValue;
public:
narrow_holder(FROM value): mValue(value) {}
/*---------------------- Narrowing unsigned to signed ----------------------*/
template <typename TO,
typename std::enable_if<std::is_unsigned<FROM>::value &&
std::is_signed<TO>::value,
bool>::type = true>
inline
operator TO() const
{
// The reason we skip the
// assert(value >= std::numeric_limits<TO>::lowest());
// 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<TO>::max());
return static_cast<TO>(mValue);
}
/*----------------------- Narrowing all other cases ------------------------*/
template <typename TO,
typename std::enable_if<! (std::is_unsigned<FROM>::value &&
std::is_signed<TO>::value),
bool>::type = true>
inline
operator TO() const
{
// two different assert()s so we can tell which condition failed
assert(mValue <= std::numeric_limits<TO>::max());
// Funny, with floating point types min() is "positive epsilon" rather
// than "largest negative" -- that's lowest().
assert(mValue >= std::numeric_limits<TO>::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<TO>::min());
return static_cast<TO>(mValue);
}
};
/// narrow() factory function returns a narrow_holder<FROM>(), which can be
/// implicitly converted to the target type.
template <typename FROM>
inline
narrow_holder<FROM> narrow(FROM value)
{
return { value };
}
#endif

View File

@ -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

View File

@ -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)
{}

View File

@ -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 int block_limit(narrow(mBlocks.size()));
for (int i(0); i < block_limit; ++i)
{
if (pos < mBlocks[i]->mUsed)

View File

@ -132,7 +132,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);

View File

@ -87,7 +87,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();

View File

@ -40,9 +40,11 @@
///----------------------------------------------------------------------------
/// Exported functions
///----------------------------------------------------------------------------
// FIXME D567 - what's the point of these, especially if we don't even use them consistently?
static const std::string INV_ITEM_ID_LABEL("item_id");
static const std::string INV_FOLDER_ID_LABEL("cat_id");
static const std::string INV_PARENT_ID_LABEL("parent_id");
static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id");
static const std::string INV_ASSET_TYPE_LABEL("type");
static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type");
static const std::string INV_INVENTORY_TYPE_LABEL("inv_type");
@ -99,6 +101,7 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other)
mParentUUID = other->mParentUUID;
mType = other->mType;
mName = other->mName;
mThumbnailUUID = other->mThumbnailUUID;
}
const LLUUID& LLInventoryObject::getUUID() const
@ -111,6 +114,11 @@ const LLUUID& LLInventoryObject::getParentUUID() const
return mParentUUID;
}
const LLUUID& LLInventoryObject::getThumbnailUUID() const
{
return mThumbnailUUID;
}
const std::string& LLInventoryObject::getName() const
{
return mName;
@ -160,6 +168,11 @@ void LLInventoryObject::setParent(const LLUUID& new_parent)
mParentUUID = new_parent;
}
void LLInventoryObject::setThumbnailUUID(const LLUUID& thumbnail_uuid)
{
mThumbnailUUID = thumbnail_uuid;
}
void LLInventoryObject::setType(LLAssetType::EType type)
{
mType = type;
@ -336,6 +349,7 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other)
copyObject(other);
mPermissions = other->mPermissions;
mAssetUUID = other->mAssetUUID;
mThumbnailUUID = other->mThumbnailUUID;
mDescription = other->mDescription;
mSaleInfo = other->mSaleInfo;
mInventoryType = other->mInventoryType;
@ -400,6 +414,7 @@ U32 LLInventoryItem::getCRC32() const
//LL_DEBUGS() << "8 crc: " << std::hex << crc << std::dec << LL_ENDL;
crc += (U32)mCreationDate;
//LL_DEBUGS() << "9 crc: " << std::hex << crc << std::dec << LL_ENDL;
crc += mThumbnailUUID.getCRC32();
return crc;
}
@ -489,6 +504,15 @@ void LLInventoryItem::setSaleInfo(const LLSaleInfo& sale_info)
mSaleInfo = sale_info;
}
const LLUUID& LLInventoryItem::getThumbnailUUID() const
{
if (mThumbnailUUID.isNull() && mType == LLAssetType::AT_TEXTURE)
{
return mAssetUUID;
}
return mThumbnailUUID;
}
LLInventoryType::EType LLInventoryItem::getInventoryType() const
{
return mInventoryType;
@ -1050,135 +1074,6 @@ fail:
}
// Deleted LLInventoryItem::exportFileXML() and LLInventoryItem::importXML()
// because I can't find any non-test code references to it. 2009-05-04 JC
S32 LLInventoryItem::packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override) const
{
// Figure out which permissions to use.
LLPermissions perm;
if (perm_override)
{
// Use the permissions override.
perm = *perm_override;
}
else
{
// Use the current permissions.
perm = getPermissions();
}
// describe the inventory item
char* buffer = (char*) bin_bucket;
std::string creator_id_str;
perm.getCreator().toString(creator_id_str);
std::string owner_id_str;
perm.getOwner().toString(owner_id_str);
std::string last_owner_id_str;
perm.getLastOwner().toString(last_owner_id_str);
std::string group_id_str;
perm.getGroup().toString(group_id_str);
std::string asset_id_str;
getAssetUUID().toString(asset_id_str);
S32 size = sprintf(buffer, /* Flawfinder: ignore */
"%d|%d|%s|%s|%s|%s|%s|%x|%x|%x|%x|%x|%s|%s|%d|%d|%x",
getType(),
getInventoryType(),
getName().c_str(),
creator_id_str.c_str(),
owner_id_str.c_str(),
last_owner_id_str.c_str(),
group_id_str.c_str(),
perm.getMaskBase(),
perm.getMaskOwner(),
perm.getMaskGroup(),
perm.getMaskEveryone(),
perm.getMaskNextOwner(),
asset_id_str.c_str(),
getDescription().c_str(),
getSaleInfo().getSaleType(),
getSaleInfo().getSalePrice(),
getFlags()) + 1;
return size;
}
void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
{
// Early exit on an empty binary bucket.
if (bin_bucket_size <= 1) return;
if (NULL == bin_bucket)
{
LL_ERRS() << "unpackBinaryBucket failed. bin_bucket is NULL." << LL_ENDL;
return;
}
// Convert the bin_bucket into a string.
std::vector<char> item_buffer(bin_bucket_size+1);
memcpy(&item_buffer[0], bin_bucket, bin_bucket_size); /* Flawfinder: ignore */
item_buffer[bin_bucket_size] = '\0';
std::string str(&item_buffer[0]);
LL_DEBUGS() << "item buffer: " << str << LL_ENDL;
// Tokenize the string.
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
tokenizer tokens(str, sep);
tokenizer::iterator iter = tokens.begin();
// Extract all values.
LLUUID item_id;
item_id.generate();
setUUID(item_id);
LLAssetType::EType type;
type = (LLAssetType::EType)(atoi((*(iter++)).c_str()));
setType( type );
LLInventoryType::EType inv_type;
inv_type = (LLInventoryType::EType)(atoi((*(iter++)).c_str()));
setInventoryType( inv_type );
std::string name((*(iter++)).c_str());
rename( name );
LLUUID creator_id((*(iter++)).c_str());
LLUUID owner_id((*(iter++)).c_str());
LLUUID last_owner_id((*(iter++)).c_str());
LLUUID group_id((*(iter++)).c_str());
PermissionMask mask_base = strtoul((*(iter++)).c_str(), NULL, 16);
PermissionMask mask_owner = strtoul((*(iter++)).c_str(), NULL, 16);
PermissionMask mask_group = strtoul((*(iter++)).c_str(), NULL, 16);
PermissionMask mask_every = strtoul((*(iter++)).c_str(), NULL, 16);
PermissionMask mask_next = strtoul((*(iter++)).c_str(), NULL, 16);
LLPermissions perm;
perm.init(creator_id, owner_id, last_owner_id, group_id);
perm.initMasks(mask_base, mask_owner, mask_group, mask_every, mask_next);
setPermissions(perm);
//LL_DEBUGS() << "perm: " << perm << LL_ENDL;
LLUUID asset_id((*(iter++)).c_str());
setAssetUUID(asset_id);
std::string desc((*(iter++)).c_str());
setDescription(desc);
LLSaleInfo::EForSale sale_type;
sale_type = (LLSaleInfo::EForSale)(atoi((*(iter++)).c_str()));
S32 price = atoi((*(iter++)).c_str());
LLSaleInfo sale_info(sale_type, price);
setSaleInfo(sale_info);
U32 flags = strtoul((*(iter++)).c_str(), NULL, 16);
setFlags(flags);
time_t now = time(NULL);
setCreationDate(now);
}
///----------------------------------------------------------------------------
/// Class LLInventoryCategory
///----------------------------------------------------------------------------
@ -1230,6 +1125,7 @@ LLSD LLInventoryCategory::asLLSD() const
LLSD sd = LLSD();
sd["item_id"] = mUUID;
sd["parent_id"] = mParentUUID;
sd["thumbnail_id"] = mThumbnailUUID;
S8 type = static_cast<S8>(mPreferredType);
sd["type"] = type;
sd["name"] = mName;
@ -1262,6 +1158,11 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
{
mParentUUID = sd[w];
}
w = INV_THUMBNAIL_ID_LABEL;
if (sd.has(w))
{
mThumbnailUUID = sd[w];
}
w = INV_ASSET_TYPE_LABEL;
if (sd.has(w))
{

View File

@ -70,6 +70,7 @@ public:
virtual const LLUUID& getUUID() const; // inventoryID that this item points to
virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
const LLUUID& getParentUUID() const;
virtual const LLUUID& getThumbnailUUID() const;
virtual const std::string& getName() const;
virtual LLAssetType::EType getType() const;
LLAssetType::EType getActualType() const; // bypasses indirection for linked items
@ -84,6 +85,7 @@ public:
void setUUID(const LLUUID& new_uuid);
virtual void rename(const std::string& new_name);
void setParent(const LLUUID& new_parent);
virtual void setThumbnailUUID(const LLUUID& thumbnail_uuid);
void setType(LLAssetType::EType type);
virtual void setCreationDate(time_t creation_date_utc); // only stored for items
@ -108,6 +110,7 @@ public:
protected:
LLUUID mUUID;
LLUUID mParentUUID; // Parent category. Root categories have LLUUID::NULL.
LLUUID mThumbnailUUID;
LLAssetType::EType mType;
std::string mName;
time_t mCreationDate; // seconds from 1/1/1970, UTC
@ -159,6 +162,7 @@ public:
virtual const std::string& getDescription() const;
virtual const std::string& getActualDescription() const; // Does not follow links
virtual const LLSaleInfo& getSaleInfo() const;
virtual const LLUUID& getThumbnailUUID() const;
virtual LLInventoryType::EType getInventoryType() const;
virtual U32 getFlags() const;
virtual time_t getCreationDate() const;
@ -203,9 +207,6 @@ public:
// Helper Functions
//--------------------------------------------------------------------
public:
// Pack all information needed to reconstruct this item into the given binary bucket.
S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
LLSD asLLSD() const;
void asLLSD( LLSD& sd ) const;
bool fromLLSD(const LLSD& sd, bool is_new = true);

View File

@ -152,28 +152,28 @@ 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))));
// <FS:Beq> FIRE-29682 Allow full range density multipliers
// 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_DENSITY_MULTIPLIER, false, LLSD::TypeReal,
boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0000001f)(2.0f)))));
boost::bind(&LLSettingsBase::Validator::verifyFloatRange, _1, _2, llsd::array(0.0000001f, 2.0f))));
// </FS:Beq>
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;
}
@ -184,19 +184,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;
}
@ -207,19 +207,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;
}
@ -230,22 +230,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;
}
@ -550,89 +550,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));
@ -723,7 +720,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position)
dfltsetting[SETTING_CLOUD_POS_DENSITY1] = LLColor4(1.0000f, 0.5260f, 1.0000f, 0.0f).getValue();
dfltsetting[SETTING_CLOUD_POS_DENSITY2] = LLColor4(1.0000f, 0.5260f, 1.0000f, 0.0f).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);

View File

@ -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;

View File

@ -400,27 +400,7 @@ namespace tut
// Deleted LLInventoryItem::exportFileXML() and LLInventoryItem::importXML()
// because I can't find any non-test code references to it. 2009-05-04 JC
}
template<> template<>
void inventory_object::test<10>()
{
LLPointer<LLInventoryItem> src1 = create_random_inventory_item();
U8* bin_bucket = new U8[300];
S32 bin_bucket_size = src1->packBinaryBucket(bin_bucket, NULL);
LLPointer<LLInventoryItem> src2 = new LLInventoryItem();
src2->unpackBinaryBucket(bin_bucket, bin_bucket_size);
ensure_equals("1.sale price::getSalePrice() failed price", src1->getSaleInfo().getSalePrice(), src2->getSaleInfo().getSalePrice());
ensure_equals("2.sale type::getSaleType() failed type", src1->getSaleInfo().getSaleType(), src2->getSaleInfo().getSaleType());
ensure_equals("3.type::getType() failed", src1->getType(), src2->getType());
ensure_equals("4.inventory type::getInventoryType() failed type", src1->getInventoryType(), src2->getInventoryType());
ensure_equals("5.name::getName() failed", src1->getName(), src2->getName());
ensure_equals("6.description::getDescription() failed", src1->getDescription(), src2->getDescription());
ensure_equals("7.flags::getFlags() failed", src1->getFlags(), src2->getFlags());
}
template<> template<>
void inventory_object::test<11>()
{

View File

@ -2436,7 +2436,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
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];

View File

@ -3413,6 +3413,7 @@ typedef std::map<const char*, LLMessageBuilder*> BuilderMap;
void LLMessageSystem::newMessageFast(const char *name)
{
//LL_DEBUGS("Messaging") << "creating new message: " << name << LL_ENDL;
LLMessageConfig::Flavor message_flavor =
LLMessageConfig::getMessageFlavor(name);
LLMessageConfig::Flavor server_flavor =

View File

@ -48,6 +48,7 @@ set(llrender_SOURCE_FILES
llrendertarget.cpp
llshadermgr.cpp
lltexture.cpp
lltexturemanagerbridge.cpp
lluiimage.cpp
llvertexbuffer.cpp
llglcommonfunc.cpp
@ -77,6 +78,7 @@ set(llrender_HEADER_FILES
llrendersphere.h
llshadermgr.h
lltexture.h
lltexturemanagerbridge.h
lluiimage.h
lluiimage.inl
llvertexbuffer.h

View File

@ -27,7 +27,6 @@
#ifndef LL_TEXTUREMANAGERBRIDGE_H
#define LL_TEXTUREMANAGERBRIDGE_H
#include "llavatarappearancedefines.h"
#include "llpointer.h"
#include "llgltexture.h"

View File

@ -1628,6 +1628,22 @@ BOOL LLFolderView::handleHover( S32 x, S32 y, MASK mask )
return LLView::handleHover( x, y, mask );
}
LLFolderViewItem* LLFolderView::getHoveredItem() const
{
return dynamic_cast<LLFolderViewItem*>(mHoveredItem.get());
}
void LLFolderView::setHoveredItem(LLFolderViewItem* itemp)
{
if (mHoveredItem.get() != itemp)
{
if (itemp)
mHoveredItem = itemp->getHandle();
else
mHoveredItem.markDead();
}
}
BOOL LLFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,

View File

@ -144,6 +144,10 @@ public:
// applies filters to control visibility of items
virtual void filter( LLFolderViewFilter& filter);
void clearHoveredItem() { setHoveredItem(nullptr); }
LLFolderViewItem* getHoveredItem() const;
void setHoveredItem(LLFolderViewItem* itemp);
// Get the last selected item
virtual LLFolderViewItem* getCurSelectedItem( void );
selected_items_t& getSelectedItems( void );
@ -280,6 +284,7 @@ protected:
LLHandle<LLView> mPopupMenuHandle;
std::string mMenuFileName;
LLHandle<LLView> mHoveredItem;
selected_items_t mSelectedItems;
bool mKeyboardSelection,
mAllowMultiSelect,

View File

@ -177,7 +177,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
// <FS:Ansariel> Fix misleading color name
//sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
//sSuffixColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemSuffixColor", DEFAULT_WHITE);
// </FS:Ansariel>
sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
@ -432,7 +432,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height )
// it is purely visual, so it is fine to do at our laisure
refreshSuffix();
}
mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + mLabelPaddingRight;
mLabelWidth = getLabelXPos() + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(LLFontGL::NORMAL)->getWidth(mLabelSuffix) + mLabelPaddingRight;
mLabelWidthDirty = false;
}
@ -691,11 +691,14 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask )
getWindow()->setCursor(UI_CURSOR_NOLOCKED);
// [/SL:KB]
root->clearHoveredItem();
return TRUE;
}
else
{
getRoot()->setShowSelectionContext(FALSE);
LLFolderView* pRoot = getRoot();
pRoot->setHoveredItem(this);
pRoot->setShowSelectionContext(FALSE);
getWindow()->setCursor(UI_CURSOR_ARROW);
// let parent handle this then...
return FALSE;
@ -750,6 +753,13 @@ BOOL LLFolderViewItem::handleMouseUp( S32 x, S32 y, MASK mask )
void LLFolderViewItem::onMouseLeave(S32 x, S32 y, MASK mask)
{
mIsMouseOverTitle = false;
// NOTE: LLViewerWindow::updateUI() calls "enter" before "leave"; if the mouse moved to another item, we can't just outright clear it
LLFolderView* pRoot = getRoot();
if (this == pRoot->getHoveredItem())
{
pRoot->clearHoveredItem();
}
}
BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@ -996,16 +1006,43 @@ void LLFolderViewItem::draw()
F32 text_left = (F32)getLabelXPos();
std::string combined_string = mLabel + mLabelSuffix;
const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL);
S32 filter_offset = mViewModelItem->getFilterStringOffset();
if (filter_string_length > 0)
{
S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2;
S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
S32 top = getRect().getHeight() - TOP_PAD;
if(mLabelSuffix.empty() || (font == suffix_font))
{
S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mViewModelItem->getFilterStringOffset()) - 2;
S32 right = left + font->getWidth(combined_string, mViewModelItem->getFilterStringOffset(), filter_string_length) + 2;
S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
S32 top = getRect().getHeight() - TOP_PAD;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
box_image->draw(box_rect, sFilterBGColor);
}
else
{
S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length);
if(label_filter_length > 0)
{
S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, llmin(filter_offset, (S32)mLabel.size())) - 2;
S32 right = left + font->getWidthF32(mLabel, filter_offset, label_filter_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
box_image->draw(box_rect, sFilterBGColor);
}
S32 suffix_filter_length = label_filter_length > 0 ? filter_string_length - label_filter_length : filter_string_length;
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
S32 left = ll_round(text_left) + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset) - 2;
S32 right = left + suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length) + 2;
LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
box_image->draw(box_rect, sFilterBGColor);
}
}
}
LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor;
@ -1042,7 +1079,7 @@ void LLFolderViewItem::draw()
//
if (!mLabelSuffix.empty())
{
font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor,
suffix_font->renderUTF8( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : (LLColor4)sSuffixColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x, FALSE );
}
@ -1052,12 +1089,35 @@ void LLFolderViewItem::draw()
//
if (filter_string_length > 0)
{
S32 filter_offset = mViewModelItem->getFilterStringOffset();
F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string, filter_offset, filter_string_length);
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
font->renderUTF8( combined_string, filter_offset, match_string_left, yy,
if(mLabelSuffix.empty() || (font == suffix_font))
{
F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string, filter_offset, filter_string_length);
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
font->renderUTF8( combined_string, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
filter_string_length, S32_MAX, &right_x, FALSE );
}
else
{
S32 label_filter_length = llmin((S32)mLabel.size() - filter_offset, (S32)filter_string_length);
if(label_filter_length > 0)
{
F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel, filter_offset, label_filter_length);
F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
font->renderUTF8( mLabel, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, label_filter_length, S32_MAX, &right_x, FALSE );
}
S32 suffix_filter_length = label_filter_length > 0 ? filter_string_length - label_filter_length : filter_string_length;
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
F32 match_string_left = text_left + font->getWidthF32(mLabel, 0, mLabel.size()) + suffix_font->getWidthF32(mLabelSuffix, 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix, suffix_offset, suffix_filter_length);
F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
suffix_font->renderUTF8( mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, suffix_filter_length, S32_MAX, &right_x, FALSE );
}
}
}
//Gilbert Linden 9-20-2012: Although this should be legal, removing it because it causes the mLabelSuffix rendering to

View File

@ -39,7 +39,9 @@ class LLUICtrlFactory;
// Classes
//
//
// Class for diplaying named UI textures
// Do not use for displaying textures from network,
// UI textures are stored permanently!
class LLIconCtrl
: public LLUICtrl
{

View File

@ -338,7 +338,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);
}

View File

@ -163,6 +163,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
: LLPanel(p),
mHasClickCallback(p.click_callback.isProvided()),
mPadding(p.padding),
mMaxWidth(p.max_width),
mTextBox(NULL),
mInfoButton(NULL),
mPlayMediaButton(NULL),
@ -272,7 +273,7 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
// do this *after* we've had our size set in LLPanel::initFromParams();
const S32 REALLY_LARGE_HEIGHT = 10000;
mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT);
mTextBox->reshape(mMaxWidth, REALLY_LARGE_HEIGHT);
if (p.styled_message.isProvided())
{
@ -288,16 +289,19 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
mTextBox->setText(p.message());
}
S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth() + 1);
updateTextBox();
snapToChildren();
}
void LLToolTip::updateTextBox()
{
S32 text_width = llmin(mMaxWidth, mTextBox->getTextPixelWidth() + 1);
S32 text_height = mTextBox->getTextPixelHeight();
mTextBox->reshape(text_width, text_height);
if (mInfoButton)
{
LLRect text_rect = mTextBox->getRect();
LLRect icon_rect = mInfoButton->getRect();
mTextBox->translate(0, icon_rect.getCenterY() - text_rect.getCenterY());
}
}
void LLToolTip::snapToChildren()
{
// reshape tooltip panel to fit text box
LLRect tooltip_rect = calcBoundingRect();
tooltip_rect.mTop += mPadding;
@ -305,7 +309,14 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
tooltip_rect.mBottom = 0;
tooltip_rect.mLeft = 0;
mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding));
if (mInfoButton)
{
mTextBox->reshape(mTextBox->getRect().getWidth(), llmax(mTextBox->getRect().getHeight(), tooltip_rect.getHeight() - 2 * mPadding));
LLRect text_rect = mTextBox->getRect();
LLRect icon_rect = mInfoButton->getRect();
mInfoButton->translate(0, text_rect.getCenterY() - icon_rect.getCenterY());
}
setShape(tooltip_rect);
}
@ -428,7 +439,10 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params)
}
tooltip_params.rect = LLRect (0, 1, 1, 0);
mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params);
if (tooltip_params.create_callback.isProvided())
mToolTip = tooltip_params.create_callback()(tooltip_params);
else
mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params);
gToolTipView->addChild(mToolTip);

View File

@ -68,6 +68,7 @@ public:
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
typedef boost::function<void(void)> click_callback_t;
typedef boost::function<LLToolTip*(LLToolTip::Params)> create_callback_t;
Optional<std::string> message;
Multiple<StyledText> styled_message;
@ -84,6 +85,8 @@ public:
Optional<bool> time_based_media,
web_based_media,
media_playing;
Optional<create_callback_t> create_callback;
Optional<LLSD> create_params;
Optional<click_callback_t> click_callback,
click_playmedia_callback,
click_homepage_callback;
@ -103,11 +106,15 @@ public:
bool hasClickCallback();
LLToolTip(const Params& p);
void initFromParams(const LLToolTip::Params& params);
virtual void initFromParams(const LLToolTip::Params& params);
void getToolTipMessage(std::string & message);
private:
protected:
void updateTextBox();
void snapToChildren();
protected:
class LLTextBox* mTextBox;
class LLButton* mInfoButton;
class LLButton* mPlayMediaButton;
@ -117,6 +124,7 @@ private:
LLFrameTimer mVisibleTimer;
bool mHasClickCallback;
S32 mPadding; // pixels
S32 mMaxWidth;
};
// used for the inspector tooltips which need different background images etc.

View File

@ -927,6 +927,17 @@ LLView* LLView::childFromPoint(S32 x, S32 y, bool recur)
return 0;
}
F32 LLView::getTooltipTimeout()
{
static LLCachedControl<F32> tooltip_fast_delay(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipFastDelay", 0.1f);
static LLCachedControl<F32> tooltip_delay(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipDelay", 0.7f);
// allow "scrubbing" over ui by showing next tooltip immediately
// if previous one was still visible
return (F32)(LLToolTipMgr::instance().toolTipVisible()
? tooltip_fast_delay
: tooltip_delay);
}
BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
@ -942,14 +953,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
std::string tooltip = getToolTip();
if (!tooltip.empty())
{
static LLCachedControl<F32> tooltip_fast_delay(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipFastDelay", 0.1f);
static LLCachedControl<F32> tooltip_delay(*LLUI::getInstance()->mSettingGroups["config"], "ToolTipDelay", 0.7f);
static LLCachedControl<bool> allow_ui_tooltips(*LLUI::getInstance()->mSettingGroups["config"], "BasicUITooltips", true);
// allow "scrubbing" over ui by showing next tooltip immediately
// if previous one was still visible
F32 timeout = LLToolTipMgr::instance().toolTipVisible()
? tooltip_fast_delay
: tooltip_delay;
// Even if we don't show tooltips, consume the event, nothing below should show tooltip
if (allow_ui_tooltips)
@ -957,7 +961,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
LLToolTipMgr::instance().show(LLToolTip::Params()
.message(tooltip)
.sticky_rect(calcScreenRect())
.delay_time(timeout));
.delay_time(getTooltipTimeout()));
}
handled = TRUE;
}

View File

@ -243,12 +243,11 @@ public:
ECursorType getHoverCursor() { return mHoverCursor; }
static F32 getTooltipTimeout();
// <FS:ND> Made this non inline when changing mToolTipMsg from a LLUIString to a char* to reduce memory usage,
// (Making a virtual function inline is debatable anyway).
// virtual const std::string getToolTip() const { return mToolTipMsg.getString(); }
virtual const std::string getToolTip() const;
// </FS:ND>
void sendChildToFront(LLView* child);

View File

@ -420,7 +420,7 @@ set(viewer_SOURCE_FILES
llfloaterpreferenceviewadvanced.cpp
llfloaterpreviewtrash.cpp
llfloaterprofiletexture.cpp
llfloaterproperties.cpp
llfloaterproperties.cpp # <FS:Ansariel> Keep legacy properties floater
llfloaterregiondebugconsole.cpp
llfloaterregioninfo.cpp
llfloaterreporter.cpp
@ -494,6 +494,7 @@ set(viewer_SOURCE_FILES
llinspectgroup.cpp
llinspectobject.cpp
llinspectremoteobject.cpp
llinspecttexture.cpp
llinspecttoast.cpp
llinventorybridge.cpp
llinventoryfilter.cpp
@ -723,6 +724,7 @@ set(viewer_SOURCE_FILES
lltextureinfodetails.cpp
lltexturestats.cpp
lltextureview.cpp
llthumbnailctrl.cpp
lltoast.cpp
lltoastalertpanel.cpp
lltoastgroupnotifypanel.cpp
@ -1204,7 +1206,7 @@ set(viewer_HEADER_FILES
llfloaterpreferenceviewadvanced.h
llfloaterpreviewtrash.h
llfloaterprofiletexture.h
llfloaterproperties.h
llfloaterproperties.h # <FS:Ansariel> Keep legacy properties floater
llfloaterregiondebugconsole.h
llfloaterregioninfo.h
llfloaterreporter.h
@ -1276,6 +1278,7 @@ set(viewer_HEADER_FILES
llinspectgroup.h
llinspectobject.h
llinspectremoteobject.h
llinspecttexture.h
llinspecttoast.h
llinventorybridge.h
llinventoryfilter.h
@ -1496,6 +1499,7 @@ set(viewer_HEADER_FILES
lltextureinfodetails.h
lltexturestats.h
lltextureview.h
llthumbnailctrl.h
lltoast.h
lltoastalertpanel.h
lltoastgroupnotifypanel.h

View File

@ -105,7 +105,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
tid.generate();
std::string url = cap + std::string("/category/") + parentId.asString() + "?tid=" + tid.asString();
LL_DEBUGS("Inventory") << "url: " << url << LL_ENDL;
LL_DEBUGS("Inventory") << "url: " << url << " parentID " << parentId << " newInventory " << newInventory << LL_ENDL;
// I may be suffering from golden hammer here, but the first part of this bind
// is actually a static cast for &HttpCoroutineAdapter::postAndSuspend so that
@ -129,7 +129,7 @@ void AISAPI::CreateInventory(const LLUUID& parentId, const LLSD& newInventory, c
(&LLCoreHttpUtil::HttpCoroutineAdapter::postAndSuspend), _1, _2, _3, _4, _5, _6);
LLCoprocedureManager::CoProcedure_t proc(boost::bind(&AISAPI::InvokeAISCommandCoro,
_1, postFn, url, parentId, newInventory, callback, COPYINVENTORY));
_1, postFn, url, parentId, newInventory, callback, CREATEINVENTORY));
EnqueueAISCommand("CreateInventory", proc);
}
@ -483,6 +483,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
LL_WARNS("Inventory") << ll_pretty_print_sd(result) << LL_ENDL;
}
LL_DEBUGS("Inventory") << result << LL_ENDL;
gInventory.onAISUpdateReceived("AISCommand", result);
if (callback && !callback.empty())
@ -498,6 +499,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
}
break;
case COPYINVENTORY:
case CREATEINVENTORY:
{
AISUpdate::parseUUIDArray(result, "_created_items", ids);
AISUpdate::parseUUIDArray(result, "_created_categories", ids);
@ -512,19 +514,42 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht
break;
}
// If we were feeling daring we'd call LLInventoryCallback::fire for every item but it would take additional work to investigate whether all LLInventoryCallback derived classes
// were designed to handle multiple fire calls (with legacy link creation only one would ever fire per link creation) so we'll be cautious and only call for the first one for now
// (note that the LL code as written below will always call fire once with the NULL UUID for anything but CopyLibraryCategoryCommand so even the above is an improvement)
callback( (!ids.empty()) ? *ids.begin() : LLUUID::null);
if (!ids.empty())
{
for (const auto& id : ids)
callback(id);
}
// [/SL:KB]
// LLUUID id(LLUUID::null);
//
// if (result.has("category_id") && (type == COPYLIBRARYCATEGORY))
// {
// id = result["category_id"];
// callback(id);
// }
//
// callback(id);
// if (type == CREATEINVENTORY)
// {
// if (result.has("_created_categories"))
// {
// LLSD& cats = result["_created_categories"];
// LLSD::array_const_iterator cat_iter;
// for (cat_iter = cats.beginArray(); cat_iter != cats.endArray(); ++cat_iter)
// {
// LLUUID cat_id = *cat_iter;
// callback(cat_id);
// }
// }
// if (result.has("_created_items"))
// {
// LLSD& items = result["_created_items"];
// LLSD::array_const_iterator item_iter;
// for (item_iter = items.beginArray(); item_iter != items.endArray(); ++item_iter)
// {
// LLUUID item_id = *item_iter;
// callback(item_id);
// }
// }
// }
}
}

View File

@ -61,7 +61,8 @@ private:
PURGEDESCENDENTS,
UPDATECATEGORY,
UPDATEITEM,
COPYLIBRARYCATEGORY
COPYLIBRARYCATEGORY,
CREATEINVENTORY
} COMMAND_TYPE;
static const std::string INVENTORY_CAP_NAME;

View File

@ -1775,6 +1775,8 @@ void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& ds
{
parent_id = gInventory.getRootFolderID();
}
// USES UDP PATH
// D567 needs to carry over thumbnail info
LLUUID subfolder_id = gInventory.createNewCategory( parent_id,
LLFolderType::FT_NONE,
src_cat->getName());
@ -3098,7 +3100,9 @@ void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool ap
{
pid = gInventory.getRootFolderID();
}
// UDP PATH
// D567 needs to carry over thumbnail info if present
LLUUID new_cat_id = gInventory.createNewCategory(
pid,
LLFolderType::FT_NONE,
@ -4498,12 +4502,15 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
// First, make a folder in the My Outfits directory.
const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
// D567 replace with coros
if (AISAPI::isAvailable())
{
// cap-based category creation was buggy until recently. use
// existence of AIS as an indicator the fix is present. Does
// not actually use AIS to create the category.
inventory_func_type func = boost::bind(&LLAppearanceMgr::onOutfitFolderCreated,this,_1,show_panel);
// D567 copy thumbnail info from source folder
gInventory.createNewCategory(
parent_id,
LLFolderType::FT_OUTFIT,
@ -4511,7 +4518,9 @@ void LLAppearanceMgr::makeNewOutfitLinks(const std::string& new_folder_name, boo
func);
}
else
{
{
// UDP PATH, should remove
// D567 copy thumbnail info from source folder
LLUUID folder_id = gInventory.createNewCategory(
parent_id,
LLFolderType::FT_OUTFIT,

View File

@ -3790,7 +3790,8 @@ 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["BUILD_DATE"] = __DATE__;
info["BUILD_TIME"] = __TIME__;

View File

@ -79,7 +79,9 @@ static S32 cube_channel = -1;
static S32 diffuse_channel = -1;
static S32 bump_channel = -1;
#define LL_BUMPLIST_MULTITHREADED 0 // TODO -- figure out why this doesn't work
// Enabled after changing LLViewerTexture::mNeedsCreateTexture to an
// LLAtomicBool; this should work just fine, now. HB
#define LL_BUMPLIST_MULTITHREADED 1
// static

View File

@ -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<LLScrollListCtrl>("parcel list");
list->clearRows();
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("parcel list");
list->clearRows();
// query_id null is known to be us
const LLUUID& query_id = LLUUID::null;

View File

@ -41,6 +41,8 @@
#include "llnotificationmanager.h"
#include "llnotificationsutil.h"
#include "llsidepaneliteminfo.h"
#include "llsidepaneltaskinfo.h"
#include "lltabcontainer.h"
#include "lltextbox.h"
#include "lltrans.h"
#include "fscommon.h"
@ -968,18 +970,29 @@ LLFloaterItemProperties::~LLFloaterItemProperties()
BOOL LLFloaterItemProperties::postBuild()
{
// On the standalone properties floater, we have no need for a back button...
LLSidepanelItemInfo* panel = getChild<LLSidepanelItemInfo>("item_panel");
LLButton* back_btn = panel->getChild<LLButton>("back_btn");
back_btn->setVisible(FALSE);
return LLFloater::postBuild();
}
void LLFloaterItemProperties::onOpen(const LLSD& key)
{
// Tell the panel which item it needs to visualize
LLSidepanelItemInfo* panel = getChild<LLSidepanelItemInfo>("item_panel");
panel->setItemID(key["id"].asUUID());
LLPanel* panel = findChild<LLPanel>("sidepanel");
LLSidepanelItemInfo* item_panel = dynamic_cast<LLSidepanelItemInfo*>(panel);
if (item_panel)
{
item_panel->setItemID(key["id"].asUUID());
if (key.has("object"))
{
item_panel->setObjectID(key["object"].asUUID());
}
item_panel->setParentFloater(this);
}
LLSidepanelTaskInfo* task_panel = dynamic_cast<LLSidepanelTaskInfo*>(panel);
if (task_panel)
{
task_panel->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
}
}

View File

@ -181,6 +181,7 @@ void LLFloaterOpenObject::moveToInventory(bool wear, bool replace)
}
inventory_func_type func = boost::bind(LLFloaterOpenObject::callbackCreateInventoryCategory,_1,object_id,wear,replace);
// D567 copy thumbnail info
LLUUID category_id = gInventory.createNewCategory(parent_category_id,
LLFolderType::FT_NONE,
name,
@ -188,6 +189,7 @@ void LLFloaterOpenObject::moveToInventory(bool wear, bool replace)
//If we get a null category ID, we are using a capability in createNewCategory and we will
//handle the following in the callbackCreateInventoryCategory routine.
// D567 review
if ( category_id.notNull() )
{
LLCatAndWear* data = new LLCatAndWear;

View File

@ -161,10 +161,7 @@ BOOL LLFloaterSimpleOutfitSnapshot::postBuild()
LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
LLView* parent_view = gSnapshotFloaterView->getParent();
parent_view->removeChild(gSnapshotFloaterView);
// make sure preview is below snapshot floater
parent_view->addChild(previewp);
parent_view->addChild(gSnapshotFloaterView);
//move snapshot floater to special purpose snapshotfloaterview
gFloaterView->removeChild(this);
@ -179,10 +176,11 @@ BOOL LLFloaterSimpleOutfitSnapshot::postBuild()
previewp->mKeepAspectRatio = FALSE;
previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
previewp->setAllowRenderUI(false);
previewp->setThumbnailSubsampled(TRUE);
return TRUE;
}
const S32 PREVIEW_OFFSET_X = 12;
const S32 PREVIEW_OFFSET_Y = 70;
void LLFloaterSimpleOutfitSnapshot::draw()
@ -202,11 +200,11 @@ void LLFloaterSimpleOutfitSnapshot::draw()
if(previewp->getThumbnailImage())
{
bool working = impl->getStatus() == ImplBase::STATUS_WORKING;
const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
const S32 thumbnail_w = previewp->getThumbnailWidth();
const S32 thumbnail_h = previewp->getThumbnailHeight();
S32 offset_x = PREVIEW_OFFSET_X;
LLRect local_rect = getLocalRect();
S32 offset_x = (local_rect.getWidth() - thumbnail_w) / 2;
S32 offset_y = PREVIEW_OFFSET_Y;
gGL.matrixMode(LLRender::MM_MODELVIEW);
@ -216,18 +214,6 @@ void LLFloaterSimpleOutfitSnapshot::draw()
gl_draw_scaled_image(offset_x, offset_y,
thumbnail_w, thumbnail_h,
previewp->getThumbnailImage(), color % alpha);
#if LL_DARWIN
std::string alpha_color = getTransparencyType() == TT_ACTIVE ? "OutfitSnapshotMacMask" : "OutfitSnapshotMacMask2";
#else
std::string alpha_color = getTransparencyType() == TT_ACTIVE ? "FloaterFocusBackgroundColor" : "DkGray";
#endif
previewp->drawPreviewRect(offset_x, offset_y, LLUIColorTable::instance().getColor(alpha_color));
gGL.pushUIMatrix();
LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
mThumbnailPlaceholder->draw();
gGL.popUIMatrix();
}
}
impl->updateLayout(this);

View File

@ -39,12 +39,14 @@ class LLFolderViewModelItemInventory
public:
LLFolderViewModelItemInventory(class LLFolderViewModelInventory& root_view_model);
virtual const LLUUID& getUUID() const = 0;
virtual const LLUUID& getThumbnailUUID() const = 0;
virtual time_t getCreationDate() const = 0; // UTC seconds
virtual void setCreationDate(time_t creation_date_utc) = 0;
virtual PermissionMask getPermissionMask() const = 0;
virtual LLFolderType::EType getPreferredType() const = 0;
virtual void showProperties(void) = 0;
virtual BOOL isItemInTrash( void) const { return FALSE; } // TODO: make into pure virtual.
virtual bool isItemInOutfits() const { return false; }
virtual BOOL isAgentInventory() const { return FALSE; }
virtual BOOL isUpToDate() const = 0;
virtual void addChild(LLFolderViewModelItem* child);

View File

@ -696,9 +696,7 @@ void LLInspectObject::onClickOpen()
void LLInspectObject::onClickMoreInfo()
{
LLSD key;
key["task"] = "task";
LLFloaterSidePanelContainer::showPanel("inventory", key);
LLFloaterReg::showInstance("task_properties");
closeFloater();
}

View File

@ -0,0 +1,308 @@
/**
* @file llinspecttexture.cpp
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llfloaterreg.h"
#include "llinspect.h"
#include "llinspecttexture.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "lltexturectrl.h"
#include "lltrans.h"
#include "llviewertexturelist.h"
// ============================================================================
// LLInspectTexture class
//
class LLInspectTexture : public LLInspect
{
friend class LLFloaterReg;
public:
LLInspectTexture(const LLSD& sdKey);
~LLInspectTexture();
public:
void onOpen(const LLSD& sdData) override;
BOOL postBuild() override;
public:
const LLUUID& getAssetId() const { return mAssetId; }
const LLUUID& getItemId() const { return mItemId; }
protected:
LLUUID mAssetId;
LLUUID mItemId; // Item UUID relative to gInventoryModel (or null if not displaying an inventory texture)
LLUUID mNotecardId;
LLTextureCtrl* mTextureCtrl = nullptr;
LLTextBox* mTextureName = nullptr;
};
LLInspectTexture::LLInspectTexture(const LLSD& sdKey)
: LLInspect(LLSD())
{
}
LLInspectTexture::~LLInspectTexture()
{
}
void LLInspectTexture::onOpen(const LLSD& sdData)
{
// Start fade animation
LLInspect::onOpen(sdData);
bool fIsAsset = sdData.has("asset_id");
bool fIsInventory = sdData.has("item_id");
// Skip if we're being asked to display the same thing
const LLUUID idAsset = (fIsAsset) ? sdData["asset_id"].asUUID() : LLUUID::null;
const LLUUID idItem = (fIsInventory) ? sdData["item_id"].asUUID() : LLUUID::null;
if ( (getVisible()) && ( ((fIsAsset) && (idAsset == mAssetId)) || ((fIsInventory) && (idItem == mItemId)) ) )
{
return;
}
// Position the inspector relative to the mouse cursor
// Similar to how tooltips are positioned [see LLToolTipMgr::createToolTip()]
if (sdData.has("pos"))
LLUI::instance().positionViewNearMouse(this, sdData["pos"]["x"].asInteger(), sdData["pos"]["y"].asInteger());
else
LLUI::instance().positionViewNearMouse(this);
std::string strName = sdData["name"].asString();
if (fIsAsset)
{
mAssetId = idAsset;
mItemId = idItem; // Will be non-null in the case of a notecard
mNotecardId = sdData["notecard_id"].asUUID();
}
else if (fIsInventory)
{
const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
if ( (pItem) && (LLAssetType::AT_TEXTURE == pItem->getType()) )
{
if (strName.empty())
strName = pItem->getName();
mAssetId = pItem->getAssetUUID();
mItemId = idItem;
}
else
{
mAssetId.setNull();
mItemId.setNull();
}
mNotecardId = LLUUID::null;
}
mTextureCtrl->setImageAssetID(mAssetId);
mTextureName->setText(strName);
}
BOOL LLInspectTexture::postBuild()
{
mTextureCtrl = getChild<LLTextureCtrl>("texture_ctrl");
mTextureName = getChild<LLTextBox>("texture_name");
return TRUE;
}
// ============================================================================
// Helper functions
//
LLToolTip* LLInspectTextureUtil::createInventoryToolTip(LLToolTip::Params p)
{
const LLSD& sdTooltip = p.create_params;
if (sdTooltip.has("thumbnail_id") && sdTooltip["thumbnail_id"].asUUID().notNull())
{
// go straight for tooltip regardless of type
return LLUICtrlFactory::create<LLTextureToolTip>(p);
}
LLInventoryType::EType eInvType = (sdTooltip.has("inv_type")) ? (LLInventoryType::EType)sdTooltip["inv_type"].asInteger() : LLInventoryType::IT_NONE;
switch (eInvType)
{
case LLInventoryType::IT_CATEGORY:
{
if (sdTooltip.has("item_id"))
{
const LLUUID idCategory = sdTooltip["item_id"].asUUID();
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLIsOfAssetType f(LLAssetType::AT_TEXTURE);
gInventory.getDirectDescendentsOf(idCategory, cats, items, f);
// Exactly one texture found => show the texture tooltip
if (1 == items.size())
{
p.create_params.getValue()["asset_id"] = items.front()->getAssetUUID();
return LLUICtrlFactory::create<LLTextureToolTip>(p);
}
}
// No or more than one texture found => show default tooltip
return LLUICtrlFactory::create<LLToolTip>(p);
}
default:
return LLUICtrlFactory::create<LLToolTip>(p);
}
}
void LLInspectTextureUtil::registerFloater()
{
LLFloaterReg::add("inspect_texture", "inspect_texture.xml", &LLFloaterReg::build<LLInspectTexture>);
}
// ============================================================================
// LLTexturePreviewView helper class
//
class LLTexturePreviewView : public LLView
{
public:
LLTexturePreviewView(const LLView::Params& p);
~LLTexturePreviewView();
public:
void draw() override;
public:
void setImageFromAssetId(const LLUUID& idAsset);
void setImageFromItemId(const LLUUID& idItem);
protected:
LLPointer<LLViewerFetchedTexture> m_Image;
S32 mImageBoostLevel = LLGLTexture::BOOST_NONE;
std::string mLoadingText;
};
LLTexturePreviewView::LLTexturePreviewView(const LLView::Params& p)
: LLView(p)
{
mLoadingText = LLTrans::getString("texture_loading");
}
LLTexturePreviewView::~LLTexturePreviewView()
{
if (m_Image)
{
m_Image->setBoostLevel(mImageBoostLevel);
m_Image = nullptr;
}
}
void LLTexturePreviewView::draw()
{
if (m_Image)
{
LLRect rctClient = getLocalRect();
gl_rect_2d(rctClient, LLColor4::black);
rctClient.stretch(-2);
if (4 == m_Image->getComponents())
gl_rect_2d_checkerboard(rctClient);
gl_draw_scaled_image(rctClient.mLeft, rctClient.mBottom, rctClient.getWidth(), rctClient.getHeight(), m_Image);
bool isLoading = (!m_Image->isFullyLoaded()) && (m_Image->getDiscardLevel() > 0);
if (isLoading)
LLFontGL::getFontSansSerif()->renderUTF8(mLoadingText, 0, llfloor(rctClient.mLeft + 3), llfloor(rctClient.mTop - 25), LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
m_Image->addTextureStats((isLoading) ? MAX_IMAGE_AREA : (F32)(rctClient.getWidth() * rctClient.getHeight()));
}
}
void LLTexturePreviewView::setImageFromAssetId(const LLUUID& idAsset)
{
m_Image = LLViewerTextureManager::getFetchedTexture(idAsset, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
if (m_Image)
{
mImageBoostLevel = m_Image->getBoostLevel();
m_Image->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
m_Image->forceToSaveRawImage(0);
if ( (!m_Image->isFullyLoaded()) && (!m_Image->hasFetcher()) )
{
if (m_Image->isInFastCacheList())
{
m_Image->loadFromFastCache();
}
gTextureList.forceImmediateUpdate(m_Image);
}
}
}
void LLTexturePreviewView::setImageFromItemId(const LLUUID& idItem)
{
const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
setImageFromAssetId( (pItem) ? pItem->getAssetUUID() : LLUUID::null );
}
// ============================================================================
// LLTextureToolTip class
//
LLTextureToolTip::LLTextureToolTip(const LLToolTip::Params& p)
: LLToolTip(p)
, mPreviewView(nullptr)
, mPreviewSize(256)
{
mMaxWidth = llmax(mMaxWidth, mPreviewSize);
}
LLTextureToolTip::~LLTextureToolTip()
{
}
void LLTextureToolTip::initFromParams(const LLToolTip::Params& p)
{
LLToolTip::initFromParams(p);
// Create and add the preview control
LLView::Params p_preview;
p_preview.name = "texture_preview";
LLRect rctPreview;
rctPreview.setOriginAndSize(mPadding, mTextBox->getRect().mTop, mPreviewSize, mPreviewSize);
p_preview.rect = rctPreview;
mPreviewView = LLUICtrlFactory::create<LLTexturePreviewView>(p_preview);
addChild(mPreviewView);
// Parse the control params
const LLSD& sdTextureParams = p.create_params;
if (sdTextureParams.has("thumbnail_id"))
{
mPreviewView->setImageFromAssetId(sdTextureParams["thumbnail_id"].asUUID());
}
else if (sdTextureParams.has("item_id"))
{
mPreviewView->setImageFromItemId(sdTextureParams["item_id"].asUUID());
}
snapToChildren();
}
// ============================================================================

View File

@ -0,0 +1,52 @@
/**
* @file llinspecttexture.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#pragma once
#include "lltooltip.h"
class LLTexturePreviewView;
namespace LLInspectTextureUtil
{
LLToolTip* createInventoryToolTip(LLToolTip::Params p);
// Register with LLFloaterReg
void registerFloater();
}
class LLTextureToolTip : public LLToolTip
{
public:
LLTextureToolTip(const LLToolTip::Params& p);
~LLTextureToolTip();
public:
void initFromParams(const LLToolTip::Params& p) override;
protected:
LLTexturePreviewView* mPreviewView;
S32 mPreviewSize;
};

View File

@ -1370,6 +1370,16 @@ BOOL LLInvFVBridge::isLinkedObjectInTrash() const
return FALSE;
}
bool LLInvFVBridge::isItemInOutfits() const
{
const LLInventoryModel* model = getInventoryModel();
if(!model) return false;
const LLUUID my_outfits_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS, false);
return isCOFFolder() || (my_outfits_cat == mUUID) || model->isObjectDescendentOf(mUUID, my_outfits_cat);
}
BOOL LLInvFVBridge::isLinkedObjectMissing() const
{
const LLInventoryObject *obj = getInventoryObject();
@ -2174,9 +2184,14 @@ std::string LLItemBridge::getLabelSuffix() const
{
// String table is loaded before login screen and inventory items are
// loaded after login, so LLTrans should be ready.
// <FS:Ansariel> Keep it the old way please
//static std::string NO_COPY = LLTrans::getString("no_copy_lbl");
//static std::string NO_MOD = LLTrans::getString("no_modify_lbl");
//static std::string NO_XFER = LLTrans::getString("no_transfer_lbl");
static std::string NO_COPY = LLTrans::getString("no_copy");
static std::string NO_MOD = LLTrans::getString("no_modify");
static std::string NO_XFER = LLTrans::getString("no_transfer");
// </FS:Ansariel>
static std::string LINK = LLTrans::getString("link");
static std::string BROKEN_LINK = LLTrans::getString("broken_link");
std::string suffix;
@ -2197,17 +2212,20 @@ std::string LLItemBridge::getLabelSuffix() const
BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
if (!copy)
{
//suffix += " "; // <FS:Ansariel> Keep it the old way please
suffix += NO_COPY;
}
BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
if (!mod)
{
suffix += NO_MOD;
//suffix += suffix.empty() ? " " : ","; // <FS:Ansariel> Keep it the old way please
suffix += NO_MOD;
}
BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
gAgent.getID());
if (!xfer)
{
//suffix += suffix.empty() ? " " : ","; // <FS:Ansariel> Keep it the old way please
suffix += NO_XFER;
}
}
@ -2412,6 +2430,21 @@ LLViewerInventoryItem* LLItemBridge::getItem() const
return item;
}
const LLUUID& LLItemBridge::getThumbnailUUID() const
{
LLViewerInventoryItem* item = NULL;
LLInventoryModel* model = getInventoryModel();
if(model)
{
item = (LLViewerInventoryItem*)model->getItem(mUUID);
}
if (item)
{
return item->getThumbnailUUID();
}
return LLUUID::null;
}
BOOL LLItemBridge::isItemPermissive() const
{
LLViewerInventoryItem* item = getItem();
@ -6632,7 +6665,7 @@ std::string LLCallingCardBridge::getLabelSuffix() const
if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) )
{
// <FS:Ansariel> FIRE-17715: Make "online" suffix in calling card folder localizable
//return LLItemBridge::getLabelSuffix() + " (online)";
//return LLItemBridge::getLabelSuffix() + " online";
return LLItemBridge::getLabelSuffix() + " " + LLTrans::getString("CallingCardOnlineLabelSuffix");
// </FS:Ansariel>
}
@ -8389,9 +8422,6 @@ class LLObjectBridgeAction: public LLInvFVBridgeAction
public:
virtual void doIt()
{
/*
LLFloaterReg::showInstance("properties", mUUID);
*/
LLInvFVBridgeAction::doIt();
}
virtual ~LLObjectBridgeAction(){}

View File

@ -28,7 +28,6 @@
#define LL_LLINVENTORYBRIDGE_H
#include "llcallingcard.h"
#include "llfloaterproperties.h"
#include "llfolderviewmodel.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
@ -84,6 +83,7 @@ public:
// LLInvFVBridge functionality
//--------------------------------------------------------------------
virtual const LLUUID& getUUID() const { return mUUID; }
virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null; }
virtual void clearDisplayName() { mDisplayName.clear(); }
virtual void restoreItem() {}
virtual void restoreToWorld() {}
@ -115,6 +115,7 @@ public:
virtual BOOL isItemRemovable() const;
virtual BOOL isItemMovable() const;
virtual BOOL isItemInTrash() const;
virtual bool isItemInOutfits() const;
virtual BOOL isLink() const;
virtual BOOL isLibraryItem() const;
//virtual BOOL removeItem() = 0;
@ -269,6 +270,7 @@ public:
virtual LLUIImagePtr getIconOverlay() const;
LLViewerInventoryItem* getItem() const;
virtual const LLUUID& getThumbnailUUID() const;
protected:
BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);

View File

@ -655,6 +655,9 @@ bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItem
if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0))
return FALSE;
if (listener->isItemInOutfits() && ((mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS) == 0))
return FALSE;
if (listener->isItemInTrash() && ((mFilterOps.mSearchVisibility & VISIBILITY_TRASH) == 0))
return FALSE;
@ -873,6 +876,24 @@ void LLInventoryFilter::toggleSearchVisibilityLinks()
}
}
void LLInventoryFilter::toggleSearchVisibilityOutfits()
{
bool hide_outfits = mFilterOps.mSearchVisibility & VISIBILITY_OUTFITS;
if (hide_outfits)
{
mFilterOps.mSearchVisibility &= ~VISIBILITY_OUTFITS;
}
else
{
mFilterOps.mSearchVisibility |= VISIBILITY_OUTFITS;
}
if (hasFilterString())
{
setModified(hide_outfits ? FILTER_MORE_RESTRICTIVE : FILTER_LESS_RESTRICTIVE);
}
}
void LLInventoryFilter::toggleSearchVisibilityTrash()
{
bool hide_trash = mFilterOps.mSearchVisibility & VISIBILITY_TRASH;

View File

@ -105,7 +105,8 @@ public:
VISIBILITY_NONE = 0,
VISIBILITY_TRASH = 0x1 << 0,
VISIBILITY_LIBRARY = 0x1 << 1,
VISIBILITY_LINKS = 0x1 << 2
VISIBILITY_LINKS = 0x1 << 2,
VISIBILITY_OUTFITS = 0x1 << 3
};
struct FilterOps
@ -234,6 +235,7 @@ public:
void toggleSearchVisibilityLinks();
void toggleSearchVisibilityTrash();
void toggleSearchVisibilityOutfits();
void toggleSearchVisibilityLibrary();
void setSearchVisibilityTypes(U32 types);
void setSearchVisibilityTypes(const Params& params);

View File

@ -99,6 +99,7 @@
#include "aoengine.h"
#include "fsfloaterwearablefavorites.h"
#include "fslslbridge.h"
#include "llfloaterproperties.h"
BOOL LLInventoryState::sWearNewClothing = FALSE;
LLUUID LLInventoryState::sWearNewClothingTransactionID;
@ -419,6 +420,7 @@ void copy_inventory_category(LLInventoryModel* model,
bool move_no_copy_items )
{
// Create the initial folder
// D567 needs to handle new fields
inventory_func_type func = boost::bind(&copy_inventory_category_content, _1, model, cat, root_copy_id, move_no_copy_items);
gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func);
}
@ -856,14 +858,21 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id)
{
// <FS:Ansariel> Optional legacy object properties
//LLFloaterSidePanelContainer::showPanel("inventory", LLSD().with("id", item_uuid).with("object", object_id));
//LLSD params;
//params["id"] = item_uuid;
//params["object"] = object_id;
//LLFloaterReg::showInstance("item_properties", params);
if (gSavedSettings.getBOOL("FSUseLegacyObjectProperties"))
{
LLFloaterReg::showInstance("properties", LLSD().with("item_id", item_uuid).with("object_id", object_id));
}
else
{
LLFloaterSidePanelContainer::showPanel("inventory", LLSD().with("id", item_uuid).with("object", object_id));
LLSD params;
params["id"] = item_uuid;
params["object"] = object_id;
LLFloaterReg::showInstance("item_properties", params);
}
// </FS:Ansariel>
}
@ -872,14 +881,14 @@ void show_item_profile(const LLUUID& item_uuid)
{
LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid);
// <FS:Ansariel> Optional legacy object properties
//LLFloaterSidePanelContainer::showPanel("inventory", LLSD().with("id", linked_uuid));
//LLFloaterReg::showInstance("item_properties", LLSD().with("id", linked_uuid));
if (gSavedSettings.getBOOL("FSUseLegacyObjectProperties"))
{
LLFloaterReg::showInstance("properties", LLSD().with("item_id", linked_uuid));
}
else
{
LLFloaterSidePanelContainer::showPanel("inventory", LLSD().with("id", linked_uuid));
LLFloaterReg::showInstance("item_properties", LLSD().with("id", linked_uuid));
}
// </FS:Ansariel>
}
@ -2832,7 +2841,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
LLMultiPreview* multi_previewp = NULL;
LLMultiProperties* multi_propertiesp = NULL;
LLMultiProperties* multi_propertiesp = NULL; // <FS:Ansariel> Keep legacy properties floater
if (("task_open" == action || "open" == action) && selected_items.size() > 1)
{
@ -2866,10 +2875,13 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
}
else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
{
// <FS:Ansariel> Keep legacy properties floater
//// Isn't supported (previously used LLMultiProperties)
//LL_WARNS() << "Tried to open properties for multiple items" << LL_ENDL;
multi_propertiesp = new LLMultiProperties();
gFloaterView->addChild(multi_propertiesp);
LLFloater::setFloaterHost(multi_propertiesp);
// </FS:Ansariel>
}
std::set<LLUUID> selected_uuid_set = LLAvatarActions::getInventorySelectedUUIDs();
@ -3048,10 +3060,12 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
{
multi_previewp->openFloater(LLSD());
}
// <FS:Ansariel> Keep legacy properties floater
else if (multi_propertiesp)
{
multi_propertiesp->openFloater(LLSD());
}
// </FS:Ansariel>
}
void LLInventoryAction::saveMultipleTextures(const std::vector<std::string>& filenames, std::set<LLFolderViewItem*> selected_items, LLInventoryModel* model)

View File

@ -518,6 +518,31 @@ void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id,
items = get_ptr_in_map(mParentChildItemTree, cat_id);
}
void LLInventoryModel::getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t& categories, item_array_t& items, LLInventoryCollectFunctor& f) const
{
if (cat_array_t* categoriesp = get_ptr_in_map(mParentChildCategoryTree, cat_id))
{
for (LLViewerInventoryCategory* pFolder : *categoriesp)
{
if (f(pFolder, nullptr))
{
categories.push_back(pFolder);
}
}
}
if (item_array_t* itemsp = get_ptr_in_map(mParentChildItemTree, cat_id))
{
for (LLViewerInventoryItem* pItem : *itemsp)
{
if (f(nullptr, pItem))
{
items.push_back(pItem);
}
}
}
}
LLMD5 LLInventoryModel::hashDirectDescendentNames(const LLUUID& cat_id) const
{
LLInventoryModel::cat_array_t* cat_array;
@ -754,24 +779,25 @@ LLUUID LLInventoryModel::findCategoryByName(std::string name)
// updateCategory() with a newly generated UUID category, but this
// version will take care of details like what the name should be
// based on preferred type. Returns the UUID of the new category.
//
// On failure, returns a null UUID.
// FIXME: callers do not check for or handle a null results currently.
LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
LLFolderType::EType preferred_type,
const std::string& pname,
inventory_func_type callback)
{
LLUUID id;
LLUUID id; // Initially null.
if (!isInventoryUsable())
{
LL_WARNS(LOG_INV) << "Inventory is not usable; can't create requested category of type "
<< preferred_type << LL_ENDL;
// FIXME failing but still returning an id?
return id;
}
if(LLFolderType::lookup(preferred_type) == LLFolderType::badLookup())
{
LL_DEBUGS(LOG_INV) << "Attempt to create undefined category." << LL_ENDL;
// FIXME failing but still returning an id?
return id;
}
@ -783,17 +809,29 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
LL_WARNS(LOG_INV) << "Creating new system folder, type " << preferred_type << LL_ENDL;
}
id.generate();
std::string name = pname;
if(!pname.empty())
{
name.assign(pname);
}
else
if (pname.empty())
{
name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
}
#ifdef USE_AIS_FOR_NC
// D567 currently this doesn't really work due to limitations in
// AIS3, also violates the common caller assumption that we can
// assign the id and return immediately.
if (callback)
{
// D567 note that we no longer assign the UUID in the viewer, so various workflows need to change.
LLSD new_inventory = LLSD::emptyMap();
new_inventory["categories"] = LLSD::emptyArray();
LLViewerInventoryCategory cat(LLUUID::null, parent_id, preferred_type, name, gAgent.getID());
LLSD cat_sd = cat.asLLSD();
new_inventory["categories"].append(cat_sd);
AISAPI::CreateInventory(parent_id, new_inventory, callback);
return LLUUID::null;
}
#else
LLViewerRegion* viewer_region = gAgent.getRegion();
std::string url;
if ( viewer_region )
@ -803,6 +841,7 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
{
//Let's use the new capability.
id.generate();
LLSD request, body;
body["folder_id"] = id;
body["parent_id"] = parent_id;
@ -818,17 +857,22 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
return LLUUID::null;
}
#endif
if (!gMessageSystem)
{
return LLUUID::null;
}
// FIXME this UDP code path needs to be removed. Requires
// D567 FIXME this UDP code path needs to be removed. Requires
// reworking many of the callers to use callbacks rather than
// assuming instant success.
// Add the category to the internal representation
LL_WARNS() << "D567 need to remove this usage" << LL_ENDL;
id.generate();
LLPointer<LLViewerInventoryCategory> cat =
new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID());
cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL - 1); // accountForUpdate() will icrease version by 1

View File

@ -267,6 +267,7 @@ public:
void getDirectDescendentsOf(const LLUUID& cat_id,
cat_array_t*& categories,
item_array_t*& items) const;
void getDirectDescendentsOf(const LLUUID& cat_id, cat_array_t& categories, item_array_t& items, LLInventoryCollectFunctor& f) const;
// Compute a hash of direct descendant names (for detecting child name changes)
LLMD5 hashDirectDescendentNames(const LLUUID& cat_id) const;

View File

@ -40,6 +40,7 @@
#include "llfolderviewitem.h"
#include "llfloaterimcontainer.h"
#include "llimview.h"
#include "llinspecttexture.h"
#include "llinventorybridge.h"
#include "llinventoryfunctions.h"
#include "llinventorymodelbackgroundfetch.h"
@ -175,7 +176,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
if (!sColorSetInitialized)
{
// <FS:Ansariel> Make inventory selection color independent from menu color
//sDefaultColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
//sDefaultColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
//sDefaultHighlightColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
sDefaultColor = LLUIColorTable::instance().getColor("InventoryItemEnabledColor", DEFAULT_WHITE);
sDefaultHighlightColor = LLUIColorTable::instance().getColor("InventoryItemHighlightFgColor", DEFAULT_WHITE);
@ -1377,6 +1378,29 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask)
return TRUE;
}
BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask)
{
if (const LLFolderViewItem* hover_item_p = (!mFolderRoot.isDead()) ? mFolderRoot.get()->getHoveredItem() : nullptr)
{
if (const LLFolderViewModelItemInventory* vm_item_p = static_cast<const LLFolderViewModelItemInventory*>(hover_item_p->getViewModelItem()))
{
LLSD params;
params["inv_type"] = vm_item_p->getInventoryType();
params["thumbnail_id"] = vm_item_p->getThumbnailUUID();
params["item_id"] = vm_item_p->getUUID();
LLToolTipMgr::instance().show(LLToolTip::Params()
.message(hover_item_p->getToolTip())
.sticky_rect(hover_item_p->calcScreenRect())
.delay_time(LLView::getTooltipTimeout())
.create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1))
.create_params(params));
return TRUE;
}
}
return LLPanel::handleToolTip(x, y, mask);
}
BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,

View File

@ -159,22 +159,23 @@ public:
LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; }
// LLView methods
/*virtual*/ void onVisibilityChange(BOOL new_visibility);
void draw();
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask );
BOOL handleHover(S32 x, S32 y, MASK mask);
/*virtual*/ void onVisibilityChange(BOOL new_visibility) override;
void draw() override;
/*virtual*/ BOOL handleKeyHere( KEY key, MASK mask ) override;
BOOL handleHover(S32 x, S32 y, MASK mask) override;
/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
std::string& tooltip_msg);
std::string& tooltip_msg) override;
BOOL handleToolTip(S32 x, S32 y, MASK mask) override;
// LLUICtrl methods
/*virtual*/ void onFocusLost();
/*virtual*/ void onFocusReceived();
/*virtual*/ void onFocusLost() override;
/*virtual*/ void onFocusReceived() override;
void onFolderOpening(const LLUUID &id);
// LLBadgeHolder methods
bool addBadge(LLBadge * badge);
bool addBadge(LLBadge * badge) override;
// Call this method to set the selection.
void openAllFolders();

View File

@ -128,6 +128,8 @@ LLPanelMainInventory::LLPanelMainInventory(const LLPanel::Params& p)
mMenuVisibility(NULL),
mMenuAddHandle(),
mNeedUploadCost(true),
mMenuViewDefault(NULL),
mViewMenuButton(nullptr), // <FS:Ansariel> Keep better inventory layout
mSearchTypeCombo(NULL) // <FS:Ansariel> Properly initialize this
{
// Menu Callbacks (non contex menus)
@ -348,6 +350,9 @@ BOOL LLPanelMainInventory::postBuild()
mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
mVisibilityMenuButton = getChild<LLMenuButton>("options_visibility_btn");
// <FS:Ansariel> Keep better inventory layout
//mViewMenuButton = getChild<LLMenuButton>("view_btn");
mViewMenuButton = findChild<LLMenuButton>("view_btn");
initListCommandsHandlers();
const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost());
@ -425,12 +430,12 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
gInventory.removeObserver(this);
delete mSavedFolderState;
auto menu = mMenuAddHandle.get();
if(menu)
{
menu->die();
mMenuAddHandle.markDead();
}
auto menu = mMenuAddHandle.get();
if(menu)
{
menu->die();
mMenuAddHandle.markDead();
}
}
LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel()
@ -1622,26 +1627,31 @@ void LLPanelMainInventory::showAllItemsPanel()
void LLPanelMainInventory::initListCommandsHandlers()
{
childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this)); // <FS:Ansariel> Keep better inventory layout
childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
// <FS:Ansariel> Keep better inventory layout
mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
, _4 // BOOL drop
, _5 // EDragAndDropType cargo_type
, _7 // EAcceptance* accept
));
// </FS:Ansariel>
mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mGearMenuButton->setMenu(mMenuGearDefault, LLMenuButton::MP_TOP_LEFT, true);
mMenuViewDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_view_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if (mViewMenuButton) // <FS:Ansariel> Keep better inventory layout
mViewMenuButton->setMenu(mMenuViewDefault);
LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mMenuAddHandle = menu->getHandle();
mMenuVisibility = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_search_visibility.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true);
mVisibilityMenuButton->setMenu(mMenuVisibility, LLMenuButton::MP_BOTTOM_LEFT, true);
// Update the trash button when selected item(s) get worn or taken off.
LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLPanelMainInventory::updateListCommands, this));
@ -1649,9 +1659,10 @@ void LLPanelMainInventory::initListCommandsHandlers()
void LLPanelMainInventory::updateListCommands()
{
// <FS:Ansariel> Keep better inventory layout
bool trash_enabled = isActionEnabled("delete");
mTrashButton->setEnabled(trash_enabled);
// </FS:Ansariel>
}
void LLPanelMainInventory::onAddButtonClick()
@ -1685,10 +1696,12 @@ void LLPanelMainInventory::showActionMenu(LLMenuGL* menu, std::string spawning_v
}
}
// <FS:Ansariel> Keep better inventory layout
void LLPanelMainInventory::onTrashButtonClick()
{
onClipboardAction("delete");
}
// </FS:Ansariel>
void LLPanelMainInventory::onClipboardAction(const LLSD& userdata)
{
@ -1841,6 +1854,11 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
LLFloaterReg::showInstance("linkreplace", params);
}
if (command_name == "toggle_search_outfits")
{
mActivePanel->getFilter().toggleSearchVisibilityOutfits();
}
if (command_name == "toggle_search_trash")
{
mActivePanel->getFilter().toggleSearchVisibilityTrash();
@ -2009,6 +2027,11 @@ BOOL LLPanelMainInventory::isActionChecked(const LLSD& userdata)
return sort_order_mask & LLInventoryFilter::SO_SYSTEM_FOLDERS_TO_TOP;
}
if (command_name == "toggle_search_outfits")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_OUTFITS) != 0;
}
if (command_name == "toggle_search_trash")
{
return (mActivePanel->getFilter().getSearchVisibilityTypes() & LLInventoryFilter::VISIBILITY_TRASH) != 0;
@ -2209,6 +2232,7 @@ BOOL LLPanelMainInventory::isSearchTypeChecked(const LLSD& userdata)
}
// </FS:Zi> Extended Inventory Search
// <FS:Ansariel> Keep better inventory layout
bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
{
*accept = ACCEPT_NO;
@ -2222,6 +2246,7 @@ bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType
}
return true;
}
// </FS:Ansariel>
void LLPanelMainInventory::setUploadCostIfNeeded()
{

View File

@ -189,7 +189,7 @@ protected:
void updateListCommands();
void onAddButtonClick();
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
void onTrashButtonClick();
void onTrashButtonClick(); // <FS:Ansariel> Keep better inventory layout
void onClipboardAction(const LLSD& userdata);
BOOL isActionEnabled(const LLSD& command_name);
BOOL isActionChecked(const LLSD& userdata);
@ -215,6 +215,7 @@ protected:
void onSearchTypeChecked(const LLSD& userdata);
// </FS:Zi> Extended Inventory Search
// <FS:Ansariel> Keep better inventory layout
bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
static bool hasSettingsInventory();
/**
@ -222,10 +223,12 @@ protected:
*/
void setUploadCostIfNeeded();
private:
LLDragAndDropButton* mTrashButton;
LLDragAndDropButton* mTrashButton; // <FS:Ansariel> Keep better inventory layout
LLToggleableMenu* mMenuGearDefault;
LLToggleableMenu* mMenuViewDefault;
LLToggleableMenu* mMenuVisibility;
LLMenuButton* mGearMenuButton;
LLMenuButton* mViewMenuButton;
LLMenuButton* mVisibilityMenuButton;
LLHandle<LLView> mMenuAddHandle;

View File

@ -78,9 +78,6 @@ BOOL LLPanelMarketplaceInbox::postBuild()
void LLPanelMarketplaceInbox::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action)
// </FS:Ansariel>
{
LLSidepanelInventory* sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
sidepanel_inventory->updateVerbs();
// <FS:Ansariel> FIRE-21948: Show element count in Received Items folder
mInventoryPanel->onSelectionChange(items, user_action);

View File

@ -71,6 +71,7 @@
#include "rlvhandler.h"
#include "rlvlocks.h"
// [/RLVa:KB]
#include "llfloaterproperties.h" // <FS:Ansariel> Keep legacy properties floater
const LLColor4U DEFAULT_WHITE(255, 255, 255);
#include "tea.h" // <FS:AW opensim currency support>
@ -122,6 +123,7 @@ public:
virtual PermissionMask getPermissionMask() const { return PERM_NONE; }
/*virtual*/ LLFolderType::EType getPreferredType() const { return LLFolderType::FT_NONE; }
virtual const LLUUID& getUUID() const { return mUUID; }
virtual const LLUUID& getThumbnailUUID() const { return LLUUID::null;}
virtual time_t getCreationDate() const;
virtual void setCreationDate(time_t creation_date_utc);
@ -1573,6 +1575,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
mInventoryNeedsUpdate = TRUE;
}
// <FS:Ansariel> Keep legacy properties floater
// refresh any properties floaters that are hanging around.
if(inventory)
{
@ -1587,6 +1590,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
}
}
}
// </FS:Ansariel>
}
void LLPanelObjectInventory::updateInventory()

View File

@ -71,6 +71,7 @@
#include "llpanelblockedlist.h"
#include "llpanelprofileclassifieds.h"
#include "llpanelprofilepicks.h"
#include "llthumbnailctrl.h"
#include "lltrans.h"
#include "llviewercontrol.h"
#include "llviewermenu.h" //is_agent_mappable
@ -954,7 +955,7 @@ BOOL LLPanelProfileSecondLife::postBuild()
mShowInSearchCheckbox = getChild<LLCheckBoxCtrl>("show_in_search");
// </FS:Ansariel>
// <FS:Zi> Allow proper texture swatch handling
// mSecondLifePic = getChild<LLIconCtrl>("2nd_life_pic");
// mSecondLifePic = getChild<LLThumbnailCtrl>("2nd_life_pic");
mSecondLifePic = getChild<LLTextureCtrl>("2nd_life_pic");
// <FS:Zi>
mSecondLifePicLayout = getChild<LLPanel>("image_panel");
@ -2700,7 +2701,7 @@ BOOL LLPanelProfileFirstLife::postBuild()
{
mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit");
// <FS:Zi> Allow proper texture swatch handling
// mPicture = getChild<LLIconCtrl>("real_world_pic");
// mPicture = getChild<LLThumbnailCtrl>("real_world_pic");
mPicture = getChild<LLTextureCtrl>("real_world_pic");
// </FS:Zi>

Some files were not shown because too many files have changed in this diff Show More