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