diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-10-08 10:52:05 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-10-08 10:52:05 -0400 |
commit | f44d70a49d2784a6170ca721411fbf993611fd49 (patch) | |
tree | 89c8d5b2235288c5ad374d931f9ffc8f96c21aae | |
parent | 56961fc0ed261ce58d26e473d122918bab56257c (diff) |
Write compare so that it can't overflow
-rw-r--r-- | region-iter.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/region-iter.c b/region-iter.c index b9632dd..cc49eb2 100644 --- a/region-iter.c +++ b/region-iter.c @@ -638,10 +638,12 @@ compare_boxes (const void *box1v, const void *box2v) const pixman_box32_t *box2 = box2v; int c; - if ((c = box1->y1 - box2->y1) == 0) - c = box1->x1 - box2->x1; - - return c; + if (box1->y1 == box2->y1) + return 0; + else if (box1->y1 < box2->y2) + return -1; + else + return 1; } static pixman_bool_t |