diff options
| author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
|---|---|---|
| committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
| commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
| tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/llcorehttp/bufferstream.cpp | |
| parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
| parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) | |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/llcorehttp/bufferstream.cpp')
| -rw-r--r-- | indra/llcorehttp/bufferstream.cpp | 394 |
1 files changed, 197 insertions, 197 deletions
diff --git a/indra/llcorehttp/bufferstream.cpp b/indra/llcorehttp/bufferstream.cpp index 678bf5ea9f..ea92f2f71d 100644 --- a/indra/llcorehttp/bufferstream.cpp +++ b/indra/llcorehttp/bufferstream.cpp @@ -33,250 +33,250 @@ namespace LLCore { BufferArrayStreamBuf::BufferArrayStreamBuf(BufferArray * array) - : mBufferArray(array), - mReadCurPos(0), - mReadCurBlock(-1), - mReadBegin(NULL), - mReadCur(NULL), - mReadEnd(NULL), - mWriteCurPos(0) + : mBufferArray(array), + mReadCurPos(0), + mReadCurBlock(-1), + mReadBegin(NULL), + mReadCur(NULL), + mReadEnd(NULL), + mWriteCurPos(0) { - if (array) - { - array->addRef(); - mWriteCurPos = array->mLen; - } + if (array) + { + array->addRef(); + mWriteCurPos = array->mLen; + } } BufferArrayStreamBuf::~BufferArrayStreamBuf() { - if (mBufferArray) - { - mBufferArray->release(); - mBufferArray = NULL; - } + if (mBufferArray) + { + mBufferArray->release(); + mBufferArray = NULL; + } } - + BufferArrayStreamBuf::int_type BufferArrayStreamBuf::underflow() { - if (! mBufferArray) - { - return traits_type::eof(); - } - - if (mReadCur == mReadEnd) - { - // Find the next block with actual data or leave - // mCurBlock/mCur/mEnd unchanged if we're at the end - // of any block chain. - const char * new_begin(NULL), * new_end(NULL); - int new_cur_block(mReadCurBlock + 1); - - while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) - { - if (new_begin != new_end) - { - break; - } - ++new_cur_block; - } - if (new_begin == new_end) - { - return traits_type::eof(); - } - - mReadCurBlock = new_cur_block; - mReadBegin = mReadCur = new_begin; - mReadEnd = new_end; - } - - return traits_type::to_int_type(*mReadCur); + if (! mBufferArray) + { + return traits_type::eof(); + } + + if (mReadCur == mReadEnd) + { + // Find the next block with actual data or leave + // mCurBlock/mCur/mEnd unchanged if we're at the end + // of any block chain. + const char * new_begin(NULL), * new_end(NULL); + int new_cur_block(mReadCurBlock + 1); + + while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) + { + if (new_begin != new_end) + { + break; + } + ++new_cur_block; + } + if (new_begin == new_end) + { + return traits_type::eof(); + } + + mReadCurBlock = new_cur_block; + mReadBegin = mReadCur = new_begin; + mReadEnd = new_end; + } + + return traits_type::to_int_type(*mReadCur); } BufferArrayStreamBuf::int_type BufferArrayStreamBuf::uflow() { - const int_type ret(underflow()); - - if (traits_type::eof() != ret) - { - ++mReadCur; - ++mReadCurPos; - } - return ret; + const int_type ret(underflow()); + + if (traits_type::eof() != ret) + { + ++mReadCur; + ++mReadCurPos; + } + return ret; } BufferArrayStreamBuf::int_type BufferArrayStreamBuf::pbackfail(int_type ch) { - if (! mBufferArray) - { - return traits_type::eof(); - } - - if (mReadCur == mReadBegin) - { - // Find the previous block with actual data or leave - // mCurBlock/mBegin/mCur/mEnd unchanged if we're at the - // beginning of any block chain. - const char * new_begin(NULL), * new_end(NULL); - int new_cur_block(mReadCurBlock - 1); - - while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) - { - if (new_begin != new_end) - { - break; - } - --new_cur_block; - } - if (new_begin == new_end) - { - return traits_type::eof(); - } - - mReadCurBlock = new_cur_block; - mReadBegin = new_begin; - mReadEnd = mReadCur = new_end; - } - - if (traits_type::eof() != ch && mReadCur[-1] != ch) - { - return traits_type::eof(); - } - --mReadCurPos; - return traits_type::to_int_type(*--mReadCur); + if (! mBufferArray) + { + return traits_type::eof(); + } + + if (mReadCur == mReadBegin) + { + // Find the previous block with actual data or leave + // mCurBlock/mBegin/mCur/mEnd unchanged if we're at the + // beginning of any block chain. + const char * new_begin(NULL), * new_end(NULL); + int new_cur_block(mReadCurBlock - 1); + + while (mBufferArray->getBlockStartEnd(new_cur_block, &new_begin, &new_end)) + { + if (new_begin != new_end) + { + break; + } + --new_cur_block; + } + if (new_begin == new_end) + { + return traits_type::eof(); + } + + mReadCurBlock = new_cur_block; + mReadBegin = new_begin; + mReadEnd = mReadCur = new_end; + } + + if (traits_type::eof() != ch && mReadCur[-1] != ch) + { + return traits_type::eof(); + } + --mReadCurPos; + return traits_type::to_int_type(*--mReadCur); } std::streamsize BufferArrayStreamBuf::showmanyc() { - if (! mBufferArray) - { - return -1; - } - return mBufferArray->mLen - mReadCurPos; + if (! mBufferArray) + { + return -1; + } + return mBufferArray->mLen - mReadCurPos; } BufferArrayStreamBuf::int_type BufferArrayStreamBuf::overflow(int c) { - if (! mBufferArray || mWriteCurPos > mBufferArray->mLen) - { - return traits_type::eof(); - } - const size_t wrote(mBufferArray->write(mWriteCurPos, &c, 1)); - mWriteCurPos += wrote; - return wrote ? c : traits_type::eof(); + if (! mBufferArray || mWriteCurPos > mBufferArray->mLen) + { + return traits_type::eof(); + } + const size_t wrote(mBufferArray->write(mWriteCurPos, &c, 1)); + mWriteCurPos += wrote; + return wrote ? c : traits_type::eof(); } std::streamsize BufferArrayStreamBuf::xsputn(const char * src, std::streamsize count) { - if (! mBufferArray || mWriteCurPos > mBufferArray->mLen) - { - return 0; - } - const size_t wrote(mBufferArray->write(mWriteCurPos, src, count)); - mWriteCurPos += wrote; - return wrote; + if (! mBufferArray || mWriteCurPos > mBufferArray->mLen) + { + return 0; + } + const size_t wrote(mBufferArray->write(mWriteCurPos, src, count)); + mWriteCurPos += wrote; + return wrote; } std::streampos BufferArrayStreamBuf::seekoff(std::streamoff off, - std::ios_base::seekdir way, - std::ios_base::openmode which) + std::ios_base::seekdir way, + std::ios_base::openmode which) { - std::streampos ret(-1); - - if (! mBufferArray) - { - return ret; - } - - if (std::ios_base::in == which) - { - size_t pos(0); - - switch (way) - { - case std::ios_base::beg: - pos = off; - break; - - case std::ios_base::cur: - pos = mReadCurPos += off; - break; - - case std::ios_base::end: - pos = mBufferArray->mLen - off; - break; - - default: - return ret; - } - - if (pos >= mBufferArray->size()) - { - pos = (std::max)(size_t(0), mBufferArray->size() - 1); - } - size_t ba_offset(0); - int block(mBufferArray->findBlock(pos, &ba_offset)); - if (block < 0) - return ret; - const char * start(NULL), * end(NULL); - if (! mBufferArray->getBlockStartEnd(block, &start, &end)) - return ret; - mReadCurBlock = block; - mReadBegin = start; - mReadCur = start + ba_offset; - mReadEnd = end; - ret = mReadCurPos = pos; - } - else if (std::ios_base::out == which) - { - size_t pos(0); - - switch (way) - { - case std::ios_base::beg: - pos = off; - break; - - case std::ios_base::cur: - pos = mWriteCurPos += off; - break; - - case std::ios_base::end: - pos = mBufferArray->mLen - off; - break; - - default: - return ret; - } - - if (pos > mBufferArray->size()) - { - pos = mBufferArray->size(); - } - ret = mWriteCurPos = pos; - } - - return ret; + std::streampos ret(-1); + + if (! mBufferArray) + { + return ret; + } + + if (std::ios_base::in == which) + { + size_t pos(0); + + switch (way) + { + case std::ios_base::beg: + pos = off; + break; + + case std::ios_base::cur: + pos = mReadCurPos += off; + break; + + case std::ios_base::end: + pos = mBufferArray->mLen - off; + break; + + default: + return ret; + } + + if (pos >= mBufferArray->size()) + { + pos = (std::max)(size_t(0), mBufferArray->size() - 1); + } + size_t ba_offset(0); + int block(mBufferArray->findBlock(pos, &ba_offset)); + if (block < 0) + return ret; + const char * start(NULL), * end(NULL); + if (! mBufferArray->getBlockStartEnd(block, &start, &end)) + return ret; + mReadCurBlock = block; + mReadBegin = start; + mReadCur = start + ba_offset; + mReadEnd = end; + ret = mReadCurPos = pos; + } + else if (std::ios_base::out == which) + { + size_t pos(0); + + switch (way) + { + case std::ios_base::beg: + pos = off; + break; + + case std::ios_base::cur: + pos = mWriteCurPos += off; + break; + + case std::ios_base::end: + pos = mBufferArray->mLen - off; + break; + + default: + return ret; + } + + if (pos > mBufferArray->size()) + { + pos = mBufferArray->size(); + } + ret = mWriteCurPos = pos; + } + + return ret; } BufferArrayStream::BufferArrayStream(BufferArray * ba) - : std::iostream(&mStreamBuf), - mStreamBuf(ba) + : std::iostream(&mStreamBuf), + mStreamBuf(ba) {} - - + + BufferArrayStream::~BufferArrayStream() {} - + } // end namespace LLCore |
