ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] some warnings and how to quiet them


From: Bernhard R. Link
Subject: [RP] some warnings and how to quiet them
Date: Fri, 13 Jan 2006 10:27:43 +0100
User-agent: Mutt/1.5.9i

Just checked out the current cvs version, and some minor issues to
start with:

Citing getsid(2) here:

To get the prototype under glibc, define both _XOPEN_SOURCE and
_XOPEN_SOURCE_EXTENDED, or use "#define _XOPEN_SOURCE n" for
some integer n larger than or equal to 500.

The following quiets the warning I get. (Which means it really
just is a cosmetical fix quieting a warning that getsid may not
be portable enough for other usages)

Index: src/window.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/window.c,v
retrieving revision 1.33
diff -u -r1.33 window.c
--- src/window.c        5 Jan 2006 04:36:07 -0000       1.33
+++ src/window.c        13 Jan 2006 08:48:52 -0000
@@ -19,6 +19,7 @@
  * Boston, MA 02111-1307 USA
  */
 
+#define _XOPEN_SOURCE 500
 #include <unistd.h>            /* for getsid */
 #include <stdio.h>
 #include <stdlib.h>

Another Warning is src/window.c:274 because those X routines
prefer char* over void*. This is really only a cosmetical fix
to let gcc shut up:

Index: src/screen.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/screen.c,v
retrieving revision 1.11
diff -u -r1.11 screen.c
--- src/screen.c        20 Oct 2005 06:21:44 -0000      1.11
+++ src/screen.c        13 Jan 2006 08:55:30 -0000
@@ -271,7 +271,8 @@
 
   /* Add netwm support. FIXME: I think this is busted. */
   XChangeProperty (dpy, RootWindow (dpy, screen_num),
-                  _net_supported, XA_ATOM, 32, PropModeReplace, &_net_wm_pid, 
1);
+                  _net_supported, XA_ATOM, 32, PropModeReplace, 
+                  (unsigned char*)&_net_wm_pid, 1);
 
   /* Set the numset for the frames to our global numset. */
   s->frames_numset = rp_frame_numset;

Quiet some signedness warnings 
(also fixing some (extremly) minor issues if someone using frame_read
 relies on negative values meaning do dedication or in case
 someone manages to grow strings beyond 2 GB)

Index: src/actions.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.c,v
retrieving revision 1.260
diff -u -r1.260 actions.c
--- src/actions.c       3 Jan 2006 21:34:20 -0000       1.260
+++ src/actions.c       13 Jan 2006 09:24:31 -0000
@@ -451,7 +451,7 @@
 }
 
 rp_action*
-find_keybinding (KeySym keysym, int state, rp_keymap *map)
+find_keybinding (KeySym keysym, unsigned int state, rp_keymap *map)
 {
   int i;
   for (i = 0; i < map->actions_last; i++)
@@ -532,7 +532,7 @@
 }
 
 static int
-remove_keybinding (KeySym keysym, int state, rp_keymap *map)
+remove_keybinding (KeySym keysym, unsigned int state, rp_keymap *map)
 {
   int i;
   int found = -1;
@@ -1348,7 +1348,7 @@
 }
 
 static char *
