Bug 2665120: flex_string fatal error assigning big string to small

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1007 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
jfbastien 2009-03-13 11:39:47 +00:00
parent 0174e55298
commit a251ebcc12

View file

@ -220,15 +220,7 @@ public:
new(this) SmallStringOpt(rhs); new(this) SmallStringOpt(rhs);
} else { } else {
SmallStringOpt copy(rhs); SmallStringOpt copy(rhs);
if (Small()) { copy.swap(*this);
// no need to swap, just destructively read copy into this
// ugly but efficient again
memcpy(this, &copy, sizeof(*this));
copy.buf_[maxSmallString] = maxSmallString; // clear the copy
} else {
// Use the swap trick
copy.swap(*this);
}
} }
} }
return *this; return *this;