From 69eaa75f647d552e322c4d3e0339c9b5bf0222e0 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Sat, 15 Feb 2014 20:25:00 +0900 Subject: [PATCH] Reduced a useless memory copy in tstring.cpp. --- taglib/toolkit/tstring.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taglib/toolkit/tstring.cpp b/taglib/toolkit/tstring.cpp index 774642a8..0151f784 100644 --- a/taglib/toolkit/tstring.cpp +++ b/taglib/toolkit/tstring.cpp @@ -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(s[i])); } + else { + ::memcpy(&d->data[0], s, length * sizeof(wchar_t)); + } } } -- 2.40.0