Simplified version of the patch from Xavier Duret.
BUG:141680
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@649032
283d02a7-25f6-0310-bc7c-
ecb5cbfe19da
int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
- ByteVectorList l = ByteVectorList::split(data.mid(1), textDelimiter(d->textEncoding), byteAlign);
+ // build a small counter to strip nulls off the end of the field
+
+ int dataLength = data.size() - 1;
+
+ while(dataLength > 0 && data[dataLength] == 0)
+ dataLength--;
+
+ while(dataLength % byteAlign != 0)
+ dataLength++;
+
+ ByteVectorList l = ByteVectorList::split(data.mid(1, dataLength), textDelimiter(d->textEncoding), byteAlign);
d->fieldList.clear();