5 Commits
4.0 ... 4.1

Author SHA1 Message Date
c9f7531f17 Fixed broken strings handling under Qt5 2025-02-13 23:34:36 +01:00
dc1655a2d7 Last protobuf leftovers 2025-01-25 09:05:13 +01:00
cb4919d5bd Silence clang-tidy warnings 2025-01-12 10:37:21 +01:00
affb818f4e Added missing include 2025-01-12 10:32:58 +01:00
851ed76e26 Version++ 2025-01-12 10:32:42 +01:00
6 changed files with 12 additions and 13 deletions

View File

@ -1,4 +1,4 @@
version: 4.0.{build}
version: 4.1.{build}
configuration:
- Release

4
.gitignore vendored
View File

@ -7,7 +7,3 @@ moc_*.cpp
moc_*.h
qrc_*.cpp
Makefile*
# lib
libpbf.so
libpbf.dylib

View File

@ -2,7 +2,7 @@ TARGET = pbf
TEMPLATE = lib
CONFIG += plugin
QT += gui
VERSION = 4.0
VERSION = 4.1
HEADERS += src/pbfhandler.h \
src/data.h \

View File

@ -11,7 +11,7 @@
struct CTX
{
CTX(const QByteArray &ba)
: bp(ba.constData()), be(bp + ba.size()) {}
: bp(ba.constData()), be(bp + ba.size()), tag(0) {}
const char *bp;
const char *be;
@ -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;

View File

@ -6,6 +6,7 @@
#include <QColor>
#include <QPair>
#include <QString>
#include <QJsonValue>
class QJsonObject;

View File

@ -22,6 +22,7 @@ static QImage sdf2img(const QImage &sdf, const QColor &color)
}
Sprites::Sprite::Sprite(const QJsonObject &json)
: _pixelRatio(1.0), _sdf(false)
{
int x, y, width, height;
@ -44,16 +45,10 @@ Sprites::Sprite::Sprite(const QJsonObject &json)
_rect = QRect(x, y, width, height);
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
_pixelRatio = json["pixelRatio"].toDouble();
else
_pixelRatio = 1.0;
if (json.contains("sdf") && json["sdf"].isBool())
_sdf = json["sdf"].toBool();
else
_sdf = false;
}
bool Sprites::load(const QString &jsonFile, const QString &imageFile)