| 491 | |
| 492 | template <bool Safe> |
| 493 | std::conditional_t<Safe, Result<c_type>, c_type> Append(const uint8_t* value, |
| 494 | int64_t length) { |
| 495 | if (length <= BinaryViewType::kInlineSize) { |
| 496 | return util::ToInlineBinaryView(value, static_cast<int32_t>(length)); |
| 497 | } |
| 498 | |
| 499 | if constexpr (Safe) { |
| 500 | ARROW_RETURN_NOT_OK(Reserve(length)); |
| 501 | } |
| 502 | |
| 503 | auto v = util::ToNonInlineBinaryView(value, static_cast<int32_t>(length), |
| 504 | static_cast<int32_t>(blocks_.size() - 1), |
| 505 | current_offset_); |
| 506 | |
| 507 | memcpy(current_out_buffer_, value, static_cast<size_t>(length)); |
| 508 | current_out_buffer_ += length; |
| 509 | current_remaining_bytes_ -= length; |
| 510 | current_offset_ += static_cast<int32_t>(length); |
| 511 | return v; |
| 512 | } |
| 513 | |
| 514 | static constexpr int64_t ValueSizeLimit() { |
| 515 | return std::numeric_limits<int32_t>::max(); |
no test coverage detected