MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SetPos

Method SetPos

src/streams.h:590–604  ·  view source on GitHub ↗

rewind to a given reading position

Source from the content-addressed store, hash-verified

588
589 //! rewind to a given reading position
590 bool SetPos(uint64_t nPos) {
591 size_t bufsize = vchBuf.size();
592 if (nPos + bufsize < nSrcPos) {
593 // rewinding too far, rewind as far as possible
594 m_read_pos = nSrcPos - bufsize;
595 return false;
596 }
597 if (nPos > nSrcPos) {
598 // can't go this far forward, go as far as possible
599 m_read_pos = nSrcPos;
600 return false;
601 }
602 m_read_pos = nPos;
603 return true;
604 }
605
606 //! prevent reading beyond a certain position
607 //! no argument removes the limit

Callers 4

LoadExternalBlockFileMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
FUZZ_TARGETFunction · 0.80
FindByteFunction · 0.80

Calls 1

sizeMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
FUZZ_TARGETFunction · 0.64