[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Fix warnings reported by Clang (Bug #13931)

noreply at xfce.org noreply at xfce.org
Sun Oct 22 14:37:27 CEST 2017


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-notifyd.

commit 9c3e85d8a7ca47b67795d20f512b81c12df246d7
Author: Olivier Duchateau <duchateau.olivier at gmail.com>
Date:   Wed Oct 18 10:32:07 2017 +0200

    Fix warnings reported by Clang (Bug #13931)
    
    Mostly assignment of variables.
---
 panel-plugin/notification-plugin-log.c | 12 +++++++++---
 xfce4-notifyd-config/main.c            | 19 +++++++++++++++----
 xfce4-notifyd/xfce-notify-daemon.c     |  6 +++---
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/panel-plugin/notification-plugin-log.c b/panel-plugin/notification-plugin-log.c
index dcc7456..caa3aaa 100644
--- a/panel-plugin/notification-plugin-log.c
+++ b/panel-plugin/notification-plugin-log.c
@@ -144,7 +144,7 @@ notification_plugin_menu_populate (NotificationPlugin *notification_plugin)
       const char *tooltip_format_simple = "<b>\%s</b> - \%s";
       char *markup;
       gchar *app_name;
-      gchar *tooltip_timestamp;
+      gchar *tooltip_timestamp = NULL;
       gchar *tmp;
       GTimeVal tv;
       GDateTime *log_timestamp;
@@ -158,7 +158,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 G_GNUC_END_IGNORE_DEPRECATIONS
 
       if (g_time_val_from_iso8601 (group, &tv) == TRUE) {
-        if (log_timestamp = g_date_time_new_from_timeval_local (&tv)) {
+        log_timestamp = g_date_time_new_from_timeval_local (&tv);
+        if (log_timestamp != NULL) {
           tooltip_timestamp = g_date_time_format (log_timestamp, "%c");
           g_date_time_unref(log_timestamp);
         }
@@ -222,7 +223,12 @@ G_GNUC_END_IGNORE_DEPRECATIONS
       tmp = g_key_file_get_string (notify_log, group, "body", NULL);
       if (g_strcmp0 (tmp, "") == 0) {
         gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 2);
-        markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
+        if (tooltip_timestamp != NULL) {
+          markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
+        }
+        else {
+          markup = g_strdup_printf (format, app_name);
+        }
       }
       else {
         gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 1);
diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index cb9d204..77605b6 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -572,13 +572,14 @@ xfce4_notifyd_log_populate (NotificationLogWidgets *log_widgets)
             const char *tooltip_format_simple = "<b>\%s</b> - \%s";
             char *markup;
             gchar *app_name;
-            gchar *tooltip_timestamp;
+            gchar *tooltip_timestamp = NULL;
             gchar *tmp;
             GTimeVal tv;
             GDateTime *log_timestamp;
 
             if (g_time_val_from_iso8601 (group, &tv) == TRUE) {
-                if (log_timestamp = g_date_time_new_from_timeval_local (&tv)) {
+                log_timestamp = g_date_time_new_from_timeval_local (&tv);
+                if (log_timestamp != NULL) {
                     tooltip_timestamp = g_date_time_format (log_timestamp, "%c");
                     g_date_time_unref(log_timestamp);
                 }
@@ -651,12 +652,22 @@ xfce4_notifyd_log_populate (NotificationLogWidgets *log_widgets)
             tmp = g_key_file_get_string (notify_log, group, "body", NULL);
             if (g_strcmp0 (tmp, "") == 0) {
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 2);
-                markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
+                if (tooltip_timestamp != NULL) {
+                    markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
+                }
+                else {
+                    markup = g_strdup_printf (format, app_name);
+                }
             }
             else {
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (summary), 1, 0, 1, 1);
                 gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (body), 1, 1, 1, 1);
-                markup = g_strdup_printf (tooltip_format, app_name, tooltip_timestamp, tmp);
+                if (tooltip_timestamp != NULL) {
+                    markup = g_strdup_printf (tooltip_format_simple, app_name, tooltip_timestamp);
+                }
+                else {
+                    markup = g_strdup_printf (format, app_name);
+                }
             }
             g_free (tmp);
             g_free (app_name);
diff --git a/xfce4-notifyd/xfce-notify-daemon.c b/xfce4-notifyd/xfce-notify-daemon.c
index 0d547d0..1d99e17 100644
--- a/xfce4-notifyd/xfce-notify-daemon.c
+++ b/xfce4-notifyd/xfce-notify-daemon.c
@@ -1250,12 +1250,12 @@ notify_notify (XfceNotifyGBus *skeleton,
             if (xndaemon->notification_log == TRUE &&
                 transient == FALSE) {
                 /* Either log in DND mode or always for muted apps */
-                if (xndaemon->log_level == 0 && xndaemon->do_not_disturb == TRUE ||
+                if ((xndaemon->log_level == 0 && xndaemon->do_not_disturb == TRUE) ||
                     xndaemon->log_level == 1)
                       /* Log either all, all except muted or only muted applications */
                       if (xndaemon->log_level_apps == 0 ||
-                          xndaemon->log_level_apps == 1 && application_is_muted == FALSE ||
-                          xndaemon->log_level_apps == 2 && application_is_muted == TRUE)
+                          (xndaemon->log_level_apps == 1 && application_is_muted == FALSE) ||
+                          (xndaemon->log_level_apps == 2 && application_is_muted == TRUE))
                           xfce_notify_log_insert (new_app_name, summary, body,
                                                   image_data, image_path, app_icon,
                                                   desktop_id, expire_timeout, actions);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list