MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / CopyDataToBuffer

Function CopyDataToBuffer

lib/mdflib/mdflib/src/cn4block.cpp:165–181  ·  view source on GitHub ↗

< Helper function that recursively copies all data bytes to a destination buffer.

Source from the content-addressed store, hash-verified

163///< Helper function that recursively copies all data bytes to a
164/// destination buffer.
165uint64_t CopyDataToBuffer(const mdf::detail::MdfBlock *data, std::streambuf& from_file,
166 std::vector<uint8_t> &buffer, uint64_t &buffer_index) {
167 if (data == nullptr) {
168 return 0;
169 }
170 uint64_t count = 0;
171 const auto *db = dynamic_cast<const mdf::detail::DataBlock *>(data);
172 const auto *dl = dynamic_cast<const mdf::detail::DataListBlock *>(data);
173 if (db != nullptr) {
174 count += db->CopyDataToBuffer(from_file, buffer, buffer_index);
175 } else if (dl != nullptr) {
176 for (const auto &block : dl->DataBlockList()) {
177 count += CopyDataToBuffer(block.get(), from_file, buffer, buffer_index);
178 }
179 }
180 return count;
181}
182
183} // end namespace
184

Callers

nothing calls this directly

Calls 2

CopyDataToBufferMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected