From cd57e354feb0f01369bc35f6c48f9b893786880d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 28 Jun 2020 13:25:53 +0200 Subject: [PATCH] NOISSUE fix a bunch of valgrind errors --- api/logic/meta/BaseEntity.cpp | 8 ++++++-- api/logic/minecraft/PackProfile_p.h | 1 - api/logic/translations/TranslationsModel.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/api/logic/meta/BaseEntity.cpp b/api/logic/meta/BaseEntity.cpp index ce0be859..697beb56 100644 --- a/api/logic/meta/BaseEntity.cpp +++ b/api/logic/meta/BaseEntity.cpp @@ -53,7 +53,9 @@ public: /* methods */ auto fname = m_entity->localFilename(); try { - m_entity->parse(Json::requireObject(Json::requireDocument(data, fname), fname)); + auto doc = Json::requireDocument(data, fname); + auto obj = Json::requireObject(doc, fname); + m_entity->parse(obj); return true; } catch (const Exception &e) @@ -87,7 +89,9 @@ bool Meta::BaseEntity::loadLocalFile() // TODO: check if the file has the expected checksum try { - parse(Json::requireObject(Json::requireDocument(fname, fname), fname)); + auto doc = Json::requireDocument(fname, fname); + auto obj = Json::requireObject(doc, fname); + parse(obj); return true; } catch (const Exception &e) diff --git a/api/logic/minecraft/PackProfile_p.h b/api/logic/minecraft/PackProfile_p.h index 2f7cc3d7..6cd2a4e5 100644 --- a/api/logic/minecraft/PackProfile_p.h +++ b/api/logic/minecraft/PackProfile_p.h @@ -9,7 +9,6 @@ class MinecraftInstance; using ComponentContainer = QList; using ComponentIndex = QMap; -using ConnectionList = QList; struct PackProfileData { diff --git a/api/logic/translations/TranslationsModel.cpp b/api/logic/translations/TranslationsModel.cpp index a5a4fb15..43b3e75f 100644 --- a/api/logic/translations/TranslationsModel.cpp +++ b/api/logic/translations/TranslationsModel.cpp @@ -184,7 +184,8 @@ void readIndex(const QString & path, QMap& languages) int index = 1; try { - auto doc = Json::requireObject(Json::requireDocument(data)); + auto toplevel_doc = Json::requireDocument(data); + auto doc = Json::requireObject(toplevel_doc); auto file_type = Json::requireString(doc, "file_type"); if(file_type != "MMC-TRANSLATION-INDEX") {