Save us 35 warnings about hooks_register_hook() return checks.
authorwwp <wwp@free.fr>
Sat, 17 Mar 2018 19:18:22 +0000 (20:18 +0100)
committerwwp <wwp@free.fr>
Sat, 17 Mar 2018 19:18:22 +0000 (20:18 +0100)
15 files changed:
src/avatars.c
src/main.c
src/plugins/address_keeper/address_keeper.c
src/plugins/attachwarner/attachwarner.c
src/plugins/bogofilter/bogofilter.c
src/plugins/bsfilter/bsfilter.c
src/plugins/clamd/clamav_plugin.c
src/plugins/demo/demo.c
src/plugins/fetchinfo/fetchinfo_plugin.c
src/plugins/libravatar/libravatar.c
src/plugins/newmail/newmail.c
src/plugins/notification/notification_plugin.c
src/plugins/python/python_plugin.c
src/plugins/spamassassin/spamassassin.c
src/statusbar.c

index ce03cdc..e731194 100644 (file)
@@ -93,19 +93,19 @@ gboolean avatars_internal_rendering_hook(gpointer source, gpointer data)
 
 void avatars_init(void)
 {
-       if (avatar_render_hook_id != -1) {
+       if (avatar_render_hook_id != (guint) -1) {
                g_warning("Internal avatars rendering already initialized");
                return;
        }
        avatar_render_hook_id = hooks_register_hook(AVATAR_IMAGE_RENDER_HOOKLIST, avatars_internal_rendering_hook, NULL);
-       if (avatar_render_hook_id == -1) {
+       if (avatar_render_hook_id == (guint) -1) {
                g_warning("Failed to register avatars internal rendering hook");
        }
 }
 
 void avatars_done(void)
 {
-       if (avatar_render_hook_id != -1) {
+       if (avatar_render_hook_id != (guint) -1) {
                hooks_unregister_hook(AVATAR_IMAGE_RENDER_HOOKLIST, avatar_render_hook_id);
                avatar_render_hook_id = -1;
        }
index c404a3d..cb86e59 100644 (file)
@@ -872,9 +872,9 @@ static void uninstall_dbus_status_handler(void)
        if(awn_proxy)
                g_object_unref(awn_proxy);
        awn_proxy = NULL;
-       if (dbus_item_hook_id != -1)
+       if (dbus_item_hook_id != (guint) -1)
                hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, dbus_item_hook_id);
-       if (dbus_folder_hook_id != -1)
+       if (dbus_folder_hook_id != (guint) -1)
                hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, dbus_folder_hook_id);
 }
 
@@ -948,14 +948,14 @@ static void install_dbus_status_handler(void)
                        "/com/google/code/Awn",
                        "com.google.code.Awn");
        dbus_item_hook_id = hooks_register_hook (FOLDER_ITEM_UPDATE_HOOKLIST, dbus_status_update_item_hook, NULL);
-       if (dbus_item_hook_id == -1) {
+       if (dbus_item_hook_id == (guint) -1) {
                g_warning("Failed to register folder item update hook");
                uninstall_dbus_status_handler();
                return;
        }
 
        dbus_folder_hook_id = hooks_register_hook (FOLDER_UPDATE_HOOKLIST, dbus_status_update_folder_hook, NULL);
-       if (dbus_folder_hook_id == -1) {
+       if (dbus_folder_hook_id == (guint) -1) {
                g_warning("Failed to register folder update hook");
                uninstall_dbus_status_handler();
                return;
index d85d949..c85b6fb 100644 (file)
@@ -248,7 +248,7 @@ gint plugin_init(gchar **error)
        hook_id = hooks_register_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, 
                                      addrk_before_send_hook, NULL);
        
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                *error = g_strdup(_("Failed to register check before send hook"));
                return -1;
        }
index 7ada74b..3f782f5 100644 (file)
@@ -248,7 +248,7 @@ gint plugin_init(gchar **error)
        hook_id = hooks_register_hook(COMPOSE_CHECK_BEFORE_SEND_HOOKLIST, 
                                      attwarn_before_send_hook, NULL);
        
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                *error = g_strdup(_("Failed to register check before send hook"));
                return -1;
        }
