| 646 | } |
| 647 | |
| 648 | bool ReadBytesZeroCopy(const std::shared_ptr<Buffer>& source_data, |
| 649 | CodedInputStream* input, std::shared_ptr<Buffer>* out) { |
| 650 | uint32_t length; |
| 651 | if (!input->ReadVarint32(&length)) { |
| 652 | return false; |
| 653 | } |
| 654 | auto buf = |
| 655 | SliceBuffer(source_data, input->CurrentPosition(), static_cast<int64_t>(length)); |
| 656 | *out = buf; |
| 657 | return input->Skip(static_cast<int>(length)); |
| 658 | } |
| 659 | |
| 660 | } // namespace |
| 661 |
no test coverage detected