[cairo] [PATCH 23/72] drm: fixed cairo_status_t vs cairo_int_status_t mixup

Bryce Harrington bryce at osg.samsung.com
Fri Jan 15 12:34:18 PST 2016


On Tue, Dec 29, 2015 at 10:17:01AM +0100, Enrico Weigelt, metux IT consult wrote:
> Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
> ---
>  src/drm/cairo-drm-i915-glyphs.c  | 14 +++++++-------
>  src/drm/cairo-drm-i915-surface.c | 18 +++++++++---------
>  src/drm/cairo-drm-i965-surface.c | 14 +++++++-------
>  src/drm/cairo-drm-intel.c        | 12 ++++++------
>  4 files changed, 29 insertions(+), 29 deletions(-)

I'm sure this one is fine, but to save me the time of looking up why
it's different could you explain why this is wrong?
 
> diff --git a/src/drm/cairo-drm-i915-glyphs.c b/src/drm/cairo-drm-i915-glyphs.c
> index 9800f1c..232a1cc 100644
> --- a/src/drm/cairo-drm-i915-glyphs.c
> +++ b/src/drm/cairo-drm-i915-glyphs.c
> @@ -189,7 +189,7 @@ i915_surface_mask_internal (i915_surface_t *dst,
>      i915_device_t *device;
>      i915_shader_t shader;
>      cairo_region_t *clip_region = NULL;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      i915_shader_init (&shader, dst, op, 1.);
>  
> @@ -295,7 +295,7 @@ i915_surface_glyphs (void			*abstract_surface,
>      intel_bo_t *last_bo = NULL;
>      i915_emit_glyph_rectangle_func_t emit_func;
>      cairo_scaled_glyph_t *glyph_cache[64];
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>      int mask_x = 0, mask_y = 0;
>      int i = 0;
>  
> @@ -325,7 +325,7 @@ i915_surface_glyphs (void			*abstract_surface,
>  
>      if (clip != NULL) {
>  	status = _cairo_clip_get_region (clip, &clip_region);
> -	if (unlikely (_cairo_status_is_error (status) ||
> +	if (unlikely (_cairo_int_status_is_error (status) ||
>  		      status == CAIRO_INT_STATUS_NOTHING_TO_DO))
>  	{
>  	    if (have_clip)
> @@ -480,7 +480,7 @@ i915_surface_glyphs (void			*abstract_surface,
>  	if (scaled_glyph->surface_private == NULL) {
>  	    status = intel_get_glyph (&device->intel, scaled_font, scaled_glyph);
>  	    if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO)) {
> -		status = CAIRO_STATUS_SUCCESS;
> +		status = CAIRO_INT_STATUS_SUCCESS;
>  		continue;
>  	    }
>  	    if (unlikely (status))
> @@ -516,7 +516,7 @@ i915_surface_glyphs (void			*abstract_surface,
>  	emit_func (device, &shader, x1, y1, x2, y2, glyph);
>      }
>  
> -    status = CAIRO_STATUS_SUCCESS;
> +    status = CAIRO_INT_STATUS_SUCCESS;
>    FINISH:
>      _cairo_scaled_font_thaw_cache (scaled_font);
>      cairo_device_release (surface->intel.drm.base.device);
> @@ -535,7 +535,7 @@ i915_surface_glyphs (void			*abstract_surface,
>  					 _cairo_fixed_from_int (mask_x),
>  					 _cairo_fixed_from_int (mask_y));
>  	}
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = surface->intel.drm.base.backend->fill (shader.target,
>  							    shader.op,
>  							    mask != NULL ? &_cairo_pattern_white.base : source,
> @@ -549,7 +549,7 @@ i915_surface_glyphs (void			*abstract_surface,
>      }
>  
>      if (mask != NULL) {
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = i915_surface_mask_internal (surface, op, source, mask,
>  					         clip, &extents);
>  	}
> diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
> index 1db6e5f..8e5ed90 100644
> --- a/src/drm/cairo-drm-i915-surface.c
> +++ b/src/drm/cairo-drm-i915-surface.c
> @@ -1576,7 +1576,7 @@ _composite_boxes (i915_surface_t *dst,
>      cairo_bool_t need_clip_surface = FALSE;
>      cairo_region_t *clip_region = NULL;
>      const struct _cairo_boxes_chunk *chunk;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>      i915_shader_t shader;
>      i915_device_t *device;
>      int i;
> @@ -1771,7 +1771,7 @@ _clip_and_composite_boxes (i915_surface_t *dst,
>  			   cairo_clip_t *clip,
>  			   double opacity)
>  {
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      if (boxes->num_boxes == 0) {
>  	if (extents->is_bounded)
> @@ -1884,7 +1884,7 @@ i915_surface_fill_with_alpha (void			*abstract_dst,
>      cairo_clip_t local_clip;
>      cairo_bool_t have_clip = FALSE;
>      int num_boxes = ARRAY_LENGTH (boxes_stack);
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      status = _cairo_composite_rectangles_init_for_fill (&extents,
>  							dst->intel.drm.width,
> @@ -1927,10 +1927,10 @@ i915_surface_fill_with_alpha (void			*abstract_dst,
>  
>  	_cairo_boxes_init (&boxes);
>  	_cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
> -	status = _cairo_path_fixed_fill_rectilinear_to_boxes (path,
> +	status = (cairo_int_status_t)_cairo_path_fixed_fill_rectilinear_to_boxes (path,
>  							      fill_rule,
>  							      &boxes);
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = _clip_and_composite_boxes (dst, op, source,
>  						&boxes, antialias,
>  						&extents, clip,
> @@ -2089,7 +2089,7 @@ i915_surface_mask (void				*abstract_dst,
>      cairo_region_t *clip_region = NULL;
>      cairo_bool_t need_clip_surface = FALSE;
>      cairo_bool_t have_clip = FALSE;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      if (mask->type == CAIRO_PATTERN_TYPE_SOLID) {
>  	const cairo_solid_pattern_t *solid = (cairo_solid_pattern_t *) mask;
> @@ -2236,7 +2236,7 @@ i915_surface_stroke (void			*abstract_dst,
>      int num_boxes = ARRAY_LENGTH (boxes_stack);
>      cairo_clip_t local_clip;
>      cairo_bool_t have_clip = FALSE;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      status = _cairo_composite_rectangles_init_for_stroke (&extents,
>  							  dst->intel.drm.width,
> @@ -2268,11 +2268,11 @@ i915_surface_stroke (void			*abstract_dst,
>  
>  	_cairo_boxes_init (&boxes);
>  	_cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
> -	status = _cairo_path_fixed_stroke_rectilinear_to_boxes (path,
> +	status = (cairo_int_status_t)_cairo_path_fixed_stroke_rectilinear_to_boxes (path,
>  								stroke_style,
>  								ctm,
>  								&boxes);
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = _clip_and_composite_boxes (dst, op, source,
>  						&boxes, antialias,
>  						&extents, clip, 1.);
> diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
> index e6ce1f1..c10ed07 100644
> --- a/src/drm/cairo-drm-i965-surface.c
> +++ b/src/drm/cairo-drm-i965-surface.c
> @@ -760,7 +760,7 @@ i965_fixup_unbounded (i965_surface_t *dst,
>  {
>      i965_shader_t shader;
>      i965_device_t *device;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      i965_shader_init (&shader, dst, CAIRO_OPERATOR_CLEAR);
>  
> @@ -996,7 +996,7 @@ _composite_boxes (i965_surface_t *dst,
>      cairo_bool_t need_clip_surface = FALSE;
>      cairo_region_t *clip_region = NULL;
>      const struct _cairo_boxes_chunk *chunk;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>      i965_shader_t shader;
>      i965_device_t *device;
>      int i;
> @@ -1066,7 +1066,7 @@ _clip_and_composite_boxes (i965_surface_t *dst,
>  			   const cairo_composite_rectangles_t *extents,
>  			   cairo_clip_t *clip)
>  {
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      if (boxes->num_boxes == 0) {
>  	if (extents->is_bounded)
> @@ -1298,7 +1298,7 @@ i965_surface_stroke (void			*abstract_dst,
>      int num_boxes = ARRAY_LENGTH (boxes_stack);
>      cairo_clip_t local_clip;
>      cairo_bool_t have_clip = FALSE;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      status = _cairo_composite_rectangles_init_for_stroke (&extents,
>  							  dst->intel.drm.width,
> @@ -1334,7 +1334,7 @@ i965_surface_stroke (void			*abstract_dst,
>  								stroke_style,
>  								ctm,
>  								&boxes);
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = _clip_and_composite_boxes (dst, op, source,
>  						&boxes, antialias,
>  						&extents, clip);
> @@ -1405,7 +1405,7 @@ i965_surface_fill (void			*abstract_dst,
>      cairo_clip_t local_clip;
>      cairo_bool_t have_clip = FALSE;
>      int num_boxes = ARRAY_LENGTH (boxes_stack);
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      status = _cairo_composite_rectangles_init_for_fill (&extents,
>  							dst->intel.drm.width,
> @@ -1441,7 +1441,7 @@ i965_surface_fill (void			*abstract_dst,
>  	status = _cairo_path_fixed_fill_rectilinear_to_boxes (path,
>  							      fill_rule,
>  							      &boxes);
> -	if (likely (status == CAIRO_STATUS_SUCCESS)) {
> +	if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
>  	    status = _clip_and_composite_boxes (dst, op, source,
>  						&boxes, antialias,
>  						&extents, clip);
> diff --git a/src/drm/cairo-drm-intel.c b/src/drm/cairo-drm-intel.c
> index c70f6d2..1e75213 100644
> --- a/src/drm/cairo-drm-intel.c
> +++ b/src/drm/cairo-drm-intel.c
> @@ -794,7 +794,7 @@ intel_glyph_cache_unpin (intel_device_t *device)
>  	_cairo_rtree_unpin (&device->glyph_cache[n].rtree);
>  }
>  
> -static cairo_status_t
> +static cairo_int_status_t
>  intel_glyph_cache_add_glyph (intel_device_t *device,
>  	                     intel_buffer_cache_t *cache,
>  			     cairo_scaled_glyph_t  *scaled_glyph)
> @@ -803,7 +803,7 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
>      intel_glyph_t *glyph;
>      cairo_rtree_node_t *node = NULL;
>      double sf_x, sf_y;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>      uint8_t *dst, *src;
>      int width, height;
>  
> @@ -819,7 +819,7 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
>      /* search for an unpinned slot */
>      if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
>  	status = _cairo_rtree_evict_random (&cache->rtree, width, height, &node);
> -	if (status == CAIRO_STATUS_SUCCESS)
> +	if (status == CAIRO_INT_STATUS_SUCCESS)
>  	    status = _cairo_rtree_node_insert (&cache->rtree, node, width, height, &node);
>      }
>      if (unlikely (status))
> @@ -914,7 +914,7 @@ intel_glyph_cache_add_glyph (intel_device_t *device,
>      glyph->width  = glyph_surface->width;
>      glyph->height = glyph_surface->height;
>  
> -    return CAIRO_STATUS_SUCCESS;
> +    return CAIRO_INT_STATUS_SUCCESS;
>  }
>  
>  void
> @@ -988,7 +988,7 @@ intel_get_glyph (intel_device_t *device,
>  {
>      cairo_bool_t own_surface = FALSE;
>      intel_buffer_cache_t *cache;
> -    cairo_status_t status;
> +    cairo_int_status_t status;
>  
>      if (scaled_glyph->surface == NULL) {
>  	status =
> @@ -1023,7 +1023,7 @@ intel_get_glyph (intel_device_t *device,
>  	return status;
>  
>      status = intel_glyph_cache_add_glyph (device, cache, scaled_glyph);
> -    if (unlikely (_cairo_status_is_error (status)))
> +    if (unlikely (_cairo_int_status_is_error (status)))
>  	return status;
>  
>      if (unlikely (status == CAIRO_INT_STATUS_UNSUPPORTED)) {
> -- 
> 2.6.4.442.g545299f
> 
> -- 
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list