mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Merge pull request #348 from TsudaKageyu/string-memcpy
Reduced a useless memory copy in tstring.cpp.
This commit is contained in:
commit
2758aed34d
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user