[file-roller] password dialog: avoid compiler warnings



commit 8e3da8cec5d96b72c9b83daf0c52710ddebfc815
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Sep 26 15:43:23 2013 +0200

    password dialog: avoid compiler warnings
    
    'pwd_type' should be either MAIN_ARCHIVE or SECOND_ARCHIVE; so just assert in
    the last 'else {}'. This should make sure that the compiler understands that the
    code won't keep on at that point, and will skip warning about 'file' and
    'old_password' being used uninitialized.
    
       dlg-ask-password.c: In function ‘dlg_ask_password__common’:
       dlg-ask-password.c:135:5: warning: ‘old_password’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
         if (old_password != NULL) {
            ^
       dlg-ask-password.c:129:11: warning: ‘file’ may be used uninitialized in this function 
[-Wmaybe-uninitialized]
         filename = _g_file_get_display_basename (file);
                  ^
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708839

 src/dlg-ask-password.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/dlg-ask-password.c b/src/dlg-ask-password.c
index a27d9f1..a307ce4 100644
--- a/src/dlg-ask-password.c
+++ b/src/dlg-ask-password.c
@@ -124,7 +124,8 @@ dlg_ask_password__common (FrWindow       *window,
        else if (data->pwd_type == FR_PASSWORD_TYPE_SECOND_ARCHIVE) {
                file = fr_window_get_archive_file_for_paste (window);
                old_password = fr_window_get_password_for_second_archive (window);
-       }
+       } else
+               g_assert_not_reached ();
 
        filename = _g_file_get_display_basename (file);
        /* Translators: %s is a filename */


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