summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocess.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-02-16 17:35:34 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-02-16 17:35:34 -0500
commita06ba836c76ea8b35aeca9d09bd7d3b043a4c962 (patch)
tree1121731ececa7c7d3ebc918359a321e036bf27c7 /indra/llcommon/llprocess.cpp
parent4ecf9d6a2d981ef27c7b5bddc4807c67d12d5984 (diff)
Fix bug in LLProcess::ReadPipe::peek() substring computation.
Add unit tests for peek() with substring args, reimplemented contains(), various forms of find(). (yay unit tests)
Diffstat (limited to 'indra/llcommon/llprocess.cpp')
-rw-r--r--indra/llcommon/llprocess.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index aa22b3f805..add1649ba5 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -230,7 +230,8 @@ public:
{
// Constrain caller's offset and len to overlap actual buffer content.
std::size_t real_offset = (std::min)(mStreambuf.size(), std::size_t(offset));
- std::size_t real_end = (std::min)(mStreambuf.size(), std::size_t(real_offset + len));
+ size_type want_end = (len == npos)? npos : (real_offset + len);
+ std::size_t real_end = (std::min)(mStreambuf.size(), std::size_t(want_end));
boost::asio::streambuf::const_buffers_type cbufs = mStreambuf.data();
return std::string(boost::asio::buffers_begin(cbufs) + real_offset,
boost::asio::buffers_begin(cbufs) + real_end);