]> granicus.if.org Git - taglib/commitdiff
A small regression -- when assigning a ByteVector to a String make sure to
authorScott Wheeler <wheeler@kde.org>
Thu, 6 May 2004 12:36:31 +0000 (12:36 +0000)
committerScott Wheeler <wheeler@kde.org>
Thu, 6 May 2004 12:36:31 +0000 (12:36 +0000)
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

toolkit/tstring.cpp

index 9f1142d9fd5de23475fa2a03356c8587ac60f16d..6670c20d4ee89d8120c8ed04fbb8adf02fde3f50 100644 (file)
@@ -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);