From 73a3c5a465dbe5df9bed5f163d2c105065b861f2 Mon Sep 17 00:00:00 2001 From: sabetts Date: Thu, 16 Mar 2006 01:00:43 +0000 Subject: * src/window.c (_XOPEN_SOURCE): new define * src/screen.c (is_a_root_window): w is unsigned int (init_screen): typecast _net_wm_pid as unsigned char*. * src/main.c (read_rc_file): linesize is size_t * src/frame.c (frame_read): use a temp var when reading the :dedicated value. * src/bar.c (max_line_length): i and start are size_t (draw_string): i is size_t (get_mark_box): mark_start and mark_end are size_t * src/actions.c (find_keybinding): state is unsigned int (remove_keybinding): likewise (frame_selector): n is unsigned int (frame_selector_match): i is size_t. typecast comparison as size_t. --- src/actions.c | 10 +++++----- src/actions.h | 2 +- src/bar.c | 8 ++++---- src/frame.c | 16 ++++++++++------ src/main.c | 2 +- src/screen.c | 5 +++-- src/screen.h | 2 +- src/window.c | 5 +++++ 8 files changed, 30 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/actions.c b/src/actions.c index 6889ee6..00f3962 100644 --- a/src/actions.c +++ b/src/actions.c @@ -455,7 +455,7 @@ find_keybinding_by_action (char *action, rp_keymap *map) } 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++) @@ -536,7 +536,7 @@ replace_keybinding (rp_action *key_action, char *newcmd) } 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; @@ -1352,7 +1352,7 @@ cmd_version (int interactive, struct cmdarg **args) } static char * -frame_selector (int n) +frame_selector (unsigned int n) { if (n < strlen (defaults.frame_selectors)) { @@ -1368,7 +1368,7 @@ frame_selector (int n) static int frame_selector_match (char ch) { - int i; + size_t i; /* Is it in the frame selector string? */ for (i=0; i= '0' && ch <= '9' - && ch - '0' >= strlen (defaults.frame_selectors)) + && (size_t)(ch - '0') >= strlen (defaults.frame_selectors)) { return ch - '0'; } diff --git a/src/actions.h b/src/actions.h index afeb653..dae4935 100644 --- a/src/actions.h +++ b/src/actions.h @@ -216,7 +216,7 @@ void keymap_free (rp_keymap *map); void free_aliases (); void free_keymaps (); char *wingravity_to_string (int g); -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); diff --git a/src/bar.c b/src/bar.c index cd46a50..79d39ec 100644 --- a/src/bar.c +++ b/src/bar.c @@ -219,8 +219,8 @@ count_lines (char* msg, int len) 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. */ @@ -292,7 +292,7 @@ line_beginning (char* msg, int pos) 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); @@ -376,7 +376,7 @@ prepare_bar (rp_screen *s, int width, int height) } 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; diff --git a/src/frame.c b/src/frame.c index d101588..9abd0d9 100644 --- a/src/frame.c +++ b/src/frame.c @@ -233,8 +233,16 @@ frame_read (char *str) 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 @@ frame_read (char *str) 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); diff --git a/src/main.c b/src/main.c index 4fced0e..4d9a8ba 100644 --- a/src/main.c +++ b/src/main.c @@ -321,7 +321,7 @@ read_rc_file (FILE *file) size_t n = 256; char *partial; char *line; - int linesize = n; + size_t linesize = n; partial = (char*)xmalloc(n); line = (char*)xmalloc(linesize); diff --git a/src/screen.c b/src/screen.c index 4bf17c0..c24d477 100644 --- a/src/screen.c +++ b/src/screen.c @@ -163,7 +163,7 @@ find_screen (Window w) /* Return 1 if w is a root window of any of the screens. */ int -is_a_root_window (int w) +is_a_root_window (unsigned int w) { int i; for (i=0; iframes_numset = rp_frame_numset; diff --git a/src/screen.h b/src/screen.h index adad4f1..92f351b 100644 --- a/src/screen.h +++ b/src/screen.h @@ -38,7 +38,7 @@ rp_frame *screen_find_frame_by_frame (rp_screen *s, rp_frame *f); 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); diff --git a/src/window.c b/src/window.c index e3a1e89..b665f71 100644 --- a/src/window.c +++ b/src/window.c @@ -19,6 +19,11 @@ * Boston, MA 02111-1307 USA */ +/* 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. */ +#define _XOPEN_SOURCE 500 #include /* for getsid */ #include #include -- cgit v1.2.3