| 829 | } |
| 830 | |
| 831 | ByteString ByteString::Clone(google::protobuf::Arena* absl_nonnull arena) const { |
| 832 | ABSL_DCHECK(arena != nullptr); |
| 833 | |
| 834 | switch (GetKind()) { |
| 835 | case ByteStringKind::kSmall: |
| 836 | return ByteString(arena, GetSmall()); |
| 837 | case ByteStringKind::kMedium: { |
| 838 | google::protobuf::Arena* absl_nullable other_arena = GetMediumArena(); |
| 839 | if (arena != nullptr) { |
| 840 | if (arena == other_arena) { |
| 841 | return *this; |
| 842 | } |
| 843 | return ByteString(arena, GetMedium()); |
| 844 | } |
| 845 | if (other_arena != nullptr) { |
| 846 | return ByteString(arena, GetMedium()); |
| 847 | } |
| 848 | return *this; |
| 849 | } |
| 850 | case ByteStringKind::kLarge: |
| 851 | return ByteString(arena, GetLarge()); |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | void ByteString::HashValue(absl::HashState state) const { |
| 856 | switch (GetKind()) { |