diff options
author | Gary Wong <gtw@gnu.org> | 2009-08-27 15:29:18 -0600 |
---|---|---|
committer | Gary Wong <gtw@gnu.org> | 2009-08-27 15:29:18 -0600 |
commit | 7bba687a40afda1e0a40a144bc4b7ae0cf577c70 (patch) | |
tree | 30ea3357e4a1787e3049aa45e353ec423c3c8b34 | |
parent | d4d7cb93352df136578fb13e9c59029d10781955 (diff) |
Use unsigned arithmetic for sequence comparison.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gwm.c | 3 |
2 files changed, 8 insertions, 1 deletions
@@ -1,5 +1,11 @@ 2009-08-27 Gary Wong <gtw@gnu.org> + * gwm.c (sync_with_callback): Perform the sequence comparison + with unsigned arithmetic, so that overflow semantics are + well-defined. + +2009-08-27 Gary Wong <gtw@gnu.org> + * frame.c (recalc_size): Implement edge resistance when resizing frames. (edge_resist): New function. @@ -25,6 +25,7 @@ #include <assert.h> #include <errno.h> +#include <limits.h> #if HAVE_MCHECK_H #include <mcheck.h> #endif @@ -264,7 +265,7 @@ static void check_async_callbacks( void ) { extern void sync_with_callback( unsigned int sequence ) { - while( queue_head && (int) sequence - (int) queue_head->sequence >= 0 ) { + while( queue_head && sequence - queue_head->sequence < UINT_MAX >> 1 ) { struct async_callback *entry = queue_head; xcb_generic_error_t *error; void *reply = xcb_wait_for_reply( c, entry->sequence, &error ); |