mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-04 16:30:32 +01:00
Merge branch 'fix-valgrind-errors' into 'master'
Fix some problems found by valgrind See merge request cairo/cairo!452
This commit is contained in:
commit
f2f2d20a36
4 changed files with 45 additions and 2 deletions
|
|
@ -105,6 +105,41 @@ _cairo_font_options_init_copy (cairo_font_options_t *options,
|
|||
}
|
||||
}
|
||||
|
||||
cairo_bool_t
|
||||
_cairo_font_options_compare (const cairo_font_options_t *a,
|
||||
const cairo_font_options_t *b)
|
||||
{
|
||||
if (a->antialias != b->antialias ||
|
||||
a->subpixel_order != b->subpixel_order ||
|
||||
a->lcd_filter != b->lcd_filter ||
|
||||
a->hint_style != b->hint_style ||
|
||||
a->hint_metrics != b->hint_metrics ||
|
||||
a->round_glyph_positions != b->round_glyph_positions ||
|
||||
a->color_mode != b->color_mode ||
|
||||
a->palette_index != b->palette_index ||
|
||||
a->custom_palette_size != b->custom_palette_size)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (a->variations && b->variations && strcmp (a->variations, b->variations) != 0)
|
||||
return FALSE;
|
||||
else if (a->variations != b->variations)
|
||||
return FALSE;
|
||||
|
||||
if (a->custom_palette && b->custom_palette &&
|
||||
memcmp (a->custom_palette, b->custom_palette, sizeof (cairo_palette_color_t) * a->custom_palette_size) != 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else if (a->custom_palette != b->custom_palette)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_font_options_create:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1748,7 +1748,7 @@ void
|
|||
_cairo_gstate_set_font_options (cairo_gstate_t *gstate,
|
||||
const cairo_font_options_t *options)
|
||||
{
|
||||
if (memcmp (options, &gstate->font_options, sizeof (cairo_font_options_t)) == 0)
|
||||
if (_cairo_font_options_compare (options, &gstate->font_options))
|
||||
return;
|
||||
|
||||
_cairo_gstate_unset_scaled_font (gstate);
|
||||
|
|
|
|||
|
|
@ -1471,10 +1471,14 @@ find_name (tt_name_t *name, unsigned long size, int name_id, int platform, int e
|
|||
if (offset + len > size)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
str = _cairo_strndup (((char*)name) + offset, len);
|
||||
str = _cairo_malloc (len + 1);
|
||||
if (str == NULL)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
memcpy (str,
|
||||
((char*)name) + offset,
|
||||
len);
|
||||
str[len] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -897,6 +897,10 @@ cairo_private void
|
|||
_cairo_font_options_init_copy (cairo_font_options_t *options,
|
||||
const cairo_font_options_t *other);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
_cairo_font_options_compare (const cairo_font_options_t *a,
|
||||
const cairo_font_options_t *b);
|
||||
|
||||
cairo_private void
|
||||
_cairo_font_options_fini (cairo_font_options_t *options);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue