From 88358f064351e867c73e46783a239265ff9fef7a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 13 Sep 2021 11:04:59 +0100 Subject: [PATCH] Add 'const' to the draw_polygon coords array parameter. Thanks to Mouse for spotting that it was missing. --- devel.but | 4 ++-- drawing.c | 2 +- gtk.c | 6 +++--- nullfe.c | 2 +- osx.m | 2 +- ps.c | 2 +- puzzles.h | 4 ++-- windows.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/devel.but b/devel.but index 7e7aa1f..76d6efa 100644 --- a/devel.but +++ b/devel.but @@ -1935,7 +1935,7 @@ This function may be used for both drawing and printing. \S{drawing-draw-polygon} \cw{draw_polygon()} -\c void draw_polygon(drawing *dr, int *coords, int npoints, +\c void draw_polygon(drawing *dr, const int *coords, int npoints, \c int fillcolour, int outlinecolour); Draws an outlined or filled polygon in the puzzle window. @@ -2497,7 +2497,7 @@ function; see \k{drawing-draw-line}. \S{drawingapi-draw-polygon} \cw{draw_polygon()} -\c void (*draw_polygon)(void *handle, int *coords, int npoints, +\c void (*draw_polygon)(void *handle, const int *coords, int npoints, \c int fillcolour, int outlinecolour); This function behaves exactly like the back end \cw{draw_polygon()} diff --git a/drawing.c b/drawing.c index a8eb8cf..3584936 100644 --- a/drawing.c +++ b/drawing.c @@ -117,7 +117,7 @@ void draw_thick_line(drawing *dr, float thickness, } } -void draw_polygon(drawing *dr, int *coords, int npoints, +void draw_polygon(drawing *dr, const int *coords, int npoints, int fillcolour, int outlinecolour) { dr->api->draw_polygon(dr->handle, coords, npoints, fillcolour, diff --git a/gtk.c b/gtk.c index 2a011fd..7710b4e 100644 --- a/gtk.c +++ b/gtk.c @@ -571,7 +571,7 @@ static void do_draw_thick_line(frontend *fe, float thickness, cairo_restore(fe->cr); } -static void do_draw_poly(frontend *fe, int *coords, int npoints, +static void do_draw_poly(frontend *fe, const int *coords, int npoints, int fillcolour, int outlinecolour) { int i; @@ -832,7 +832,7 @@ static void do_draw_thick_line(frontend *fe, float thickness, save.join_style); } -static void do_draw_poly(frontend *fe, int *coords, int npoints, +static void do_draw_poly(frontend *fe, const int *coords, int npoints, int fillcolour, int outlinecolour) { GdkPoint *points = snewn(npoints, GdkPoint); @@ -1206,7 +1206,7 @@ void gtk_draw_thick_line(void *handle, float thickness, do_draw_thick_line(fe, thickness, x1, y1, x2, y2); } -void gtk_draw_poly(void *handle, int *coords, int npoints, +void gtk_draw_poly(void *handle, const int *coords, int npoints, int fillcolour, int outlinecolour) { frontend *fe = (frontend *)handle; diff --git a/nullfe.c b/nullfe.c index 7cba4e0..f55aec7 100644 --- a/nullfe.c +++ b/nullfe.c @@ -15,7 +15,7 @@ void draw_rect(drawing *dr, int x, int y, int w, int h, int colour) {} void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour) {} void draw_thick_line(drawing *dr, float thickness, float x1, float y1, float x2, float y2, int colour) {} -void draw_polygon(drawing *dr, int *coords, int npoints, +void draw_polygon(drawing *dr, const int *coords, int npoints, int fillcolour, int outlinecolour) {} void draw_circle(drawing *dr, int cx, int cy, int radius, int fillcolour, int outlinecolour) {} diff --git a/osx.m b/osx.m index ee9161f..36e9693 100644 --- a/osx.m +++ b/osx.m @@ -1344,7 +1344,7 @@ struct frontend { /* * Drawing routines called by the midend. */ -static void osx_draw_polygon(void *handle, int *coords, int npoints, +static void osx_draw_polygon(void *handle, const int *coords, int npoints, int fillcolour, int outlinecolour) { frontend *fe = (frontend *)handle; diff --git a/ps.c b/ps.c index ab8a158..d0ea0ff 100644 --- a/ps.c +++ b/ps.c @@ -157,7 +157,7 @@ static void ps_draw_line(void *handle, int x1, int y1, int x2, int y2, ps_stroke(ps, colour); } -static void ps_draw_polygon(void *handle, int *coords, int npoints, +static void ps_draw_polygon(void *handle, const int *coords, int npoints, int fillcolour, int outlinecolour) { psdata *ps = (psdata *)handle; diff --git a/puzzles.h b/puzzles.h index fd3f67f..f0a7e99 100644 --- a/puzzles.h +++ b/puzzles.h @@ -248,7 +248,7 @@ void draw_text(drawing *dr, int x, int y, int fonttype, int fontsize, int align, int colour, const char *text); void draw_rect(drawing *dr, int x, int y, int w, int h, int colour); void draw_line(drawing *dr, int x1, int y1, int x2, int y2, int colour); -void draw_polygon(drawing *dr, int *coords, int npoints, +void draw_polygon(drawing *dr, const int *coords, int npoints, int fillcolour, int outlinecolour); void draw_circle(drawing *dr, int cx, int cy, int radius, int fillcolour, int outlinecolour); @@ -700,7 +700,7 @@ struct drawing_api { void (*draw_rect)(void *handle, int x, int y, int w, int h, int colour); void (*draw_line)(void *handle, int x1, int y1, int x2, int y2, int colour); - void (*draw_polygon)(void *handle, int *coords, int npoints, + void (*draw_polygon)(void *handle, const int *coords, int npoints, int fillcolour, int outlinecolour); void (*draw_circle)(void *handle, int cx, int cy, int radius, int fillcolour, int outlinecolour); diff --git a/windows.c b/windows.c index adf66d6..844d96b 100644 --- a/windows.c +++ b/windows.c @@ -627,7 +627,7 @@ static void win_draw_circle(void *handle, int cx, int cy, int radius, win_reset_pen(fe); } -static void win_draw_polygon(void *handle, int *coords, int npoints, +static void win_draw_polygon(void *handle, const int *coords, int npoints, int fillcolour, int outlinecolour) { frontend *fe = (frontend *)handle;