From b468aee01a3921e1b6439523281350f7e3d400be Mon Sep 17 00:00:00 2001 From: rogerman Date: Tue, 20 Jun 2023 17:12:53 -0700 Subject: [PATCH] Linux GTK Port: Fix compiling issues that prevented building. (Regression from commit aa21454.) --- desmume/src/frontend/posix/gtk/cheatsGTK.cpp | 19 ++++++++++--------- desmume/src/frontend/posix/gtk2/cheatsGTK.cpp | 19 ++++++++++--------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/desmume/src/frontend/posix/gtk/cheatsGTK.cpp b/desmume/src/frontend/posix/gtk/cheatsGTK.cpp index 1d1c653a9..ca74ba403 100644 --- a/desmume/src/frontend/posix/gtk/cheatsGTK.cpp +++ b/desmume/src/frontend/posix/gtk/cheatsGTK.cpp @@ -77,25 +77,26 @@ enabled_toggled(GtkCellRendererToggle * cell, GtkTreeModel *model = (GtkTreeModel *) data; GtkTreeIter iter; GtkTreePath *path = gtk_tree_path_new_from_string(path_str); - gboolean enabled; + gboolean guiEnabled; gtk_tree_model_get_iter(model, &iter, path); - gtk_tree_model_get(model, &iter, COLUMN_ENABLED, &enabled, -1); + gtk_tree_model_get(model, &iter, COLUMN_ENABLED, &guiEnabled, -1); - enabled ^= 1; - CHEATS_LIST cheat; + guiEnabled ^= 1; + const bool cheatEnabled = (guiEnabled) ? true : false; + CHEATS_LIST tempCheatItem; u32 ii; GtkTreePath *path1; path1 = gtk_tree_model_get_path (model, &iter); ii = gtk_tree_path_get_indices (path)[0]; - cheats->copyItemFromIndex(ii, cheat); + cheats->copyItemFromIndex(ii, tempCheatItem); - cheats->update(cheat.size, cheat.code[0][0], cheat.code[0][1], cheat.description, - enabled, ii); + cheats->update(tempCheatItem.size, tempCheatItem.code[0][0], tempCheatItem.code[0][1], tempCheatItem.description, + cheatEnabled, ii); - gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ENABLED, enabled, -1); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ENABLED, guiEnabled, -1); gtk_tree_path_free(path); } @@ -180,7 +181,7 @@ static void cheat_list_add_cheat(GtkWidget * widget, gpointer data) #define NEW_DESC "New cheat" GtkListStore *store = (GtkListStore *) data; GtkTreeIter iter; - cheats->add(1, 0, 0, g_strdup(NEW_DESC), FALSE); + cheats->add(1, 0, 0, g_strdup(NEW_DESC), false); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COLUMN_ENABLED, FALSE, diff --git a/desmume/src/frontend/posix/gtk2/cheatsGTK.cpp b/desmume/src/frontend/posix/gtk2/cheatsGTK.cpp index 0215adfd8..411243f4e 100644 --- a/desmume/src/frontend/posix/gtk2/cheatsGTK.cpp +++ b/desmume/src/frontend/posix/gtk2/cheatsGTK.cpp @@ -77,25 +77,26 @@ enabled_toggled(GtkCellRendererToggle * cell, GtkTreeModel *model = (GtkTreeModel *) data; GtkTreeIter iter; GtkTreePath *path = gtk_tree_path_new_from_string(path_str); - gboolean enabled; + gboolean guiEnabled; gtk_tree_model_get_iter(model, &iter, path); - gtk_tree_model_get(model, &iter, COLUMN_ENABLED, &enabled, -1); + gtk_tree_model_get(model, &iter, COLUMN_ENABLED, &guiEnabled, -1); - enabled ^= 1; - CHEATS_LIST cheat; + guiEnabled ^= 1; + const bool cheatEnabled = (guiEnabled) ? true : false; + CHEATS_LIST tempCheatItem; u32 ii; GtkTreePath *path1; path1 = gtk_tree_model_get_path (model, &iter); ii = gtk_tree_path_get_indices (path)[0]; - cheats->copyItemFromIndex(ii, cheat); + cheats->copyItemFromIndex(ii, tempCheatItem); - cheats->update(cheat.size, cheat.code[0][0], cheat.code[0][1], cheat.description, - enabled, ii); + cheats->update(tempCheatItem.size, tempCheatItem.code[0][0], tempCheatItem.code[0][1], tempCheatItem.description, + cheatEnabled, ii); - gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ENABLED, enabled, -1); + gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_ENABLED, guiEnabled, -1); gtk_tree_path_free(path); } @@ -180,7 +181,7 @@ static void cheat_list_add_cheat(GtkWidget * widget, gpointer data) #define NEW_DESC "New cheat" GtkListStore *store = (GtkListStore *) data; GtkTreeIter iter; - cheats->add(1, 0, 0, g_strdup(NEW_DESC), FALSE); + cheats->add(1, 0, 0, g_strdup(NEW_DESC), false); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, COLUMN_ENABLED, FALSE,