summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-02-15 17:29:48 -0500
committerNat Goodspeed <nat@lindenlab.com>2023-02-15 17:29:48 -0500
commit292bb3991b589d39d61cf721b82fe7bdae460785 (patch)
treec27ca0e82409f35c3aa719e07b392d5b49a0abcd
parent224667e1cc53d8b22e4b6107c3b0b274127941a7 (diff)
SL-18330: Fix per PR review comments.
-rw-r--r--indra/llcommon/llsdserialize.cpp6
-rw-r--r--indra/llcommon/llstreamtools.cpp2
-rw-r--r--indra/llcommon/llstreamtools.h2
3 files changed, 7 insertions, 3 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index 0a5e3652c7..a14a6b5b1b 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -169,9 +169,13 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, llssize max_bytes)
/*
* Remove the newline chars
*/
- auto lastchar = header.find_last_not_of("\r\n");
+ std::string::size_type lastchar = header.find_last_not_of("\r\n");
if (lastchar != std::string::npos)
{
+ // It's important that find_last_not_of() returns size_type, which is
+ // why lastchar explicitly declares the type above. erase(size_type)
+ // erases from that offset to the end of the string, whereas
+ // erase(iterator) erases only a single character.
header.erase(lastchar+1);
}
diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp
index 979e96b848..bc32b6fd9e 100644
--- a/indra/llcommon/llstreamtools.cpp
+++ b/indra/llcommon/llstreamtools.cpp
@@ -519,7 +519,7 @@ int cat_streambuf::underflow()
if (gptr() == egptr())
{
// here because our buffer is empty
- std::streamsize size;
+ std::streamsize size = 0;
// Until we've run out of mInputs, try reading the first of them
// into mBuffer. If that fetches some characters, break the loop.
while (! mInputs.empty()
diff --git a/indra/llcommon/llstreamtools.h b/indra/llcommon/llstreamtools.h
index 997f738840..bb7bc20327 100644
--- a/indra/llcommon/llstreamtools.h
+++ b/indra/llcommon/llstreamtools.h
@@ -135,7 +135,7 @@ public:
mBuffer(1024)
{}
- int underflow();
+ int underflow() override;
};
#endif