[cairo-commit] boilerplate/cairo-boilerplate-cogl.c boilerplate/cairo-boilerplate-egl.c INSTALL src/cairo-analysis-surface.c src/cairo-base64-stream.c src/cairo-ft-font.c src/cairo-path-fixed.c src/cairo-path-stroke-polygon.c src/cairo-path-stroke-traps.c src/cairo-pdf-surface.c src/cairo-svg-surface.c src/cairo-type1-subset.c util/cairo-script util/cairo-trace

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 7 16:55:36 UTC 2020


 INSTALL                                    |    2 
 boilerplate/cairo-boilerplate-cogl.c       |    5 -
 boilerplate/cairo-boilerplate-egl.c        |    2 
 src/cairo-analysis-surface.c               |  110 +++++++++++++++--------------
 src/cairo-base64-stream.c                  |    1 
 src/cairo-ft-font.c                        |    1 
 src/cairo-path-fixed.c                     |    2 
 src/cairo-path-stroke-polygon.c            |    2 
 src/cairo-path-stroke-traps.c              |    3 
 src/cairo-pdf-surface.c                    |   22 ++---
 src/cairo-svg-surface.c                    |    1 
 src/cairo-type1-subset.c                   |    2 
 util/cairo-script/cairo-script-file.c      |    1 
 util/cairo-script/cairo-script-operators.c |    1 
 util/cairo-script/cairo-script-scanner.c   |    1 
 util/cairo-trace/trace.c                   |   10 +-
 16 files changed, 90 insertions(+), 76 deletions(-)

New commits:
commit ed98414686ede45a4f2302b4521dece51acdb785
Author: George Matsumura <gmmatsumura01 at bvsd.org>
Date:   Mon Aug 31 22:14:59 2020 -0600

    build: Fix various compiler warnings
    
    This fixes a few compiler warnings that were encountered with gcc 9.3.0.
    
    Signed-off-by: George Matsumura <gmmatsumura01 at bvsd.org>

diff --git a/INSTALL b/INSTALL
index f25f8f34d..dfdc2139e 100644
--- a/INSTALL
+++ b/INSTALL
@@ -89,7 +89,7 @@ More detailed build instructions
        cairo errs during configure if your intention cannot be followed.
 
      * default=no: These are the "experimental" features, and hence by
-       default off.  Use --enabled-XYZ to enable them.
+       default off.  Use --enable-XYZ to enable them.
 
    The list of all features and their default state can be seen in the
    output of ./configure --help.
diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c
index 2339dd883..0982e4133 100644
--- a/boilerplate/cairo-boilerplate-cogl.c
+++ b/boilerplate/cairo-boilerplate-cogl.c
@@ -31,7 +31,6 @@
  */
 
 #include "cairo-boilerplate-private.h"
-#include "cairo-malloc-private.h"
 
 #include <cairo-cogl.h>
 #include <cogl/cogl2-experimental.h>
