MCPcopy Create free account
hub / github.com/apache/arrow / ValidateReadRange

Function ValidateReadRange

cpp/src/arrow/io/interfaces.cc:333–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

331}
332
333Result<int64_t> ValidateReadRange(int64_t offset, int64_t size, int64_t file_size) {
334 if (offset < 0 || size < 0) {
335 return Status::Invalid("Invalid read (offset = ", offset, ", size = ", size, ")");
336 }
337 if (offset > file_size) {
338 return Status::IOError("Read out of bounds (offset = ", offset, ", size = ", size,
339 ") in file of size ", file_size);
340 }
341 return std::min(size, file_size - offset);
342}
343
344Status ValidateWriteRange(int64_t offset, int64_t size, int64_t file_size) {
345 if (offset < 0 || size < 0) {

Callers 1

ReadAtMethod · 0.85

Calls 2

IOErrorFunction · 0.85
InvalidFunction · 0.50

Tested by

no test coverage detected