[cairo-commit] 2 commits - src/cairo.c src/Makefile.am

Carl Worth cworth at kemper.freedesktop.org
Tue Jan 29 05:42:21 PST 2008


 src/Makefile.am |    2 ++
 src/cairo.c     |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 52 insertions(+), 4 deletions(-)

New commits:
commit 849322235764f570a4a3a1217960d096d16165cf
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Jan 29 05:40:39 2008 -0800

    Initialize return values for cairo_*_extents in case of error
    
    Previously we left the return values alone, which set the
    user up for a nasty trap, (using potentially uninitialized
    values with no indication that there was an error). So now
    we initialize these values to 0.0 if the cairo_t is in error.
    
    The fixed functions include:
    
    	cairo_path_extents
    	cairo_stroke_extents
    	cairo_fill_extents
    	cairo_clip_extents
    	cairo_font_extents

diff --git a/src/cairo.c b/src/cairo.c
index d3c5ba4..b047d99 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1904,8 +1904,18 @@ void
 cairo_path_extents (cairo_t *cr,
 		    double *x1, double *y1, double *x2, double *y2)
 {
-    if (cr->status)
+    if (cr->status) {
+	if (x1)
+	    *x1 = 0.0;
+	if (y1)
+	    *y1 = 0.0;
+	if (x2)
+	    *x2 = 0.0;
+	if (y2)
+	    *y2 = 0.0;
+
 	return;
+    }
 
     _cairo_gstate_path_extents (cr->gstate,
 				cr->path,
@@ -2301,8 +2311,18 @@ cairo_stroke_extents (cairo_t *cr,
 {
     cairo_status_t status;
 
-    if (cr->status)
+    if (cr->status) {
+	if (x1)
+	    *x1 = 0.0;
+	if (y1)
+	    *y1 = 0.0;
+	if (x2)
+	    *x2 = 0.0;
+	if (y2)
+	    *y2 = 0.0;
+
 	return;
+    }
 
     status = _cairo_gstate_stroke_extents (cr->gstate,
 					   cr->path,
@@ -2337,8 +2357,18 @@ cairo_fill_extents (cairo_t *cr,
 {
     cairo_status_t status;
 
-    if (cr->status)
+    if (cr->status) {
+	if (x1)
+	    *x1 = 0.0;
+	if (y1)
+	    *y1 = 0.0;
+	if (x2)
+	    *x2 = 0.0;
+	if (y2)
+	    *y2 = 0.0;
+
 	return;
+    }
 
     status = _cairo_gstate_fill_extents (cr->gstate,
 					 cr->path,
@@ -2462,8 +2492,18 @@ cairo_clip_extents (cairo_t *cr,
 {
     cairo_status_t status;
 
-    if (cr->status)
+    if (cr->status) {
+	if (x1)
+	    *x1 = 0.0;
+	if (y1)
+	    *y1 = 0.0;
+	if (x2)
+	    *x2 = 0.0;
+	if (y2)
+	    *y2 = 0.0;
+
 	return;
+    }
 
     status = _cairo_gstate_clip_extents (cr->gstate, x1, y1, x2, y2);
     if (status)
@@ -2561,6 +2601,12 @@ cairo_font_extents (cairo_t              *cr,
 {
     cairo_status_t status;
 
+    extents->ascent = 0.0;
+    extents->descent = 0.0;
+    extents->height = 0.0;
+    extents->max_x_advance = 0.0;
+    extents->max_y_advance = 0.0;
+
     if (cr->status)
 	return;
 
commit 6bdba4b4be5e66ffa61e164f8098b76d848e8f32
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Jan 29 05:27:10 2008 -0800

    Add missing libcairo_font_subset_sources to fix the build

diff --git a/src/Makefile.am b/src/Makefile.am
index 53cee44..51c86b1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -136,6 +136,8 @@ cairo_sources += $(svg_sources)
 backend_pkgconfigs += cairo-svg.pc
 endif
 
+cairo_sources += $(libcairo_font_subset_sources)
+
 test_sources = test-fallback-surface.c test-fallback-surface.h \
 	       test-meta-surface.c test-meta-surface.h		\
 	       test-paginated-surface.c test-paginated-surface.h


More information about the cairo-commit mailing list