@@ -81,7 +80,7 @@ _cairo_boilerplate_cogl_create_offscreen_color_surface (const char		*name,
     /* The device will take a reference on the context */
     cogl_object_unref (context);
 
-    closure = _cairo_malloc (sizeof (cogl_closure_t));
+    closure = malloc (sizeof (cogl_closure_t));
     *abstract_closure = closure;
     closure->device = device;
     closure->surface = cairo_cogl_offscreen_surface_create (device,
@@ -152,7 +151,7 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char	       *name,
     /* The device will take a reference on the context */
     cogl_object_unref (context);
 
-    closure = _cairo_malloc (sizeof (cogl_closure_t));
+    closure = malloc (sizeof (cogl_closure_t));
     *abstract_closure = closure;
     closure->device = device;
     closure->surface = cairo_cogl_onscreen_surface_create (device,
diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c
index c44441cc5..8196b1ffd 100644
--- a/boilerplate/cairo-boilerplate-egl.c
+++ b/boilerplate/cairo-boilerplate-egl.c
@@ -42,8 +42,6 @@
 #include <GL/gl.h>
 #endif
 
-static const cairo_user_data_key_t gl_closure_key;
-
 typedef struct _egl_target_closure {
     EGLDisplay dpy;
     EGLContext ctx;
diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index d113c5fac..3a6fd0598 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -931,55 +931,63 @@ _cairo_analysis_surface_get_bounding_box (cairo_surface_t *abstract_surface,
 /* null surface type: a surface that does nothing (has no side effects, yay!) */
 
 static cairo_int_status_t
-_return_success (void)
+_paint_return_success (void			*surface,
+		       cairo_operator_t		 op,
+		       const cairo_pattern_t	*source,
+		       const cairo_clip_t	*clip)
 {
-    return CAIRO_STATUS_SUCCESS;
+    return CAIRO_INT_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_mask_return_success (void			*surface,
+		      cairo_operator_t		 op,
+		      const cairo_pattern_t	*source,
+		      const cairo_pattern_t	*mask,
+		      const cairo_clip_t	*clip)
+{
+    return CAIRO_INT_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_stroke_return_success (void				*surface,
+			cairo_operator_t		 op,
+			const cairo_pattern_t		*source,
+			const cairo_path_fixed_t	*path,
+			const cairo_stroke_style_t	*style,
+			const cairo_matrix_t		*ctm,
+			const cairo_matrix_t		*ctm_inverse,
+			double				 tolerance,
+			cairo_antialias_t		 antialias,
+			const cairo_clip_t		*clip)
+{
+    return CAIRO_INT_STATUS_SUCCESS;
+}
+
+static cairo_int_status_t
+_fill_return_success (void			*surface,
+		      cairo_operator_t		 op,
+		      const cairo_pattern_t	*source,
+		      const cairo_path_fixed_t	*path,
+		      cairo_fill_rule_t		 fill_rule,
+		      double			 tolerance,
+		      cairo_antialias_t		 antialias,
+		      const cairo_clip_t	*clip)
+{
+    return CAIRO_INT_STATUS_SUCCESS;
 }
 
-/* These typedefs are just to silence the compiler... */
-typedef cairo_int_status_t
-(*_paint_func)			(void			*surface,
-			         cairo_operator_t	 op,
-				 const cairo_pattern_t	*source,
-				 const cairo_clip_t		*clip);
-
-typedef cairo_int_status_t
-(*_mask_func)			(void			*surface,
-			         cairo_operator_t	 op,
-				 const cairo_pattern_t	*source,
-				 const cairo_pattern_t	*mask,
-				 const cairo_clip_t		*clip);
-
-typedef cairo_int_status_t
-(*_stroke_func)			(void			*surface,
-			         cairo_operator_t	 op,
-				 const cairo_pattern_t	*source,
-				 const cairo_path_fixed_t	*path,
-				 const cairo_stroke_style_t	*style,
-				 const cairo_matrix_t		*ctm,
-				 const cairo_matrix_t		*ctm_inverse,
-				 double			 tolerance,
-				 cairo_antialias_t	 antialias,
-				 const cairo_clip_t		*clip);
-
-typedef cairo_int_status_t
-(*_fill_func)			(void			*surface,
-			         cairo_operator_t	 op,
-				 const cairo_pattern_t	*source,
-				 const cairo_path_fixed_t	*path,
-				 cairo_fill_rule_t	 fill_rule,
-				 double			 tolerance,
-				 cairo_antialias_t	 antialias,
-				 const cairo_clip_t		*clip);
-
-typedef cairo_int_status_t
-(*_show_glyphs_func)		(void			*surface,
-			         cairo_operator_t	 op,
-				 const cairo_pattern_t	*source,
-				 cairo_glyph_t		*glyphs,
-				 int			 num_glyphs,
-				 cairo_scaled_font_t	*scaled_font,
-				 const cairo_clip_t		*clip);
+static cairo_int_status_t
+_show_glyphs_return_success (void			*surface,
+			     cairo_operator_t		 op,
+			     const cairo_pattern_t	*source,
+			     cairo_glyph_t		*glyphs,
+			     int			 num_glyphs,
+			     cairo_scaled_font_t	*scaled_font,
+			     const cairo_clip_t		*clip)
+{
+    return CAIRO_INT_STATUS_SUCCESS;
+}
 
 static const cairo_surface_backend_t cairo_null_surface_backend = {
     CAIRO_INTERNAL_SURFACE_TYPE_NULL,
@@ -1006,12 +1014,12 @@ static const cairo_surface_backend_t cairo_null_surface_backend = {
     NULL, /* flush */
     NULL, /* mark_dirty_rectangle */
 
-    (_paint_func) _return_success,	    /* paint */
-    (_mask_func) _return_success,	    /* mask */
-    (_stroke_func) _return_success,	    /* stroke */
-    (_fill_func) _return_success,	    /* fill */
+    _paint_return_success,	    /* paint */
+    _mask_return_success,	    /* mask */
+    _stroke_return_success,	    /* stroke */
+    _fill_return_success,	    /* fill */
     NULL, /* fill_stroke */
-    (_show_glyphs_func) _return_success,    /* show_glyphs */
+    _show_glyphs_return_success,    /* show_glyphs */
     NULL, /* has_show_text_glyphs */
     NULL  /* show_text_glyphs */
 };
diff --git a/src/cairo-base64-stream.c b/src/cairo-base64-stream.c
index 6352545f7..7f331e539 100644
--- a/src/cairo-base64-stream.c
+++ b/src/cairo-base64-stream.c
@@ -85,6 +85,7 @@ _cairo_base64_stream_write (cairo_output_stream_t *base,
 	switch (stream->trailing) {
 	    case 2:
 		dst[2] = '=';
+		/* fall through */
 	    case 1:
 		dst[3] = '=';
 	    default:
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index c22da6f95..d2221edec 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1369,6 +1369,7 @@ _get_bitmap_surface (FT_Bitmap		     *bitmap,
 	    memcpy (data, bitmap->buffer, stride * height);
 	    break;
 	}
+	/* fall through */
 	/* These could be triggered by very rare types of TrueType fonts */
     default:
 	if (own_buffer)
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index 9e9166cbd..d74182346 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -1516,7 +1516,7 @@ _cairo_path_fixed_iter_is_fill_box (cairo_path_fixed_iter_t *_iter,
     /* a horizontal/vertical closed line is also a degenerate rectangle */
     switch (iter.buf->op[iter.n_op]) {
     case CAIRO_PATH_OP_CLOSE_PATH:
-	_cairo_path_fixed_iter_next_op (&iter);
+	_cairo_path_fixed_iter_next_op (&iter); /* fall through */
     case CAIRO_PATH_OP_MOVE_TO: /* implicit close */
 	box->p1 = box->p2 = points[0];
 	*_iter = iter;
diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c
index 29050fa76..3f7c49802 100644
--- a/src/cairo-path-stroke-polygon.c
+++ b/src/cairo-path-stroke-polygon.c
@@ -408,7 +408,7 @@ outer_close (struct stroker *stroker,
 		     clockwise, outer);
 	    break;
 	}
-
+	/* else fall through */
     case CAIRO_LINE_JOIN_MITER:
     default: {
 	/* dot product of incoming slope vector with outgoing slope vector */
diff --git a/src/cairo-path-stroke-traps.c b/src/cairo-path-stroke-traps.c
index da54e5a35..1363ffa86 100644
--- a/src/cairo-path-stroke-traps.c
+++ b/src/cairo-path-stroke-traps.c
@@ -458,9 +458,8 @@ join (struct stroker *stroker,
 		break;
 	    }
 	}
-	/* fall through ... */
     }
-
+    /* fall through ... */
     case CAIRO_LINE_JOIN_BEVEL: {
 	cairo_point_t t[] = { { in->point.x, in->point.y }, { inpt->x, inpt->y }, { outpt->x, outpt->y } };
 	cairo_point_t e[] = { { in->cw.x, in->cw.y }, { in->ccw.x, in->ccw.y },
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 939b2d2d7..93fc9022c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -5278,16 +5278,16 @@ _hash_data (const unsigned char *data, int length, uint32_t initval)
 
     c += length;
     switch(len) {
-    case 11: c+= ((uint32_t) data[10] << 24);
-    case 10: c+= ((uint32_t) data[9] << 16);
-    case 9 : c+= ((uint32_t) data[8] << 8);
-    case 8 : b+= ((uint32_t) data[7] << 24);
-    case 7 : b+= ((uint32_t) data[6] << 16);
-    case 6 : b+= ((uint32_t) data[5] << 8);
-    case 5 : b+= data[4];
-    case 4 : a+= ((uint32_t) data[3] << 24);
-    case 3 : a+= ((uint32_t) data[2] << 16);
-    case 2 : a+= ((uint32_t) data[1] << 8);
+    case 11: c+= ((uint32_t) data[10] << 24); /* fall through */
+    case 10: c+= ((uint32_t) data[9] << 16);  /* fall through */
+    case 9 : c+= ((uint32_t) data[8] << 8);   /* fall through */
+    case 8 : b+= ((uint32_t) data[7] << 24);  /* fall through */
+    case 7 : b+= ((uint32_t) data[6] << 16);  /* fall through */
+    case 6 : b+= ((uint32_t) data[5] << 8);   /* fall through */
+    case 5 : b+= data[4];		      /* fall through */
+    case 4 : a+= ((uint32_t) data[3] << 24);  /* fall through */
+    case 3 : a+= ((uint32_t) data[2] << 16);  /* fall through */
+    case 2 : a+= ((uint32_t) data[1] << 8);   /* fall through */
     case 1 : a+= data[0];
     }
     HASH_MIX (a,b,c);
@@ -5309,7 +5309,7 @@ _create_font_subset_tag (cairo_scaled_font_subset_t	*font_subset,
     hash = _hash_data ((unsigned char *) (font_subset->glyphs),
 		       font_subset->num_glyphs * sizeof(unsigned long), hash);
 
-    numerator = abs (hash);
+    numerator = hash;
     for (i = 0; i < 6; i++) {
 	d = ldiv (numerator, 26);
 	numerator = d.quot;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index dd37198ef..7e7051eb6 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1276,6 +1276,7 @@ base64_write_func (void *closure,
 	switch (info->trailing) {
 	    case 2:
 		dst[2] = '=';
+		/* fall through */
 	    case 1:
 		dst[3] = '=';
 	    default:
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index 754c32395..068b59e99 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -334,7 +334,7 @@ cairo_type1_font_subset_get_matrix (cairo_type1_font_subset_t *font,
     j = 0;
     while (i < end - start && j < s_max - decimal_point_len) {
 	if (start[i] == '.') {
-	    strncpy(s + j, decimal_point, decimal_point_len);
+	    strncpy(s + j, decimal_point, decimal_point_len + 1);
 	    i++;
 	    j += decimal_point_len;
 	} else {
diff --git a/util/cairo-script/cairo-script-file.c b/util/cairo-script/cairo-script-file.c
index e7c5376bf..7027f6027 100644
--- a/util/cairo-script/cairo-script-file.c
+++ b/util/cairo-script/cairo-script-file.c
@@ -833,6 +833,7 @@ csi_file_getc (csi_file_t *file)
 	    file->rem--;
 	} else {
 	    file->rem = fread (file->bp = file->data, 1, CHUNK_SIZE, file->src);
+	    /* fall through */
     case BYTES:
 	    if (_csi_likely (file->rem)) {
 		c = *file->bp++;
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index 7cdb5afb6..df8886ef6 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -465,6 +465,7 @@ _csi_ostack_get_matrix (csi_t *ctx, unsigned int i, cairo_matrix_t *out)
 			       csi_number_get_value (&obj->datum.array->stack.objects[5]));
 	    return CSI_STATUS_SUCCESS;
 	}
+	/* else fall through */
     default:
 	return _csi_error (CSI_STATUS_INVALID_SCRIPT);
     }
diff --git a/util/cairo-script/cairo-script-scanner.c b/util/cairo-script/cairo-script-scanner.c
index 3dfb3a9a2..fe6512dd9 100644
--- a/util/cairo-script/cairo-script-scanner.c
+++ b/util/cairo-script/cairo-script-scanner.c
@@ -1054,6 +1054,7 @@ scan_token:
 	switch (c) {
 	case 0xa:
 	    scan->line_number++;
+	    /* fall through */
 	case 0x0:
 	case 0x9:
 	case 0xc:
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index bb618b5d9..84952a365 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -784,7 +784,7 @@ static cairo_bool_t
 _init_logfile (void)
 {
     static cairo_bool_t initialized;
-    char buf[4105];
+    char buf[4096];
     const char *filename;
     const char *env;
 
@@ -836,8 +836,12 @@ _init_logfile (void)
 	if (*name == '\0')
 	    strcpy (name, "cairo-trace.dat");
 
-	snprintf (buf, sizeof (buf), "%s/%s.%d.trace",
-		filename, name, getpid());
+	if (snprintf (buf, sizeof (buf), "%s/%s.%d.trace",
+		      filename, name, getpid()) >= (int) sizeof (buf))
+	{
+	    fprintf (stderr, "cairo-trace: Trace file name too long\n");
+	    return FALSE;
+	}
 
 	filename = buf;
     } else {


More information about the cairo-commit mailing list