summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstreamtools.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-08-24 01:23:52 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-08-24 01:23:52 +0300
commit7373fd91fa42b3fce0804ccd10899a5d1fdb5c36 (patch)
tree54a107f3415c04e6e493f54e156c3ac278d36f99 /indra/llcommon/llstreamtools.cpp
parent264d9c32d9e04df0ceeaf2a63f6872aad29dd46a (diff)
parentd454512050e636a19e4b7545515dea4f4b1bbf0d (diff)
Merge remote-tracking branch 'origin/main' into DRTVWR-489
# Conflicts: # indra/llcommon/llsdserialize.cpp # indra/llcommon/llsdserialize.h # indra/llmath/llvolume.cpp # indra/llrender/llgl.cpp # indra/llxml/llcontrol.cpp # indra/newview/llpanelnearbymedia.cpp # indra/newview/llsceneview.cpp # indra/newview/llselectmgr.cpp # indra/newview/llstartup.cpp # indra/newview/lltextureview.cpp # indra/newview/llvovolume.cpp # indra/newview/skins/default/xui/en/menu_viewer.xml
Diffstat (limited to 'indra/llcommon/llstreamtools.cpp')
-rw-r--r--indra/llcommon/llstreamtools.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp
index 1ff15fcf89..bc32b6fd9e 100644
--- a/indra/llcommon/llstreamtools.cpp
+++ b/indra/llcommon/llstreamtools.cpp
@@ -513,3 +513,29 @@ std::istream& operator>>(std::istream& str, const char *tocheck)
}
return str;
}
+
+int cat_streambuf::underflow()
+{
+ if (gptr() == egptr())
+ {
+ // here because our buffer is empty
+ 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()
+ && ! (size = mInputs.front()->sgetn(mBuffer.data(), mBuffer.size())))
+ {
+ // We tried to read mInputs.front() but got zero characters.
+ // Discard the first streambuf and try the next one.
+ mInputs.pop_front();
+ }
+ // Either we ran out of mInputs or we succeeded in reading some
+ // characters, that is, size != 0. Tell base class what we have.
+ setg(mBuffer.data(), mBuffer.data(), mBuffer.data() + size);
+ }
+ // If we fell out of the above loop with mBuffer still empty, return
+ // eof(), otherwise return the next character.
+ return (gptr() == egptr())
+ ? std::char_traits<char>::eof()
+ : std::char_traits<char>::to_int_type(*gptr());
+}