mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
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:
parent
f4edb7296f
commit
96836e849f
@ -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") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user