[bijiben] src: Add missing cases to switch statements



commit 8485002ad1858d804c8d932a1908cb0cad963ab2
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Thu Apr 27 15:02:58 2017 +0800

    src: Add missing cases to switch statements
    
    This makes it more explicit about how each element in an enum is handled
    by the switch.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762648
    
    Signed-off-by: Isaque Galdino <igaldino gmail com>

 src/bjb-main-toolbar.c                            |    5 +--
 src/libbiji/deserializer/biji-lazy-deserializer.c |    3 ++
 src/libbiji/deserializer/biji-tomboy-reader.c     |   31 +++++++++++---------
 src/libbiji/editor/biji-editor-selection.c        |   12 +++++---
 4 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 9cadd85..a1449d8 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -36,8 +36,7 @@ typedef enum
   BJB_TOOLBAR_TRASH_LIST,
   BJB_TOOLBAR_TRASH_ICON,
   BJB_TOOLBAR_TRASH_SELECT,
-  BJB_TOOLBAR_NOTE_VIEW,
-  BJB_TOOLBAR_NUM
+  BJB_TOOLBAR_NOTE_VIEW
 } BjbToolbarType;
 
 /* Color Button */
@@ -1016,7 +1015,7 @@ populate_main_toolbar(BjbMainToolbar *self)
     /* Not really a toolbar,
      * still used for Spinner */
     default:
-      to_be = BJB_TOOLBAR_0;
+      break;
   }
 
 
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c 
b/src/libbiji/deserializer/biji-lazy-deserializer.c
index 2559524..321518e 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -278,6 +278,9 @@ process_tomboy_node (BijiLazyDeserializer *self)
     case XML_DTD_NODE:
       process_tomboy_text_elem (self);
       break;
+
+    default:
+      break;
   }
 }
 
diff --git a/src/libbiji/deserializer/biji-tomboy-reader.c b/src/libbiji/deserializer/biji-tomboy-reader.c
index 01ede3e..1619c01 100644
--- a/src/libbiji/deserializer/biji-tomboy-reader.c
+++ b/src/libbiji/deserializer/biji-tomboy-reader.c
@@ -1,18 +1,18 @@
 /*
  * biji-tomboy-reader.c
- * 
+ *
  * Copyright 2013 Pierre-Yves Luyten <py luyten fr>
- * 
+ *
  * bijiben is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * bijiben is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -46,7 +46,7 @@ enum {
 static GParamSpec *properties[TOMBOY_READER_PROP] = { NULL, };
 
 
-typedef enum 
+typedef enum
 {
   NO_TYPE,
   TOMBOY_1,
@@ -130,7 +130,7 @@ process_tomboy_end_elem (BijiTomboyReader *self)
 {
   BijiTomboyReaderPrivate *priv = self->priv;
   const gchar *element_name;
-  
+
   element_name = (const gchar *) xmlTextReaderConstName (priv->inner);
 
   if (g_strcmp0 (element_name, "note-content")==0)
@@ -211,6 +211,9 @@ process_tomboy_node (BijiTomboyReader *self)
     case XML_DTD_NODE:
       process_tomboy_text_elem (self);
       break;
+
+    default:
+      break;
   }
 }
 
@@ -248,7 +251,7 @@ process_tomboy_xml_content (BijiTomboyReader *self, gchar *text)
 
 
 static void
-processNode (BijiTomboyReader *self) 
+processNode (BijiTomboyReader *self)
 {
   BijiTomboyReaderPrivate *priv;
   xmlTextReaderPtr r;
@@ -264,7 +267,7 @@ processNode (BijiTomboyReader *self)
 
   if (g_strcmp0 (name, "title") == 0)
     priv->set->title = (gchar*) xmlTextReaderReadString (r);
-    
+
 
   if (g_strcmp0(name, "text") == 0)
   {
@@ -297,7 +300,7 @@ processNode (BijiTomboyReader *self)
 
 
 
-  if (g_strcmp0 (name,"tag") == 0 )  
+  if (g_strcmp0 (name,"tag") == 0 )
   {
     tag = (gchar*) xmlTextReaderReadString(r);
 
@@ -330,15 +333,15 @@ biji_tomboy_reader_constructed (GObject *obj)
   BijiTomboyReaderPrivate *priv;
   xmlDocPtr doc;
   xmlNodePtr cur;
-  xmlChar     *version; 
+  xmlChar     *version;
 
   self = BIJI_TOMBOY_READER (obj);
   priv = self->priv;
- 
+
 
   doc = xmlParseFile (priv->path);
 
-  if (doc == NULL ) 
+  if (doc == NULL )
   {
     priv->error = biji_error_new (BIJI_ERROR_SOURCE,
                                   "File not parsed successfully");
@@ -348,7 +351,7 @@ biji_tomboy_reader_constructed (GObject *obj)
 
   cur = xmlDocGetRootElement (doc);
 
-  if (cur == NULL) 
+  if (cur == NULL)
   {
     priv->error = biji_error_new (BIJI_ERROR_SOURCE,
                                   "File empty");
@@ -357,7 +360,7 @@ biji_tomboy_reader_constructed (GObject *obj)
   }
 
 
-  if (xmlStrcmp(cur->name, (const xmlChar *) "note")) 
+  if (xmlStrcmp(cur->name, (const xmlChar *) "note"))
   {
     priv->error = biji_error_new (BIJI_ERROR_SOURCE,
                                   "Root node != note");
diff --git a/src/libbiji/editor/biji-editor-selection.c b/src/libbiji/editor/biji-editor-selection.c
index 768328c..fc38d7c 100644
--- a/src/libbiji/editor/biji-editor-selection.c
+++ b/src/libbiji/editor/biji-editor-selection.c
@@ -113,20 +113,22 @@ e_editor_selection_get_property (GObject *object,
                case PROP_BOLD:
                        g_value_set_boolean (value,
                                e_editor_selection_get_bold (selection));
-                       return;
+                       break;
 
                case PROP_ITALIC:
                        g_value_set_boolean (value,
                                e_editor_selection_get_italic (selection));
-                       return;
+                       break;
 
                case PROP_STRIKE_THROUGH:
                        g_value_set_boolean (value,
                                e_editor_selection_get_strike_through (selection));
-                       return;
-       }
+                       break;
 
-       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                       break;
+       }
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]