-frame_selector (int n)
+frame_selector (unsigned int n)
 {
   if (n < strlen (defaults.frame_selectors))
     {
@@ -1364,7 +1364,7 @@
 static int
 frame_selector_match (char ch)
 {
-  int i;
+  size_t i;
 
   /* Is it in the frame selector string? */
   for (i=0; i<strlen (defaults.frame_selectors); i++)
@@ -1376,7 +1376,7 @@
   /* Maybe it's a number less than 9 and the frame selector doesn't
      define that many selectors. */
   if (ch >= '0' && ch <= '9'
-      && ch - '0' >= strlen (defaults.frame_selectors))
+      && (size_t)(ch - '0') >= strlen (defaults.frame_selectors))
     {
       return ch - '0';
     }
Index: src/actions.h
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/actions.h,v
retrieving revision 1.84
diff -u -r1.84 actions.h
--- src/actions.h       20 Oct 2005 06:21:44 -0000      1.84
+++ src/actions.h       13 Jan 2006 09:24:31 -0000
@@ -215,7 +215,7 @@
 void keymap_free (rp_keymap *map);
 void free_aliases ();
 void free_keymaps ();
-rp_action* find_keybinding (KeySym keysym, int state, rp_keymap *map);
+rp_action* find_keybinding (KeySym keysym, unsigned int state, rp_keymap *map);
 rp_action* find_keybinding_by_action (char *action, rp_keymap *map);
 
 
Index: src/bar.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/bar.c,v
retrieving revision 1.51
diff -u -r1.51 bar.c
--- src/bar.c   9 Dec 2004 05:18:11 -0000       1.51
+++ src/bar.c   13 Jan 2006 09:24:31 -0000
@@ -227,8 +227,8 @@
 static int
 max_line_length (char* msg)
 {
-  int i;
-  int start;
+  size_t i;
+  size_t start;
   int ret = 0;
   
   /* Count each line and keep the length of the longest one. */
@@ -300,7 +300,7 @@
 static void
 draw_string (rp_screen *s, char *msg)
 {
-  int i;
+  size_t i;
   int line_no;
   int start;
   int line_height = FONT_HEIGHT (defaults.font);
@@ -384,7 +384,7 @@
 }
 
 static void
-get_mark_box (char *msg, int mark_start, int mark_end, 
+get_mark_box (char *msg, size_t mark_start, size_t mark_end, 
              int *x, int *y, int *width, int *height)
 {
   int start, end;
Index: src/frame.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/frame.c,v
retrieving revision 1.15
diff -u -r1.15 frame.c
--- src/frame.c 17 Jan 2005 23:26:05 -0000      1.15
+++ src/frame.c 13 Jan 2006 09:24:31 -0000
@@ -233,8 +233,16 @@
        read_slot(w);
       else if (!strcmp(tmp, ":last-access"))
        read_slot(f->last_access);
-      else if (!strcmp(tmp, ":dedicated"))
-       read_slot(f->dedicated);
+      else if (!strcmp(tmp, ":dedicated")) {
+       /* f->dedicated is unsigned, so read into local variable  */
+        long dedicated;
+
+       read_slot(dedicated);
+        if (dedicated <= 0)
+          f->dedicated = 0;
+        else if (f->dedicated >= 1)
+          f->dedicated = 1;
+      }
       else if (!strcmp(tmp, ")"))
        break;
       else
@@ -260,10 +268,6 @@
     f->height = defaults.window_border_width*2 + 1;
   if (f->last_access < 0)
     f->last_access = 0;
-  if (f->dedicated < 0)
-    f->dedicated = 0;
-  else if (f->dedicated > 1)
-    f->dedicated = 1;
 
   /* Find the window with the X11 window ID. */
   win = find_window_in_list (w, &rp_mapped_window);
Index: src/main.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/main.c,v
retrieving revision 1.118
diff -u -r1.118 main.c
--- src/main.c  3 Jan 2006 21:34:21 -0000       1.118
+++ src/main.c  13 Jan 2006 09:24:31 -0000
@@ -321,7 +321,7 @@
   size_t n = 256;
   char *partial;
   char *line;
-  int linesize = n;
+  size_t linesize = n;
 
   partial = (char*)xmalloc(n);
   line = (char*)xmalloc(linesize);
Index: src/screen.h
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/screen.h,v
retrieving revision 1.11
diff -u -r1.11 screen.h
--- src/screen.h        20 Oct 2005 06:21:44 -0000      1.11
+++ src/screen.h        13 Jan 2006 09:24:31 -0000
@@ -38,7 +38,7 @@
 void init_screens (int screen_arg, int screen_num);
 
 int is_rp_window_for_screen (Window w, rp_screen *s);
-int is_a_root_window (int w);
+int is_a_root_window (unsigned int w);
 
 char *screen_dump (rp_screen *screen);
 
Index: src/window.c
===================================================================
RCS file: /cvsroot/ratpoison/ratpoison/src/window.c,v
retrieving revision 1.33
diff -u -r1.33 window.c
--- src/window.c        5 Jan 2006 04:36:07 -0000       1.33
+++ src/window.c        13 Jan 2006 09:24:31 -0000
@@ -715,7 +716,7 @@
    
  */
 static int
-isdigit (ch)
+isdigit (int ch)
 {
   return ch >= '0' && ch <= '9';
 }

Hochachtungsvoll,
        Bernhard R. Link

Attachment: rpp
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]