Commit ed984146 authored by George Matsumura's avatar George Matsumura
Browse files

build: Fix various compiler warnings



This fixes a few compiler warnings that were encountered with gcc 9.3.0.
Signed-off-by: George Matsumura's avatarGeorge Matsumura <gmmatsumura01@bvsd.org>
parent 618b13c4
......@@ -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.
......
......@@ -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,
......
......@@ -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;
......
......@@ -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 */
};
......
......@@ -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:
......
......@@ -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)
......
......@@ -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;
......
......@@ -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 */
......
......@@ -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 },
......
......@@ -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;
......
......@@ -1276,6 +1276,7 @@ base64_write_func (void *closure,
switch (info->trailing) {
case 2:
dst[2] = '=';
/* fall through */
case 1:
dst[3] = '=';
default:
......
......@@ -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 {
......
......@@ -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++;
......
......@@ -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);
}
......
......@@ -1054,6 +1054,7 @@ scan_token:
switch (c) {
case 0xa:
scan->line_number++;
/* fall through */
case 0x0:
case 0x9:
case 0xc:
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment