mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-23 19:25:55 +01:00
Code cleanup
This commit is contained in:
parent
a298cfc47d
commit
032c699e8b
@ -1,11 +1,10 @@
|
||||
#include <QtEndian>
|
||||
#include <QDebug>
|
||||
#include <QIODevice>
|
||||
#include <zlib.h>
|
||||
#include "gzip.h"
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
QByteArray Gzip::uncompress(QIODevice *device, qint64 limit)
|
||||
QByteArray Gzip::uncompress(QIODevice *device, int limit)
|
||||
{
|
||||
int ret;
|
||||
z_stream strm;
|
||||
|
@ -7,7 +7,7 @@ class QIODevice;
|
||||
|
||||
namespace Gzip
|
||||
{
|
||||
QByteArray uncompress(QIODevice *device, qint64 limit = 0);
|
||||
QByteArray uncompress(QIODevice *device, int limit = 0);
|
||||
}
|
||||
|
||||
#endif // GZIP_H
|
||||
|
@ -65,12 +65,14 @@ bool PBFHandler::read(QImage *image)
|
||||
return false;
|
||||
|
||||
QByteArray ba;
|
||||
if (isGZIPPBF(magic))
|
||||
if (isGZIPPBF(magic)) {
|
||||
ba = Gzip::uncompress(device());
|
||||
else if (isPlainPBF(magic))
|
||||
ba = device()->readAll();
|
||||
if (ba.isNull())
|
||||
if (ba.isNull()) {
|
||||
qCritical() << "Invalid gzip data";
|
||||
return false;
|
||||
}
|
||||
} else if (isPlainPBF(magic))
|
||||
ba = device()->readAll();
|
||||
vector_tile::Tile data;
|
||||
if (!data.ParseFromArray(ba.constData(), ba.size())) {
|
||||
qCritical() << "Invalid PBF data";
|
||||
|
Loading…
Reference in New Issue
Block a user