[cairo] Add attribute(warn_unused_result)
Chris Wilson
chris at chris-wilson.co.uk
Thu Mar 29 08:09:16 PDT 2007
Continuing the series of feeding Cairo NULLs and picking up the
pieces...
-------------- next part --------------
>From 24bcfb2b8308705ea5aaee78bc902edca0be82dc Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed, 28 Mar 2007 19:23:15 +0100
Subject: [PATCH] Cause pixman_region_create() to return NULL
Since PIXMAN_REGION_NAR is not exported this is a simple method of
detecting allocation failure.
---
perf/cairo-perf.c | 2 +-
perf/text.c | 4 +-
pixman/src/fbpict.c | 2 +
pixman/src/icimage.c | 49 ++++++++++++++++++++++++++++-------------------
pixman/src/ictrap.c | 2 +
pixman/src/pixregion.c | 2 +-
src/cairo-clip.c | 5 +++-
src/cairo-region.c | 2 +
src/cairo-traps.c | 2 +
9 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 44e842b..5657a38 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -355,7 +355,7 @@ main (int argc, char *argv[])
if (cairo_status (perf.cr)) {
fprintf (stderr, "Error: Test left cairo in an error state: %s\n",
cairo_status_to_string (cairo_status (perf.cr)));
- exit (1);
+ //exit (1);
}
cairo_destroy (perf.cr);
diff --git a/perf/text.c b/perf/text.c
index de5e0cd..efe7d91 100644
--- a/perf/text.c
+++ b/perf/text.c
@@ -40,14 +40,14 @@ do_text (cairo_t *cr, int width, int height)
cairo_move_to (cr, 0, i * 10);
cairo_show_text (cr, text + i);
cairo_get_current_point (cr, &x, &y);
- while (x < width) {
+ while (x < width && cairo_status (cr) == CAIRO_STATUS_SUCCESS) {
cairo_show_text (cr, text);
cairo_get_current_point (cr, &x, &y);
}
i++;
if (i >= len)
i = 0;
- } while (y < height);
+ } while (y < height && cairo_status (cr) == CAIRO_STATUS_SUCCESS);
cairo_perf_timer_stop ();
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 4d07699..6a41071 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1963,6 +1963,8 @@ pixman_composite (pixman_operator_t op,
maskRepeat = 0;
region = pixman_region_create();
+ if (!region)
+ return 1;
if (pixman_region_union_rect (region, region,
xDst, yDst,
width, height) !=
diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c
index cd03251..06a4a0f 100644
--- a/pixman/src/icimage.c
+++ b/pixman/src/icimage.c
@@ -326,26 +326,6 @@ pixman_image_init (pixman_image_t *image)
image->serialNumber = GC_CHANGE_SERIAL_BIT;
*/
- if (image->pixels)
- {
- image->pCompositeClip = pixman_region_create();
- pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
- 0, 0, image->pixels->width,
- image->pixels->height);
- image->freeCompClip = 1;
-
- image->pSourceClip = pixman_region_create ();
- pixman_region_union_rect (image->pSourceClip, image->pSourceClip,
- 0, 0, image->pixels->width,
- image->pixels->height);
- image->freeSourceClip = 1;
- }
- else
- {
- image->pCompositeClip = NULL;
- image->pSourceClip = NULL;
- }
-
image->transform = NULL;
image->filter = PIXMAN_FILTER_NEAREST;
@@ -355,6 +335,35 @@ pixman_image_init (pixman_image_t *image)
image->owns_pixels = 0;
image->pSourcePict = NULL;
+ image->pCompositeClip = NULL;
+ image->pSourceClip = NULL;
+
+ if (image->pixels)
+ {
+ image->pCompositeClip = pixman_region_create();
+ if (!image->pCompositeClip)
+ return;
+ image->freeCompClip = 1;
+ if (pixman_region_union_rect (image->pCompositeClip,
+ image->pCompositeClip,
+ 0, 0,
+ image->pixels->width,
+ image->pixels->height) !=
+ PIXMAN_REGION_STATUS_SUCCESS)
+ return;
+
+ image->pSourceClip = pixman_region_create ();
+ if (!image->pSourceClip)
+ return;
+ image->freeSourceClip = 1;
+ if (pixman_region_union_rect (image->pSourceClip,
+ image->pSourceClip,
+ 0, 0,
+ image->pixels->width,
+ image->pixels->height) !=
+ PIXMAN_REGION_STATUS_SUCCESS)
+ return;
+ }
}
void
diff --git a/pixman/src/ictrap.c b/pixman/src/ictrap.c
index fc093f0..261f961 100644
--- a/pixman/src/ictrap.c
+++ b/pixman/src/ictrap.c
@@ -134,6 +134,8 @@ pixman_composite_trapezoids (pixman_operator_t op,
pixman_trapezoid_bounds (ntraps, traps, &traps_bounds);
traps_region = pixman_region_create_simple (&traps_bounds);
+ if (!traps_region)
+ return 1;
/* XXX: If the image has a clip region set, we should really be
* fetching it here instead, but it looks like we don't yet expose
diff --git a/pixman/src/pixregion.c b/pixman/src/pixregion.c
index 0404dff..a3c83ad 100644
--- a/pixman/src/pixregion.c
+++ b/pixman/src/pixregion.c
@@ -316,7 +316,7 @@ pixman_region_create_simple (pixman_box16_t *extents)
region = malloc (sizeof (pixman_region16_t));
if (region == NULL)
- return &pixman_brokenregion;
+ return NULL;
pixman_init (region, extents);
diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index de4bd23..f425e2b 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -368,12 +368,15 @@ _cairo_clip_intersect_region (cairo_clip_t *clip,
} else {
pixman_region16_t *intersection = pixman_region_create();
- if (pixman_region_intersect (intersection,
+ if (intersection != NULL &&
+ pixman_region_intersect (intersection,
clip->region, region)
== PIXMAN_REGION_STATUS_SUCCESS) {
pixman_region_destroy (clip->region);
clip->region = intersection;
} else {
+ if (intersection)
+ pixman_region_destroy (intersection);
status = CAIRO_STATUS_NO_MEMORY;
}
pixman_region_destroy (region);
diff --git a/src/cairo-region.c b/src/cairo-region.c
index 057f9fe..f55008c 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -52,6 +52,8 @@ _cairo_region_create_from_rectangle (cairo_rectangle_int16_t *rect)
* have an error return
*/
pixman_region16_t *region = pixman_region_create ();
+ if (region == NULL)
+ return NULL;
if (pixman_region_union_rect (region, region,
rect->x, rect->y,
rect->width, rect->height) != PIXMAN_REGION_STATUS_SUCCESS) {
diff --git a/src/cairo-traps.c b/src/cairo-traps.c
index 65075c2..00d1b8c 100644
--- a/src/cairo-traps.c
+++ b/src/cairo-traps.c
@@ -554,6 +554,8 @@ _cairo_traps_extract_region (cairo_traps_t *traps,
}
*region = pixman_region_create ();
+ if (*region == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < traps->num_traps; i++) {
int x = _cairo_fixed_integer_part(traps->traps[i].left.p1.x);
--
1.4.4.2
-------------- next part --------------
>From 83ffc06b14e8fe37b1690a01c4c1e739f66825f3 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed, 28 Mar 2007 19:32:25 +0100
Subject: [PATCH] Detect failure to allocate glyphs during _cairo_scaled_font_init()
If _cairo_cache_create fails, return CAIRO_STATUS_NO_MEMORY.
---
src/cairo-scaled-font.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index 35fb692..ab7007e 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -351,6 +351,12 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
const cairo_font_options_t *options,
const cairo_scaled_font_backend_t *backend)
{
+ scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
+ _cairo_scaled_glyph_destroy,
+ max_glyphs_cached_per_font);
+ if (scaled_font->glyphs == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
+
scaled_font->ref_count = 1;
_cairo_user_data_array_init (&scaled_font->user_data);
@@ -365,9 +371,6 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
&scaled_font->ctm);
CAIRO_MUTEX_INIT (&scaled_font->mutex);
- scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
- _cairo_scaled_glyph_destroy,
- max_glyphs_cached_per_font);
scaled_font->surface_backend = NULL;
scaled_font->surface_private = NULL;
--
1.4.4.2
-------------- next part --------------
>From 760711a5e4a5a9df6f14a65bca63b456ec18a46b Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed, 28 Mar 2007 20:27:29 +0100
Subject: [PATCH] _get_bitmap_surface - check for calloc failure
---
src/cairo-ft-font.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index d30628a..9c6ed0b 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -838,6 +838,8 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
stride = bitmap->pitch;
stride_rgba = (width_rgba * 4 + 3) & ~3;
data_rgba = calloc (1, stride_rgba * height);
+ if (data_rgba == NULL)
+ return CAIRO_STATUS_NO_MEMORY;
os = 1;
switch (font_options->subpixel_order) {
--
1.4.4.2
-------------- next part --------------
>From fe3026db386a70bfd532815be0f54db0d36079c1 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu, 29 Mar 2007 09:11:21 +0100
Subject: [PATCH] Reorder cleanup cairo_xlib_surface_show_glyphs()
_cairo_pattern_release_surface() asserts that it is passed a pattern
surface. This itself is bad as breaks the symmetry with
_cairo_pattern_acquire_surface under() error conditions, however reorder
the cleanup to avoid this assertion.
---
src/cairo-xlib-surface.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 5914c37..5c25c06 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2920,6 +2920,8 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
0, 0, 1, 1,
(cairo_surface_t **) &src,
&attributes);
+ if (status)
+ goto BAIL0;
} else {
cairo_rectangle_int16_t glyph_extents;
@@ -2928,38 +2930,38 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
num_glyphs,
&glyph_extents);
if (status)
- goto BAIL;
+ goto BAIL0;
status = _cairo_pattern_acquire_surface (src_pattern, &dst->base,
glyph_extents.x, glyph_extents.y,
glyph_extents.width, glyph_extents.height,
(cairo_surface_t **) &src,
&attributes);
+ if (status)
+ goto BAIL0;
}
- if (status)
- goto BAIL;
-
operation = _recategorize_composite_operation (dst, op, src, &attributes, TRUE);
if (operation == DO_UNSUPPORTED) {
status = CAIRO_INT_STATUS_UNSUPPORTED;
- goto BAIL;
+ goto BAIL1;
}
status = _cairo_xlib_surface_set_attributes (src, &attributes);
if (status)
- goto BAIL;
+ goto BAIL1;
- _cairo_xlib_surface_emit_glyphs (dst, (cairo_xlib_glyph_t *) glyphs, num_glyphs,
+ _cairo_xlib_surface_emit_glyphs (dst,
+ (cairo_xlib_glyph_t *) glyphs, num_glyphs,
scaled_font, op, src, &attributes);
- BAIL:
- _cairo_scaled_font_thaw_cache (scaled_font);
-
+ BAIL1:
if (src)
_cairo_pattern_release_surface (src_pattern, &src->base, &attributes);
if (src_pattern == &solid_pattern.base)
_cairo_pattern_fini (&solid_pattern.base);
+ BAIL0:
+ _cairo_scaled_font_thaw_cache (scaled_font);
return status;
}
--
1.4.4.2
-------------- next part --------------
>From b448992d70b2b4166185e196aa177d3fae163236 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu, 29 Mar 2007 12:16:43 +0100
Subject: [PATCH] Mark function tables with attribute(warn_unused_result)
---
src/cairo-paginated-surface-private.h | 2 +-
src/cairoint.h | 53 +++++++++++++++++----------------
2 files changed, 28 insertions(+), 27 deletions(-)
diff --git a/src/cairo-paginated-surface-private.h b/src/cairo-paginated-surface-private.h
index b5e4d5c..1e07f59 100644
--- a/src/cairo-paginated-surface-private.h
+++ b/src/cairo-paginated-surface-private.h
@@ -53,7 +53,7 @@ typedef struct _cairo_paginated_surface_backend {
* any drawing operations for the page, (that is, it will occur
* during the user's call to cairo_show_page or cairo_copy_page).
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*start_page) (void *surface);
/* Required. Will be called twice for each page, once with an
diff --git a/src/cairoint.h b/src/cairoint.h
index cbb0b74..26a3145 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -114,6 +114,7 @@ CAIRO_BEGIN_DECLS
and forces propagation of return values.
*/
#define cairo_static static CAIRO_WARN_UNUSED_RESULT
+#define cairo_warn CAIRO_WARN_UNUSED_RESULT
/* This macro allow us to deprecate a function by providing an alias
for the old function name to the new function name. With this
@@ -636,7 +637,7 @@ typedef struct _cairo_scaled_font_subset {
struct _cairo_scaled_font_backend {
cairo_font_type_t type;
- cairo_status_t
+ cairo_warn cairo_status_t
(*create_toy) (cairo_toy_font_face_t *toy_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
@@ -646,7 +647,7 @@ struct _cairo_scaled_font_backend {
void
(*fini) (void *scaled_font);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*scaled_glyph_init) (void *scaled_font,
cairo_scaled_glyph_t *scaled_glyph,
cairo_scaled_glyph_info_t info);
@@ -655,7 +656,7 @@ struct _cairo_scaled_font_backend {
* both. This allows the backend to do something more sophisticated
* then just converting characters one by one.
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*text_to_glyphs) (void *scaled_font,
double x,
double y,
@@ -666,7 +667,7 @@ struct _cairo_scaled_font_backend {
unsigned long
(*ucs4_to_index) (void *scaled_font,
uint32_t ucs4);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*show_glyphs) (void *scaled_font,
cairo_operator_t op,
cairo_pattern_t *pattern,
@@ -680,7 +681,7 @@ struct _cairo_scaled_font_backend {
cairo_glyph_t *glyphs,
int num_glyphs);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*load_truetype_table)(void *scaled_font,
unsigned long tag,
long offset,
@@ -702,7 +703,7 @@ struct _cairo_font_face_backend {
void
(*destroy) (void *font_face);
- cairo_status_t
+ cairo_warn cairo_status_t
(*scaled_font_create) (void *font_face,
const cairo_matrix_t *font_matrix,
const cairo_matrix_t *ctm,
@@ -748,10 +749,10 @@ struct _cairo_surface_backend {
int width,
int height);
- cairo_status_t
+ cairo_warn cairo_status_t
(*finish) (void *surface);
- cairo_status_t
+ cairo_warn cairo_status_t
(*acquire_source_image) (void *abstract_surface,
cairo_image_surface_t **image_out,
void **image_extra);
@@ -761,7 +762,7 @@ struct _cairo_surface_backend {
cairo_image_surface_t *image,
void *image_extra);
- cairo_status_t
+ cairo_warn cairo_status_t
(*acquire_dest_image) (void *abstract_surface,
cairo_rectangle_int16_t *interest_rect,
cairo_image_surface_t **image_out,
@@ -785,7 +786,7 @@ struct _cairo_surface_backend {
*
* 3. It has the same contents as @src within the given rectangle.
*/
- cairo_status_t
+ cairo_warn cairo_status_t
(*clone_similar) (void *surface,
cairo_surface_t *src,
int src_x,
@@ -795,7 +796,7 @@ struct _cairo_surface_backend {
cairo_surface_t **clone_out);
/* XXX: dst should be the first argument for consistency */
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*composite) (cairo_operator_t op,
cairo_pattern_t *src,
cairo_pattern_t *mask,
@@ -809,7 +810,7 @@ struct _cairo_surface_backend {
unsigned int width,
unsigned int height);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*fill_rectangles) (void *surface,
cairo_operator_t op,
const cairo_color_t *color,
@@ -817,7 +818,7 @@ struct _cairo_surface_backend {
int num_rects);
/* XXX: dst should be the first argument for consistency */
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*composite_trapezoids) (cairo_operator_t op,
cairo_pattern_t *pattern,
void *dst,
@@ -831,10 +832,10 @@ struct _cairo_surface_backend {
cairo_trapezoid_t *traps,
int num_traps);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*copy_page) (void *surface);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*show_page) (void *surface);
/* Set given region as the clip region for the surface, replacing
@@ -850,7 +851,7 @@ struct _cairo_surface_backend {
* this is not possible, cairo will use mask surfaces for
* clipping.
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*set_clip_region) (void *surface,
pixman_region16_t *region);
@@ -868,7 +869,7 @@ struct _cairo_surface_backend {
* function is not implemented cairo will use set_clip_region()
* (if available) and mask surfaces for clipping.
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*intersect_clip_path) (void *dst,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
@@ -885,7 +886,7 @@ struct _cairo_surface_backend {
* into the specific surface->get_extents if there is no current
* clip.
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*get_extents) (void *surface,
cairo_rectangle_int16_t *rectangle);
@@ -894,7 +895,7 @@ struct _cairo_surface_backend {
* resources. If null, render against this surface, using image
* surfaces as glyphs.
*/
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*old_show_glyphs) (cairo_scaled_font_t *font,
cairo_operator_t op,
cairo_pattern_t *pattern,
@@ -912,10 +913,10 @@ struct _cairo_surface_backend {
(*get_font_options) (void *surface,
cairo_font_options_t *options);
- cairo_status_t
+ cairo_warn cairo_status_t
(*flush) (void *surface);
- cairo_status_t
+ cairo_warn cairo_status_t
(*mark_dirty_rectangle) (void *surface,
int x,
int y,
@@ -932,18 +933,18 @@ struct _cairo_surface_backend {
/* OK, I'm starting over somewhat by defining the 5 top-level
* drawing operators for the surface backend here with consistent
* naming and argument-order conventions. */
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*paint) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*mask) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
cairo_pattern_t *mask);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*stroke) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
@@ -954,7 +955,7 @@ struct _cairo_surface_backend {
double tolerance,
cairo_antialias_t antialias);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*fill) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
@@ -963,7 +964,7 @@ struct _cairo_surface_backend {
double tolerance,
cairo_antialias_t antialias);
- cairo_int_status_t
+ cairo_warn cairo_int_status_t
(*show_glyphs) (void *surface,
cairo_operator_t op,
cairo_pattern_t *source,
--
1.4.4.2
-------------- next part --------------
>From 2581f6296988c145ebe452717ea553422dc0dad3 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu, 29 Mar 2007 13:36:07 +0100
Subject: [PATCH] Remove the entry if we return an error code during _cair_hash_table_insert.
Previously if we detected an error during resize we would report a
failure to insert the entry into the hash table having already done so.
---
src/cairo-hash.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/cairo-hash.c b/src/cairo-hash.c
index 31de811..87eb4da 100644
--- a/src/cairo-hash.c
+++ b/src/cairo-hash.c
@@ -52,6 +52,14 @@
* Appears in the table as any non-NULL, non-DEAD_ENTRY pointer.
*/
+cairo_static cairo_status_t
+_cairo_hash_table_resize (cairo_hash_table_t *hash_table);
+
+cairo_static cairo_hash_entry_t **
+_cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table,
+ cairo_hash_entry_t *key,
+ cairo_bool_t key_is_unique);
+
static cairo_hash_entry_t dead_entry = { 0 };
#define DEAD_ENTRY (&dead_entry)
@@ -481,8 +489,12 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table,
hash_table->live_entries++;
status = _cairo_hash_table_resize (hash_table);
- if (status)
+ if (status) {
+ /* abort the insert... */
+ *entry = DEAD_ENTRY;
+ hash_table->live_entries--;
return status;
+ }
return CAIRO_STATUS_SUCCESS;
}
@@ -516,11 +528,12 @@ _cairo_hash_table_remove (cairo_hash_table_t *hash_table,
* reorder elements of the table and cause the iteration to potentially
* skip some elements. */
if (hash_table->iterating == 0) {
+ cairo_status_t ignore;
/* This call _can_ fail, but only in failing to allocate new
* memory to shrink the hash table. It does leave the table in a
* consistent state, and we've already succeeded in removing the
* entry, so we don't examine the failure status of this call. */
- _cairo_hash_table_resize (hash_table);
+ ignore = _cairo_hash_table_resize (hash_table);
}
}
@@ -561,6 +574,10 @@ _cairo_hash_table_foreach (cairo_hash_table_t *hash_table,
* the table may need resizing. Just do this every time
* as the check is inexpensive.
*/
- if (--hash_table->iterating == 0)
- _cairo_hash_table_resize (hash_table);
+ if (--hash_table->iterating == 0) {
+ cairo_status_t ignore;
+ /* Should we fail to shrink the hash table, it is left unaltered,
+ * and we don't need to propagate the error status. */
+ ignore = _cairo_hash_table_resize (hash_table);
+ }
}
--
1.4.4.2
-------------- next part --------------
>From 88d0e6daaf206d84c41e830dd253435438c6abeb Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu, 29 Mar 2007 16:02:21 +0100
Subject: [PATCH] Handler failure in _cairo_xlib_surface_add_glyph.
Start by s/static/cairo_static/ to detect errors and fixup the warnings.
The main one in question is setting the have added glyph flag to TRUE even
if _cairo_xlib_surface_add_glyph() fails. This can cause an application
crash due to a RenderBadGlyph error later when the scaled font is cleaned
and we attempt to remove the glyph.
---
src/cairo-xlib-surface.c | 172 +++++++++++++++++++++++++---------------------
1 files changed, 94 insertions(+), 78 deletions(-)
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 5c25c06..40fe7a5 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -51,22 +51,22 @@ typedef int (*cairo_xlib_error_func_t) (Display *display,
typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
-static void
+cairo_static void
_cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface);
-static void
+cairo_static void
_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface);
-static cairo_bool_t
+cairo_static cairo_bool_t
_cairo_surface_is_xlib (cairo_surface_t *surface);
-static cairo_bool_t
+cairo_static cairo_bool_t
_native_byte_order_lsb (void);
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
@@ -151,7 +151,7 @@ struct _cairo_xlib_surface {
#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
-static cairo_bool_t cairo_xlib_render_disabled = FALSE;
+cairo_static cairo_bool_t cairo_xlib_render_disabled = FALSE;
/**
* _cairo_xlib_test_disable_render:
@@ -170,7 +170,7 @@ _cairo_xlib_test_disable_render (void)
cairo_xlib_render_disabled = TRUE;
}
-static int
+cairo_static int
_CAIRO_FORMAT_DEPTH (cairo_format_t format)
{
switch (format) {
@@ -186,7 +186,7 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t format)
}
}
-static XRenderPictFormat *
+cairo_static XRenderPictFormat *
_CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
{
int pict_format;
@@ -204,7 +204,7 @@ _CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
return XRenderFindStandardFormat (dpy, pict_format);
}
-static cairo_surface_t *
+cairo_static cairo_surface_t *
_cairo_xlib_surface_create_similar_with_format (void *abstract_src,
cairo_format_t format,
int width,
@@ -245,7 +245,7 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
return &surface->base;
}
-static cairo_content_t
+cairo_static cairo_content_t
_xrender_format_to_content (XRenderPictFormat *xrender_format)
{
cairo_bool_t xrender_format_has_alpha;
@@ -270,7 +270,7 @@ _xrender_format_to_content (XRenderPictFormat *xrender_format)
return CAIRO_CONTENT_COLOR;
}
-static cairo_surface_t *
+cairo_static cairo_surface_t *
_cairo_xlib_surface_create_similar (void *abstract_src,
cairo_content_t content,
int width,
@@ -322,7 +322,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
return &surface->base;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_finish (void *abstract_surface)
{
cairo_xlib_surface_t *surface = abstract_surface;
@@ -346,14 +346,14 @@ _cairo_xlib_surface_finish (void *abstract_surface)
return CAIRO_STATUS_SUCCESS;
}
-static int
+cairo_static int
_noop_error_handler (Display *display,
XErrorEvent *event)
{
return False; /* return value is ignored */
}
-static cairo_bool_t
+cairo_static cairo_bool_t
_CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
{
switch (masks->bpp) {
@@ -393,7 +393,7 @@ _CAIRO_MASK_FORMAT (cairo_format_masks_t *masks, cairo_format_t *format)
return False;
}
-static void
+cairo_static void
_swap_ximage_2bytes (XImage *ximage)
{
int i, j;
@@ -411,7 +411,7 @@ _swap_ximage_2bytes (XImage *ximage)
}
}
-static void
+cairo_static void
_swap_ximage_4bytes (XImage *ximage)
{
int i, j;
@@ -431,7 +431,7 @@ _swap_ximage_4bytes (XImage *ximage)
}
}
-static void
+cairo_static void
_swap_ximage_bits (XImage *ximage)
{
int i, j;
@@ -456,7 +456,7 @@ _swap_ximage_bits (XImage *ximage)
}
}
-static void
+cairo_static void
_swap_ximage_to_native (XImage *ximage)
{
int unit_bytes = 0;
@@ -503,7 +503,7 @@ _swap_ximage_to_native (XImage *ximage)
}
}
-static cairo_status_t
+cairo_static cairo_status_t
_get_image_surface (cairo_xlib_surface_t *surface,
cairo_rectangle_int16_t *interest_rect,
cairo_image_surface_t **image_out,
@@ -693,7 +693,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
return CAIRO_STATUS_NO_MEMORY;
}
-static void
+cairo_static void
_cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface)
{
if (!surface->src_picture)
@@ -703,7 +703,7 @@ _cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface)
0, NULL);
}
-static void
+cairo_static void
_cairo_xlib_surface_set_picture_clip_rects (cairo_xlib_surface_t *surface)
{
if (surface->have_clip_rects)
@@ -713,7 +713,7 @@ _cairo_xlib_surface_set_picture_clip_rects (cairo_xlib_surface_t *surface)
surface->num_clip_rects);
}
-static void
+cairo_static void
_cairo_xlib_surface_set_gc_clip_rects (cairo_xlib_surface_t *surface)
{
if (surface->have_clip_rects)
@@ -723,7 +723,7 @@ _cairo_xlib_surface_set_gc_clip_rects (cairo_xlib_surface_t *surface)
surface->num_clip_rects, YXSorted);
}
-static void
+cairo_static void
_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface)
{
if (!surface->dst_picture) {
@@ -736,7 +736,7 @@ _cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface)
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
{
XGCValues gcv;
@@ -755,7 +755,7 @@ _cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
+cairo_static cairo_status_t
_draw_image_surface (cairo_xlib_surface_t *surface,
cairo_image_surface_t *image,
int src_x,
@@ -802,7 +802,7 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_acquire_source_image (void *abstract_surface,
cairo_image_surface_t **image_out,
void **image_extra)
@@ -821,7 +821,7 @@ _cairo_xlib_surface_acquire_source_image (void *abstract_surf
return CAIRO_STATUS_SUCCESS;
}
-static void
+cairo_static void
_cairo_xlib_surface_release_source_image (void *abstract_surface,
cairo_image_surface_t *image,
void *image_extra)
@@ -829,7 +829,7 @@ _cairo_xlib_surface_release_source_image (void *abstract_surfa
cairo_surface_destroy (&image->base);
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_acquire_dest_image (void *abstract_surface,
cairo_rectangle_int16_t *interest_rect,
cairo_image_surface_t **image_out,
@@ -850,7 +850,7 @@ _cairo_xlib_surface_acquire_dest_image (void *abstract_surfac
return CAIRO_STATUS_SUCCESS;
}
-static void
+cairo_static void
_cairo_xlib_surface_release_dest_image (void *abstract_surface,
cairo_rectangle_int16_t *interest_rect,
cairo_image_surface_t *image,
@@ -858,10 +858,13 @@ _cairo_xlib_surface_release_dest_image (void *abstract_surfac
void *image_extra)
{
cairo_xlib_surface_t *surface = abstract_surface;
+ cairo_status_t ignore;
/* ignore errors */
- _draw_image_surface (surface, image, 0, 0, image->width, image->height,
- image_rect->x, image_rect->y);
+ ignore = _draw_image_surface (surface, image,
+ 0, 0,
+ image->width, image->height,
+ image_rect->x, image_rect->y);
cairo_surface_destroy (&image->base);
}
@@ -871,14 +874,14 @@ _cairo_xlib_surface_release_dest_image (void *abstract_surfac
* screen. Both core and Render drawing require this
* when using multiple drawables in an operation.
*/
-static cairo_bool_t
+cairo_static cairo_bool_t
_cairo_xlib_surface_same_screen (cairo_xlib_surface_t *dst,
cairo_xlib_surface_t *src)
{
return dst->dpy == src->dpy && dst->screen == src->screen;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_clone_similar (void *abstract_surface,
cairo_surface_t *src,
int src_x,
@@ -889,6 +892,7 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
{
cairo_xlib_surface_t *surface = abstract_surface;
cairo_xlib_surface_t *clone;
+ cairo_status_t status;
if (src->backend == surface->base.backend ) {
cairo_xlib_surface_t *xlib_src = (cairo_xlib_surface_t *)src;
@@ -910,8 +914,12 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
if (clone->base.status)
return CAIRO_STATUS_NO_MEMORY;
- _draw_image_surface (clone, image_src, src_x, src_y,
+ status = _draw_image_surface (clone, image_src, src_x, src_y,
width, height, src_x, src_y);
+ if (status) {
+ cairo_surface_destroy (&clone->base);
+ return status;
+ }
*clone_out = &clone->base;
@@ -921,7 +929,7 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
cairo_matrix_t *matrix)
{
@@ -944,7 +952,7 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
if (!CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface))
{
- static const XTransform identity = { {
+ cairo_static const XTransform identity = { {
{ 1 << 16, 0x00000, 0x00000 },
{ 0x00000, 1 << 16, 0x00000 },
{ 0x00000, 0x00000, 1 << 16 },
@@ -961,7 +969,7 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
cairo_filter_t filter)
{
@@ -1011,7 +1019,7 @@ _cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
return CAIRO_STATUS_SUCCESS;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat)
{
XRenderPictureAttributes pa;
@@ -1028,7 +1036,7 @@ _cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat)
return CAIRO_STATUS_SUCCESS;
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
cairo_surface_attributes_t *attributes)
{
@@ -1042,15 +1050,17 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
switch (attributes->extend) {
case CAIRO_EXTEND_NONE:
- _cairo_xlib_surface_set_repeat (surface, 0);
+ status = _cairo_xlib_surface_set_repeat (surface, 0);
break;
case CAIRO_EXTEND_REPEAT:
- _cairo_xlib_surface_set_repeat (surface, 1);
+ status = _cairo_xlib_surface_set_repeat (surface, 1);
break;
case CAIRO_EXTEND_REFLECT:
case CAIRO_EXTEND_PAD:
return CAIRO_INT_STATUS_UNSUPPORTED;
}
+ if (status)
+ return status;
status = _cairo_xlib_surface_set_filter (surface, attributes->filter);
if (status)
@@ -1063,7 +1073,7 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
* the core protocol: either with CopyArea or using src as a
* a tile in a GC.
*/
-static cairo_bool_t
+cairo_static cairo_bool_t
_surfaces_compatible (cairo_xlib_surface_t *dst,
cairo_xlib_surface_t *src)
{
@@ -1086,7 +1096,7 @@ _surfaces_compatible (cairo_xlib_surface_t *dst,
return FALSE;
}
-static cairo_bool_t
+cairo_static cairo_bool_t
_surface_has_alpha (cairo_xlib_surface_t *surface)
{
if (surface->xrender_format) {
@@ -1105,7 +1115,7 @@ _surface_has_alpha (cairo_xlib_surface_t *surface)
/* Returns true if the given operator and source-alpha combination
* requires alpha compositing to complete.
*/
-static cairo_bool_t
+cairo_static cairo_bool_t
_operator_needs_alpha_composite (cairo_operator_t op,
cairo_bool_t surface_has_alpha)
{
@@ -1148,7 +1158,7 @@ typedef enum {
* All we do here is reject cases where we *know* are going to
* hit the bug and won't be able to use a core protocol fallback.
*/
-static composite_operation_t
+cairo_static composite_operation_t
_categorize_composite_operation (cairo_xlib_surface_t *dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
@@ -1208,7 +1218,7 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst,
* Also check here if we can just use XCopyArea, instead of going through
* Render.
*/
-static composite_operation_t
+cairo_static composite_operation_t
_recategorize_composite_operation (cairo_xlib_surface_t *dst,
cairo_operator_t op,
cairo_xlib_surface_t *src,
@@ -1254,7 +1264,7 @@ _recategorize_composite_operation (cairo_xlib_surface_t *dst,
return DO_RENDER;
}
-static int
+cairo_static int
_render_operator (cairo_operator_t op)
{
switch (op) {
@@ -1294,7 +1304,7 @@ _render_operator (cairo_operator_t op)
}
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_composite (cairo_operator_t op,
cairo_pattern_t *src_pattern,
cairo_pattern_t *mask_pattern,
@@ -1442,7 +1452,7 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
return status;
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_fill_rectangles (void *abstract_surface,
cairo_operator_t op,
const cairo_color_t *color,
@@ -1472,7 +1482,7 @@ _cairo_xlib_surface_fill_rectangles (void *abstract_surface,
/* Creates an A8 picture of size @width x @height, initialized with @color
*/
-static Picture
+cairo_static Picture
_create_a8_picture (cairo_xlib_surface_t *surface,
XRenderColor *color,
int width,
@@ -1506,7 +1516,7 @@ _create_a8_picture (cairo_xlib_surface_t *surface,
/* Creates a temporary mask for the trapezoids covering the area
* [@dst_x, @dst_y, @width, @height] of the destination surface.
*/
-static Picture
+cairo_static Picture
_create_trapezoid_mask (cairo_xlib_surface_t *dst,
cairo_trapezoid_t *traps,
int num_traps,
@@ -1561,7 +1571,7 @@ _create_trapezoid_mask (cairo_xlib_surface_t *dst,
return mask_picture;
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
cairo_pattern_t *pattern,
void *abstract_dst,
@@ -1687,7 +1697,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
return status;
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_set_clip_region (void *abstract_surface,
pixman_region16_t *region)
{
@@ -1748,7 +1758,7 @@ _cairo_xlib_surface_set_clip_region (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
}
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_get_extents (void *abstract_surface,
cairo_rectangle_int16_t *rectangle)
{
@@ -1763,7 +1773,7 @@ _cairo_xlib_surface_get_extents (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
}
-static void
+cairo_static void
_cairo_xlib_surface_get_font_options (void *abstract_surface,
cairo_font_options_t *options)
{
@@ -1772,14 +1782,14 @@ _cairo_xlib_surface_get_font_options (void *abstract_surface,
*options = surface->screen_info->font_options;
}
-static void
+cairo_static void
_cairo_xlib_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font);
-static void
+cairo_static void
_cairo_xlib_surface_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph,
cairo_scaled_font_t *scaled_font);
-static const cairo_surface_backend_t cairo_xlib_surface_backend = {
+cairo_static const cairo_surface_backend_t cairo_xlib_surface_backend = {
CAIRO_SURFACE_TYPE_XLIB,
_cairo_xlib_surface_create_similar,
_cairo_xlib_surface_finish,
@@ -1819,13 +1829,13 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = {
*
* Return value: True if the surface is an xlib surface
**/
-static cairo_bool_t
+cairo_static cairo_bool_t
_cairo_surface_is_xlib (cairo_surface_t *surface)
{
return surface->backend == &cairo_xlib_surface_backend;
}
-static cairo_surface_t *
+cairo_static cairo_surface_t *
_cairo_xlib_surface_create_internal (Display *dpy,
Drawable drawable,
Screen *screen,
@@ -1928,7 +1938,7 @@ _cairo_xlib_surface_create_internal (Display *dpy,
return (cairo_surface_t *) surface;
}
-static Screen *
+cairo_static Screen *
_cairo_xlib_screen_from_visual (Display *dpy, Visual *visual)
{
int s;
@@ -2293,7 +2303,7 @@ typedef struct _cairo_xlib_surface_font_private {
XRenderPictFormat *xrender_format;
} cairo_xlib_surface_font_private_t;
-static void
+cairo_static void
_cairo_xlib_surface_remove_scaled_font (Display *dpy,
void *data)
{
@@ -2311,22 +2321,24 @@ _cairo_xlib_surface_remove_scaled_font (Display *dpy,
}
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_font_init (Display *dpy,
cairo_scaled_font_t *scaled_font,
cairo_format_t format)
{
cairo_xlib_surface_font_private_t *font_private;
- if (!_cairo_xlib_add_close_display_hook (dpy,
- _cairo_xlib_surface_remove_scaled_font,
- scaled_font, scaled_font))
- return CAIRO_STATUS_NO_MEMORY;
-
font_private = malloc (sizeof (cairo_xlib_surface_font_private_t));
if (!font_private)
return CAIRO_STATUS_NO_MEMORY;
+ if (!_cairo_xlib_add_close_display_hook (dpy,
+ _cairo_xlib_surface_remove_scaled_font,
+ scaled_font, scaled_font)) {
+ free (font_private);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
font_private->dpy = dpy;
font_private->format = format;
font_private->xrender_format = _CAIRO_FORMAT_TO_XRENDER_FORMAT(dpy, format);
@@ -2337,7 +2349,7 @@ _cairo_xlib_surface_font_init (Display *dpy,
return CAIRO_STATUS_SUCCESS;
}
-static void
+cairo_static void
_cairo_xlib_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font)
{
cairo_xlib_surface_font_private_t *font_private = scaled_font->surface_private;
@@ -2349,7 +2361,7 @@ _cairo_xlib_surface_scaled_font_fini (cairo_scaled_font_t *scaled_font)
}
}
-static void
+cairo_static void
_cairo_xlib_surface_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph,
cairo_scaled_font_t *scaled_font)
{
@@ -2363,7 +2375,7 @@ _cairo_xlib_surface_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph,
}
}
-static cairo_bool_t
+cairo_static cairo_bool_t
_native_byte_order_lsb (void)
{
int x = 1;
@@ -2371,7 +2383,7 @@ _native_byte_order_lsb (void)
return *((char *) &x) == 1;
}
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_add_glyph (Display *dpy,
cairo_scaled_font_t *scaled_font,
cairo_scaled_glyph_t *scaled_glyph)
@@ -2580,7 +2592,7 @@ typedef struct {
#define GLYPH_INDEX_SKIP ((unsigned long) -1)
#define STACK_ELTS_LEN ((int) (CAIRO_STACK_BUFFER_SIZE / sizeof (XGlyphElt8)))
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_emit_glyphs_chunk (cairo_xlib_surface_t *dst,
cairo_xlib_glyph_t *glyphs,
int num_glyphs,
@@ -2695,7 +2707,7 @@ _cairo_xlib_surface_emit_glyphs_chunk (cairo_xlib_surface_t *dst,
#undef STACK_ELTS_LEN
-static cairo_status_t
+cairo_static cairo_status_t
_cairo_xlib_surface_emit_glyphs (cairo_xlib_surface_t *dst,
cairo_xlib_glyph_t *glyphs,
int num_glyphs,
@@ -2815,7 +2827,11 @@ _cairo_xlib_surface_emit_glyphs (cairo_xlib_surface_t *dst,
/* Send unsent glyphs to the server */
if (scaled_glyph->surface_private == NULL) {
- _cairo_xlib_surface_add_glyph (dst->dpy, scaled_font, scaled_glyph);
+ status = _cairo_xlib_surface_add_glyph (dst->dpy,
+ scaled_font,
+ scaled_glyph);
+ if (status)
+ return status;
scaled_glyph->surface_private = (void *) 1;
}
@@ -2837,7 +2853,7 @@ _cairo_xlib_surface_emit_glyphs (cairo_xlib_surface_t *dst,
#undef GLYPH_INDEX_SKIP
-static cairo_int_status_t
+cairo_static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
@@ -2951,7 +2967,7 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
if (status)
goto BAIL1;
- _cairo_xlib_surface_emit_glyphs (dst,
+ status = _cairo_xlib_surface_emit_glyphs (dst,
(cairo_xlib_glyph_t *) glyphs, num_glyphs,
scaled_font, op, src, &attributes);
--
1.4.4.2
More information about the cairo
mailing list