Fix handling of null terminated ANI metadata with Qt6

In Qt5 converting a QByteArray to a QString stops at the first null byte,
in Qt6 the QByteArray size is respected, and trailing null bytes are
therefore included in the final QString. Explicitly determine the length
of the string data to deal with that.
This commit is contained in:
Volker Krause 2022-01-22 19:14:52 +01:00
parent f4edb7296f
commit 96836e849f

View File

@ -12,6 +12,8 @@
#include <QVariant>
#include <QtEndian>
#include <cstring>
namespace
{
struct ChunkHeader {
@ -419,7 +421,7 @@ bool ANIHandler::ensureScanned() const
}
// FIXME encoding
const QString stringValue = QString::fromLocal8Bit(value);
const QString stringValue = QString::fromLocal8Bit(value.constData(), std::strlen(value.constData()));
if (chunkId == "INAM") {
mutableThis->m_name = stringValue;
} else if (chunkId == "IART") {