Append 'str' to the current string, allocating a new buffer as necessary. Return error status if memory limit is exceeded.
| 50 | /// Append 'str' to the current string, allocating a new buffer as necessary. |
| 51 | /// Return error status if memory limit is exceeded. |
| 52 | Status Append(const char* str, int64_t str_len) WARN_UNUSED_RESULT { |
| 53 | int64_t new_len = len_ + str_len; |
| 54 | if (UNLIKELY(new_len > buffer_size_)) RETURN_IF_ERROR(GrowBuffer(new_len)); |
| 55 | Ubsan::MemCpy(buffer_ + len_, str, str_len); |
| 56 | len_ += str_len; |
| 57 | return Status::OK(); |
| 58 | } |
| 59 | |
| 60 | /// Wrapper around append() for input type 'uint8_t'. |
| 61 | Status Append(const uint8_t* str, int64_t str_len) WARN_UNUSED_RESULT { |