[PATCH 07/11] wmhdplop: Fix compiler warnings.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
In particular, the following:

 wmhdplop.c:451:96: warning: operation on ‘dl->touched_w’ may be undefined
 [-Wsequence-point]

 wmhdplop.c:980:44: warning: ignoring return value of ‘seteuid’, declared with
 attribute warn_unused_result [-Wunused-result]

 procstat.c:73:19: warning: variable ‘in_our_disk’ set but not used
 [-Wunused-but-set-variable]

 dockapp_imlib2.c:311:85: warning: unused parameter ‘prefs’ [-Wunused-parameter]

 gkrellm_hdplop.c:187:40: warning: unused parameter ‘widget’
 [-Wunused-parameter]

https://sources.debian.net/src/wmhdplop/0.9.9-5/debian/patches/
  fix_compiler_warnings.patch/
---
 wmhdplop/dockapp_imlib2.c |  1 +
 wmhdplop/gkrellm_hdplop.c |  1 +
 wmhdplop/procstat.c       |  5 ++---
 wmhdplop/wmhdplop.c       | 10 ++++++++--
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/wmhdplop/dockapp_imlib2.c b/wmhdplop/dockapp_imlib2.c
index c632b99..4d21115 100644
--- a/wmhdplop/dockapp_imlib2.c
+++ b/wmhdplop/dockapp_imlib2.c
@@ -319,6 +319,7 @@ DockImlib2* dockimlib2_gkrellm_setup(int x0, int y0, int w, int h, DockImlib2Pre
 #ifndef GKRELLM
   dockimlib2_xinit(dock, prefs);
 #else
+  (void) prefs;
   dockimlib2_gkrellm_xinit(dock, gkdrawable);
 #endif
   dockimlib2_setup_imlib(dock);
diff --git a/wmhdplop/gkrellm_hdplop.c b/wmhdplop/gkrellm_hdplop.c
index 42e0e5d..ed14534 100644
--- a/wmhdplop/gkrellm_hdplop.c
+++ b/wmhdplop/gkrellm_hdplop.c
@@ -185,6 +185,7 @@ static void cb_spinbutton_modified(GtkWidget *widget UNUSED, GtkSpinButton *spin
 }
 
 static void cb_reload_fonts(GtkWidget *widget) {
+  (void) widget;
   if (strcmp(gtk_entry_get_text(GTK_ENTRY(entry_smallfont)), app->current_smallfont_name) ||
       strcmp(gtk_entry_get_text(GTK_ENTRY(entry_bigfont)), app->current_bigfont_name)) {
     ASSIGN_STRING(Prefs.smallfontname, gtk_entry_get_text(GTK_ENTRY(entry_smallfont)));
diff --git a/wmhdplop/procstat.c b/wmhdplop/procstat.c
index c899435..18c74cf 100644
--- a/wmhdplop/procstat.c
+++ b/wmhdplop/procstat.c
@@ -70,7 +70,7 @@ void update_stats() {
   FILE *f;
   char line[1024];
   char hdname[200];
-  int readok = 0, in_our_disk = 0;
+  int readok = 0;
   const char *proc_fname;
   if (!use_proc_diskstats) proc_fname = "/proc/partitions";
   else proc_fname = "/proc/diskstats";
@@ -93,7 +93,6 @@ void update_stats() {
         dl->touched_r = (dl->nr - nr) ? 10 : dl->touched_r; 
         dl->touched_w = (dl->nw - nw) ? 10 : dl->touched_w; 
         dl->nr = nr; dl->nw = nw;
-        if (!is_partition(major,minor)) in_our_disk = 1;
         if (is_displayed(dl->hd_id,dl->part_id) && 
             ((dl->part_id && (!find_id(dl->hd_id, 0) || !is_displayed(dl->hd_id, 0))) || /* partition without host disk */
              (dl->part_id == 0))) /* disk */
@@ -112,7 +111,7 @@ void update_stats() {
             }
             readok = 2;
           }
-      } else if (!is_partition(major,minor)) in_our_disk = 0;
+      }
       /*      if (in_our_disk || find_dev(major,minor))*/ {
         strlist *sl;
         for (sl = swap_list(); sl; sl=sl->next) {
diff --git a/wmhdplop/wmhdplop.c b/wmhdplop/wmhdplop.c
index f55224f..91b6d52 100644
--- a/wmhdplop/wmhdplop.c
+++ b/wmhdplop/wmhdplop.c
@@ -448,7 +448,8 @@ static void draw_hdlist(App *app) {
         imlib_image_fill_rectangle(lx+1,y-5,3,3); 
       }
       if (dl->touched_w) { 
-        imlib_context_set_color(255,100-10*dl->touched_w,100-10*dl->touched_w, 25*dl->touched_w--); 
+        imlib_context_set_color(255,100-10*dl->touched_w,100-10*dl->touched_w, 25*dl->touched_w - 1);
+        dl->touched_w--;
         imlib_image_fill_rectangle(lx+1,y-9,3,3); 
       }
       x += 5;
@@ -977,7 +978,12 @@ int main(int argc, char**argv)
 int hdplop_main(int width, int height, GdkDrawable *gkdrawable)
 #endif
 {
-  euid = geteuid(); uid = getuid(); seteuid(uid);
+  int s;
+
+  euid = geteuid(); uid = getuid();
+  s = seteuid(uid);
+  if (s == -1)
+    fprintf(stderr, "seteuid(uid) failed : %s\n", strerror(errno));
   ALLOC_OBJ(app);
   srand(time(NULL));
   /* Initialize options */
-- 
2.7.4


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.