adjustments, based on comments in PR.
This commit is contained in:
Christopher Dunn 2015-10-19 23:49:07 -05:00
parent 2b00891a86
commit 527965cbde

View File

@ -218,8 +218,7 @@ void Value::CommentInfo::setComment(const char* text, size_t len) {
Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {} Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate) Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
: cstr_(str) : cstr_(str) {
{
// allocate != duplicate // allocate != duplicate
storage_.policy_ = allocate & 0x3; storage_.policy_ = allocate & 0x3;
storage_.length_ = ulength & 0x3FFFFFFF; storage_.length_ = ulength & 0x3FFFFFFF;
@ -228,8 +227,7 @@ Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy a
Value::CZString::CZString(const CZString& other) Value::CZString::CZString(const CZString& other)
: cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0
? duplicateStringValue(other.cstr_, other.storage_.length_) ? duplicateStringValue(other.cstr_, other.storage_.length_)
: other.cstr_) : other.cstr_) {
{
storage_.policy_ = (other.cstr_ storage_.policy_ = (other.cstr_
? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
? noDuplication : duplicate) ? noDuplication : duplicate)
@ -239,10 +237,8 @@ Value::CZString::CZString(const CZString& other)
#if JSON_HAS_RVALUE_REFERENCES #if JSON_HAS_RVALUE_REFERENCES
Value::CZString::CZString(CZString&& other) Value::CZString::CZString(CZString&& other)
: cstr_(other.cstr_), : cstr_(other.cstr_), index_(other.index_) {
index_(other.index_) other.cstr_ = nullptr;
{
other.cstr_ = 0;
} }
#endif #endif
@ -436,10 +432,9 @@ Value::Value(Value const& other)
#if JSON_HAS_RVALUE_REFERENCES #if JSON_HAS_RVALUE_REFERENCES
// Move constructor // Move constructor
Value::Value(Value&& other) Value::Value(Value&& other) {
{ initBasic(nullValue);
initBasic(nullValue); swap(other);
swap(other);
} }
#endif #endif