mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
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:
parent
88668d9fd0
commit
fecad172f3
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user