[PATCH 7/8] mesh: Avoid theoretical infinite loops
"Bryce W. Harrington" <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
This quells this warning: src/cairo-mesh-pattern-rasterizer.c:731:5: warning: cannot optimize possibly infinite loops I guess the compiler's complaining because if vsteps were negative or equal to UINT_MAX the loop could cycle infinitely. Silly compiler. Signed-off-by: Bryce Harrington <[email protected]> --- src/cairo-mesh-pattern-rasterizer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cairo-mesh-pattern-rasterizer.c b/src/cairo-mesh-pattern-rasterizer.c index 6f0dd66..96c7670 100644 --- a/src/cairo-mesh-pattern-rasterizer.c +++ b/src/cairo-mesh-pattern-rasterizer.c @@ -693,11 +693,11 @@ draw_bezier_curve (unsigned char *data, int width, int height, int stride, * [0,1] (including both extremes). */ static inline void -rasterize_bezier_patch (unsigned char *data, int width, int height, int stride, int vshift, +rasterize_bezier_patch (unsigned char *data, int width, int height, int stride, unsigned int vshift, cairo_point_double_t p[4][4], double col[4][4]) { double pv[4][2][4], cstart[4], cend[4], dcstart[4], dcend[4]; - int vsteps, v, i, k; + unsigned int vsteps, v, i, k; vsteps = 1 << vshift; @@ -728,7 +728,7 @@ rasterize_bezier_patch (unsigned char *data, int width, int height, int stride, dcend[i] = (col[3][i] - col[1][i]) / vsteps; } - for (v = 0; v <= vsteps; ++v) { + for (v = 0; v < vsteps+1; ++v) { cairo_point_double_t nodes[4]; for (i = 0; i < 4; ++i) { nodes[i].x = pv[i][0][0]; -- 1.7.9.5 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo