| 3476 | } |
| 3477 | |
| 3478 | void Value::dupPayload(const Value& other) { |
| 3479 | type_ = other.type_; |
| 3480 | allocated_ = false; |
| 3481 | switch (type_) { |
| 3482 | case nullValue: |
| 3483 | case intValue: |
| 3484 | case uintValue: |
| 3485 | case realValue: |
| 3486 | case booleanValue: |
| 3487 | value_ = other.value_; |
| 3488 | break; |
| 3489 | case stringValue: |
| 3490 | if (other.value_.string_ && other.allocated_) { |
| 3491 | unsigned len; |
| 3492 | char const* str; |
| 3493 | decodePrefixedString(other.allocated_, other.value_.string_, &len, &str); |
| 3494 | value_.string_ = duplicateAndPrefixStringValue(str, len); |
| 3495 | allocated_ = true; |
| 3496 | } else { |
| 3497 | value_.string_ = other.value_.string_; |
| 3498 | } |
| 3499 | break; |
| 3500 | case arrayValue: |
| 3501 | case objectValue: |
| 3502 | value_.map_ = new ObjectValues(*other.value_.map_); |
| 3503 | break; |
| 3504 | default: |
| 3505 | JSON_ASSERT_UNREACHABLE; |
| 3506 | } |
| 3507 | } |
| 3508 | |
| 3509 | void Value::releasePayload() { |
| 3510 | switch (type_) { |
nothing calls this directly
no test coverage detected