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