[cairo-commit] 5 commits - src/cairo-atomic-private.h src/cairo-device.c src/cairo-region.c src/cairo-surface.c src/cairo-xcb-surface-render.c

Benjamin Otte company at kemper.freedesktop.org
Fri Feb 18 09:32:30 PST 2011


 src/cairo-atomic-private.h     |    1 +
 src/cairo-device.c             |    6 ++----
 src/cairo-region.c             |    6 +++---
 src/cairo-surface.c            |    6 ------
 src/cairo-xcb-surface-render.c |    6 ------
 5 files changed, 6 insertions(+), 19 deletions(-)

New commits:
commit 4a3ab4b60a80b01c17ce1789019d57d5d7430fdc
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Feb 18 18:30:17 2011 +0100

    region: Don't be nice to people setting internal error code
    
    Just DIE DIE DIE in the _cairo_status_set_status() assertion.

diff --git a/src/cairo-region.c b/src/cairo-region.c
index b15f151..4c57ef1 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -133,10 +133,10 @@ _cairo_region_create_in_error (cairo_status_t status)
  **/
 static cairo_status_t
 _cairo_region_set_error (cairo_region_t *region,
-			cairo_status_t status)
+			 cairo_status_t status)
 {
-    if (! _cairo_status_is_error (status))
-	return status;
+    if (status == CAIRO_STATUS_SUCCESS)
+        return CAIRO_STATUS_SUCCESS;
 
     /* Don't overwrite an existing error. This preserves the first
      * error, which is the most significant. */
commit 3823c486f7d5b10ba3109fe547ed10eef8e87700
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Feb 18 18:26:14 2011 +0100

    device: Don't be nice to people setting internal error codes
    
    Just DIE DIE DIE in the _cairo_status_set_status() assertion.

diff --git a/src/cairo-device.c b/src/cairo-device.c
index 4be30b4..f905caf 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -453,11 +453,9 @@ cairo_status_t
 _cairo_device_set_error (cairo_device_t *device,
 			 cairo_status_t  status)
 {
-    if (status == CAIRO_STATUS_SUCCESS || status >= CAIRO_INT_STATUS_UNSUPPORTED)
-	return status;
+    if (status == CAIRO_STATUS_SUCCESS)
+        return CAIRO_STATUS_SUCCESS;
 
-    /* Don't overwrite an existing error. This preserves the first
-     * error, which is the most significant. */
     _cairo_status_set_error (&device->status, status);
 
     return _cairo_error (status);
commit badf32290ff894351e0f6879aafeac6db8e0d846
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Feb 18 18:23:25 2011 +0100

    surface: Don't be nice to people setting internal error codes
    
    Just DIE DIE DIE in the _cairo_status_set_status() assertion.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index b9d9e16..4c6dc76 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -169,12 +169,6 @@ cairo_status_t
 _cairo_surface_set_error (cairo_surface_t *surface,
 			  cairo_status_t status)
 {
-    if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	status = CAIRO_STATUS_SUCCESS;
-
-    if (status == CAIRO_STATUS_SUCCESS || status >= CAIRO_INT_STATUS_UNSUPPORTED)
-	return status;
-
     /* Don't overwrite an existing error. This preserves the first
      * error, which is the most significant. */
     _cairo_status_set_error (&surface->status, status);
commit 3b3cfbfffe9e9acd1da753600c1e00044f065760
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Feb 18 18:21:54 2011 +0100

    Assert that an error is valid when set

diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h
index 8d02ec9..eeac68a 100644
--- a/src/cairo-atomic-private.h
+++ b/src/cairo-atomic-private.h
@@ -254,6 +254,7 @@ _cairo_atomic_ptr_cmpxchg_return_old_fallback(void **x, void *oldv, void *newv)
     _cairo_atomic_int_cmpxchg((cairo_atomic_int_t *)x, oldv, newv)
 
 #define _cairo_status_set_error(status, err) do { \
+    assert (err < CAIRO_STATUS_LAST_STATUS); \
     /* hide compiler warnings about cairo_status_t != int (gcc treats its as \
      * an unsigned integer instead, and about ignoring the return value. */  \
     int ret__ = _cairo_atomic_int_cmpxchg ((cairo_atomic_int_t *) status, CAIRO_STATUS_SUCCESS, err); \
commit 9c5833638499f9faa740c1681342bce78596dc8a
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Feb 18 17:56:46 2011 +0100

    xcb: Don't operate on a status variable that is never set

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index dce77e7..5f1ede8 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -1008,7 +1008,6 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target,
     cairo_surface_t *source = pattern->surface;
     cairo_xcb_picture_t *picture;
     cairo_filter_t filter;
-    cairo_status_t status;
 
     {
 	cairo_xcb_surface_t *snapshot;
@@ -1234,11 +1233,6 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target,
 	    return picture;
     }
 
-    if (unlikely (status)) {
-	cairo_surface_destroy (&picture->base);
-	return (cairo_xcb_picture_t *) _cairo_surface_create_in_error (status);
-    }
-
     _cairo_surface_attach_snapshot (source,
 				    &picture->base,
 				    NULL);


More information about the cairo-commit mailing list