| 76 | } |
| 77 | |
| 78 | bool Tuple::TryDeepCopyStrings(uint8_t** data, const uint8_t* data_end, int* offset, |
| 79 | const TupleDescriptor& desc, bool convert_ptrs) { |
| 80 | vector<SlotDescriptor*>::const_iterator slot = desc.string_slots().begin(); |
| 81 | for (; slot != desc.string_slots().end(); ++slot) { |
| 82 | DCHECK((*slot)->type().IsVarLenStringType()); |
| 83 | if (IsNull((*slot)->null_indicator_offset())) continue; |
| 84 | |
| 85 | StringValue* string_v = GetStringSlot((*slot)->tuple_offset()); |
| 86 | // It is safe to smallify at this point as DeepCopyVarlenData is called on the new |
| 87 | // tuple which can be modified. |
| 88 | if (string_v->Smallify()) continue; |
| 89 | int len = string_v->Len(); |
| 90 | DCHECK_GT(len, 0); // Size 0 should be handled by "smallify" case. |
| 91 | if (!TryMemCopy(*data, data_end, len, string_v->Ptr())) return false; |
| 92 | char* new_ptr = convert_ptrs ? reinterpret_cast<char*>(*offset) : |
| 93 | reinterpret_cast<char*>(*data); |
| 94 | string_v->SetPtr(new_ptr); |
| 95 | *data += len; |
| 96 | *offset += len; |
| 97 | } |
| 98 | return true; |
| 99 | } |
| 100 | |
| 101 | bool Tuple::TryDeepCopyCollections(uint8_t** data, const uint8_t* data_end, int* offset, |
| 102 | const TupleDescriptor& desc, bool convert_ptrs) { |
no test coverage detected