summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2022-12-06 14:40:11 -0500
committerNat Goodspeed <nat@lindenlab.com>2022-12-06 14:40:11 -0500
commitdb1d757aebc3dd23e542f7cd4f468dbcd97edcb7 (patch)
tree88993e020790e4bbbae5044b1f989a186fb86d73 /indra
parent73aced620fce59d98373cec6e830315bb6781546 (diff)
DRTVWR-575: Update a few more int lengths in llsdserialize.{h,cpp}.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llsdserialize.cpp70
-rw-r--r--indra/llcommon/llsdserialize.h6
-rw-r--r--indra/llcommon/llsdserialize_xml.cpp6
-rw-r--r--indra/newview/llpathfindingnavmesh.cpp2
4 files changed, 42 insertions, 42 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 08b3e52597..af57f4ac5e 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -50,7 +50,7 @@
#include "lluri.h"
// File constants
-static const int MAX_HDR_LEN = 20;
+static const size_t MAX_HDR_LEN = 20;
static const S32 UNZIP_LLSD_MAX_DEPTH = 96;
static const char LEGACY_NON_HEADER[] = "<llsd>";
const std::string LLSD_BINARY_HEADER("LLSD/Binary");
@@ -252,7 +252,7 @@ F64 ll_ntohd(F64 netdouble)
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
-int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes);
+llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes);
/**
* @brief Parse a delimited string.
@@ -263,7 +263,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
-int deserialize_string_delim(std::istream& istr, std::string& value, char d);
+llssize deserialize_string_delim(std::istream& istr, std::string& value, char d);
/**
* @brief Read a raw string off the stream.
@@ -277,7 +277,7 @@ int deserialize_string_delim(std::istream& istr, std::string& value, char d);
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
-int deserialize_string_raw(
+llssize deserialize_string_raw(
std::istream& istr,
std::string& value,
llssize max_bytes);
@@ -292,7 +292,7 @@ int deserialize_string_raw(
* @return Returns number of bytes read off of the stream. Returns
* PARSE_FAILURE (-1) on failure.
*/
-int deserialize_boolean(
+llssize deserialize_boolean(
std::istream& istr,
LLSD& data,
const std::string& compare,
@@ -359,7 +359,7 @@ std::istream& LLSDParser::get(
char delim) const
{
istr.get(s, n, delim);
- if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
+ if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
return istr;
}
@@ -369,7 +369,7 @@ std::istream& LLSDParser::get(
char delim) const
{
istr.get(sb, delim);
- if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
+ if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
return istr;
}
@@ -393,11 +393,11 @@ std::istream& LLSDParser::read(
std::streamsize n) const
{
istr.read(s, n);
- if(mCheckLimits) mMaxBytesLeft -= (int)istr.gcount();
+ if(mCheckLimits) mMaxBytesLeft -= istr.gcount();
return istr;
}
-void LLSDParser::account(S32 bytes) const
+void LLSDParser::account(llssize bytes) const
{
if(mCheckLimits) mMaxBytesLeft -= bytes;
}
@@ -502,7 +502,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
c = istr.peek();
if(isalpha(c))
{
- int cnt = deserialize_boolean(
+ auto cnt = deserialize_boolean(
istr,
data,
NOTATION_FALSE_SERIAL,
@@ -532,7 +532,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
c = istr.peek();
if(isalpha(c))
{
- int cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true);
+ auto cnt = deserialize_boolean(istr,data,NOTATION_TRUE_SERIAL,true);
if(PARSE_FAILURE == cnt) parse_count = cnt;
else account(cnt);
}
@@ -608,7 +608,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
c = get(istr); // pop the 'l'
c = get(istr); // pop the delimiter
std::string str;
- int cnt = deserialize_string_delim(istr, str, c);
+ auto cnt = deserialize_string_delim(istr, str, c);
if(PARSE_FAILURE == cnt)
{
parse_count = PARSE_FAILURE;
@@ -631,7 +631,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
c = get(istr); // pop the 'd'
c = get(istr); // pop the delimiter
std::string str;
- int cnt = deserialize_string_delim(istr, str, c);
+ auto cnt = deserialize_string_delim(istr, str, c);
if(PARSE_FAILURE == cnt)
{
parse_count = PARSE_FAILURE;
@@ -663,7 +663,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) c
default:
parse_count = PARSE_FAILURE;
- LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c
+ LL_INFOS() << "Unrecognized character while parsing: int(" << int(c)
<< ")" << LL_ENDL;
break;
}
@@ -694,7 +694,7 @@ S32 LLSDNotationParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) c
{
putback(istr, c);
found_name = true;
- int count = deserialize_string(istr, name, mMaxBytesLeft);
+ auto count = deserialize_string(istr, name, mMaxBytesLeft);
if(PARSE_FAILURE == count) return PARSE_FAILURE;
account(count);
}
@@ -776,7 +776,7 @@ S32 LLSDNotationParser::parseArray(std::istream& istr, LLSD& array, S32 max_dept
bool LLSDNotationParser::parseString(std::istream& istr, LLSD& data) const
{
std::string value;
- int count = deserialize_string(istr, value, mMaxBytesLeft);
+ auto count = deserialize_string(istr, value, mMaxBytesLeft);
if(PARSE_FAILURE == count) return false;
account(count);
data = value;
@@ -809,7 +809,7 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const
if(len)
{
value.resize(len);
- account((int)fullread(istr, (char *)&value[0], len));
+ account(fullread(istr, (char *)&value[0], len));
}
c = get(istr); // strip off the trailing double-quote
data = value;
@@ -1006,7 +1006,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
case '"':
{
std::string value;
- int cnt = deserialize_string_delim(istr, value, c);
+ auto cnt = deserialize_string_delim(istr, value, c);
if(PARSE_FAILURE == cnt)
{
parse_count = PARSE_FAILURE;
@@ -1093,7 +1093,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
if(size > 0)
{
value.resize(size);
- account((int)fullread(istr, (char*)&value[0], size));
+ account(fullread(istr, (char*)&value[0], size));
}
data = value;
}
@@ -1107,7 +1107,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data, S32 max_depth) con
default:
parse_count = PARSE_FAILURE;
- LL_INFOS() << "Unrecognized character while parsing: int(" << (int)c
+ LL_INFOS() << "Unrecognized character while parsing: int(" << int(c)
<< ")" << LL_ENDL;
break;
}
@@ -1141,7 +1141,7 @@ S32 LLSDBinaryParser::parseMap(std::istream& istr, LLSD& map, S32 max_depth) con
case '\'':
case '"':
{
- int cnt = deserialize_string_delim(istr, name, c);
+ auto cnt = deserialize_string_delim(istr, name, c);
if(PARSE_FAILURE == cnt) return PARSE_FAILURE;
account(cnt);
break;
@@ -1225,7 +1225,7 @@ bool LLSDBinaryParser::parseString(
if(size)
{
buf.resize(size);
- account((int)fullread(istr, &buf[0], size));
+ account(fullread(istr, &buf[0], size));
value.assign(buf.begin(), buf.end());
}
return true;
@@ -1429,7 +1429,7 @@ S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr,
ostr << std::uppercase;
auto oldfill(ostr.fill('0'));
auto oldwidth(ostr.width());
- for (int i = 0; i < buffer.size(); i++)
+ for (size_t i = 0; i < buffer.size(); i++)
{
// have to restate setw() before every conversion
ostr << std::setw(2) << (int) buffer[i];
@@ -1592,7 +1592,7 @@ void LLSDBinaryFormatter::formatString(
/**
* local functions
*/
-int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes)
+llssize deserialize_string(std::istream& istr, std::string& value, llssize max_bytes)
{
int c = istr.get();
if(istr.fail())
@@ -1602,7 +1602,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes
return LLSDParser::PARSE_FAILURE;
}
- int rv = LLSDParser::PARSE_FAILURE;
+ llssize rv = LLSDParser::PARSE_FAILURE;
switch(c)
{
case '\'':
@@ -1622,7 +1622,7 @@ int deserialize_string(std::istream& istr, std::string& value, llssize max_bytes
return rv + 1; // account for the character grabbed at the top.
}
-int deserialize_string_delim(
+llssize deserialize_string_delim(
std::istream& istr,
std::string& value,
char delim)
@@ -1632,7 +1632,7 @@ int deserialize_string_delim(
bool found_hex = false;
bool found_digit = false;
U8 byte = 0;
- int count = 0;
+ llssize count = 0;
while (true)
{
@@ -1647,7 +1647,7 @@ int deserialize_string_delim(
}
char next_char = (char)next_byte; // Now that we know it's not EOF
-
+
if(found_escape)
{
// next character(s) is a special sequence.
@@ -1725,16 +1725,16 @@ int deserialize_string_delim(
return count;
}
-int deserialize_string_raw(
+llssize deserialize_string_raw(
std::istream& istr,
std::string& value,
llssize max_bytes)
{
- int count = 0;
+ llssize count = 0;
const S32 BUF_LEN = 20;
char buf[BUF_LEN]; /* Flawfinder: ignore */
istr.get(buf, BUF_LEN - 1, ')');
- count += (int)istr.gcount();
+ count += istr.gcount();
int c = istr.get();
c = istr.get();
count += 2;
@@ -1749,7 +1749,7 @@ int deserialize_string_raw(
if(len)
{
buf.resize(len);
- count += (int)fullread(istr, (char *)&buf[0], len);
+ count += fullread(istr, (char *)&buf[0], len);
value.assign(buf.begin(), buf.end());
}
c = istr.get();
@@ -2038,7 +2038,7 @@ void serialize_string(const std::string& value, std::ostream& str)
}
}
-int deserialize_boolean(
+llssize deserialize_boolean(
std::istream& istr,
LLSD& data,
const std::string& compare,
@@ -2055,7 +2055,7 @@ int deserialize_boolean(
// * set data to LLSD::null
// * return LLSDParser::PARSE_FAILURE (-1)
//
- int bytes_read = 0;
+ llssize bytes_read = 0;
std::string::size_type ii = 0;
char c = istr.peek();
while((++ii < compare.size())
@@ -2294,7 +2294,7 @@ LLUZipHelper::EZipRresult LLUZipHelper::unzip_llsd(LLSD& data, std::istream& is,
//This unzip function will only work with a gzip header and trailer - while the contents
//of the actual compressed data is the same for either format (gzip vs zlib ), the headers
//and trailers are different for the formats.
-U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 size )
+U8* unzip_llsdNavMesh( bool& valid, size_t& outsize, std::istream& is, S32 size )
{
if (size == 0)
{
diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h
index ddcd795e8a..bd5ef668c0 100644
--- a/indra/llcommon/llsdserialize.h
+++ b/indra/llcommon/llsdserialize.h
@@ -194,7 +194,7 @@ protected:
* Conceptually const since it only modifies mutable members.
* @param bytes The number of bytes read.
*/
- void account(S32 bytes) const;
+ void account(llssize bytes) const;
protected:
/**
@@ -336,7 +336,7 @@ private:
class Impl;
Impl& impl;
- void parsePart(const char* buf, int len);
+ void parsePart(const char* buf, llssize len);
friend class LLSDSerialize;
};
@@ -867,5 +867,5 @@ public:
LL_COMMON_API std::string zip_llsd(LLSD& data);
-LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize,std::istream& is, S32 size);
+LL_COMMON_API U8* unzip_llsdNavMesh( bool& valid, size_t& outsize,std::istream& is, S32 size);
#endif // LL_LLSDSERIALIZE_H
diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp
index b8b827135d..ac128c9f86 100644
--- a/indra/llcommon/llsdserialize_xml.cpp
+++ b/indra/llcommon/llsdserialize_xml.cpp
@@ -260,7 +260,7 @@ public:
S32 parse(std::istream& input, LLSD& data);
S32 parseLines(std::istream& input, LLSD& data);
- void parsePart(const char *buf, int len);
+ void parsePart(const char *buf, llssize len);
void reset();
@@ -542,7 +542,7 @@ LLSDXMLParser::Impl::findAttribute(const XML_Char* name, const XML_Char** pairs)
return NULL;
}
-void LLSDXMLParser::Impl::parsePart(const char* buf, int len)
+void LLSDXMLParser::Impl::parsePart(const char* buf, llssize len)
{
if ( buf != NULL
&& len > 0 )
@@ -915,7 +915,7 @@ LLSDXMLParser::~LLSDXMLParser()
delete &impl;
}
-void LLSDXMLParser::parsePart(const char *buf, int len)
+void LLSDXMLParser::parsePart(const char *buf, llssize len)
{
impl.parsePart(buf, len);
}
diff --git a/indra/newview/llpathfindingnavmesh.cpp b/indra/newview/llpathfindingnavmesh.cpp
index 0287c07f96..c297cac771 100644
--- a/indra/newview/llpathfindingnavmesh.cpp
+++ b/indra/newview/llpathfindingnavmesh.cpp
@@ -143,7 +143,7 @@ void LLPathfindingNavMesh::handleNavMeshResult(const LLSD &pContent, U32 pNavMes
unsigned int binSize = value.size();
std::string newStr(reinterpret_cast<const char *>(&value[0]), binSize);
std::istringstream streamdecomp( newStr );
- unsigned int decompBinSize = 0;
+ size_t decompBinSize = 0;
bool valid = false;
U8* pUncompressedNavMeshContainer = unzip_llsdNavMesh( valid, decompBinSize, streamdecomp, binSize ) ;
if ( !valid )