index 07a764b..85c5ddb 100644 (file)
@@ -959,7 +959,7 @@ FolderItem *bogofilter_get_spam_folder(MsgInfo *msginfo)
 
 gboolean plugin_done(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                bogofilter_unregister_hook();
        }
 #ifdef USE_PTHREAD
@@ -1021,9 +1021,9 @@ struct PluginFeature *plugin_provides(void)
 
 void bogofilter_register_hook(void)
 {
-       if (hook_id == -1)
+       if (hook_id == (guint) -1)
                hook_id = hooks_register_hook(MAIL_LISTFILTERING_HOOKLIST, mail_filtering_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                g_warning("Failed to register mail filtering hook");
                config.process_emails = FALSE;
        }
@@ -1031,7 +1031,7 @@ void bogofilter_register_hook(void)
 
 void bogofilter_unregister_hook(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                hooks_unregister_hook(MAIL_LISTFILTERING_HOOKLIST, hook_id);
        }
        hook_id = -1;
index 127e677..9390983 100644 (file)
@@ -592,7 +592,7 @@ FolderItem *bsfilter_get_spam_folder(MsgInfo *msginfo)
 
 gboolean plugin_done(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                bsfilter_unregister_hook();
        }
 #ifdef USE_PTHREAD
@@ -654,9 +654,9 @@ struct PluginFeature *plugin_provides(void)
 
 void bsfilter_register_hook(void)
 {
-       if (hook_id == -1)
+       if (hook_id == (guint) -1)
                hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                g_warning("Failed to register mail filtering hook");
                config.process_emails = FALSE;
        }
@@ -664,7 +664,7 @@ void bsfilter_register_hook(void)
 
 void bsfilter_unregister_hook(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                hooks_unregister_hook(MAIL_FILTERING_HOOKLIST, hook_id);
        }
        hook_id = -1;
index 7653d47..8a2736c 100644 (file)
@@ -276,7 +276,7 @@ gint plugin_init(gchar **error)
                return -1;
 
        hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                *error = g_strdup(_("Failed to register mail filtering hook"));
                return -1;
        }
index 751c33f..d5f484c 100644 (file)
@@ -48,7 +48,7 @@ gint plugin_init(gchar **error)
                return -1;
 
        hook_id = hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, my_log_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                *error = g_strdup(_("Failed to register log text hook"));
                return -1;
        }
index 04faead..bf350dd 100644 (file)
@@ -162,7 +162,7 @@ gint plugin_init(gchar **error)
                return -1;
 
        mail_receive_hook_id = hooks_register_hook(MAIL_RECEIVE_HOOKLIST, mail_receive_hook, NULL);
