< Helper function that recursively copies all data bytes to a destination buffer.
| 163 | ///< Helper function that recursively copies all data bytes to a |
| 164 | /// destination buffer. |
| 165 | uint64_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 |
nothing calls this directly
no test coverage detected