mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-02-22 02:50:50 +01:00
Fixed broken strings handling under Qt5
This commit is contained in:
parent
dc1655a2d7
commit
c9f7531f17
@ -60,7 +60,14 @@ static bool str(CTX &ctx, QByteArray &val)
|
|||||||
if (ctx.bp + len > ctx.be)
|
if (ctx.bp + len > ctx.be)
|
||||||
return false;
|
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);
|
val = QByteArray::fromRawData(ctx.bp, len);
|
||||||
|
#endif
|
||||||
ctx.bp += len;
|
ctx.bp += len;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user