[file-roller] ace: avoid compiler warnings



commit 7a6b126b652e9e629de7570a17f12bf969bd61d6
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Sep 26 15:44:25 2013 +0200

    ace: avoid compiler warnings
    
    Skip compiler warnings about 'fields' or 'field_name' being used uninitialized.
    
      fr-command-ace.c: In function ‘process_line’:
      fr-command-ace.c:135:20: warning: ‘field_name’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
        if (field_name[0] != '/') {
                          ^
      fr-command-ace.c:122:40: warning: ‘fields’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
        if ((fields == NULL) || (fields[0] == NULL) || (g_strv_length (fields) < 5))
                                           ^
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708839

 src/fr-command-ace.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/fr-command-ace.c b/src/fr-command-ace.c
index fb3a84f..507a6f1 100644
--- a/src/fr-command-ace.c
+++ b/src/fr-command-ace.c
@@ -118,6 +118,8 @@ process_line (char     *line,
                fields = g_strsplit (line, "|", 6);
        else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE)
                fields = _g_str_split_line (line, 5);
+       else
+               fields = NULL;
 
        if ((fields == NULL) || (fields[0] == NULL) || (g_strv_length (fields) < 5))
                return;
@@ -131,6 +133,8 @@ process_line (char     *line,
        }
        else if (ace_comm->command_type == FR_ACE_COMMAND_NONFREE)
                field_name = _g_str_get_last_field (line, 6);
+       else
+               g_assert_not_reached ();
 
        if (field_name[0] != '/') {
                fdata->full_path = g_strconcat ("/", field_name, NULL);


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