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

Method write

src/streams.cpp:95–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void AutoFile::write(std::span<const std::byte> src)
96{
97 if (!m_file) throw std::ios_base::failure("AutoFile::write: file handle is nullptr");
98 if (!m_obfuscation) {
99 if (std::fwrite(src.data(), 1, src.size(), m_file) != src.size()) {
100 throw std::ios_base::failure("AutoFile::write: write failed");
101 }
102 m_was_written = true;
103 if (m_position.has_value()) *m_position += src.size();
104 } else {
105 std::array<std::byte, 4096> buf;
106 while (src.size()) {
107 auto buf_now{std::span{buf}.first(std::min<size_t>(src.size(), buf.size()))};
108 std::copy_n(src.begin(), buf_now.size(), buf_now.begin());
109 write_buffer(buf_now);
110 src = src.subspan(buf_now.size());
111 }
112 }
113}
114
115void AutoFile::write_buffer(std::span<std::byte> src)
116{

Callers 15

filter-lcov.pyFile · 0.45
writeBlockMethod · 0.45
mainFunction · 0.45
tree_sha512sumFunction · 0.45
save_binaryFunction · 0.45
process_nodesFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
gen-manpages.pyFile · 0.45
download_from_urlFunction · 0.45

Calls 4

dataMethod · 0.45
sizeMethod · 0.45
has_valueMethod · 0.45
beginMethod · 0.45

Tested by 10

test_empty_asmapMethod · 0.36
test_valid_signerMethod · 0.36
test_dir_configMethod · 0.36
test_negated_configMethod · 0.36
test_ignored_confMethod · 0.36
run_testsFunction · 0.36
replace_in_configMethod · 0.36