Fixed broken strings handling under Qt5

This commit is contained in:
Martin Tůma 2025-02-13 23:34:36 +01:00
parent dc1655a2d7
commit c9f7531f17

View File

@ -60,7 +60,14 @@ static bool str(CTX &ctx, QByteArray &val)
if (ctx.bp + len > ctx.be)
return false;
/* In Qt5 the (later) conversion to QString is broken when the QByteArray is
not nul terminated so we have to use the "deep copy" constructor that
nul-terminates the byte array when it is created. */
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
val = QByteArray(ctx.bp, len);
#else
val = QByteArray::fromRawData(ctx.bp, len);
#endif
ctx.bp += len;
return true;