-       if (mail_receive_hook_id == (guint)-1) {
+       if (mail_receive_hook_id == (guint) -1) {
                /* i18n: Possible error message during plugin load */
                *error = g_strdup(_("Failed to register mail receive hook"));
                return -1;
index 7ce4341..b8da96c 100644 (file)
@@ -313,12 +313,12 @@ static void missing_cache_done()
 
 static void unregister_hooks()
 {
-       if (render_hook_id != -1) {
+       if (render_hook_id != (guint) -1) {
                hooks_unregister_hook(AVATAR_IMAGE_RENDER_HOOKLIST,
                                      render_hook_id);
                render_hook_id = -1;
        }
-       if (update_hook_id != -1) {
+       if (update_hook_id != (guint) -1) {
                hooks_unregister_hook(AVATAR_HEADER_UPDATE_HOOKLIST,
                                      update_hook_id);
                update_hook_id = -1;
@@ -341,7 +341,7 @@ gint plugin_init(gchar **error)
        update_hook_id = hooks_register_hook(AVATAR_HEADER_UPDATE_HOOKLIST,
                                             libravatar_header_update_hook,
                                             NULL);
-       if (update_hook_id == -1) {
+       if (update_hook_id == (guint) -1) {
                *error = g_strdup(_("Failed to register avatar header update hook"));
                return -1;
        }
@@ -349,7 +349,7 @@ gint plugin_init(gchar **error)
        render_hook_id = hooks_register_hook(AVATAR_IMAGE_RENDER_HOOKLIST,
                                             libravatar_image_render_hook,
                                             NULL);
-       if (render_hook_id == -1) {
+       if (render_hook_id == (guint) -1) {
                unregister_hooks();
                *error = g_strdup(_("Failed to register avatar image render hook"));
                return -1;
index 5888748..1d77954 100644 (file)
@@ -107,7 +107,7 @@ gint plugin_init (gchar **error)
                return -1;
 
        hook_id = hooks_register_hook (MAIL_POSTFILTERING_HOOKLIST, newmail_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                *error = g_strdup (_("Failed to register newmail hook"));
                return (-1);
        }
index 0da3c1f..1cc8c9f 100644 (file)
@@ -302,7 +302,7 @@ gint plugin_init(gchar **error)
   }
 
   hook_theme_changed = hooks_register_hook(THEME_CHANGED_HOOKLIST, my_update_theme_hook, NULL);
-  if(hook_theme_changed == (guint)-1) {
+  if(hook_theme_changed == (guint) -1) {
     *error = g_strdup(_("Failed to register theme change hook in the "
       "Notification plugin"));
     hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item);
index 0b0d813..1634a76 100644 (file)
@@ -653,7 +653,7 @@ gint plugin_init(gchar **error)
 
   /* load hooks */
   hook_compose_create = hooks_register_hook(COMPOSE_CREATED_HOOKLIST, my_compose_create_hook, NULL);
-  if(hook_compose_create == (guint)-1) {
+  if(hook_compose_create == (guint) -1) {
     *error = g_strdup(_("Failed to register \"compose create hook\" in the Python plugin"));
     return -1;
   }
index 59fd92a..84aa9a6 100644 (file)
@@ -513,7 +513,7 @@ gboolean spamassassin_check_username(void)
        if (config.username == NULL || config.username[0] == '\0') {
                config.username = (gchar*)g_get_user_name();
                if (config.username == NULL) {
-                       if (hook_id != -1) {
+                       if (hook_id != (guint) -1) {
                                spamassassin_unregister_hook();
                        }
                        procmsg_unregister_spam_learner(spamassassin_learn);
@@ -571,7 +571,7 @@ gint plugin_init(gchar **error)
 
 gboolean plugin_done(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                spamassassin_unregister_hook();
        }
        g_free(config.hostname);
@@ -629,9 +629,9 @@ struct PluginFeature *plugin_provides(void)
 
 void spamassassin_register_hook(void)
 {
-       if (hook_id == -1)
+       if (hook_id == (guint) -1)
                hook_id = hooks_register_hook(MAIL_FILTERING_HOOKLIST, mail_filtering_hook, NULL);
-       if (hook_id == -1) {
+       if (hook_id == (guint) -1) {
                g_warning("Failed to register mail filtering hook");
                config.process_emails = FALSE;
        }
@@ -639,7 +639,7 @@ void spamassassin_register_hook(void)
 
 void spamassassin_unregister_hook(void)
 {
-       if (hook_id != -1) {
+       if (hook_id != (guint) -1) {
                hooks_unregister_hook(MAIL_FILTERING_HOOKLIST, hook_id);
        }
        hook_id = -1;
index 13d6bb6..12fdb1d 100644 (file)
@@ -37,7 +37,7 @@
 #define BUFFSIZE 1024
 
 static GList *statusbar_list = NULL;
-gint statusbar_puts_all_hook_id = -1;
+guint statusbar_puts_all_hook_id = -1;
 
 GtkWidget *statusbar_create(void)
 {
@@ -149,10 +149,10 @@ static gboolean statusbar_puts_all_hook (gpointer source, gpointer data)
 
 void statusbar_verbosity_set(gboolean verbose)
 {
-       if (verbose && (statusbar_puts_all_hook_id == -1)) {
+       if (verbose && (statusbar_puts_all_hook_id == (guint) -1)) {
                statusbar_puts_all_hook_id =
                        hooks_register_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook, NULL);
-       } else if (!verbose && (statusbar_puts_all_hook_id != -1)) {
+       } else if (!verbose && (statusbar_puts_all_hook_id != (guint) -1)) {
                hooks_unregister_hook(LOG_APPEND_TEXT_HOOKLIST, statusbar_puts_all_hook_id);
                statusbar_puts_all_hook_id = -1;
                statusbar_pop_all();