From 7fe10dea3ede8553bcc4ac8e8a34707557f789b2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 11 Sep 2018 22:28:28 -0400 Subject: [PATCH 1/2] game_list: Use QJsonValueRef() within LoadCompatibilityList() This way, we aren't constructing unnecessary QJsonValue instances. --- src/yuzu/game_list.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 8c6e16d470..9dfd6a7083 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -366,7 +366,7 @@ void GameList::LoadCompatibilityList() { QJsonDocument json = QJsonDocument::fromJson(string_content.toUtf8()); QJsonArray arr = json.array(); - for (const QJsonValue& value : arr) { + for (const QJsonValueRef& value : arr) { QJsonObject game = value.toObject(); if (game.contains("compatibility") && game["compatibility"].isDouble()) { @@ -374,7 +374,7 @@ void GameList::LoadCompatibilityList() { QString directory = game["directory"].toString(); QJsonArray ids = game["releases"].toArray(); - for (const QJsonValue& value : ids) { + for (const QJsonValueRef& value : ids) { QJsonObject object = value.toObject(); QString id = object["id"].toString(); compatibility_list.emplace( From 0e61e8362f1e8c082eb40f6cc7200e091d0452e8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 11 Sep 2018 22:34:07 -0400 Subject: [PATCH 2/2] game_list: Resolve variable shadowing within LoadCompatibilityList() "value" is already a used variable name within the outermost ranged-for loop, so this variable was shadowing the outer one. This isn't a bug, but it will get rid of a -Wshadow warning. --- src/yuzu/game_list.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 9dfd6a7083..3b3b551bb7 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -374,9 +374,9 @@ void GameList::LoadCompatibilityList() { QString directory = game["directory"].toString(); QJsonArray ids = game["releases"].toArray(); - for (const QJsonValueRef& value : ids) { - QJsonObject object = value.toObject(); - QString id = object["id"].toString(); + for (const QJsonValueRef& id_ref : ids) { + QJsonObject id_object = id_ref.toObject(); + QString id = id_object["id"].toString(); compatibility_list.emplace( id.toUpper().toStdString(), std::make_pair(QString::number(compatibility), directory));