From e8009661bc2a647678b944a09ee3a7e218692e44 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 20 Oct 2020 23:44:30 +0200
Subject: Fixed some compilation warnings.

---
 plugins/arm/v7/operands/offset.c   |  6 ++----
 plugins/arm/v7/operands/rotation.c |  6 ++----
 plugins/arm/v7/operands/shift.c    |  6 ++----
 plugins/itanium/component.c        |  1 +
 src/analysis/db/server.c           |  3 +++
 src/analysis/routine.c             | 41 ++++++++++++++++++++++----------------
 src/arch/operands/immediate.c      |  8 +++++---
 src/gui/editor.c                   |  2 ++
 8 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/plugins/arm/v7/operands/offset.c b/plugins/arm/v7/operands/offset.c
index 967b296..75fd6a0 100644
--- a/plugins/arm/v7/operands/offset.c
+++ b/plugins/arm/v7/operands/offset.c
@@ -263,6 +263,8 @@ static GArchOperand *g_armv7_offset_operand_get_inner_operand_from_path(const GA
 {
     GArchOperand *result;                   /* Opérande trouvée à renvoyer */
 
+    result = NULL;
+
     if (strncmp(path, "0", 1) == 0)
         switch (path[1])
         {
@@ -275,10 +277,6 @@ static GArchOperand *g_armv7_offset_operand_get_inner_operand_from_path(const GA
                 result = g_arch_operand_get_inner_operand_from_path(operand->value, path + 1);
                 break;
 
-            default:
-                result = NULL;
-                break;
-
         }
 
     return result;
diff --git a/plugins/arm/v7/operands/rotation.c b/plugins/arm/v7/operands/rotation.c
index 5db1d27..bd99e63 100644
--- a/plugins/arm/v7/operands/rotation.c
+++ b/plugins/arm/v7/operands/rotation.c
@@ -279,6 +279,8 @@ static GArchOperand *g_armv7_rotation_operand_get_inner_operand_from_path(const
 {
     GArchOperand *result;                   /* Opérande trouvée à renvoyer */
 
+    result = NULL;
+
     if (strncmp(path, "0", 1) == 0)
         switch (path[1])
         {
@@ -291,10 +293,6 @@ static GArchOperand *g_armv7_rotation_operand_get_inner_operand_from_path(const
                 result = g_arch_operand_get_inner_operand_from_path(operand->value, path + 1);
                 break;
 
-            default:
-                result = NULL;
-                break;
-
         }
 
     return result;
diff --git a/plugins/arm/v7/operands/shift.c b/plugins/arm/v7/operands/shift.c
index 8da666e..a25f36c 100644
--- a/plugins/arm/v7/operands/shift.c
+++ b/plugins/arm/v7/operands/shift.c
@@ -263,6 +263,8 @@ static GArchOperand *g_armv7_shift_operand_get_inner_operand_from_path(const GAr
 {
     GArchOperand *result;                   /* Opérande trouvée à renvoyer */
 
+    result = NULL;
+
     if (strncmp(path, "0", 1) == 0)
         switch (path[1])
         {
@@ -275,10 +277,6 @@ static GArchOperand *g_armv7_shift_operand_get_inner_operand_from_path(const GAr
                 result = g_arch_operand_get_inner_operand_from_path(operand->shift_value, path + 1);
                 break;
 
-            default:
-                result = NULL;
-                break;
-
         }
 
     return result;
diff --git a/plugins/itanium/component.c b/plugins/itanium/component.c
index 25ea175..558936a 100644
--- a/plugins/itanium/component.c
+++ b/plugins/itanium/component.c
@@ -1087,6 +1087,7 @@ char *itd_translate_component(const itanium_component *comp, char *base)
                     break;
                 default:
                     assert(false);
+                    result = NULL;
                     break;
             }
 
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index 252fcb3..258a66c 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -548,7 +548,10 @@ GHubServer *g_hub_server_new_remote(const char *host, const char *port, bool ipv
     }
 
     else
+    {
         assert(false);
+        ip = NULL;
+    }
 
     if (ip == NULL)
     {
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index 422e7de..99f1b28 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -868,25 +868,32 @@ char *g_binary_routine_to_string(const GBinRoutine *routine, bool include)
     else if (routine->name != NULL)
         name = routine->name;
 
-    switch (routine->type)
-    {
-        case RTT_CONSTRUCTOR:
-            result = stradd(result, name);
-            result = stradd(result, routine->ns_sep);
-            result = stradd(result, name);
-            break;
+    else
+        name = NULL;
 
-        case RTT_DESTRUCTOR:
-            result = stradd(result, name);
-            result = stradd(result, routine->ns_sep);
-            result = stradd(result, "~");
-            result = stradd(result, name);
-            break;
+    if (name != NULL)
+    {
+        switch (routine->type)
+        {
+            case RTT_CONSTRUCTOR:
+                result = stradd(result, name);
+                result = stradd(result, routine->ns_sep);
+                result = stradd(result, name);
+                break;
+
+            case RTT_DESTRUCTOR:
+                result = stradd(result, name);
+                result = stradd(result, routine->ns_sep);
+                result = stradd(result, "~");
+                result = stradd(result, name);
+                break;
+
+            default: /* Pour gcc */
+            case RTT_CLASSIC:
+                result = stradd(result, name);
+                break;
 
-        default: /* Pour gcc */
-        case RTT_CLASSIC:
-            result = stradd(result, name);
-            break;
+        }
 
     }
 
diff --git a/src/arch/operands/immediate.c b/src/arch/operands/immediate.c
index 746bcae..2a3ca0b 100644
--- a/src/arch/operands/immediate.c
+++ b/src/arch/operands/immediate.c
@@ -667,6 +667,8 @@ bool g_imm_operand_get_value(const GImmOperand *operand, MemoryDataSize size, ..
     int32_t *sval32;                        /* Valeur sur 32 bits          */
     int64_t *sval64;                        /* Valeur sur 64 bits          */
 
+    result = false;
+
     extra = GET_IMM_OP_EXTRA(operand);
 
     g_bit_lock(&extra->lock, HOLE_LOCK_BIT);
@@ -674,15 +676,13 @@ bool g_imm_operand_get_value(const GImmOperand *operand, MemoryDataSize size, ..
     if (extra->size != size)
         goto exit;
 
-    result = true;
-
     va_start(ap, size);
 
     switch (size)
     {
         /* Pour GCC... */
         case MDS_UNDEFINED:
-            result = false;
+            goto exit;
             break;
         case MDS_4_BITS_UNSIGNED:
         case MDS_8_BITS_UNSIGNED:
@@ -722,6 +722,8 @@ bool g_imm_operand_get_value(const GImmOperand *operand, MemoryDataSize size, ..
 
     va_end(ap);
 
+    result = true;
+
  exit:
 
     g_bit_unlock(&extra->lock, HOLE_LOCK_BIT);
diff --git a/src/gui/editor.c b/src/gui/editor.c
index 1d4190f..1a58b90 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -332,6 +332,8 @@ static void connect_all_editor_signals(GtkBuilder *builder, GObject *obj, const
     {
         if (g_module_supported())
             module = g_module_open(NULL, G_MODULE_BIND_LAZY);
+        else
+            module = NULL;
 
         if (module == NULL)
         {
-- 
cgit v0.11.2-87-g4458