From 34970d0cf28d0daaf6bea71f56b78c51c377a6e3 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 26 Jul 2017 14:57:27 +0100 Subject: [PATCH] remove some casts and use VIPS_AREA instead --- libvips/arithmetic/getpoint.c | 2 +- libvips/arithmetic/linear.c | 4 ++-- libvips/arithmetic/max.c | 6 +++--- libvips/arithmetic/min.c | 6 +++--- libvips/conversion/arrayjoin.c | 2 +- libvips/deprecated/vips7compat.c | 8 ++++---- libvips/draw/draw_circle.c | 2 +- libvips/draw/draw_flood.c | 2 +- libvips/draw/draw_line.c | 2 +- libvips/draw/draw_mask.c | 2 +- libvips/draw/draw_rect.c | 2 +- libvips/foreign/dzsave.c | 2 +- libvips/iofuncs/object.c | 2 +- libvips/iofuncs/type.c | 4 ++-- libvips/resample/affine.c | 2 +- 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/libvips/arithmetic/getpoint.c b/libvips/arithmetic/getpoint.c index 3eb81bef..bc96a685 100644 --- a/libvips/arithmetic/getpoint.c +++ b/libvips/arithmetic/getpoint.c @@ -113,7 +113,7 @@ vips_getpoint_build( VipsObject *object ) g_object_set( object, "out_array", out_array, NULL ); - vips_area_unref( (VipsArea *) out_array ); + vips_area_unref( VIPS_AREA( out_array ) ); return( 0 ); } diff --git a/libvips/arithmetic/linear.c b/libvips/arithmetic/linear.c index cad7751d..ffeb3b81 100644 --- a/libvips/arithmetic/linear.c +++ b/libvips/arithmetic/linear.c @@ -426,8 +426,8 @@ vips_linearv( VipsImage *in, VipsImage **out, VipsArea *area_b; int result; - area_a = (VipsArea *) vips_array_double_new( a, n ); - area_b = (VipsArea *) vips_array_double_new( b, n ); + area_a = VIPS_AREA( vips_array_double_new( a, n ) ); + area_b = VIPS_AREA( vips_array_double_new( b, n ) ); result = vips_call_split( "linear", ap, in, out, area_a, area_b ); diff --git a/libvips/arithmetic/max.c b/libvips/arithmetic/max.c index 4dc0bc58..f44955d9 100644 --- a/libvips/arithmetic/max.c +++ b/libvips/arithmetic/max.c @@ -241,9 +241,9 @@ vips_max_build( VipsObject *object ) "y_array", y_array, NULL ); - vips_area_unref( (VipsArea *) out_array ); - vips_area_unref( (VipsArea *) x_array ); - vips_area_unref( (VipsArea *) y_array ); + vips_area_unref( VIPS_AREA( out_array ) ); + vips_area_unref( VIPS_AREA( x_array ) ); + vips_area_unref( VIPS_AREA( y_array ) ); } #ifdef DEBUG diff --git a/libvips/arithmetic/min.c b/libvips/arithmetic/min.c index 0120d943..57b0d348 100644 --- a/libvips/arithmetic/min.c +++ b/libvips/arithmetic/min.c @@ -241,9 +241,9 @@ vips_min_build( VipsObject *object ) "y_array", y_array, NULL ); - vips_area_unref( (VipsArea *) out_array ); - vips_area_unref( (VipsArea *) x_array ); - vips_area_unref( (VipsArea *) y_array ); + vips_area_unref( VIPS_AREA( out_array ) ); + vips_area_unref( VIPS_AREA( x_array ) ); + vips_area_unref( VIPS_AREA( y_array ) ); } #ifdef DEBUG diff --git a/libvips/conversion/arrayjoin.c b/libvips/conversion/arrayjoin.c index de8c11be..3b4e60d4 100644 --- a/libvips/conversion/arrayjoin.c +++ b/libvips/conversion/arrayjoin.c @@ -80,7 +80,7 @@ vips_arrayjoin_gen( VipsRegion *or, void *seq, VipsRegion **ir = (VipsRegion **) seq; VipsArrayjoin *join = (VipsArrayjoin *) b; VipsRect *r = &or->valid; - int n = ((VipsArea *) join->in)->n; + int n = VIPS_AREA( join->in )->n; int i; diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 9420a608..1a496a7a 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -3383,7 +3383,7 @@ im_Lab2XYZ_temp( IMAGE *in, IMAGE *out, double X0, double Y0, double Z0 ) VipsArea *temp; VipsImage *x; - temp = (VipsArea *) vips_array_double_newv( 3, X0, Y0, Z0 ); + temp = VIPS_AREA( vips_array_double_newv( 3, X0, Y0, Z0 ) ); if( vips_Lab2XYZ( in, &x, "temp", temp, NULL ) ) { vips_area_unref( temp ); return( -1 ); @@ -3425,7 +3425,7 @@ im_XYZ2Lab_temp( IMAGE *in, IMAGE *out, double X0, double Y0, double Z0 ) ary[0] = X0; ary[1] = Y0; ary[2] = Z0; - temp = (VipsArea *) vips_array_double_new( ary, 3 ); + temp = VIPS_AREA( vips_array_double_new( ary, 3 ) ); if( vips_XYZ2Lab( in, &x, "temp", temp, NULL ) ) { vips_area_unref( temp ); return( -1 ); @@ -4562,9 +4562,9 @@ im__affinei( VipsImage *in, VipsImage *out, VipsArea *oarea; gboolean repack; - oarea = (VipsArea *) vips_array_int_newv( 4, + oarea = VIPS_AREA( vips_array_int_newv( 4, trn->oarea.left, trn->oarea.top, - trn->oarea.width, trn->oarea.height ); + trn->oarea.width, trn->oarea.height ) ); /* vips7 affine would repack labq and im_benchmark() depends upon * this. diff --git a/libvips/draw/draw_circle.c b/libvips/draw/draw_circle.c index dee81e6f..29a45d94 100644 --- a/libvips/draw/draw_circle.c +++ b/libvips/draw/draw_circle.c @@ -274,7 +274,7 @@ vips_draw_circlev( VipsImage *image, VipsArea *area_ink; int result; - area_ink = (VipsArea *) vips_array_double_new( ink, n ); + area_ink = VIPS_AREA( vips_array_double_new( ink, n ) ); result = vips_call_split( "draw_circle", ap, image, area_ink, cx, cy, radius ); vips_area_unref( area_ink ); diff --git a/libvips/draw/draw_flood.c b/libvips/draw/draw_flood.c index d9e6b2f2..23f0f2a0 100644 --- a/libvips/draw/draw_flood.c +++ b/libvips/draw/draw_flood.c @@ -670,7 +670,7 @@ vips_draw_floodv( VipsImage *image, VipsArea *area_ink; int result; - area_ink = (VipsArea *) vips_array_double_new( ink, n ); + area_ink = VIPS_AREA( vips_array_double_new( ink, n ) ); result = vips_call_split( "draw_flood", ap, image, area_ink, x, y ); vips_area_unref( area_ink ); diff --git a/libvips/draw/draw_line.c b/libvips/draw/draw_line.c index 9c00d807..a39969cb 100644 --- a/libvips/draw/draw_line.c +++ b/libvips/draw/draw_line.c @@ -322,7 +322,7 @@ vips_draw_linev( VipsImage *image, VipsArea *area_ink; int result; - area_ink = (VipsArea *) vips_array_double_new( ink, n ); + area_ink = VIPS_AREA( vips_array_double_new( ink, n ) ); result = vips_call_split( "draw_line", ap, image, area_ink, x1, y1, x2, y2 ); vips_area_unref( area_ink ); diff --git a/libvips/draw/draw_mask.c b/libvips/draw/draw_mask.c index 5f54685a..92228631 100644 --- a/libvips/draw/draw_mask.c +++ b/libvips/draw/draw_mask.c @@ -353,7 +353,7 @@ vips_draw_maskv( VipsImage *image, VipsArea *area_ink; int result; - area_ink = (VipsArea *) vips_array_double_new( ink, n ); + area_ink = VIPS_AREA( vips_array_double_new( ink, n ) ); result = vips_call_split( "draw_mask", ap, image, area_ink, mask, x, y ); vips_area_unref( area_ink ); diff --git a/libvips/draw/draw_rect.c b/libvips/draw/draw_rect.c index 261c6517..ac7f33b1 100644 --- a/libvips/draw/draw_rect.c +++ b/libvips/draw/draw_rect.c @@ -219,7 +219,7 @@ vips_draw_rectv( VipsImage *image, VipsArea *area_ink; int result; - area_ink = (VipsArea *) vips_array_double_new( ink, n ); + area_ink = VIPS_AREA( vips_array_double_new( ink, n ) ); result = vips_call_split( "draw_rect", ap, image, area_ink, left, top, width, height ); vips_area_unref( area_ink ); diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index d9e887cc..277447d6 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -805,7 +805,7 @@ write_blank( VipsForeignSaveDz *dz ) * vips_black() to make sure we set Type correctly, otherwise we can * try saving a B_W image as PNG, with disasterous results. */ - bg = (double *) vips_area_get_data( (VipsArea *) save->background, + bg = (double *) vips_area_get_data( VIPS_AREA( save->background ), NULL, &n, NULL, NULL ); if( vips_black( &x, dz->tile_size, dz->tile_size, "bands", n, NULL ) ) diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index b672fda1..40e1d3b7 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1915,7 +1915,7 @@ vips_object_set_argument_from_string( VipsObject *object, /* Setting gvalue will have upped @array_image's count again, * go back to 1 so that gvalue has the only ref. */ - vips_area_unref( (VipsArea *) array_image ); + vips_area_unref( VIPS_AREA( array_image ) ); } else if( g_type_is_a( otype, VIPS_TYPE_OBJECT ) && (oclass = g_type_class_ref( otype )) ) { diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index d9ffac94..bef96b93 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -276,7 +276,7 @@ vips__type_leak( void ) fprintf( stderr, "%d VipsArea alive\n", g_slist_length( vips_area_all ) ); for( p = vips_area_all; p; p = p->next ) { - VipsArea *area = (VipsArea *) p->data; + VipsArea *area = VIPS_AREA( p->data ); fprintf( stderr, "\t%p count = %d, bytes = %zd\n", area, area->count, area->length ); @@ -1325,7 +1325,7 @@ transform_g_string_array_image( const GValue *src_value, GValue *dest_value ) g_free( str ); g_value_set_boxed( dest_value, array_image ); - vips_area_unref( (VipsArea *) array_image ); + vips_area_unref( VIPS_AREA( array_image ) ); } GType diff --git a/libvips/resample/affine.c b/libvips/resample/affine.c index 091f1351..76ff1a9c 100644 --- a/libvips/resample/affine.c +++ b/libvips/resample/affine.c @@ -652,7 +652,7 @@ vips_affine( VipsImage *in, VipsImage **out, VipsArea *matrix; int result; - matrix = (VipsArea *) vips_array_double_newv( 4, a, b, c, d ); + matrix = VIPS_AREA( vips_array_double_newv( 4, a, b, c, d ) ); va_start( ap, d ); result = vips_call_split( "affine", ap, in, out, matrix );