| 191 | max_recursion_depth_(options.max_recursion_depth) {} |
| 192 | |
| 193 | Status ReadBuffer(int64_t offset, int64_t length, std::shared_ptr<Buffer>* out) { |
| 194 | // This construct permits overriding GetBuffer at compile time |
| 195 | if (skip_io_) { |
| 196 | return Status::OK(); |
| 197 | } |
| 198 | if (offset < 0) { |
| 199 | return Status::Invalid("Negative offset for reading buffer ", buffer_index_); |
| 200 | } |
| 201 | if (length < 0) { |
| 202 | return Status::Invalid("Negative length for reading buffer ", buffer_index_); |
| 203 | } |
| 204 | auto read_end = AddWithOverflow({offset, length}); |
| 205 | if (!read_end.has_value() || (file_length_.has_value() && read_end > file_length_)) { |
| 206 | return Status::Invalid("Buffer ", buffer_index_, " exceeds IPC file area"); |
| 207 | } |
| 208 | if (!bit_util::IsMultipleOf8(offset)) { |
| 209 | return Status::Invalid("Buffer ", buffer_index_, |
| 210 | " did not start on 8-byte aligned offset: ", offset); |
| 211 | } |
| 212 | if (file_) { |
| 213 | return file_->ReadAt(offset, length).Value(out); |
| 214 | } else { |
| 215 | if (!AddWithOverflow({read_end.value(), file_offset_}).has_value()) { |
| 216 | return Status::Invalid("Buffer ", buffer_index_, " exceeds IPC file area"); |
| 217 | } |
| 218 | read_request_.RequestRange(offset + file_offset_, length, out); |
| 219 | return Status::OK(); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | Status LoadType(const DataType& type) { |
| 224 | DCHECK_NE(out_, nullptr); |
nothing calls this directly
no test coverage detected