From: Scott Wheeler Date: Thu, 6 May 2004 12:36:31 +0000 (+0000) Subject: A small regression -- when assigning a ByteVector to a String make sure to X-Git-Tag: v1.5~394 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a2cdbcc45183365356dbf1e37f511f3cd1ec653;p=taglib A small regression -- when assigning a ByteVector to a String make sure to not include the trailing null characters. (This was introduced after the last release.) git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@309070 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- diff --git a/toolkit/tstring.cpp b/toolkit/tstring.cpp index 9f1142d9..6670c20d 100644 --- a/toolkit/tstring.cpp +++ b/toolkit/tstring.cpp @@ -160,12 +160,15 @@ String::String(const ByteVector &v, Type t) if(t == Latin1 || t == UTF8) { + int length = 0; d->data.resize(v.size()); wstring::iterator targetIt = d->data.begin(); for(ByteVector::ConstIterator it = v.begin(); it != v.end() && (*it); ++it) { *targetIt = uchar(*it); ++targetIt; + ++length; } + d->data.resize(length); } else { d->data.resize(v.size() / 2);