[cairo] error handling

Behdad Esfahbod behdad at behdad.org
Tue May 29 23:56:59 PDT 2007


On Wed, 2007-05-30 at 02:48 +0100, Baz wrote:
> On 29/05/07, Behdad Esfahbod <behdad at behdad.org> wrote:

> > > The policy on when to return a status_t [etc...].
> 
> point taken. I made the change for each of these:
> cairo_scaled_font_glyph_extents
> cairo_scaled_font_text_extents
> cairo_set_font_face
> cairo_select_font_face
> cairo_glyph_extents
> cairo_text_extents
> cairo_glyph_path
> cairo_text_path
> cairo_show_glyphs
> cairo_show_text
> cairo_get_current_point
> 
> Patches here:
> http://gitweb.freedesktop.org/?p=users/brianewins/cairo;a=shortlog;h=return-status
> b0f401e1868161da6e6a81aa108df2e37077937d to
> 6befafab89be36c32b853629e87d6eee69df4979

Quickly checked a couple of them.  Seems like in
cairo_scaled_font_glyph_extents() and probably others, you return any
error that happens.  I don't think that quite works.  For example, if an
out of memory error happens, we want to still keep the error in the
object.  Only the "ignorable" errors should be returned immediately.  In
this case, out-of-range glyph id is the only such error.

I don't see why you changed cairo_set_font_face and
cairo_select_font_face at all.


Cheers,

behdad

> > > Oh while we're at it - get_current_point should return a status_t too
> > > :) (I think this has been discussed before)
> >
> > Yes.
> 
> The tests weren't setting the current point before show_text or
> text_extents, so I had 13 failures to fix - the last patch. The only
> one of these that might be controversial is the invalid-matrix test -
> since it checks the status of a cairo_t when I've converted the error
> it's looking for into a return value.
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list