Merge pull request #348 from TsudaKageyu/string-memcpy

Reduced a useless memory copy in tstring.cpp.
This commit is contained in:
Lukáš Lalinský 2014-02-17 08:45:49 +01:00
commit 2758aed34d

View File

@ -805,12 +805,13 @@ void String::copyFromUTF16(const wchar_t *s, size_t length, Type t)
d->data.resize(length);
if(length > 0) {
memcpy(&d->data[0], s, length * sizeof(wchar_t));
if(swap) {
for(size_t i = 0; i < length; ++i)
d->data[i] = Utils::byteSwap(static_cast<ushort>(s[i]));
}
else {
::memcpy(&d->data[0], s, length * sizeof(wchar_t));
}
}
}