mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-02 03:50:29 +01:00
polygon-intersection: Try not to invoke undefined behaviour
Optimizing compilers aggressively remove code that is executed only after an undefined behaviour occurred. Also, the difference of two (non char) pointers hides an integer division that, because the divisor is known at compile time, is transformed into a multiplication by a pseudo-reciprocal, and in this case the difference is not always a multiple of the divisor, resulting in an invalid comparison predicate. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74779 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
a3c022bb98
commit
63f59ea896
1 changed files with 2 additions and 2 deletions
|
|
@ -76,7 +76,7 @@ struct _cairo_bo_edge {
|
|||
#define PQ_LEFT_CHILD_INDEX(i) ((i) << 1)
|
||||
|
||||
typedef enum {
|
||||
CAIRO_BO_EVENT_TYPE_STOP,
|
||||
CAIRO_BO_EVENT_TYPE_STOP = -1,
|
||||
CAIRO_BO_EVENT_TYPE_INTERSECTION,
|
||||
CAIRO_BO_EVENT_TYPE_START
|
||||
} cairo_bo_event_type_t;
|
||||
|
|
@ -783,7 +783,7 @@ cairo_bo_event_compare (const cairo_bo_event_t *a,
|
|||
if (cmp)
|
||||
return cmp;
|
||||
|
||||
return a - b;
|
||||
return a < b ? -1 : a == b ? 0 : 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue