From 5db9effac12d781f179e329ea138fb531a5ae2a0 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Wed, 2 Jan 2019 19:54:33 +0100
Subject: Got ride of some uninitialized variable usages.

---
 src/analysis/db/collection.c | 14 ++++++++------
 src/gtkext/tiledgrid.c       |  5 +++++
 src/gui/core/panels.c        |  5 +++--
 src/gui/menus/edition.c      |  2 +-
 src/gui/panels/bintree.c     |  9 +++++++--
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/analysis/db/collection.c b/src/analysis/db/collection.c
index 2c6086a..0e4f756 100644
--- a/src/analysis/db/collection.c
+++ b/src/analysis/db/collection.c
@@ -293,12 +293,12 @@ bool _g_db_collection_unpack(GDbCollection *collec, packed_buffer *pbuf, DBActio
     GDbItem *item;                          /* Définition d'élément visé   */
 
     result = extract_packed_buffer(pbuf, &tmp32, sizeof(uint32_t), true);
-    if (!result) goto exit;
+    if (!result) goto qck_exit;
 
     *action = tmp32;
 
     result = (*action >= 0 && *action < DBA_COUNT);
-    if (!result) goto exit;
+    if (!result) goto qck_exit;
 
     item = g_object_new(collec->type, NULL);
 
@@ -306,14 +306,16 @@ bool _g_db_collection_unpack(GDbCollection *collec, packed_buffer *pbuf, DBActio
     if (!result) goto exit;
 
     if (dest != NULL)
+    {
+        g_object_ref(G_OBJECT(item));
         *dest = item;
-    else
-        g_object_unref(G_OBJECT(item));
+    }
 
  exit:
 
-    if (!result)
-        g_object_unref(G_OBJECT(item));
+    g_object_unref(G_OBJECT(item));
+
+ qck_exit:
 
     return result;
 
diff --git a/src/gtkext/tiledgrid.c b/src/gtkext/tiledgrid.c
index 577550d..0256563 100644
--- a/src/gtkext/tiledgrid.c
+++ b/src/gtkext/tiledgrid.c
@@ -543,6 +543,11 @@ static grid_tile_t *split_tile(grid_tile_t **tile, const char *path, char endpoi
             new = create_inter_tile((*tile)->parent, true, result, *tile);
             break;
 
+        default:
+            assert(false);
+            new = NULL;
+            break;
+
     }
 
     /* Connexions */
diff --git a/src/gui/core/panels.c b/src/gui/core/panels.c
index 4564f86..71aee86 100644
--- a/src/gui/core/panels.c
+++ b/src/gui/core/panels.c
@@ -181,6 +181,8 @@ bool _browse_all_item_panels(bool skip, handle_panel_item_fc handle, void *data)
 
     if (skip)
         welcome = get_panel_item_by_name(PANEL_WELCOME_ID);
+    else
+        welcome = NULL;
 
     panels_list_for_each(iter, _panels_list)
     {
@@ -193,8 +195,7 @@ bool _browse_all_item_panels(bool skip, handle_panel_item_fc handle, void *data)
 
     }
 
-    if (skip)
-        g_object_unref(G_OBJECT(welcome));
+    g_clear_object(&welcome);
 
     return result;
 
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index be045b5..f4b0712 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -358,7 +358,7 @@ void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCu
         if (g_line_cursor_is_valid(cursor))
             creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
         else
-            cursor = NULL;
+            creator = NULL;
 
     }
 
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c
index d45fa0b..ffecd6e 100644
--- a/src/gui/panels/bintree.c
+++ b/src/gui/panels/bintree.c
@@ -134,7 +134,7 @@ static bool populate_tree_with_portion(GBinPortion *, GBinPortion *, BinaryPorti
 static void reload_portions_for_new_tree_view(const GBintreePanel *, GtkStatusStack *, activity_id_t, bintree_update_data *);
 
 /* Met en surbrillance les éléments recherchés dans les noms. */
-static void update_bintree_column_in_tree_view(GtkTreeStore *, GtkTreeIter *, GBinPortion *, gint, const regmatch_t *);
+static void update_bintree_column_in_tree_view(GtkTreeStore *, GtkTreeIter *, GBinPortion *, BinaryTreeColumn, const regmatch_t *);
 
 
 
@@ -786,7 +786,7 @@ static void reload_portions_for_new_tree_view(const GBintreePanel *panel, GtkSta
 *                                                                             *
 ******************************************************************************/
 
-static void update_bintree_column_in_tree_view(GtkTreeStore *store, GtkTreeIter *iter, GBinPortion *portion, gint column, const regmatch_t *match)
+static void update_bintree_column_in_tree_view(GtkTreeStore *store, GtkTreeIter *iter, GBinPortion *portion, BinaryTreeColumn column, const regmatch_t *match)
 {
     const char *content;                    /* Contenu brut d'origine      */
     const mrange_t *range;                  /* Espace de portion à traiter */
@@ -824,6 +824,11 @@ static void update_bintree_column_in_tree_view(GtkTreeStore *store, GtkTreeIter
             content = hrights;
             break;
 
+        default:
+            assert(false);
+            content = NULL;
+            break;
+
     }
 
     value = build_highlighted_name(content, match, 0);
-- 
cgit v0.11.2-87-g4458