diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-11-03 14:58:32 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-11-03 14:58:32 -0400 |
commit | 9522a0b7c16414fce2103cf58bfdd63aaf0cb01b (patch) | |
tree | 3384f6bbf9dac0e86fa8f39d98d483f1aaf09575 /indra/llcommon/llsdserialize.h | |
parent | 206993f8439ee83f7d010860f421d1e0106daca0 (diff) |
DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.
It's a little distressing how often we have historically coded S32 or U32 to
pass a length or index.
There are more such assumptions in other viewer subdirectories, but this is a
start.
Diffstat (limited to 'indra/llcommon/llsdserialize.h')
-rw-r--r-- | indra/llcommon/llsdserialize.h | 14 |
1 files changed, 7 insertions, 7 deletions
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; |