[cairo-commit] 2 commits - src/cairo-pdf-operators.c src/cairo-pdf-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Aug 6 04:12:34 PDT 2008


 src/cairo-pdf-operators.c |    9 ++++++---
 src/cairo-pdf-surface.c   |    6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 0ec6c9ca6210649006e40d031a118c4c7ef437ea
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 6 11:11:24 2008 +0100

    [pdf] Propagate status from emit_glyph()
    
    Propagate the error status from _cairo_pdf_operators_emit_glyph().

diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index e20b38f..d51363a 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -932,7 +932,7 @@ _cairo_pdf_operators_flush_glyphs (cairo_pdf_operators_t    *pdf_operators)
     double x;
 
     if (pdf_operators->num_glyphs == 0)
-	return 0;
+	return CAIRO_STATUS_SUCCESS;
 
     word_wrap_stream = _word_wrap_stream_create (pdf_operators->stream, 72);
     status = _cairo_output_stream_get_status (word_wrap_stream);
@@ -959,7 +959,7 @@ _cairo_pdf_operators_flush_glyphs (cairo_pdf_operators_t    *pdf_operators)
     if (status)
 	return status;
 
-    return status;
+    return CAIRO_STATUS_SUCCESS;
 }
 
 static cairo_status_t
@@ -1275,7 +1275,10 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 	    status = _cairo_pdf_operators_emit_glyph (pdf_operators,
 						      glyphs,
 						      &subset_glyph);
-	    return 0;
+	    if (status)
+		return status;
+
+	    return CAIRO_STATUS_SUCCESS;
 	}
     }
 
commit 2dfee9986c739b2fdadf551dd71e104df332b2b8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Aug 6 10:51:34 2008 +0100

    [pdf] Fixup a couple of inverted tests.
    
    Check for NULL returns from malloc, instead of reporting errors and
    leaking on success.

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 1d1407c..f58bd7a 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -4783,8 +4783,8 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
 	group->source_res = pattern_res;
 
 	if (utf8_len) {
-	    group->utf8 = malloc(utf8_len);
-	    if (group->utf8) {
+	    group->utf8 = malloc (utf8_len);
+	    if (group->utf8 == NULL) {
 		_cairo_pdf_smask_group_destroy (group);
 		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 	    }
@@ -4804,7 +4804,7 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
 
 	if (num_clusters) {
 	    group->clusters = _cairo_malloc_ab (num_clusters, sizeof (cairo_text_cluster_t));
-	    if (group->clusters) {
+	    if (group->clusters == NULL) {
 		_cairo_pdf_smask_group_destroy (group);
 		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 	    }


More information about the cairo-commit mailing list