Handle the fast common path where all the bytes are in the first buffer. This is the path used by sequence/rc/parquet file formats to read a very small number (i.e. single int) of bytes.
| 32 | /// is the path used by sequence/rc/parquet file formats to read a very small number |
| 33 | /// (i.e. single int) of bytes. |
| 34 | inline bool ScannerContext::Stream::GetBytes(int64_t requested_len, uint8_t** buffer, |
| 35 | int64_t* out_len, Status* status, bool peek) { |
| 36 | if (UNLIKELY(requested_len < 0)) { |
| 37 | *status = ReportInvalidRead(requested_len); |
| 38 | return false; |
| 39 | } |
| 40 | if (UNLIKELY(requested_len == 0)) { |
| 41 | *out_len = 0; |
| 42 | return true; |
| 43 | } |
| 44 | if (LIKELY(requested_len <= *output_buffer_bytes_left_)) { |
| 45 | *out_len = requested_len; |
| 46 | *buffer = *output_buffer_pos_; |
| 47 | if (LIKELY(!peek)) { |
| 48 | total_bytes_returned_ += *out_len; |
| 49 | AdvanceBufferPos(*out_len, output_buffer_pos_, output_buffer_bytes_left_); |
| 50 | } |
| 51 | return true; |
| 52 | } |
| 53 | DCHECK_GT(requested_len, 0); |
| 54 | *status = GetBytesInternal(requested_len, buffer, peek, out_len); |
| 55 | return status->ok(); |
| 56 | } |
| 57 | |
| 58 | inline bool ScannerContext::Stream::ReadBytes(int64_t length, uint8_t** buf, |
| 59 | Status* status, bool peek) { |
no test coverage detected