From 777d1ea55406bb3e65057566ae258165734d7664 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 2 Nov 2012 14:41:47 +0000 Subject: [PATCH] better error domain names --- TODO | 13 ------------- libvips/arithmetic/arithmetic.c | 7 ++++--- libvips/arithmetic/boolean.c | 8 +++++--- libvips/arithmetic/complex.c | 5 +++-- libvips/arithmetic/deviate.c | 3 ++- libvips/arithmetic/linear.c | 5 +++-- libvips/arithmetic/math.c | 3 ++- libvips/arithmetic/math2.c | 8 +++++--- libvips/arithmetic/measure.c | 3 ++- libvips/arithmetic/remainder.c | 8 +++++--- libvips/arithmetic/stats.c | 3 ++- libvips/arithmetic/unaryconst.c | 3 ++- libvips/colour/Lab2XYZ.c | 3 ++- libvips/colour/XYZ2Lab.c | 3 ++- libvips/conversion/bandary.c | 9 ++++++--- libvips/conversion/cast.c | 7 +++++-- libvips/conversion/embed.c | 8 +++++--- libvips/conversion/extract.c | 11 +++++++---- libvips/conversion/flatten.c | 7 ++++--- libvips/conversion/ifthenelse.c | 3 ++- libvips/conversion/insert.c | 11 ++++++----- libvips/conversion/recomb.c | 13 +++++++------ libvips/conversion/sequential.c | 3 ++- libvips/foreign/foreign.c | 15 ++++++++------- 24 files changed, 91 insertions(+), 71 deletions(-) diff --git a/TODO b/TODO index 129490b7..7cc0510b 100644 --- a/TODO +++ b/TODO @@ -1,16 +1,3 @@ -- test dzsave depth option - -- boolean.c has - - vips_check_noncomplex( "VipsBoolean", binary->left ) ) - - why not - - vips_check_noncomplex( VIPS_OBJECT_GET_CLASS( object )->nickname, - binary->left ) - - many other places too - - can we make DOUBLE ARRAY args easier from C? at the moment they are horrible or ad-hoc, see vips_linear() etc. and diff --git a/libvips/arithmetic/arithmetic.c b/libvips/arithmetic/arithmetic.c index 5a33dc4d..ab99a4f9 100644 --- a/libvips/arithmetic/arithmetic.c +++ b/libvips/arithmetic/arithmetic.c @@ -297,6 +297,7 @@ vips_arithmetic_gen( VipsRegion *or, static int vips_arithmetic_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsArithmeticClass *aclass = VIPS_ARITHMETIC_GET_CLASS( arithmetic ); @@ -320,13 +321,13 @@ vips_arithmetic_build( VipsObject *object ) /* No need to check input bands, bandalike will do this for us. */ if( arithmetic->n > MAX_INPUT_IMAGES ) { - vips_error( "VipsArithmetic", + vips_error( class->nickname, "%s", _( "too many input images" ) ); return( -1 ); } for( i = 0; i < arithmetic->n; i++ ) if( vips_image_pio_input( arithmetic->in[i] ) || - vips_check_uncoded( "VipsArithmetic", + vips_check_uncoded( class->nickname, arithmetic->in[i] ) ) return( -1 ); @@ -340,7 +341,7 @@ vips_arithmetic_build( VipsObject *object ) /* Cast our input images up to a common format, bands and size. */ if( vips__formatalike_vec( arithmetic->in, format, arithmetic->n ) || - vips__bandalike_vec( "VipsArithmetic", + vips__bandalike_vec( class->nickname, format, band, arithmetic->n, arithmetic->base_bands ) || vips__sizealike_vec( band, size, arithmetic->n ) ) return( -1 ); diff --git a/libvips/arithmetic/boolean.c b/libvips/arithmetic/boolean.c index 9067af8f..50349b02 100644 --- a/libvips/arithmetic/boolean.c +++ b/libvips/arithmetic/boolean.c @@ -90,13 +90,14 @@ G_DEFINE_TYPE( VipsBoolean, vips_boolean, VIPS_TYPE_BINARY ); static int vips_boolean_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsBinary *binary = (VipsBinary *) object; if( binary->left && - vips_check_noncomplex( "VipsBoolean", binary->left ) ) + vips_check_noncomplex( class->nickname, binary->left ) ) return( -1 ); if( binary->right && - vips_check_noncomplex( "VipsBoolean", binary->right ) ) + vips_check_noncomplex( class->nickname, binary->right ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_boolean_parent_class )->build( object ) ) @@ -423,11 +424,12 @@ G_DEFINE_TYPE( VipsBooleanConst, static int vips_boolean_const_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsUnary *unary = (VipsUnary *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object; if( unary->in && - vips_check_noncomplex( "VipsBoolean", unary->in ) ) + vips_check_noncomplex( class->nickname, unary->in ) ) return( -1 ); uconst->const_format = VIPS_FORMAT_INT; diff --git a/libvips/arithmetic/complex.c b/libvips/arithmetic/complex.c index 5e50f5b9..89c202f3 100644 --- a/libvips/arithmetic/complex.c +++ b/libvips/arithmetic/complex.c @@ -578,13 +578,14 @@ G_DEFINE_TYPE( VipsComplexform, vips_complexform, VIPS_TYPE_BINARY ); static int vips_complexform_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsBinary *binary = (VipsBinary *) object; if( binary->left && - vips_check_noncomplex( "VipsComplexform", binary->left ) ) + vips_check_noncomplex( class->nickname, binary->left ) ) return( -1 ); if( binary->right && - vips_check_noncomplex( "VipsComplexform", binary->right ) ) + vips_check_noncomplex( class->nickname, binary->right ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_complexform_parent_class )-> diff --git a/libvips/arithmetic/deviate.c b/libvips/arithmetic/deviate.c index 7b2d9712..2581b0d0 100644 --- a/libvips/arithmetic/deviate.c +++ b/libvips/arithmetic/deviate.c @@ -88,6 +88,7 @@ G_DEFINE_TYPE( VipsDeviate, vips_deviate, VIPS_TYPE_STATISTIC ); static int vips_deviate_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsStatistic *statistic = VIPS_STATISTIC( object ); VipsDeviate *deviate = (VipsDeviate *) object; @@ -95,7 +96,7 @@ vips_deviate_build( VipsObject *object ) double s, s2; if( statistic->in && - vips_check_noncomplex( "VipsDeviate", statistic->in ) ) + vips_check_noncomplex( class->nickname, statistic->in ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_deviate_parent_class )->build( object ) ) diff --git a/libvips/arithmetic/linear.c b/libvips/arithmetic/linear.c index 548d85db..0f0105b6 100644 --- a/libvips/arithmetic/linear.c +++ b/libvips/arithmetic/linear.c @@ -106,6 +106,7 @@ G_DEFINE_TYPE( VipsLinear, vips_linear, VIPS_TYPE_UNARY ); static int vips_linear_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsUnary *unary = (VipsUnary *) object; VipsLinear *linear = (VipsLinear *) object; @@ -124,9 +125,9 @@ vips_linear_build( VipsObject *object ) arithmetic->base_bands = linear->n; if( unary->in && linear->a && linear->b ) { - if( vips_check_vector( "VipsLinear", + if( vips_check_vector( class->nickname, linear->a->n, unary->in ) || - vips_check_vector( "VipsLinear", + vips_check_vector( class->nickname, linear->b->n, unary->in ) ) return( -1 ); } diff --git a/libvips/arithmetic/math.c b/libvips/arithmetic/math.c index fb61e361..5454987a 100644 --- a/libvips/arithmetic/math.c +++ b/libvips/arithmetic/math.c @@ -82,10 +82,11 @@ G_DEFINE_TYPE( VipsMath, vips_math, VIPS_TYPE_UNARY ); static int vips_math_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsUnary *unary = (VipsUnary *) object; if( unary->in && - vips_check_noncomplex( "VipsMath", unary->in ) ) + vips_check_noncomplex( class->nickname, unary->in ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_math_parent_class )->build( object ) ) diff --git a/libvips/arithmetic/math2.c b/libvips/arithmetic/math2.c index c12343bd..d926fc3c 100644 --- a/libvips/arithmetic/math2.c +++ b/libvips/arithmetic/math2.c @@ -84,13 +84,14 @@ G_DEFINE_TYPE( VipsMath2, vips_math2, VIPS_TYPE_BINARY ); static int vips_math2_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsBinary *binary = (VipsBinary *) object; if( binary->left && - vips_check_noncomplex( "VipsMath2", binary->left ) ) + vips_check_noncomplex( class->nickname, binary->left ) ) return( -1 ); if( binary->right && - vips_check_noncomplex( "VipsMath2", binary->right ) ) + vips_check_noncomplex( class->nickname, binary->right ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_math2_parent_class )->build( object ) ) @@ -335,11 +336,12 @@ G_DEFINE_TYPE( VipsMath2Const, static int vips_math2_const_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsUnary *unary = (VipsUnary *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object; if( unary->in && - vips_check_noncomplex( "VipsMath2", unary->in ) ) + vips_check_noncomplex( class->nickname, unary->in ) ) return( -1 ); uconst->const_format = VIPS_FORMAT_DOUBLE; diff --git a/libvips/arithmetic/measure.c b/libvips/arithmetic/measure.c index 77d8a3dc..2dc1cbf2 100644 --- a/libvips/arithmetic/measure.c +++ b/libvips/arithmetic/measure.c @@ -91,6 +91,7 @@ G_DEFINE_TYPE( VipsMeasure, vips_measure, VIPS_TYPE_OPERATION ); static int vips_measure_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsMeasure *measure = (VipsMeasure *) object; int bands; @@ -159,7 +160,7 @@ vips_measure_build( VipsObject *object ) * measure on IM_TYPE_LAB images). */ if( dev * 5 > fabs( avg ) && fabs( avg ) > 3 ) - vips_warn( "VipsMeasure", + vips_warn( class->nickname, _( "patch %d x %d, band %d: " "avg = %g, sdev = %g" ), i, j, avg, dev ); diff --git a/libvips/arithmetic/remainder.c b/libvips/arithmetic/remainder.c index 725e93d8..27efa400 100644 --- a/libvips/arithmetic/remainder.c +++ b/libvips/arithmetic/remainder.c @@ -72,13 +72,14 @@ G_DEFINE_TYPE( VipsRemainder, vips_remainder, VIPS_TYPE_BINARY ); static int vips_remainder_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsBinary *binary = (VipsBinary *) object; if( binary->left && - vips_check_noncomplex( "VipsRemainder", binary->left ) ) + vips_check_noncomplex( class->nickname, binary->left ) ) return( -1 ); if( binary->right && - vips_check_noncomplex( "VipsRemainder", binary->right ) ) + vips_check_noncomplex( class->nickname, binary->right ) ) return( -1 ); if( VIPS_OBJECT_CLASS( vips_remainder_parent_class )->build( object ) ) @@ -239,11 +240,12 @@ G_DEFINE_TYPE( VipsRemainderConst, static int vips_remainder_const_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsUnary *unary = (VipsUnary *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object; if( unary->in && - vips_check_noncomplex( "VipsRemainder", unary->in ) ) + vips_check_noncomplex( class->nickname, unary->in ) ) return( -1 ); if( unary->in ) diff --git a/libvips/arithmetic/stats.c b/libvips/arithmetic/stats.c index 7b630497..5da9cd0c 100644 --- a/libvips/arithmetic/stats.c +++ b/libvips/arithmetic/stats.c @@ -108,6 +108,7 @@ enum { static int vips_stats_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsStatistic *statistic = VIPS_STATISTIC( object ); VipsStats *stats = (VipsStats *) object; @@ -118,7 +119,7 @@ vips_stats_build( VipsObject *object ) if( statistic->in ) { int bands = vips_image_get_bands( statistic->in ); - if( vips_check_noncomplex( "VipsStats", statistic->in ) ) + if( vips_check_noncomplex( class->nickname, statistic->in ) ) return( -1 ); g_object_set( object, diff --git a/libvips/arithmetic/unaryconst.c b/libvips/arithmetic/unaryconst.c index c74cb94f..0ab1cba6 100644 --- a/libvips/arithmetic/unaryconst.c +++ b/libvips/arithmetic/unaryconst.c @@ -145,6 +145,7 @@ make_pixel( VipsObject *obj, int m, VipsBandFmt fmt, int n, double *p ) static int vips_unary_const_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsUnary *unary = (VipsUnary *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object; @@ -160,7 +161,7 @@ vips_unary_const_build( VipsObject *object ) arithmetic->base_bands = uconst->n; if( unary->in && uconst->c ) { - if( vips_check_vector( "VipsRelationalConst", + if( vips_check_vector( class->nickname, uconst->c->n, unary->in ) ) return( -1 ); } diff --git a/libvips/colour/Lab2XYZ.c b/libvips/colour/Lab2XYZ.c index 80994275..a52b2e4d 100644 --- a/libvips/colour/Lab2XYZ.c +++ b/libvips/colour/Lab2XYZ.c @@ -136,10 +136,11 @@ vips_Lab2XYZ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width ) static int vips_Lab2XYZ_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsLab2XYZ *Lab2XYZ = (VipsLab2XYZ *) object; if( Lab2XYZ->temp ) { - if( vips_check_vector_length( "VipsLab2XYZ", + if( vips_check_vector_length( class->nickname, Lab2XYZ->temp->n, 3 ) ) return( -1 ); Lab2XYZ->X0 = ((double *) Lab2XYZ->temp->data)[0]; diff --git a/libvips/colour/XYZ2Lab.c b/libvips/colour/XYZ2Lab.c index f4705485..642654d9 100644 --- a/libvips/colour/XYZ2Lab.c +++ b/libvips/colour/XYZ2Lab.c @@ -194,10 +194,11 @@ vips_col_XYZ2Lab( float X, float Y, float Z, float *L, float *a, float *b ) static int vips_XYZ2Lab_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsXYZ2Lab *XYZ2Lab = (VipsXYZ2Lab *) object; if( XYZ2Lab->temp ) { - if( vips_check_vector_length( "VipsXYZ2Lab", + if( vips_check_vector_length( class->nickname, XYZ2Lab->temp->n, 3 ) ) return( -1 ); XYZ2Lab->X0 = ((double *) XYZ2Lab->temp->data)[0]; diff --git a/libvips/conversion/bandary.c b/libvips/conversion/bandary.c index 45bb4647..cdee6783 100644 --- a/libvips/conversion/bandary.c +++ b/libvips/conversion/bandary.c @@ -113,6 +113,7 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) static int vips_bandary_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsBandary *bandary = (VipsBandary *) object; @@ -124,16 +125,18 @@ vips_bandary_build( VipsObject *object ) return( -1 ); if( bandary->n <= 0 ) { - vips_error( "VipsBandary", "%s", _( "no input images" ) ); + vips_error( class->nickname, + "%s", _( "no input images" ) ); return( -1 ); } if( bandary->n > MAX_INPUT_IMAGES ) { - vips_error( "VipsBandary", "%s", _( "too many input images" ) ); + vips_error( class->nickname, + "%s", _( "too many input images" ) ); return( -1 ); } for( i = 0; i < bandary->n; i++ ) if( vips_image_pio_input( bandary->in[i] ) || - vips_check_uncoded( "VipsBandary", bandary->in[i] ) ) + vips_check_uncoded( class->nickname, bandary->in[i] ) ) return( -1 ); format = (VipsImage **) vips_object_local_array( object, bandary->n ); diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index ee420694..dc0bb30c 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -120,8 +120,10 @@ vips_cast_preeval( VipsImage *image, VipsProgress *progress, VipsCast *cast ) static void vips_cast_posteval( VipsImage *image, VipsProgress *progress, VipsCast *cast ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cast ); + if( cast->overflow || cast->underflow ) - vips_warn( "VipsCast", + vips_warn( class->nickname, _( "%d underflows and %d overflows detected" ), cast->underflow, cast->overflow ); } @@ -422,6 +424,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b, static int vips_cast_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsCast *cast = (VipsCast *) object; @@ -433,7 +436,7 @@ vips_cast_build( VipsObject *object ) if( cast->in->BandFmt == cast->format ) return( vips_image_write( cast->in, conversion->out ) ); - if( vips_check_uncoded( "VipsCast", cast->in ) || + if( vips_check_uncoded( class->nickname, cast->in ) || vips_image_pio_input( cast->in ) ) return( -1 ); diff --git a/libvips/conversion/embed.c b/libvips/conversion/embed.c index 1cc7894b..e82191ad 100644 --- a/libvips/conversion/embed.c +++ b/libvips/conversion/embed.c @@ -322,6 +322,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) static int vips_embed_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsEmbed *embed = (VipsEmbed *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 7 ); @@ -331,7 +332,7 @@ vips_embed_build( VipsObject *object ) if( VIPS_OBJECT_CLASS( vips_embed_parent_class )->build( object ) ) return( -1 ); - /* nip can generate this quite often ... just copy. + /* nip2 can generate this quite often ... just copy. */ if( embed->x == 0 && embed->y == 0 && @@ -343,7 +344,7 @@ vips_embed_build( VipsObject *object ) return( -1 ); if( !(embed->ink = vips__vector_to_ink( - "VipsEmbed", embed->in, + class->nickname, embed->in, embed->background->data, embed->background->n )) ) return( -1 ); @@ -456,7 +457,8 @@ vips_embed_build( VipsObject *object ) * and remove this test. */ if( vips_rect_isempty( &embed->rsub ) ) { - vips_error( "VipsEmbed", "%s", _( "bad dimensions" ) ); + vips_error( class->nickname, + "%s", _( "bad dimensions" ) ); return( -1 ); } diff --git a/libvips/conversion/extract.c b/libvips/conversion/extract.c index f3c6c68d..9bea5f24 100644 --- a/libvips/conversion/extract.c +++ b/libvips/conversion/extract.c @@ -134,22 +134,24 @@ vips_extract_area_gen( VipsRegion *or, void *seq, void *a, void *b, static int vips_extract_area_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsExtractArea *extract = (VipsExtractArea *) object; - if( VIPS_OBJECT_CLASS( vips_extract_area_parent_class )->build( object ) ) + if( VIPS_OBJECT_CLASS( vips_extract_area_parent_class )-> + build( object ) ) return( -1 ); if( extract->left + extract->width > extract->in->Xsize || extract->top + extract->height > extract->in->Ysize || extract->left < 0 || extract->top < 0 || extract->width <= 0 || extract->height <= 0 ) { - vips_error( "VipsExtractArea", "%s", _( "bad extract area" ) ); + vips_error( class->nickname, "%s", _( "bad extract area" ) ); return( -1 ); } if( vips_image_pio_input( extract->in ) || - vips_check_coding_known( "VipsExtractArea", extract->in ) ) + vips_check_coding_known( class->nickname, extract->in ) ) return( -1 ); if( vips_image_copy_fields( conversion->out, extract->in ) ) @@ -308,6 +310,7 @@ vips_extract_band_buffer( VipsBandary *bandary, static int vips_extract_band_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsBandary *bandary = (VipsBandary *) object; VipsExtractBand *extract = (VipsExtractBand *) object; @@ -317,7 +320,7 @@ vips_extract_band_build( VipsObject *object ) bandary->out_bands = extract->n; if( extract->band + extract->n > extract->in->Bands ) { - vips_error( "VipsExtractBand", + vips_error( class->nickname, "%s", _( "bad extract band" ) ); return( -1 ); } diff --git a/libvips/conversion/flatten.c b/libvips/conversion/flatten.c index d4cd0461..9554873e 100644 --- a/libvips/conversion/flatten.c +++ b/libvips/conversion/flatten.c @@ -296,6 +296,7 @@ vips_flatten_gen( VipsRegion *or, void *vseq, void *a, void *b, static int vips_flatten_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsFlatten *flatten = (VipsFlatten *) object; int i; @@ -309,8 +310,8 @@ vips_flatten_build( VipsObject *object ) if( flatten->in->Bands == 1 ) return( vips_image_write( flatten->in, conversion->out ) ); - if( vips_check_uncoded( "VipsFlatten", flatten->in ) || - vips_check_noncomplex( "VipsFlatten", flatten->in ) || + if( vips_check_uncoded( class->nickname, flatten->in ) || + vips_check_noncomplex( class->nickname, flatten->in ) || vips_image_pio_input( flatten->in ) ) return( -1 ); @@ -340,7 +341,7 @@ vips_flatten_build( VipsObject *object ) /* Convert the background to the image's format. */ if( !(flatten->ink = vips__vector_to_ink( - "VipsFlatten", conversion->out, + class->nickname, conversion->out, flatten->background->data, flatten->background->n )) ) return( -1 ); diff --git a/libvips/conversion/ifthenelse.c b/libvips/conversion/ifthenelse.c index e2ac66a2..aa49c896 100644 --- a/libvips/conversion/ifthenelse.c +++ b/libvips/conversion/ifthenelse.c @@ -400,6 +400,7 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2, static int vips_ifthenelse_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsIfthenelse *ifthenelse = (VipsIfthenelse *) object; VipsGenerateFn generate_fn = ifthenelse->blend ? @@ -429,7 +430,7 @@ vips_ifthenelse_build( VipsObject *object ) /* Cast our input images up to a common bands and size. */ - if( vips__bandalike_vec( "VipsIfthenelse", all, band, 3, 0 ) || + if( vips__bandalike_vec( class->nickname, all, band, 3, 0 ) || vips__sizealike_vec( band, size, 3 ) ) return( -1 ); diff --git a/libvips/conversion/insert.c b/libvips/conversion/insert.c index be73b7db..2a297eaf 100644 --- a/libvips/conversion/insert.c +++ b/libvips/conversion/insert.c @@ -253,6 +253,7 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n ) static int vips_insert_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = VIPS_CONVERSION( object ); VipsInsert *insert = (VipsInsert *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 6 ); @@ -264,17 +265,17 @@ vips_insert_build( VipsObject *object ) if( vips_image_pio_input( insert->main ) || vips_image_pio_input( insert->sub ) || - vips_check_bands_1orn( "VipsInsert", + vips_check_bands_1orn( class->nickname, insert->main, insert->sub ) || - vips_check_coding_known( "VipsInsert", insert->main ) || - vips_check_coding_same( "VipsInsert", + vips_check_coding_known( class->nickname, insert->main ) || + vips_check_coding_same( class->nickname, insert->main, insert->sub ) ) return( -1 ); /* Cast our input images up to a common format and bands. */ if( vips__formatalike( insert->main, insert->sub, &t[0], &t[1] ) || - vips__bandalike( "VipsInsert", t[0], t[1], &t[2], &t[3] ) ) + vips__bandalike( class->nickname, t[0], t[1], &t[2], &t[3] ) ) return( -1 ); insert->main_processed = t[2]; insert->sub_processed = t[3]; @@ -320,7 +321,7 @@ vips_insert_build( VipsObject *object ) conversion->out->Ysize = insert->rout.height; if( !(insert->ink = vips__vector_to_ink( - "VipsInsert", conversion->out, + class->nickname, conversion->out, insert->background->data, insert->background->n )) ) return( -1 ); diff --git a/libvips/conversion/recomb.c b/libvips/conversion/recomb.c index 88e228f3..7884481b 100644 --- a/libvips/conversion/recomb.c +++ b/libvips/conversion/recomb.c @@ -139,6 +139,7 @@ vips_recomb_gen( VipsRegion *or, static int vips_recomb_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConversion *conversion = (VipsConversion *) object; VipsRecomb *recomb = (VipsRecomb *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 ); @@ -147,16 +148,16 @@ vips_recomb_build( VipsObject *object ) return( -1 ); if( vips_image_pio_input( recomb->in ) || - vips_check_uncoded( "VipsRecomb", recomb->in ) || - vips_check_noncomplex( "VipsRecomb", recomb->in ) ) + vips_check_uncoded( class->nickname, recomb->in ) || + vips_check_noncomplex( class->nickname, recomb->in ) ) return( -1 ); if( vips_image_pio_input( recomb->m ) || - vips_check_uncoded( "VipsRecomb", recomb->m ) || - vips_check_noncomplex( "VipsRecomb", recomb->m ) || - vips_check_mono( "VipsRecomb", recomb->m ) ) + vips_check_uncoded( class->nickname, recomb->m ) || + vips_check_noncomplex( class->nickname, recomb->m ) || + vips_check_mono( class->nickname, recomb->m ) ) return( -1 ); if( recomb->in->Bands != recomb->m->Xsize ) { - vips_error( "VipsRecomb", + vips_error( class->nickname, "%s", _( "bands in must equal matrix width" ) ); return( -1 ); } diff --git a/libvips/conversion/sequential.c b/libvips/conversion/sequential.c index 0d036a64..a24671e0 100644 --- a/libvips/conversion/sequential.c +++ b/libvips/conversion/sequential.c @@ -111,6 +111,7 @@ vips_sequential_generate( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsSequential *sequential = (VipsSequential *) b; + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( sequential ); VipsRect *r = &or->valid; VipsRegion *ir = (VipsRegion *) seq; @@ -118,7 +119,7 @@ vips_sequential_generate( VipsRegion *or, g_thread_self(), r->height, r->top ); if( sequential->trace ) - vips_diag( "VipsSequential", + vips_diag( class->nickname, "request for %d lines, starting at line %d", r->height, r->top ); diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 8ccae8c3..c863a6b8 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -820,8 +820,9 @@ vips_foreign_load_generate( VipsRegion *or, static int vips_foreign_load_build( VipsObject *object ) { + VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsForeignLoad *load = VIPS_FOREIGN_LOAD( object ); - VipsForeignLoadClass *class = VIPS_FOREIGN_LOAD_GET_CLASS( object ); + VipsForeignLoadClass *fclass = VIPS_FOREIGN_LOAD_GET_CLASS( object ); VipsForeignFlags flags; @@ -830,12 +831,12 @@ vips_foreign_load_build( VipsObject *object ) #endif /*DEBUG*/ flags = 0; - if( class->get_flags ) - flags |= class->get_flags( load ); + if( fclass->get_flags ) + flags |= fclass->get_flags( load ); if( (flags & VIPS_FOREIGN_PARTIAL) && (flags & VIPS_FOREIGN_SEQUENTIAL) ) { - vips_warn( "VipsForeign", "%s", + vips_warn( class->nickname, "%s", _( "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL " "both set -- using SEQUENTIAL" ) ); flags ^= VIPS_FOREIGN_PARTIAL; @@ -855,8 +856,8 @@ vips_foreign_load_build( VipsObject *object ) /* Read the header into @out. */ - if( class->header && - class->header( load ) ) + if( fclass->header && + fclass->header( load ) ) return( -1 ); /* If there's no ->load() method then the header read has done @@ -866,7 +867,7 @@ vips_foreign_load_build( VipsObject *object ) * Delay the load until the first pixel is requested by doing the work * in the start function of the copy. */ - if( class->load ) { + if( fclass->load ) { #ifdef DEBUG printf( "vips_foreign_load_build: delaying read ...\n" ); #endif /*DEBUG*/