diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-12-29 16:11:29 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-12-29 16:11:29 +0000 |
commit | fa63c43532de4a38d59d2746c34c815d18121062 (patch) | |
tree | 41d746a5be4d882f18c846d9de46d08473749f93 /src/cairo-spline.c | |
parent | 7df082dd8aaa9d31479a8bb1f6f1dfe07f52019a (diff) | |
download | cairo-fa63c43532de4a38d59d2746c34c815d18121062.tar.gz |
[spline] Be pedantic and propagate errors.
We know that the current users will always return SUCCESS, but propagate
the status return for future users.
Diffstat (limited to 'src/cairo-spline.c')
-rw-r--r-- | src/cairo-spline.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/cairo-spline.c b/src/cairo-spline.c index 85e8a9038..414e05360 100644 --- a/src/cairo-spline.c +++ b/src/cairo-spline.c @@ -210,7 +210,7 @@ _cairo_spline_decompose (cairo_spline_t *spline, double tolerance) } /* Note: this function is only good for computing bounds in device space. */ -void +cairo_status_t _cairo_spline_bound (cairo_spline_add_point_func_t add_point_func, void *closure, const cairo_point_t *p0, const cairo_point_t *p1, @@ -221,6 +221,7 @@ _cairo_spline_bound (cairo_spline_add_point_func_t add_point_func, double a, b, c; double t[4]; int t_num = 0, i; + cairo_status_t status; x0 = _cairo_fixed_to_double (p0->x); y0 = _cairo_fixed_to_double (p0->y); @@ -317,7 +318,10 @@ _cairo_spline_bound (cairo_spline_add_point_func_t add_point_func, c = -y0 + y1; FIND_EXTREMES (a, b, c); - add_point_func (closure, p0); + status = add_point_func (closure, p0); + if (unlikely (status)) + return status; + for (i = 0; i < t_num; i++) { cairo_point_t p; double x, y; @@ -348,7 +352,10 @@ _cairo_spline_bound (cairo_spline_add_point_func_t add_point_func, p.x = _cairo_fixed_from_double (x); p.y = _cairo_fixed_from_double (y); - add_point_func (closure, &p); + status = add_point_func (closure, &p); + if (unlikely (status)) + return status; } - add_point_func (closure, p3); + + return add_point_func (closure, p3); } |