summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/llapp.cpp6
-rw-r--r--indra/llcommon/llbase64.cpp4
-rw-r--r--indra/llcommon/lldefs.h54
-rw-r--r--indra/llcommon/lldependencies.cpp2
-rw-r--r--indra/llcommon/lldependencies.h4
-rw-r--r--indra/llcommon/llerror.cpp2
-rw-r--r--indra/llcommon/lleventdispatcher.cpp24
-rw-r--r--indra/llcommon/llinstancetracker.h4
-rw-r--r--indra/llcommon/llkeybind.cpp12
-rw-r--r--indra/llcommon/llkeybind.h2
-rw-r--r--indra/llcommon/llmd5.cpp34
-rw-r--r--indra/llcommon/llmd5.h8
-rw-r--r--indra/llcommon/llmetricperformancetester.cpp4
-rw-r--r--indra/llcommon/llmetricperformancetester.h4
-rw-r--r--indra/llcommon/llmortician.cpp4
-rw-r--r--indra/llcommon/llmortician.h4
-rw-r--r--indra/llcommon/llqueuedthread.cpp17
-rw-r--r--indra/llcommon/llqueuedthread.h10
-rw-r--r--indra/llcommon/llrun.cpp2
-rw-r--r--indra/llcommon/llrun.h2
-rw-r--r--indra/llcommon/llsd.cpp98
-rw-r--r--indra/llcommon/llsd.h12
-rw-r--r--indra/llcommon/llsdserialize.cpp20
-rw-r--r--indra/llcommon/llsdserialize.h14
-rw-r--r--indra/llcommon/llsdserialize_xml.cpp4
-rw-r--r--indra/llcommon/llstreamtools.cpp24
-rw-r--r--indra/llcommon/llstring.cpp10
-rw-r--r--indra/llcommon/llstring.h2
-rw-r--r--indra/llcommon/llsys.cpp12
-rw-r--r--indra/llcommon/llsys.h2
-rw-r--r--indra/llcommon/llsys_objc.mm4
-rw-r--r--indra/llcommon/llthreadsafequeue.h6
-rw-r--r--indra/llcommon/lltimer.cpp2
-rw-r--r--indra/llcommon/lltrace.cpp2
-rw-r--r--indra/llcommon/lltrace.h4
-rw-r--r--indra/llcommon/lltraceaccumulators.cpp4
-rw-r--r--indra/llcommon/lltracerecording.cpp64
-rw-r--r--indra/llcommon/lltracerecording.h100
-rw-r--r--indra/llcommon/lltracethreadrecorder.cpp2
-rw-r--r--indra/llcommon/lltracethreadrecorder.h2
-rw-r--r--indra/llcommon/llunittype.h8
-rw-r--r--indra/llcommon/llworkerthread.cpp4
-rw-r--r--indra/llcommon/llworkerthread.h2
-rw-r--r--indra/llcommon/threadsafeschedule.h2
44 files changed, 300 insertions, 307 deletions
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index 8ddd132793..c658075a31 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -905,14 +905,14 @@ bool unix_post_minidump_callback(const char *dump_dir,
// heap allocations in a crash handler.
// path format: <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;
diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp
index 4e82cf7f20..85f22969b8 100644
--- a/indra/llcommon/llbase64.cpp
+++ b/indra/llcommon/llbase64.cpp
@@ -42,7 +42,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
&& input_size > 0)
{
// Yes, it returns int.
- int b64_buffer_length = apr_base64_encode_len(input_size);
+ int b64_buffer_length = apr_base64_encode_len(int(input_size));
char* b64_buffer = new char[b64_buffer_length];
// This is faster than apr_base64_encode() if you know
@@ -52,7 +52,7 @@ std::string LLBase64::encode(const U8* input, size_t input_size)
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
input,
- input_size);
+ int(input_size));
output.assign(b64_buffer);
delete[] b64_buffer;
}
diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h
index 5a4b8325f4..d9b0cbf71b 100644
--- a/indra/llcommon/lldefs.h
+++ b/indra/llcommon/lldefs.h
@@ -28,6 +28,7 @@
#define LL_LLDEFS_H
#include "stdtypes.h"
+#include <type_traits>
// Often used array indices
const U32 VX = 0;
@@ -168,50 +169,51 @@ const U32 MAXADDRSTR = 17; // 123.567.901.345 = 15 chars + \0 + 1 for good luc
// llclampb(a) // clamps a to [0 .. 255]
//
-template <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 typename std::common_type<A, MIN, MAX>::type
+llclamp(A a, MIN minval, MAX maxval)
{
if ( a < minval )
{
@@ -225,23 +227,21 @@ inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const L
}
template <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
diff --git a/indra/llcommon/lldependencies.cpp b/indra/llcommon/lldependencies.cpp
index 0d5757effd..db546c5c3b 100644
--- a/indra/llcommon/lldependencies.cpp
+++ b/indra/llcommon/lldependencies.cpp
@@ -42,7 +42,7 @@
// other Linden headers
#include "llexception.h"
-LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const
+LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(size_t vertices, const EdgeList& edges) const
{
// Construct a Boost Graph Library graph according to the constraints
// we've collected. It seems as though we ought to be able to capture
diff --git a/indra/llcommon/lldependencies.h b/indra/llcommon/lldependencies.h
index db2bbab8b0..950af4a4ad 100644
--- a/indra/llcommon/lldependencies.h
+++ b/indra/llcommon/lldependencies.h
@@ -126,7 +126,7 @@ public:
protected:
typedef std::vector< std::pair<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();
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 919d2dabc4..519426e9d1 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1514,7 +1514,7 @@ namespace LLError
const size_t BUF_SIZE = 64;
char time_str[BUF_SIZE]; /* Flawfinder: ignore */
- int chars = strftime(time_str, BUF_SIZE,
+ auto chars = strftime(time_str, BUF_SIZE,
"%Y-%m-%dT%H:%M:%SZ",
gmtime(&now));
diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp
index 5b6d4efbe9..cd0ab6bc29 100644
--- a/indra/llcommon/lleventdispatcher.cpp
+++ b/indra/llcommon/lleventdispatcher.cpp
@@ -178,7 +178,7 @@ private:
// store it as a map from name string to position index. Of course that's
// easy to generate from the incoming names array, but why do it more than
// once?
- typedef std::map<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());
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 02535a59e7..34f2a5985a 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -99,7 +99,7 @@ public:
return mSelf;
}
- static S32 instanceCount()
+ static size_t instanceCount()
{
return LockStatic()->mMap.size();
}
@@ -363,7 +363,7 @@ public:
return mSelf;
}
- static S32 instanceCount()
+ static size_t instanceCount()
{
return LockStatic()->mSet.size();
}
diff --git a/indra/llcommon/llkeybind.cpp b/indra/llcommon/llkeybind.cpp
index 38696c2258..f47ba41bae 100644
--- a/indra/llcommon/llkeybind.cpp
+++ b/indra/llcommon/llkeybind.cpp
@@ -180,10 +180,10 @@ LLKeyBind::LLKeyBind(const LLSD &key_bind)
bool LLKeyBind::operator==(const LLKeyBind& rhs)
{
- U32 size = mData.size();
+ auto size = mData.size();
if (size != rhs.mData.size()) return false;
- for (U32 i = 0; i < size; i++)
+ for (size_t i = 0; i < size; i++)
{
if (mData[i] != rhs.mData[i]) return false;
}
@@ -193,7 +193,7 @@ bool LLKeyBind::operator==(const LLKeyBind& rhs)
bool LLKeyBind::operator!=(const LLKeyBind& rhs)
{
- U32 size = mData.size();
+ auto size = mData.size();
if (size != rhs.mData.size()) return true;
for (U32 i = 0; i < size; i++)
@@ -215,7 +215,7 @@ bool LLKeyBind::isEmpty() const
LLSD LLKeyBind::asLLSD() const
{
- S32 last = mData.size() - 1;
+ auto last = mData.size() - 1;
while (mData[last].empty())
{
last--;
@@ -380,7 +380,7 @@ void LLKeyBind::resetKeyData(S32 index)
void LLKeyBind::trimEmpty()
{
- S32 last = mData.size() - 1;
+ auto last = mData.size() - 1;
while (last >= 0 && mData[last].empty())
{
mData.erase(mData.begin() + last);
@@ -388,7 +388,7 @@ void LLKeyBind::trimEmpty()
}
}
-U32 LLKeyBind::getDataCount()
+size_t LLKeyBind::getDataCount()
{
return mData.size();
}
diff --git a/indra/llcommon/llkeybind.h b/indra/llcommon/llkeybind.h
index c6b4bd970f..f63ad1d64e 100644
--- a/indra/llcommon/llkeybind.h
+++ b/indra/llcommon/llkeybind.h
@@ -95,7 +95,7 @@ public:
void clear() { mData.clear(); }
// if there any empty LLKeyData in the end of the array, remove them
void trimEmpty();
- U32 getDataCount();
+ size_t getDataCount();
private:
typedef std::vector<LLKeyData> data_vector_t;
diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp
index f942a976b7..9b2a2bab60 100644
--- a/indra/llcommon/llmd5.cpp
+++ b/indra/llcommon/llmd5.cpp
@@ -96,10 +96,10 @@ LLMD5::LLMD5()
// operation, processing another message block, and updating the
// context.
-void LLMD5::update (const uint1 *input, const uint4 input_length) {
+void LLMD5::update (const uint1 *input, const size_t input_length) {
- uint4 input_index, buffer_index;
- uint4 buffer_space; // how much space is left in buffer
+ size_t input_index, buffer_index;
+ size_t buffer_space; // how much space is left in buffer
if (finalized){ // so we can't update!
std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
@@ -107,14 +107,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
}
// Compute number of bytes mod 64
- buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
+ buffer_index = size_t((count >> 3) & 0x3F);
// Update number of bits
- if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
- count[1]++;
-
- count[1] += ((uint4)input_length >> 29);
-
+ count += input_length << 3;
buffer_space = 64 - buffer_index; // how much space is left in buffer
@@ -192,7 +188,7 @@ void LLMD5::update(const std::string& s)
void LLMD5::finalize (){
unsigned char bits[8]; /* Flawfinder: ignore */
- unsigned int index, padLen;
+ size_t index, padLen;
static uint1 PADDING[64]={
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -204,11 +200,12 @@ void LLMD5::finalize (){
return;
}
- // Save number of bits
- encode (bits, count, 8);
+ // Save number of bits.
+ // Treat count, a uint64_t, as uint4[2].
+ encode (bits, reinterpret_cast<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) |
diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h
index 1526e6ac3c..8530dc0389 100644
--- a/indra/llcommon/llmd5.h
+++ b/indra/llcommon/llmd5.h
@@ -86,7 +86,7 @@ class LL_COMMON_API LLMD5 {
public:
// methods for controlled operation:
LLMD5 (); // simple initializer
- void update (const uint1 *input, const uint4 input_length);
+ void update (const uint1 *input, const size_t input_length);
void update (std::istream& stream);
void update (FILE *file);
void update (const std::string& str);
@@ -110,7 +110,7 @@ private:
// next, the private data:
uint4 state[4];
- uint4 count[2]; // number of *bits*, mod 2^64
+ uint64_t count; // number of *bits*, mod 2^64
uint1 buffer[64]; // input buffer
uint1 digest[16];
uint1 finalized;
@@ -120,8 +120,8 @@ private:
void transform (const uint1 *buffer); // does the real update work. Note
// that length is implied to be 64.
- static void encode (uint1 *dest, const uint4 *src, const uint4 length);
- static void decode (uint4 *dest, const uint1 *src, const uint4 length);
+ static void encode (uint1 *dest, const uint4 *src, const size_t length);
+ static void decode (uint4 *dest, const uint1 *src, const size_t length);
};
diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp
index 100eb57555..864ecf650b 100644
--- a/indra/llcommon/llmetricperformancetester.cpp
+++ b/indra/llcommon/llmetricperformancetester.cpp
@@ -111,8 +111,8 @@ LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& i
{
ret[label]["Name"] = iter->second["Name"] ;
- S32 num_of_metrics = tester->getNumberOfMetrics() ;
- for(S32 index = 0 ; index < num_of_metrics ; index++)
+ auto num_of_metrics = tester->getNumberOfMetrics() ;
+ for(size_t index = 0 ; index < num_of_metrics ; index++)
{
ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ;
}
diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h
index 2e99ed979d..6561a78f03 100644
--- a/indra/llcommon/llmetricperformancetester.h
+++ b/indra/llcommon/llmetricperformancetester.h
@@ -67,12 +67,12 @@ public:
/**
* @return Returns the number of the test metrics in this tester instance.
*/
- S32 getNumberOfMetrics() const { return mMetricStrings.size() ;}
+ auto getNumberOfMetrics() const { return mMetricStrings.size() ;}
/**
* @return Returns the metric name at index
* @param[in] index - Index on the list of metrics managed by this tester instance.
*/
- std::string getMetricName(S32 index) const { return mMetricStrings[index] ;}
+ std::string getMetricName(size_t index) const { return mMetricStrings[index] ;}
protected:
/**
diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp
index 93c7d520f2..b6ad40c2af 100644
--- a/indra/llcommon/llmortician.cpp
+++ b/indra/llcommon/llmortician.cpp
@@ -37,9 +37,9 @@ LLMortician::~LLMortician()
sGraveyard.remove(this);
}
-U32 LLMortician::logClass(std::stringstream &str)
+size_t LLMortician::logClass(std::stringstream &str)
{
- U32 size = sGraveyard.size();
+ auto size = sGraveyard.size();
str << "Mortician graveyard count: " << size;
str << " Zealous: " << (sDestroyImmediate ? "True" : "False");
if (size == 0)
diff --git a/indra/llcommon/llmortician.h b/indra/llcommon/llmortician.h
index 41cb49fab1..f92c5a11db 100644
--- a/indra/llcommon/llmortician.h
+++ b/indra/llcommon/llmortician.h
@@ -34,8 +34,8 @@ class LL_COMMON_API LLMortician
{
public:
LLMortician() { mIsDead = FALSE; }
- static U32 graveyardCount() { return sGraveyard.size(); };
- static U32 logClass(std::stringstream &str);
+ static auto graveyardCount() { return sGraveyard.size(); };
+ static size_t logClass(std::stringstream &str);
static void updateClass();
virtual ~LLMortician();
void die();
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp
index 8cef4293cd..b06fee0ec2 100644
--- a/indra/llcommon/llqueuedthread.cpp
+++ b/indra/llcommon/llqueuedthread.cpp
@@ -110,7 +110,7 @@ void LLQueuedThread::shutdown()
// MAIN THREAD
// virtual
-S32 LLQueuedThread::update(F32 max_time_ms)
+size_t LLQueuedThread::update(F32 max_time_ms)
{
if (!mStarted)
{
@@ -123,11 +123,11 @@ S32 LLQueuedThread::update(F32 max_time_ms)
return updateQueue(max_time_ms);
}
-S32 LLQueuedThread::updateQueue(F32 max_time_ms)
+size_t LLQueuedThread::updateQueue(F32 max_time_ms)
{
F64 max_time = (F64)max_time_ms * .001;
LLTimer timer;
- S32 pending = 1;
+ size_t pending = 1;
// Frame Update
if (mThreaded)
@@ -164,9 +164,9 @@ void LLQueuedThread::incQueue()
//virtual
// May be called from any thread
-S32 LLQueuedThread::getPending()
+size_t LLQueuedThread::getPending()
{
- S32 res;
+ size_t res;
lockData();
res = mRequestQueue.size();
unlockData();
@@ -399,7 +399,7 @@ bool LLQueuedThread::check()
//============================================================================
// Runs on its OWN thread
-S32 LLQueuedThread::processNextRequest()
+size_t LLQueuedThread::processNextRequest()
{
QueuedRequest *req;
// Get next request from pool
@@ -473,8 +473,7 @@ S32 LLQueuedThread::processNextRequest()
LLTrace::get_thread_recorder()->pushToParent();
}
- S32 pending = getPending();
- return pending;
+ return getPending();
}
// virtual
@@ -511,7 +510,7 @@ void LLQueuedThread::run()
threadedUpdate();
- int pending_work = processNextRequest();
+ auto pending_work = processNextRequest();
if (pending_work == 0)
{
diff --git a/indra/llcommon/llqueuedthread.h b/indra/llcommon/llqueuedthread.h
index 5d3f873646..90fce3dc5d 100644
--- a/indra/llcommon/llqueuedthread.h
+++ b/indra/llcommon/llqueuedthread.h
@@ -167,19 +167,19 @@ private:
protected:
handle_t generateHandle();
bool addRequest(QueuedRequest* req);
- S32 processNextRequest(void);
+ size_t processNextRequest(void);
void incQueue();
public:
bool waitForResult(handle_t handle, bool auto_complete = true);
- virtual S32 update(F32 max_time_ms);
- S32 updateQueue(F32 max_time_ms);
-
+ virtual size_t update(F32 max_time_ms);
+ size_t updateQueue(F32 max_time_ms);
+
void waitOnPending();
void printQueueStats();
- virtual S32 getPending();
+ virtual size_t getPending();
bool getThreaded() { return mThreaded ? true : false; }
// Request accessors
diff --git a/indra/llcommon/llrun.cpp b/indra/llcommon/llrun.cpp
index f5d3f302fa..a3b3fccf4b 100644
--- a/indra/llcommon/llrun.cpp
+++ b/indra/llcommon/llrun.cpp
@@ -47,7 +47,7 @@ LLRunner::~LLRunner()
mRunEvery.clear();
}
-S32 LLRunner::run()
+size_t LLRunner::run()
{
// We collect all of the runnables which should be run. Since the
// runnables are allowed to adjust the run list, we need to copy
diff --git a/indra/llcommon/llrun.h b/indra/llcommon/llrun.h
index a117405366..d610f86234 100644
--- a/indra/llcommon/llrun.h
+++ b/indra/llcommon/llrun.h
@@ -85,7 +85,7 @@ public:
*
* @return Returns the number of runnables run.
*/
- S32 run();
+ size_t run();
/**
* @brief Add a runnable to the run list.
diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 807b3d13f8..8772178b05 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -136,10 +136,10 @@ public:
virtual void erase(const String&) { }
virtual const LLSD& ref(const String&) const{ return undef(); }
- virtual int size() const { return 0; }
- virtual LLSD get(Integer) const { return LLSD(); }
- virtual void erase(Integer) { }
- virtual const LLSD& ref(Integer) const { return undef(); }
+ virtual size_t size() const { return 0; }
+ virtual LLSD get(size_t) const { return LLSD(); }
+ virtual void erase(size_t) { }
+ virtual const LLSD& ref(size_t) const { return undef(); }
virtual LLSD::map_const_iterator beginMap() const { return endMap(); }
virtual LLSD::map_const_iterator endMap() const { static const std::map<String, LLSD> empty; return empty.end(); }
@@ -272,7 +272,7 @@ namespace
virtual LLSD::UUID asUUID() const { return LLUUID(mValue); }
virtual LLSD::Date asDate() const { return LLDate(mValue); }
virtual LLSD::URI asURI() const { return LLURI(mValue); }
- virtual int size() const { return mValue.size(); }
+ virtual size_t size() const { return mValue.size(); }
virtual const LLSD::String& asStringRef() const { return mValue; }
};
@@ -377,9 +377,9 @@ namespace
virtual bool has(const LLSD::String&) const;
- using LLSD::Impl::get; // Unhiding get(LLSD::Integer)
- using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
- using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
+ using LLSD::Impl::get; // Unhiding get(size_t)
+ using LLSD::Impl::erase; // Unhiding erase(size_t)
+ using LLSD::Impl::ref; // Unhiding ref(size_t)
virtual LLSD get(const LLSD::String&) const;
virtual LLSD getKeys() const;
void insert(const LLSD::String& k, const LLSD& v);
@@ -387,7 +387,7 @@ namespace
LLSD& ref(const LLSD::String&);
virtual const LLSD& ref(const LLSD::String&) const;
- virtual int size() const { return mData.size(); }
+ virtual size_t size() const { return mData.size(); }
LLSD::map_iterator beginMap() { return mData.begin(); }
LLSD::map_iterator endMap() { return mData.end(); }
@@ -518,14 +518,14 @@ namespace
using LLSD::Impl::get; // Unhiding get(LLSD::String)
using LLSD::Impl::erase; // Unhiding erase(LLSD::String)
using LLSD::Impl::ref; // Unhiding ref(LLSD::String)
- virtual int size() const;
- virtual LLSD get(LLSD::Integer) const;
- void set(LLSD::Integer, const LLSD&);
- void insert(LLSD::Integer, const LLSD&);
+ virtual size_t size() const;
+ virtual LLSD get(size_t) const;
+ void set(size_t, const LLSD&);
+ void insert(size_t, const LLSD&);
LLSD& append(const LLSD&);
- virtual void erase(LLSD::Integer);
- LLSD& ref(LLSD::Integer);
- virtual const LLSD& ref(LLSD::Integer) const;
+ virtual void erase(size_t);
+ LLSD& ref(size_t);
+ virtual const LLSD& ref(size_t) const;
LLSD::array_iterator beginArray() { return mData.begin(); }
LLSD::array_iterator endArray() { return mData.end(); }
@@ -550,85 +550,77 @@ namespace
return *this;
}
}
-
- int ImplArray::size() const { return mData.size(); }
-
- LLSD ImplArray::get(LLSD::Integer i) const
+
+ size_t ImplArray::size() const { return mData.size(); }
+
+ LLSD ImplArray::get(size_t i) const
{
- if (i < 0) { return LLSD(); }
DataVector::size_type index = i;
-
+
return (index < mData.size()) ? mData[index] : LLSD();
}
-
- void ImplArray::set(LLSD::Integer i, const LLSD& v)
+
+ void ImplArray::set(size_t i, const LLSD& v)
{
- if (i < 0) { return; }
DataVector::size_type index = i;
-
+
if (index >= mData.size())
{
mData.resize(index + 1);
}
-
+
mData[index] = v;
}
-
- void ImplArray::insert(LLSD::Integer i, const LLSD& v)
+
+ void ImplArray::insert(size_t i, const LLSD& v)
{
- if (i < 0)
- {
- return;
- }
DataVector::size_type index = i;
-
+
if (index >= mData.size()) // tbd - sanity check limit for index ?
{
mData.resize(index + 1);
}
-
+
mData.insert(mData.begin() + index, v);
}
-
+
LLSD& ImplArray::append(const LLSD& v)
{
mData.push_back(v);
return mData.back();
}
-
- void ImplArray::erase(LLSD::Integer i)
+
+ void ImplArray::erase(size_t i)
{
- if (i < 0) { return; }
DataVector::size_type index = i;
-
+
if (index < mData.size())
{
mData.erase(mData.begin() + index);
}
}
-
- LLSD& ImplArray::ref(LLSD::Integer i)
+
+ LLSD& ImplArray::ref(size_t i)
{
- DataVector::size_type index = i >= 0 ? i : 0;
-
+ DataVector::size_type index = i;
+
if (index >= mData.size())
{
mData.resize(i + 1);
}
-
+
return mData[index];
}
- const LLSD& ImplArray::ref(LLSD::Integer i) const
+ const LLSD& ImplArray::ref(size_t i) const
{
- if (i < 0) { return undef(); }
DataVector::size_type index = i;
-
+
if (index >= mData.size())
{
return undef();
}
-
+
return mData[index];
}
@@ -912,7 +904,7 @@ LLSD LLSD::emptyArray()
return v;
}
-int LLSD::size() const { return safe(impl).size(); }
+size_t LLSD::size() const { return safe(impl).size(); }
LLSD LLSD::get(Integer i) const { return safe(impl).get(i); }
void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
@@ -926,12 +918,12 @@ LLSD& LLSD::with(Integer i, const LLSD& v)
LLSD& LLSD::append(const LLSD& v) { return makeArray(impl).append(v); }
void LLSD::erase(Integer i) { makeArray(impl).erase(i); }
-LLSD& LLSD::operator[](Integer i)
+LLSD& LLSD::operator[](size_t i)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
return makeArray(impl).ref(i);
}
-const LLSD& LLSD::operator[](Integer i) const
+const LLSD& LLSD::operator[](size_t i) const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD;
return safe(impl).ref(i);
@@ -956,7 +948,7 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat)
out << LLSDNotationStreamer(llsd);
out_string = out.str();
}
- int len = out_string.length();
+ auto len = out_string.length();
sStorage = new char[len + 1];
memcpy(sStorage, out_string.c_str(), len);
sStorage[len] = '\0';
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 24cb9bbce1..f034470da7 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -313,14 +313,18 @@ public:
LLSD& append(const LLSD&);
void erase(Integer);
LLSD& with(Integer, const LLSD&);
-
- const LLSD& operator[](Integer) const;
- LLSD& operator[](Integer);
+
+ // accept size_t so we can index relative to size()
+ const LLSD& operator[](size_t) const;
+ LLSD& operator[](size_t);
+ // overload to disambiguate [0], [1] et al.
+ const LLSD& operator[](Integer i) const { return (*this)[size_t(i)]; }
+ LLSD& operator[](Integer i) { return (*this)[size_t(i)]; }
//@}
/** @name Iterators */
//@{
- int size() const;
+ size_t size() const;
typedef std::map<String, LLSD>::iterator map_iterator;
typedef std::map<String, LLSD>::const_iterator map_const_iterator;
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 8b4a0ee6d8..666da717b2 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -99,7 +99,7 @@ void LLSDSerialize::serialize(const LLSD& sd, std::ostream& str, ELLSD_Serialize
}
// static
-bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes)
+bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, size_t max_bytes)
{
LLPointer<LLSDParser> p = NULL;
char hdr_buf[MAX_HDR_LEN + 1] = ""; /* Flawfinder: ignore */
@@ -252,7 +252,7 @@ F64 ll_ntohd(F64 netdouble)
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
-int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes);
+int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes);
/**
* @brief Parse a delimited string.
@@ -280,7 +280,7 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d);
int deserialize_string_raw(
std::istream& istr,
std::string& value,
- S32 max_bytes);
+ size_t max_bytes);
/**
* @brief helper method for dealing with the different notation boolean format.
@@ -329,7 +329,7 @@ LLSDParser::LLSDParser()
LLSDParser::~LLSDParser()
{ }
-S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth)
+S32 LLSDParser::parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth)
{
mCheckLimits = (LLSDSerialize::SIZE_UNLIMITED == max_bytes) ? false : true;
mMaxBytesLeft = max_bytes;
@@ -803,7 +803,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
{
// We probably have a valid raw binary stream. determine
// the size, and read it.
- S32 len = strtol(buf + 2, NULL, 0);
+ auto len = strtol(buf + 2, NULL, 0);
if(mCheckLimits && (len > mMaxBytesLeft)) return false;
std::vector<U8> value;
if(len)
@@ -1592,7 +1592,7 @@ void LLSDBinaryFormatter::formatString(
/**
* local functions
*/
-int deserialize_string(std::istream& istr, std::string& value, S32 max_bytes)
+int deserialize_string(std::istream& istr, std::string& value, size_t max_bytes)
{
int c = istr.get();
if(istr.fail())
@@ -1728,7 +1728,7 @@ int deserialize_string_delim(
int deserialize_string_raw(
std::istream& istr,
std::string& value,
- S32 max_bytes)
+ size_t max_bytes)
{
int count = 0;
const S32 BUF_LEN = 20;
@@ -1743,7 +1743,7 @@ int deserialize_string_raw(
// We probably have a valid raw string. determine
// the size, and read it.
// *FIX: This is memory inefficient.
- S32 len = strtol(buf + 1, NULL, 0);
+ auto len = strtol(buf + 1, NULL, 0);
if((max_bytes>0)&&(len>max_bytes)) return LLSDParser::PARSE_FAILURE;
std::vector<char> buf;
if(len)
@@ -2110,7 +2110,7 @@ std::string zip_llsd(LLSD& data)
U8 out[CHUNK];
- strm.avail_in = source.size();
+ strm.avail_in = uint32_t(source.size());
strm.next_in = (U8*) source.data();
U8* output = NULL;
@@ -2173,7 +2173,7 @@ std::string zip_llsd(LLSD& data)
LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is, S32 size)
{
U8* result = NULL;
- U32 cur_size = 0;
+ size_t cur_size = 0;
z_stream strm;
const U32 CHUNK = 65536;
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index d6079fd9fa..86d34cde9a 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -77,7 +77,7 @@ public:
* @return Returns the number of LLSD objects parsed into
* data. Returns PARSE_FAILURE (-1) on parse failure.
*/
- S32 parse(std::istream& istr, LLSD& data, S32 max_bytes, S32 max_depth = -1);
+ S32 parse(std::istream& istr, LLSD& data, size_t max_bytes, S32 max_depth = -1);
/** Like parse(), but uses a different call (istream.getline()) to read by lines
* This API is better suited for XML, where the parse cannot tell
@@ -205,7 +205,7 @@ protected:
/**
* @brief The maximum number of bytes left to be parsed.
*/
- mutable S32 mMaxBytesLeft;
+ mutable size_t mMaxBytesLeft;
/**
* @brief Use line-based reading to get text
@@ -756,7 +756,7 @@ public:
* @param max_bytes the maximum number of bytes to parse
* @return Returns true if the stream appears to contain valid data
*/
- static bool deserialize(LLSD& sd, std::istream& str, S32 max_bytes);
+ static bool deserialize(LLSD& sd, std::istream& str, size_t max_bytes);
/*
* Notation Methods
@@ -778,12 +778,12 @@ public:
LLSDFormatter::EFormatterOptions(LLSDFormatter::OPTIONS_PRETTY |
LLSDFormatter::OPTIONS_PRETTY_BINARY));
}
- static S32 fromNotation(LLSD& sd, std::istream& str, S32 max_bytes)
+ static S32 fromNotation(LLSD& sd, std::istream& str, size_t max_bytes)
{
LLPointer<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, size_t 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, size_t 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, size_t max_bytes, S32 max_depth = -1)
{
LLPointer<LLSDBinaryParser> p = new LLSDBinaryParser;
LLSD sd;
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index 0da824d694..f47c06a2dc 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -196,12 +196,12 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr,
// *FIX: memory inefficient.
// *TODO: convert to use LLBase64
ostr << pre << "<binary encoding=\"base64\">";
- int b64_buffer_length = apr_base64_encode_len(buffer.size());
+ int b64_buffer_length = apr_base64_encode_len(int(buffer.size()));
char* b64_buffer = new char[b64_buffer_length];
b64_buffer_length = apr_base64_encode_binary(
b64_buffer,
&buffer[0],
- buffer.size());
+ int(buffer.size()));
ostr.write(b64_buffer, b64_buffer_length - 1);
delete[] b64_buffer;
ostr << "</binary>" << post;
diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp
index d7a6f47932..1eccfda755 100644
--- a/indra/llcommon/llstreamtools.cpp
+++ b/indra/llcommon/llstreamtools.cpp
@@ -118,7 +118,7 @@ bool skip_to_next_word(std::istream& input_stream)
bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream)
{
- int key_length = strlen(keyword); /*Flawfinder: ignore*/
+ auto key_length = strlen(keyword); /*Flawfinder: ignore*/
if (0 == key_length)
{
return false;
@@ -315,7 +315,7 @@ bool unget_line(const std::string& line, std::istream& input_stream)
// returns true if removed last char
bool remove_last_char(char c, std::string& line)
{
- int line_size = line.size();
+ auto line_size = line.size();
if (line_size > 1
&& c == line[line_size - 1])
{
@@ -330,8 +330,8 @@ bool remove_last_char(char c, std::string& line)
// "\\n" ---> '\n' (backslash n becomes carriage return)
void unescape_string(std::string& line)
{
- int line_size = line.size();
- int index = 0;
+ auto line_size = line.size();
+ size_t index = 0;
while (index < line_size - 1)
{
if ('\\' == line[index])
@@ -356,8 +356,8 @@ void unescape_string(std::string& line)
// '\n' ---> "\\n" (carriage return becomes backslash n)
void escape_string(std::string& line)
{
- int line_size = line.size();
- int index = 0;
+ auto line_size = line.size();
+ size_t index = 0;
while (index < line_size)
{
if ('\\' == line[index])
@@ -379,8 +379,8 @@ void escape_string(std::string& line)
// removes '\n' characters
void replace_newlines_with_whitespace(std::string& line)
{
- int line_size = line.size();
- int index = 0;
+ auto line_size = line.size();
+ size_t index = 0;
while (index < line_size)
{
if ('\n' == line[index])
@@ -394,8 +394,8 @@ void replace_newlines_with_whitespace(std::string& line)
// erases any double-quote characters in 'line'
void remove_double_quotes(std::string& line)
{
- int index = 0;
- int line_size = line.size();
+ size_t index = 0;
+ auto line_size = line.size();
while (index < line_size)
{
if ('"' == line[index])
@@ -424,8 +424,8 @@ void get_keyword_and_value(std::string& keyword,
const std::string& line)
{
// skip initial whitespace
- int line_size = line.size();
- int line_index = 0;
+ auto line_size = line.size();
+ size_t line_index = 0;
char c;
while (line_index < line_size)
{
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 7f501f2e77..f6629803ee 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -141,7 +141,7 @@ std::string rawstr_to_utf8(const std::string& raw)
return wstring_to_utf8str(wstr);
}
-S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
+std::ptrdiff_t wchar_to_utf8chars(llwchar in_char, char* outchars)
{
U32 cur_char = (U32)in_char;
char* base = outchars;
@@ -192,7 +192,7 @@ S32 wchar_to_utf8chars(llwchar in_char, char* outchars)
return outchars - base;
}
-S32 utf16chars_to_wchar(const U16* inchars, llwchar* outchar)
+auto utf16chars_to_wchar(const U16* inchars, llwchar* outchar)
{
const U16* base = inchars;
U16 cur_char = *inchars++;
@@ -310,7 +310,7 @@ S32 wstring_utf16_length(const LLWString &wstr, const S32 woffset, const S32 wle
// and whose equivalent utf-16 string does not exceeds the given utf16_length.
S32 wstring_wstring_length_from_utf16_length(const LLWString & wstr, const S32 woffset, const S32 utf16_length, BOOL *unaligned)
{
- const S32 end = wstr.length();
+ const auto end = wstr.length();
BOOL u = FALSE;
S32 n = woffset + utf16_length;
S32 i = woffset;
@@ -426,7 +426,7 @@ LLWString utf8str_to_wstring(const char* utf8str, size_t len)
}
// Check that this character doesn't go past the end of the string
- S32 end = (len < (i + cont_bytes)) ? len : (i + cont_bytes);
+ auto end = (len < (i + cont_bytes)) ? len : (i + cont_bytes);
do
{
++i;
@@ -471,7 +471,7 @@ std::string wstring_to_utf8str(const llwchar* utf32str, size_t len)
while (i < len)
{
char tchars[8]; /* Flawfinder: ignore */
- S32 n = wchar_to_utf8chars(utf32str[i], tchars);
+ auto n = wchar_to_utf8chars(utf32str[i], tchars);
tchars[n] = 0;
out += tchars;
i++;
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index d94f549480..1fd6cac14a 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -664,7 +664,7 @@ ll_convert_forms(ll_convert_alias, LLWString, std::string, utf8str_to_
// Same function, better name. JC
inline LLWString utf8string_to_wstring(const std::string& utf8_string) { return utf8str_to_wstring(utf8_string); }
-LL_COMMON_API S32 wchar_to_utf8chars(llwchar inchar, char* outchars);
+LL_COMMON_API std::ptrdiff_t wchar_to_utf8chars(llwchar inchar, char* outchars);
ll_convert_forms(ll_convert_alias, std::string, LLWString, wstring_to_utf8str);
ll_convert_forms(ll_convert_u16_alias, std::string, llutf16string, utf16str_to_utf8str);
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index a8b5c7b3a8..1951ca6843 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -454,14 +454,14 @@ LLOSInfo::LLOSInfo() :
#ifndef LL_WINDOWS
// static
-S32 LLOSInfo::getMaxOpenFiles()
+long LLOSInfo::getMaxOpenFiles()
{
- const S32 OPEN_MAX_GUESS = 256;
+ const long OPEN_MAX_GUESS = 256;
#ifdef OPEN_MAX
- static S32 open_max = OPEN_MAX;
+ static long open_max = OPEN_MAX;
#else
- static S32 open_max = 0;
+ static long open_max = 0;
#endif
if (0 == open_max)
@@ -909,7 +909,7 @@ void LLMemoryInfo::stream(std::ostream& s) const
// Now stream stats
BOOST_FOREACH(const MapEntry& pair, inMap(mStatsMap))
{
- s << pfx << std::setw(key_width+1) << (pair.first + ':') << ' ';
+ s << pfx << std::setw(int(key_width+1)) << (pair.first + ':') << ' ';
LLSD value(pair.second);
if (value.isInteger())
s << std::setw(12) << value.asInteger();
@@ -1280,7 +1280,7 @@ public:
<< " seconds ";
}
- S32 precision = LL_CONT.precision();
+ auto precision = LL_CONT.precision();
LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n'
<< LLMemoryInfo();
diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index 5ffbf5a732..70a03810c5 100644
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -59,7 +59,7 @@ public:
S32 mBuild;
#ifndef LL_WINDOWS
- static S32 getMaxOpenFiles();
+ static long getMaxOpenFiles();
#endif
static bool is64Bit();
diff --git a/indra/llcommon/llsys_objc.mm b/indra/llcommon/llsys_objc.mm
index cdb1e320d5..9359503a19 100644
--- a/indra/llcommon/llsys_objc.mm
+++ b/indra/llcommon/llsys_objc.mm
@@ -27,12 +27,12 @@
#import "llsys_objc.h"
#import <AppKit/AppKit.h>
-static int intAtStringIndex(NSArray *array, int index)
+static NSInteger intAtStringIndex(NSArray *array, int index)
{
return [(NSString *)[array objectAtIndex:index] integerValue];
}
-bool LLGetDarwinOSInfo(int &major, int &minor, int &patch)
+bool LLGetDarwinOSInfo(NSInteger &major, NSInteger &minor, NSInteger &patch)
{
if (NSAppKitVersionNumber > NSAppKitVersionNumber10_8)
{
diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h
index 68d79cdd12..f396a71e6f 100644
--- a/indra/llcommon/llthreadsafequeue.h
+++ b/indra/llcommon/llthreadsafequeue.h
@@ -82,7 +82,7 @@ public:
// Limiting the number of pending items prevents unbounded growth of the
// underlying queue.
- LLThreadSafeQueue(U32 capacity = 1024);
+ LLThreadSafeQueue(size_t capacity = 1024);
virtual ~LLThreadSafeQueue() {}
// Add an element to the queue (will block if the queue has reached
@@ -179,7 +179,7 @@ public:
protected:
typedef QueueT queue_type;
QueueT mStorage;
- U32 mCapacity;
+ size_t mCapacity;
bool mClosed;
boost::fibers::timed_mutex mLock;
@@ -262,7 +262,7 @@ namespace LL
* LLThreadSafeQueue implementation
*****************************************************************************/
template<typename ElementT, typename QueueT>
-LLThreadSafeQueue<ElementT, QueueT>::LLThreadSafeQueue(U32 capacity) :
+LLThreadSafeQueue<ElementT, QueueT>::LLThreadSafeQueue(size_t capacity) :
mCapacity(capacity),
mClosed(false)
{
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index aaa6df325c..74ec62d347 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -123,7 +123,7 @@ U32 micro_sleep(U64 us, U32 max_yields)
// interrupts at 250 Hz (every 4,000 microseconds).
const U64 KERNEL_SLEEP_INTERVAL_US = 4000;
- S32 num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US;
+ auto num_sleep_intervals = (us - (KERNEL_SLEEP_INTERVAL_US >> 1)) / KERNEL_SLEEP_INTERVAL_US;
if (num_sleep_intervals > 0)
{
U64 sleep_time = (num_sleep_intervals * KERNEL_SLEEP_INTERVAL_US) - (KERNEL_SLEEP_INTERVAL_US >> 1);
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp
index f59b207ded..818eb0457b 100644
--- a/indra/llcommon/lltrace.cpp
+++ b/indra/llcommon/lltrace.cpp
@@ -65,7 +65,7 @@ void TimeBlockTreeNode::setParent( BlockTimerStatHandle* parent )
llassert_always(parent != mBlock);
llassert_always(parent != NULL);
- TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(parent->getIndex());
+ TimeBlockTreeNode* parent_tree_node = get_thread_recorder()->getTimeBlockTreeNode(S32(parent->getIndex()));
if (!parent_tree_node) return;
if (mParent)
diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h
index fcd8753f75..580cf0a5fd 100644
--- a/indra/llcommon/lltrace.h
+++ b/indra/llcommon/lltrace.h
@@ -340,7 +340,7 @@ inline void claim_alloc(MemStatHandle& measurement, const T& value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
#if LL_TRACE_ENABLED
- S32 size = MeasureMem<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);
@@ -353,7 +353,7 @@ inline void disclaim_alloc(MemStatHandle& measurement, const T& value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
#if LL_TRACE_ENABLED
- S32 size = MeasureMem<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);
diff --git a/indra/llcommon/lltraceaccumulators.cpp b/indra/llcommon/lltraceaccumulators.cpp
index 34299f5a29..84c1ccd9fe 100644
--- a/indra/llcommon/lltraceaccumulators.cpp
+++ b/indra/llcommon/lltraceaccumulators.cpp
@@ -96,9 +96,9 @@ void AccumulatorBufferGroup::makeCurrent()
ThreadRecorder* thread_recorder = get_thread_recorder().get();
AccumulatorBuffer<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(S32(i));
if (tree_node)
{
timer_accumulator_buffer[i].mParent = tree_node->mParent;
diff --git a/indra/llcommon/lltracerecording.cpp b/indra/llcommon/lltracerecording.cpp
index 1613af1dcf..1d31d7b9d0 100644
--- a/indra/llcommon/lltracerecording.cpp
+++ b/indra/llcommon/lltracerecording.cpp
@@ -606,7 +606,7 @@ void PeriodicRecording::nextPeriod()
mCurPeriod = (mCurPeriod + 1) % mRecordingPeriods.size();
old_recording.splitTo(getCurRecording());
- mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
+ mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + 1);
}
void PeriodicRecording::appendRecording(Recording& recording)
@@ -625,21 +625,21 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
getCurRecording().update();
other.getCurRecording().update();
- const S32 other_recording_slots = other.mRecordingPeriods.size();
- const S32 other_num_recordings = other.getNumRecordedPeriods();
- const S32 other_current_recording_index = other.mCurPeriod;
- const S32 other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots;
+ const auto other_recording_slots = other.mRecordingPeriods.size();
+ const auto other_num_recordings = other.getNumRecordedPeriods();
+ const auto other_current_recording_index = other.mCurPeriod;
+ const auto other_oldest_recording_index = (other_current_recording_index + other_recording_slots - other_num_recordings) % other_recording_slots;
// append first recording into our current slot
getCurRecording().appendRecording(other.mRecordingPeriods[other_oldest_recording_index]);
// from now on, add new recordings for everything after the first
- S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots;
+ auto other_index = (other_oldest_recording_index + 1) % other_recording_slots;
if (mAutoResize)
{
// push back recordings for everything in the middle
- S32 other_index = (other_oldest_recording_index + 1) % other_recording_slots;
+ auto other_index = (other_oldest_recording_index + 1) % other_recording_slots;
while (other_index != other_current_recording_index)
{
mRecordingPeriods.push_back(other.mRecordingPeriods[other_index]);
@@ -682,7 +682,7 @@ void PeriodicRecording::appendPeriodicRecording( PeriodicRecording& other )
llassert(num_to_copy >= 1);
// advance to last recording period copied, and make that our current period
mCurPeriod = (mCurPeriod + num_to_copy - 1) % mRecordingPeriods.size();
- mNumRecordedPeriods = llmin((S32)mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1);
+ mNumRecordedPeriods = llmin(mRecordingPeriods.size() - 1, mNumRecordedPeriods + num_to_copy - 1);
}
// end with fresh period, otherwise next appendPeriodicRecording() will merge the first
@@ -695,10 +695,10 @@ F64Seconds PeriodicRecording::getDuration() const
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
F64Seconds duration;
- S32 num_periods = mRecordingPeriods.size();
- for (S32 i = 1; i <= num_periods; i++)
+ auto num_periods = mRecordingPeriods.size();
+ for (size_t i = 1; i <= num_periods; i++)
{
- S32 index = (mCurPeriod + num_periods - i) % num_periods;
+ auto index = (mCurPeriod + num_periods - i) % num_periods;
duration += mRecordingPeriods[index].getDuration();
}
return duration;
@@ -734,16 +734,16 @@ const Recording& PeriodicRecording::getCurRecording() const
return mRecordingPeriods[mCurPeriod];
}
-Recording& PeriodicRecording::getPrevRecording( S32 offset )
+Recording& PeriodicRecording::getPrevRecording( size_t offset )
{
- S32 num_periods = mRecordingPeriods.size();
+ auto num_periods = mRecordingPeriods.size();
offset = llclamp(offset, 0, num_periods - 1);
return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
}
-const Recording& PeriodicRecording::getPrevRecording( S32 offset ) const
+const Recording& PeriodicRecording::getPrevRecording( size_t offset ) const
{
- S32 num_periods = mRecordingPeriods.size();
+ auto num_periods = mRecordingPeriods.size();
offset = llclamp(offset, 0, num_periods - 1);
return mRecordingPeriods[(mCurPeriod + num_periods - offset) % num_periods];
}
@@ -790,7 +790,7 @@ void PeriodicRecording::handleSplitTo(PeriodicRecording& other)
getCurRecording().splitTo(other.getCurRecording());
}
-F64 PeriodicRecording::getPeriodMin( const StatType<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 +812,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 +835,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 +858,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 +883,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 +905,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 +928,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 +951,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 +977,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 +1003,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 +1018,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 +1038,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 +1059,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 +1089,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);
}
diff --git a/indra/llcommon/lltracerecording.h b/indra/llcommon/lltracerecording.h
index 556b7470cf..8b56721f42 100644
--- a/indra/llcommon/lltracerecording.h
+++ b/indra/llcommon/lltracerecording.h
@@ -334,7 +334,7 @@ namespace LLTrace
~PeriodicRecording();
void nextPeriod();
- S32 getNumRecordedPeriods()
+ auto getNumRecordedPeriods()
{
// current period counts if not active
return mNumRecordedPeriods + (isStarted() ? 0 : 1);
@@ -348,24 +348,24 @@ namespace LLTrace
const Recording& getLastRecording() const;
Recording& getCurRecording();
const Recording& getCurRecording() const;
- Recording& getPrevRecording(S32 offset);
- const Recording& getPrevRecording(S32 offset) const;
+ Recording& getPrevRecording(size_t offset);
+ const Recording& getPrevRecording(size_t offset) const;
Recording snapshotCurRecording() const;
template <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();
diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp
index 090d3297a0..d10312e0ec 100644
--- a/indra/llcommon/lltracethreadrecorder.cpp
+++ b/indra/llcommon/lltracethreadrecorder.cpp
@@ -125,7 +125,7 @@ ThreadRecorder::~ThreadRecorder()
#endif
}
-TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index )
+TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( size_t index )
{
#if LL_TRACE_ENABLED
if (0 <= index && index < mNumTimeBlockTreeNodes)
diff --git a/indra/llcommon/lltracethreadrecorder.h b/indra/llcommon/lltracethreadrecorder.h
index a797c6687e..1294d4318f 100644
--- a/indra/llcommon/lltracethreadrecorder.h
+++ b/indra/llcommon/lltracethreadrecorder.h
@@ -58,7 +58,7 @@ namespace LLTrace
void pullFromChildren();
void pushToParent();
- TimeBlockTreeNode* getTimeBlockTreeNode(S32 index);
+ TimeBlockTreeNode* getTimeBlockTreeNode(size_t index);
protected:
void init();
diff --git a/indra/llcommon/llunittype.h b/indra/llcommon/llunittype.h
index 81f244e422..e283e8f79a 100644
--- a/indra/llcommon/llunittype.h
+++ b/indra/llcommon/llunittype.h
@@ -83,8 +83,10 @@ struct LLUnit
typedef void is_unit_t;
// value initialization
- LL_FORCE_INLINE explicit LLUnit(storage_t value = storage_t())
- : mValue(value)
+ // allow for convertible type
+ template <typename T=storage_t>
+ LL_FORCE_INLINE explicit LLUnit(T value = T())
+ : mValue(storage_t(value))
{}
@@ -124,7 +126,7 @@ struct LLUnit
// unit initialization and conversion
template<typename OTHER_STORAGE_TYPE, typename OTHER_UNITS>
LL_FORCE_INLINE LLUnit(LLUnit<OTHER_STORAGE_TYPE, OTHER_UNITS> other)
- : mValue(convert(other).mValue)
+ : mValue(storage_t(convert(other).mValue))
{}
LL_FORCE_INLINE storage_t value() const
diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp
index 4b91b2caca..97838e296e 100644
--- a/indra/llcommon/llworkerthread.cpp
+++ b/indra/llcommon/llworkerthread.cpp
@@ -81,9 +81,9 @@ void LLWorkerThread::clearDeleteList()
}
// virtual
-S32 LLWorkerThread::update(F32 max_time_ms)
+size_t LLWorkerThread::update(F32 max_time_ms)
{
- S32 res = LLQueuedThread::update(max_time_ms);
+ auto res = LLQueuedThread::update(max_time_ms);
// Delete scheduled workers
std::vector<LLWorkerClass*> delete_list;
std::vector<LLWorkerClass*> abort_list;
diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h
index 0387e75c65..e3004d7242 100644
--- a/indra/llcommon/llworkerthread.h
+++ b/indra/llcommon/llworkerthread.h
@@ -88,7 +88,7 @@ public:
LLWorkerThread(const std::string& name, bool threaded = true, bool should_pause = false);
~LLWorkerThread();
- /*virtual*/ S32 update(F32 max_time_ms);
+ /*virtual*/ size_t update(F32 max_time_ms);
handle_t addWorkRequest(LLWorkerClass* workerclass, S32 param, U32 priority = PRIORITY_NORMAL);
diff --git a/indra/llcommon/threadsafeschedule.h b/indra/llcommon/threadsafeschedule.h
index 3e0da94c02..2d82d6a15e 100644
--- a/indra/llcommon/threadsafeschedule.h
+++ b/indra/llcommon/threadsafeschedule.h
@@ -82,7 +82,7 @@ namespace LL
using TimePoint = ThreadSafeSchedulePrivate::TimePoint;
using Clock = TimePoint::clock;
- ThreadSafeSchedule(U32 capacity=1024):
+ ThreadSafeSchedule(size_t capacity=1024):
super(capacity)
{}