[cairo-commit] 4 commits - src/cairo-svg-surface.c src/cairo-type1-subset.c src/cairo-xlib-surface.c src/test-fallback-surface.c src/test-meta-surface.c src/test-paginated-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Oct 5 10:32:34 PDT 2007
src/cairo-svg-surface.c | 2 +-
src/cairo-type1-subset.c | 4 +++-
src/cairo-xlib-surface.c | 6 ++++++
src/test-fallback-surface.c | 4 ++--
src/test-meta-surface.c | 4 ++--
src/test-paginated-surface.c | 12 ++++++++++--
6 files changed, 24 insertions(+), 8 deletions(-)
New commits:
diff-tree 709f3160368417d9a9a78974b16d93ec3e5e3c14 (from 2f22510e22237283869fb2e23585504077566adf)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Oct 5 17:37:05 2007 +0100
Cleanup a couple of warnings for use of uninitialized statuses.
The compiler spotted a couple of potential uses of an uninitialized
status variable - apply the obvious fixes.
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 71adc39..2d1c961 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -713,7 +713,7 @@ _cairo_svg_document_emit_font_subset (ca
{
cairo_svg_document_t *document = closure;
unsigned int i;
- cairo_status_t status;
+ cairo_status_t status = CAIRO_STATUS_SUCCESS;
for (i = 0; i < font_subset->num_glyphs; i++) {
status = _cairo_svg_document_emit_glyph (document,
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index ba37731..ceb20d9 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -1104,8 +1104,10 @@ cairo_type1_font_subset_generate (void
ret = font->face->stream->read (font->face->stream, 0,
(unsigned char *) font->type1_data,
font->type1_length);
- if (ret != font->type1_length)
+ if (ret != font->type1_length) {
+ status = _cairo_error (CAIRO_STATUS_READ_ERROR);
goto fail;
+ }
} else {
memcpy (font->type1_data,
font->face->stream->base, font->type1_length);
diff-tree 2f22510e22237283869fb2e23585504077566adf (from d2557cd5eec7e51496d6b1b57899b2a028898a7c)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Oct 5 16:23:12 2007 +0100
[cairo-xlib] Initialize the global mutexes.
The xlib surface creation routines will eventually attempt to lock the
global _cairo_xlib_display_mutex. Under the default environment this is
a non-issue as the CAIRO_MUTEX_INITIALIZE/FINALIZE become no-ops under
pthreads. However, for the sake of correctness (i.e. to silence the
lockdep debugger!) insert a call to initialize the global mutexes at the
start of the public entry points.
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index e67a5f9..f911de1 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -2098,6 +2098,8 @@ cairo_xlib_surface_create (Display *
return (cairo_surface_t*) &_cairo_surface_nil;
}
+ CAIRO_MUTEX_INITIALIZE ();
+
return _cairo_xlib_surface_create_internal (dpy, drawable, screen,
visual, NULL, width, height, 0);
}
@@ -2122,6 +2124,8 @@ cairo_xlib_surface_create_for_bitmap (Di
int width,
int height)
{
+ CAIRO_MUTEX_INITIALIZE ();
+
return _cairo_xlib_surface_create_internal (dpy, bitmap, screen,
NULL, NULL, width, height, 1);
}
@@ -2155,6 +2159,8 @@ cairo_xlib_surface_create_with_xrender_f
int width,
int height)
{
+ CAIRO_MUTEX_INITIALIZE ();
+
return _cairo_xlib_surface_create_internal (dpy, drawable, screen,
NULL, format, width, height, 0);
}
diff-tree d2557cd5eec7e51496d6b1b57899b2a028898a7c (from 60ffeecd4888fdf824b4095c945e1b27e05c0e1d)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Oct 5 00:57:38 2007 +0100
[test-paginated] Free resources if fail to create the test surface.
Ensure that all the locally allocated resources are freed if we fail
to allocate the paginated test surface.
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index 3e9bad8..7d341ad 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -69,6 +69,7 @@ _cairo_test_paginated_surface_create_for
{
cairo_status_t status;
cairo_surface_t *target;
+ cairo_surface_t *paginated;
test_paginated_surface_t *surface;
target = _cairo_image_surface_create_for_data_with_content (data, content,
@@ -80,6 +81,7 @@ _cairo_test_paginated_surface_create_for
surface = malloc (sizeof (test_paginated_surface_t));
if (surface == NULL) {
+ cairo_surface_destroy (target);
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;
}
@@ -89,8 +91,14 @@ _cairo_test_paginated_surface_create_for
surface->target = target;
- return _cairo_paginated_surface_create (&surface->base, content, width, height,
- &test_paginated_surface_paginated_backend);
+ paginated = _cairo_paginated_surface_create (&surface->base,
+ content, width, height,
+ &test_paginated_surface_paginated_backend);
+ if (paginated->status) {
+ cairo_surface_destroy (target);
+ free (surface);
+ }
+ return paginated;
}
static cairo_status_t
diff-tree 60ffeecd4888fdf824b4095c945e1b27e05c0e1d (from 6598973661490ce90b9f42155d8397af491b90c9)
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Oct 5 00:56:11 2007 +0100
[test-surfaces] Mark the test backend as static.
There is no need to export the test surface backends, so mark them
static.
diff --git a/src/test-fallback-surface.c b/src/test-fallback-surface.c
index 3db945d..f56db45 100644
--- a/src/test-fallback-surface.c
+++ b/src/test-fallback-surface.c
@@ -62,7 +62,7 @@ typedef struct _test_fallback_surface {
cairo_surface_t *backing;
} test_fallback_surface_t;
-const cairo_private cairo_surface_backend_t test_fallback_surface_backend;
+static const cairo_surface_backend_t test_fallback_surface_backend;
slim_hidden_proto (_cairo_test_fallback_surface_create);
@@ -199,7 +199,7 @@ _test_fallback_surface_get_extents (void
return _cairo_surface_get_extents (surface->backing, rectangle);
}
-const cairo_surface_backend_t test_fallback_surface_backend = {
+static const cairo_surface_backend_t test_fallback_surface_backend = {
CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
_test_fallback_surface_create_similar,
_test_fallback_surface_finish,
diff --git a/src/test-meta-surface.c b/src/test-meta-surface.c
index 773d011..3b317ab 100644
--- a/src/test-meta-surface.c
+++ b/src/test-meta-surface.c
@@ -63,7 +63,7 @@ typedef struct _test_meta_surface {
cairo_bool_t image_reflects_meta;
} test_meta_surface_t;
-const cairo_private cairo_surface_backend_t test_meta_surface_backend;
+static const cairo_surface_backend_t test_meta_surface_backend;
static cairo_int_status_t
_test_meta_surface_show_page (void *abstract_surface);
@@ -322,7 +322,7 @@ _test_meta_surface_snapshot (void *abstr
#endif
}
-const cairo_surface_backend_t test_meta_surface_backend = {
+static const cairo_surface_backend_t test_meta_surface_backend = {
CAIRO_INTERNAL_SURFACE_TYPE_TEST_META,
NULL, /* create_similar */
_test_meta_surface_finish,
More information about the cairo-commit
mailing list