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

Method seek

src/streams.cpp:33–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void AutoFile::seek(int64_t offset, int origin)
34{
35 if (IsNull()) {
36 throw std::ios_base::failure("AutoFile::seek: file handle is nullptr");
37 }
38 if (std::fseek(m_file, offset, origin) != 0) {
39 throw std::ios_base::failure(feof() ? "AutoFile::seek: end of file" : "AutoFile::seek: fseek failed");
40 }
41 if (origin == SEEK_SET) {
42 m_position = offset;
43 } else if (origin == SEEK_CUR && m_position.has_value()) {
44 *m_position += offset;
45 } else {
46 int64_t r{std::ftell(m_file)};
47 if (r < 0) {
48 throw std::ios_base::failure("AutoFile::seek: ftell failed");
49 }
50 m_position = r;
51 }
52}
53
54int64_t AutoFile::tell()
55{

Callers 15

fetchBlockMethod · 0.45
runMethod · 0.45
process_fileFunction · 0.45
lint_trailing_newlineFunction · 0.45
out_of_orderMethod · 0.45
get_node_outputMethod · 0.45
run_testMethod · 0.45
get_node_outputFunction · 0.45
run_testMethod · 0.45
get_nextMethod · 0.45

Calls 1

has_valueMethod · 0.45

Tested by 8

get_nextMethod · 0.36
is_node_stoppedMethod · 0.36
debug_log_sizeMethod · 0.36
assert_debug_logMethod · 0.36