aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2008-09-20 15:53:17 +0000
committerMax Horn2008-09-20 15:53:17 +0000
commitbbba275913692c026af87aed4ee6455b498b16db (patch)
tree66be8c5ba405678e377e20c717c0dcb139c2cdc5 /common
parent487dec8e778491b7851acabcc0e89abd7d7c4318 (diff)
downloadscummvm-rg350-bbba275913692c026af87aed4ee6455b498b16db.tar.gz
scummvm-rg350-bbba275913692c026af87aed4ee6455b498b16db.tar.bz2
scummvm-rg350-bbba275913692c026af87aed4ee6455b498b16db.zip
Little readability tweak
svn-id: r34615
Diffstat (limited to 'common')
-rw-r--r--common/str.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/str.cpp b/common/str.cpp
index a415e376c9..d1fed68844 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -79,15 +79,17 @@ void String::initWithCStr(const char *str, uint32 len) {
}
String::String(const String &str)
- : _size(str._size), _str(str.isStorageIntern() ? _storage : str._str) {
+ : _size(str._size) {
if (str.isStorageIntern()) {
// String in internal storage: just copy it
- memcpy(_storage, str._storage, sizeof(_storage));
+ memcpy(_storage, str._storage, _builtinCapacity);
+ _str = _storage;
} else {
// String in external storage: use refcount mechanism
str.incRefCount();
_extern._refCount = str._extern._refCount;
_extern._capacity = str._extern._capacity;
+ _str = str._str;
}
assert(_str != 0);
}