[Pixman] [PATCH] Make pixman.h more const-correct

Søren Sandmann sandmann at cs.au.dk
Sat Sep 29 07:40:50 PDT 2012


From: Søren Sandmann Pedersen <ssp at redhat.com>

Add const to pointer arguments when the function doesn't change the
pointed-to data.
---
 pixman/pixman-conical-gradient.c |    2 +-
 pixman/pixman-glyph.c            |    8 ++++----
 pixman/pixman-linear-gradient.c  |    4 ++--
 pixman/pixman-radial-gradient.c  |    4 ++--
 pixman/pixman-solid-fill.c       |    2 +-
 pixman/pixman-trap.c             |   10 +++++-----
 pixman/pixman.c                  |   10 +++++-----
 pixman/pixman.h                  |   24 ++++++++++++------------
 8 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c
index 8b52176..05d3595 100644
--- a/pixman/pixman-conical-gradient.c
+++ b/pixman/pixman-conical-gradient.c
@@ -180,7 +180,7 @@ _pixman_conical_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
 }
 
 PIXMAN_EXPORT pixman_image_t *
-pixman_image_create_conical_gradient (pixman_point_fixed_t *        center,
+pixman_image_create_conical_gradient (const pixman_point_fixed_t *  center,
                                       pixman_fixed_t                angle,
                                       const pixman_gradient_stop_t *stops,
                                       int                           n_stops)
diff --git a/pixman/pixman-glyph.c b/pixman/pixman-glyph.c
index 30a4099..657b62d 100644
--- a/pixman/pixman-glyph.c
+++ b/pixman/pixman-glyph.c
@@ -354,7 +354,7 @@ pixman_glyph_get_extents (pixman_glyph_cache_t *cache,
 PIXMAN_EXPORT pixman_format_code_t
 pixman_glyph_get_mask_format (pixman_glyph_cache_t *cache,
 			      int		    n_glyphs,
-			      pixman_glyph_t *      glyphs)
+			      const pixman_glyph_t *glyphs)
 {
     pixman_format_code_t format = PIXMAN_a1;
     int i;
@@ -401,7 +401,7 @@ pixman_composite_glyphs_no_mask (pixman_op_t            op,
 				 int32_t                dest_y,
 				 pixman_glyph_cache_t  *cache,
 				 int                    n_glyphs,
-				 pixman_glyph_t        *glyphs)
+				 const pixman_glyph_t  *glyphs)
 {
     pixman_region32_t region;
     pixman_format_code_t glyph_format = PIXMAN_null;
@@ -502,7 +502,7 @@ static void
 add_glyphs (pixman_glyph_cache_t *cache,
 	    pixman_image_t *dest,
 	    int off_x, int off_y,
-	    int n_glyphs, pixman_glyph_t *glyphs)
+	    int n_glyphs, const pixman_glyph_t *glyphs)
 {
     pixman_format_code_t glyph_format = PIXMAN_null;
     uint32_t glyph_flags = 0;
@@ -651,7 +651,7 @@ pixman_composite_glyphs (pixman_op_t            op,
 			 int32_t                height,
 			 pixman_glyph_cache_t  *cache,
 			 int			n_glyphs,
-			 pixman_glyph_t        *glyphs)
+			 const pixman_glyph_t  *glyphs)
 {
     pixman_image_t *mask;
 
diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c
index 32b8ba7..e511368 100644
--- a/pixman/pixman-linear-gradient.c
+++ b/pixman/pixman-linear-gradient.c
@@ -255,8 +255,8 @@ _pixman_linear_gradient_iter_init (pixman_image_t *image, pixman_iter_t  *iter)
 }
 
 PIXMAN_EXPORT pixman_image_t *
-pixman_image_create_linear_gradient (pixman_point_fixed_t *        p1,
-                                     pixman_point_fixed_t *        p2,
+pixman_image_create_linear_gradient (const pixman_point_fixed_t *  p1,
+                                     const pixman_point_fixed_t *  p2,
                                      const pixman_gradient_stop_t *stops,
                                      int                           n_stops)
 {
diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c
index 715711f..41bb79d 100644
--- a/pixman/pixman-radial-gradient.c
+++ b/pixman/pixman-radial-gradient.c
@@ -420,8 +420,8 @@ _pixman_radial_gradient_iter_init (pixman_image_t *image, pixman_iter_t *iter)
 }
 
 PIXMAN_EXPORT pixman_image_t *
-pixman_image_create_radial_gradient (pixman_point_fixed_t *        inner,
-                                     pixman_point_fixed_t *        outer,
+pixman_image_create_radial_gradient (const pixman_point_fixed_t *  inner,
+                                     const pixman_point_fixed_t *  outer,
                                      pixman_fixed_t                inner_radius,
                                      pixman_fixed_t                outer_radius,
                                      const pixman_gradient_stop_t *stops,
diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c
index 8b25d5d..26f85ce 100644
--- a/pixman/pixman-solid-fill.c
+++ b/pixman/pixman-solid-fill.c
@@ -72,7 +72,7 @@ color_to_uint64 (const pixman_color_t *color)
 }
 
 PIXMAN_EXPORT pixman_image_t *
-pixman_image_create_solid_fill (pixman_color_t *color)
+pixman_image_create_solid_fill (const pixman_color_t *color)
 {
     pixman_image_t *img = _pixman_image_allocate ();
 
diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index adf5d7b..35128ee 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -230,11 +230,11 @@ pixman_line_fixed_edge_init (pixman_edge_t *            e,
 }
 
 PIXMAN_EXPORT void
-pixman_add_traps (pixman_image_t * image,
-                  int16_t          x_off,
-                  int16_t          y_off,
-                  int              ntrap,
-                  pixman_trap_t *  traps)
+pixman_add_traps (pixman_image_t *     image,
+                  int16_t              x_off,
+                  int16_t              y_off,
+                  int                  ntrap,
+                  const pixman_trap_t *traps)
 {
     int bpp;
     int height;
diff --git a/pixman/pixman.c b/pixman/pixman.c
index 739cc79..bbe8b08 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -774,9 +774,9 @@ color_to_uint32 (const pixman_color_t *color)
 }
 
 static pixman_bool_t
-color_to_pixel (pixman_color_t *     color,
-                uint32_t *           pixel,
-                pixman_format_code_t format)
+color_to_pixel (const pixman_color_t *color,
+                uint32_t *            pixel,
+                pixman_format_code_t  format)
 {
     uint32_t c = color_to_uint32 (color);
 
@@ -833,7 +833,7 @@ color_to_pixel (pixman_color_t *     color,
 PIXMAN_EXPORT pixman_bool_t
 pixman_image_fill_rectangles (pixman_op_t                 op,
                               pixman_image_t *            dest,
-                              pixman_color_t *            color,
+			      const pixman_color_t *      color,
                               int                         n_rects,
                               const pixman_rectangle16_t *rects)
 {
@@ -872,7 +872,7 @@ pixman_image_fill_rectangles (pixman_op_t                 op,
 PIXMAN_EXPORT pixman_bool_t
 pixman_image_fill_boxes (pixman_op_t           op,
                          pixman_image_t *      dest,
-                         pixman_color_t *      color,
+                         const pixman_color_t *color,
                          int                   n_boxes,
                          const pixman_box32_t *boxes)
 {
diff --git a/pixman/pixman.h b/pixman/pixman.h
index e1cb90a..1dc167a 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -737,18 +737,18 @@ pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
 pixman_bool_t pixman_format_supported_source      (pixman_format_code_t format);
 
 /* Constructors */
-pixman_image_t *pixman_image_create_solid_fill       (pixman_color_t               *color);
-pixman_image_t *pixman_image_create_linear_gradient  (pixman_point_fixed_t         *p1,
-						      pixman_point_fixed_t         *p2,
+pixman_image_t *pixman_image_create_solid_fill       (const pixman_color_t         *color);
+pixman_image_t *pixman_image_create_linear_gradient  (const pixman_point_fixed_t   *p1,
+						      const pixman_point_fixed_t   *p2,
 						      const pixman_gradient_stop_t *stops,
 						      int                           n_stops);
-pixman_image_t *pixman_image_create_radial_gradient  (pixman_point_fixed_t         *inner,
-						      pixman_point_fixed_t         *outer,
+pixman_image_t *pixman_image_create_radial_gradient  (const pixman_point_fixed_t   *inner,
+						      const pixman_point_fixed_t   *outer,
 						      pixman_fixed_t                inner_radius,
 						      pixman_fixed_t                outer_radius,
 						      const pixman_gradient_stop_t *stops,
 						      int                           n_stops);
-pixman_image_t *pixman_image_create_conical_gradient (pixman_point_fixed_t         *center,
+pixman_image_t *pixman_image_create_conical_gradient (const pixman_point_fixed_t   *center,
 						      pixman_fixed_t                angle,
 						      const pixman_gradient_stop_t *stops,
 						      int                           n_stops);
@@ -804,12 +804,12 @@ int		pixman_image_get_depth               (pixman_image_t		   *image);
 pixman_format_code_t pixman_image_get_format	     (pixman_image_t		   *image);
 pixman_bool_t	pixman_image_fill_rectangles	     (pixman_op_t		    op,
 						      pixman_image_t		   *image,
-						      pixman_color_t		   *color,
+						      const pixman_color_t	   *color,
 						      int			    n_rects,
 						      const pixman_rectangle16_t   *rects);
 pixman_bool_t   pixman_image_fill_boxes              (pixman_op_t                   op,
                                                       pixman_image_t               *dest,
-                                                      pixman_color_t               *color,
+                                                      const pixman_color_t         *color,
                                                       int                           n_boxes,
                                                       const pixman_box32_t         *boxes);
 
@@ -903,7 +903,7 @@ void                  pixman_glyph_get_extents        (pixman_glyph_cache_t *cac
 						       pixman_box32_t       *extents);
 pixman_format_code_t  pixman_glyph_get_mask_format    (pixman_glyph_cache_t *cache,
 						       int		     n_glyphs,
-						       pixman_glyph_t *      glyphs);
+						       const pixman_glyph_t *glyphs);
 void                  pixman_composite_glyphs         (pixman_op_t           op,
 						       pixman_image_t       *src,
 						       pixman_image_t       *dest,
@@ -918,7 +918,7 @@ void                  pixman_composite_glyphs         (pixman_op_t           op,
 						       int32_t		     height,
 						       pixman_glyph_cache_t *cache,
 						       int		     n_glyphs,
-						       pixman_glyph_t       *glyphs);
+						       const pixman_glyph_t *glyphs);
 void                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
 						       pixman_image_t       *src,
 						       pixman_image_t       *dest,
@@ -928,7 +928,7 @@ void                  pixman_composite_glyphs_no_mask (pixman_op_t           op,
 						       int32_t               dest_y,
 						       pixman_glyph_cache_t *cache,
 						       int		     n_glyphs,
-						       pixman_glyph_t       *glyphs);
+						       const pixman_glyph_t *glyphs);
 
 /*
  * Trapezoids
@@ -1014,7 +1014,7 @@ void           pixman_add_traps            (pixman_image_t            *image,
 					    int16_t                    x_off,
 					    int16_t                    y_off,
 					    int                        ntrap,
-					    pixman_trap_t             *traps);
+					    const pixman_trap_t       *traps);
 void           pixman_add_trapezoids       (pixman_image_t            *image,
 					    int16_t                    x_off,
 					    int                        y_off,
-- 
1.7.4



More information about the Pixman mailing list