| 3379 | } |
| 3380 | |
| 3381 | void Value::dupPayload(const Value &other) { |
| 3382 | setType(other.type()); |
| 3383 | setIsAllocated(false); |
| 3384 | switch (type()) { |
| 3385 | case nullValue: |
| 3386 | case intValue: |
| 3387 | case uintValue: |
| 3388 | case realValue: |
| 3389 | case booleanValue: |
| 3390 | value_ = other.value_; |
| 3391 | break; |
| 3392 | case stringValue: |
| 3393 | if (other.value_.string_ && other.isAllocated()) { |
| 3394 | unsigned len; |
| 3395 | char const *str; |
| 3396 | decodePrefixedString(other.isAllocated(), other.value_.string_, &len, |
| 3397 | &str); |
| 3398 | value_.string_ = duplicateAndPrefixStringValue(str, len); |
| 3399 | setIsAllocated(true); |
| 3400 | } else { |
| 3401 | value_.string_ = other.value_.string_; |
| 3402 | } |
| 3403 | break; |
| 3404 | case arrayValue: |
| 3405 | case objectValue: |
| 3406 | value_.map_ = new ObjectValues(*other.value_.map_); |
| 3407 | break; |
| 3408 | default: |
| 3409 | JSON_ASSERT_UNREACHABLE; |
| 3410 | } |
| 3411 | } |
| 3412 | |
| 3413 | void Value::releasePayload() { |
| 3414 | switch (type()) { |
nothing calls this directly
no test coverage detected