MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetPos

Method SetPos

src/streams.h:678–692  ·  view source on GitHub ↗

rewind to a given reading position

Source from the content-addressed store, hash-verified

676
677 //! rewind to a given reading position
678 bool SetPos(uint64_t nPos) {
679 size_t bufsize = vchBuf.size();
680 if (nPos + bufsize < nSrcPos) {
681 // rewinding too far, rewind as far as possible
682 m_read_pos = nSrcPos - bufsize;
683 return false;
684 }
685 if (nPos > nSrcPos) {
686 // can't go this far forward, go as far as possible
687 m_read_pos = nSrcPos;
688 return false;
689 }
690 m_read_pos = nPos;
691 return true;
692 }
693
694 //! prevent reading beyond a certain position
695 //! no argument removes the limit

Callers 3

LoadExternalBlockFileMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
FUZZ_TARGETFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
FUZZ_TARGETFunction · 0.64