Strip nulls from the end of ID3v2 text fields.

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
This commit is contained in:
Scott Wheeler 2007-04-01 22:08:44 +00:00
parent 88668d9fd0
commit fecad172f3

View File

@ -108,7 +108,17 @@ void TextIdentificationFrame::parseFields(const ByteVector &data)
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();