Fix entity data not being gzipped when adding id+version

This commit is contained in:
Ryan Huffman 2018-02-12 11:46:45 -08:00 committed by Atlante45
parent ff5be2d690
commit 1b7b4eee50
3 changed files with 14 additions and 1 deletions

View file

@ -1193,7 +1193,7 @@ void OctreeServer::handleOctreeDataFileReply(QSharedPointer<ReceivedMessage> mes
QFile file(_persistAbsoluteFilePath);
if (file.open(QIODevice::WriteOnly)) {
auto entityData = data.toByteArray();
auto entityData = data.toGzippedByteArray();
file.write(entityData);
file.close();
} else {

View file

@ -152,3 +152,15 @@ QByteArray OctreeUtils::RawOctreeData::toByteArray() {
return doc.toJson();
}
QByteArray OctreeUtils::RawOctreeData::toGzippedByteArray() {
auto data = toByteArray();
QByteArray gzData;
if (!gzip(data, gzData, -1)) {
qCritical("Unable to gzip data while converting json.");
return QByteArray();
}
return gzData;
}

View file

@ -31,6 +31,7 @@ public:
QJsonArray octreeData;
QByteArray toByteArray();
QByteArray toGzippedByteArray();
};
bool readOctreeFile(QString path, QJsonDocument* doc);