better error domain names

This commit is contained in:
John Cupitt 2012-11-02 14:41:47 +00:00
parent bf11e2ff55
commit 777d1ea554
24 changed files with 91 additions and 71 deletions

13
TODO
View File

@ -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? - can we make DOUBLE ARRAY args easier from C?
at the moment they are horrible or ad-hoc, see vips_linear() etc. and at the moment they are horrible or ad-hoc, see vips_linear() etc. and

View File

@ -297,6 +297,7 @@ vips_arithmetic_gen( VipsRegion *or,
static int static int
vips_arithmetic_build( VipsObject *object ) vips_arithmetic_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsArithmeticClass *aclass = VIPS_ARITHMETIC_GET_CLASS( arithmetic ); 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. /* No need to check input bands, bandalike will do this for us.
*/ */
if( arithmetic->n > MAX_INPUT_IMAGES ) { if( arithmetic->n > MAX_INPUT_IMAGES ) {
vips_error( "VipsArithmetic", vips_error( class->nickname,
"%s", _( "too many input images" ) ); "%s", _( "too many input images" ) );
return( -1 ); return( -1 );
} }
for( i = 0; i < arithmetic->n; i++ ) for( i = 0; i < arithmetic->n; i++ )
if( vips_image_pio_input( arithmetic->in[i] ) || if( vips_image_pio_input( arithmetic->in[i] ) ||
vips_check_uncoded( "VipsArithmetic", vips_check_uncoded( class->nickname,
arithmetic->in[i] ) ) arithmetic->in[i] ) )
return( -1 ); return( -1 );
@ -340,7 +341,7 @@ vips_arithmetic_build( VipsObject *object )
/* Cast our input images up to a common format, bands and size. /* Cast our input images up to a common format, bands and size.
*/ */
if( vips__formatalike_vec( arithmetic->in, format, arithmetic->n ) || 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 ) || format, band, arithmetic->n, arithmetic->base_bands ) ||
vips__sizealike_vec( band, size, arithmetic->n ) ) vips__sizealike_vec( band, size, arithmetic->n ) )
return( -1 ); return( -1 );

View File

@ -90,13 +90,14 @@ G_DEFINE_TYPE( VipsBoolean, vips_boolean, VIPS_TYPE_BINARY );
static int static int
vips_boolean_build( VipsObject *object ) vips_boolean_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsBinary *binary = (VipsBinary *) object; VipsBinary *binary = (VipsBinary *) object;
if( binary->left && if( binary->left &&
vips_check_noncomplex( "VipsBoolean", binary->left ) ) vips_check_noncomplex( class->nickname, binary->left ) )
return( -1 ); return( -1 );
if( binary->right && if( binary->right &&
vips_check_noncomplex( "VipsBoolean", binary->right ) ) vips_check_noncomplex( class->nickname, binary->right ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_boolean_parent_class )->build( object ) ) if( VIPS_OBJECT_CLASS( vips_boolean_parent_class )->build( object ) )
@ -423,11 +424,12 @@ G_DEFINE_TYPE( VipsBooleanConst,
static int static int
vips_boolean_const_build( VipsObject *object ) vips_boolean_const_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
VipsUnaryConst *uconst = (VipsUnaryConst *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object;
if( unary->in && if( unary->in &&
vips_check_noncomplex( "VipsBoolean", unary->in ) ) vips_check_noncomplex( class->nickname, unary->in ) )
return( -1 ); return( -1 );
uconst->const_format = VIPS_FORMAT_INT; uconst->const_format = VIPS_FORMAT_INT;

View File

@ -578,13 +578,14 @@ G_DEFINE_TYPE( VipsComplexform, vips_complexform, VIPS_TYPE_BINARY );
static int static int
vips_complexform_build( VipsObject *object ) vips_complexform_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsBinary *binary = (VipsBinary *) object; VipsBinary *binary = (VipsBinary *) object;
if( binary->left && if( binary->left &&
vips_check_noncomplex( "VipsComplexform", binary->left ) ) vips_check_noncomplex( class->nickname, binary->left ) )
return( -1 ); return( -1 );
if( binary->right && if( binary->right &&
vips_check_noncomplex( "VipsComplexform", binary->right ) ) vips_check_noncomplex( class->nickname, binary->right ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_complexform_parent_class )-> if( VIPS_OBJECT_CLASS( vips_complexform_parent_class )->

View File

@ -88,6 +88,7 @@ G_DEFINE_TYPE( VipsDeviate, vips_deviate, VIPS_TYPE_STATISTIC );
static int static int
vips_deviate_build( VipsObject *object ) vips_deviate_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsStatistic *statistic = VIPS_STATISTIC( object ); VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsDeviate *deviate = (VipsDeviate *) object; VipsDeviate *deviate = (VipsDeviate *) object;
@ -95,7 +96,7 @@ vips_deviate_build( VipsObject *object )
double s, s2; double s, s2;
if( statistic->in && if( statistic->in &&
vips_check_noncomplex( "VipsDeviate", statistic->in ) ) vips_check_noncomplex( class->nickname, statistic->in ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_deviate_parent_class )->build( object ) ) if( VIPS_OBJECT_CLASS( vips_deviate_parent_class )->build( object ) )

View File

@ -106,6 +106,7 @@ G_DEFINE_TYPE( VipsLinear, vips_linear, VIPS_TYPE_UNARY );
static int static int
vips_linear_build( VipsObject *object ) vips_linear_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
VipsLinear *linear = (VipsLinear *) object; VipsLinear *linear = (VipsLinear *) object;
@ -124,9 +125,9 @@ vips_linear_build( VipsObject *object )
arithmetic->base_bands = linear->n; arithmetic->base_bands = linear->n;
if( unary->in && linear->a && linear->b ) { if( unary->in && linear->a && linear->b ) {
if( vips_check_vector( "VipsLinear", if( vips_check_vector( class->nickname,
linear->a->n, unary->in ) || linear->a->n, unary->in ) ||
vips_check_vector( "VipsLinear", vips_check_vector( class->nickname,
linear->b->n, unary->in ) ) linear->b->n, unary->in ) )
return( -1 ); return( -1 );
} }

View File

@ -82,10 +82,11 @@ G_DEFINE_TYPE( VipsMath, vips_math, VIPS_TYPE_UNARY );
static int static int
vips_math_build( VipsObject *object ) vips_math_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
if( unary->in && if( unary->in &&
vips_check_noncomplex( "VipsMath", unary->in ) ) vips_check_noncomplex( class->nickname, unary->in ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_math_parent_class )->build( object ) ) if( VIPS_OBJECT_CLASS( vips_math_parent_class )->build( object ) )

View File

@ -84,13 +84,14 @@ G_DEFINE_TYPE( VipsMath2, vips_math2, VIPS_TYPE_BINARY );
static int static int
vips_math2_build( VipsObject *object ) vips_math2_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsBinary *binary = (VipsBinary *) object; VipsBinary *binary = (VipsBinary *) object;
if( binary->left && if( binary->left &&
vips_check_noncomplex( "VipsMath2", binary->left ) ) vips_check_noncomplex( class->nickname, binary->left ) )
return( -1 ); return( -1 );
if( binary->right && if( binary->right &&
vips_check_noncomplex( "VipsMath2", binary->right ) ) vips_check_noncomplex( class->nickname, binary->right ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_math2_parent_class )->build( object ) ) if( VIPS_OBJECT_CLASS( vips_math2_parent_class )->build( object ) )
@ -335,11 +336,12 @@ G_DEFINE_TYPE( VipsMath2Const,
static int static int
vips_math2_const_build( VipsObject *object ) vips_math2_const_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
VipsUnaryConst *uconst = (VipsUnaryConst *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object;
if( unary->in && if( unary->in &&
vips_check_noncomplex( "VipsMath2", unary->in ) ) vips_check_noncomplex( class->nickname, unary->in ) )
return( -1 ); return( -1 );
uconst->const_format = VIPS_FORMAT_DOUBLE; uconst->const_format = VIPS_FORMAT_DOUBLE;

View File

@ -91,6 +91,7 @@ G_DEFINE_TYPE( VipsMeasure, vips_measure, VIPS_TYPE_OPERATION );
static int static int
vips_measure_build( VipsObject *object ) vips_measure_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsMeasure *measure = (VipsMeasure *) object; VipsMeasure *measure = (VipsMeasure *) object;
int bands; int bands;
@ -159,7 +160,7 @@ vips_measure_build( VipsObject *object )
* measure on IM_TYPE_LAB images). * measure on IM_TYPE_LAB images).
*/ */
if( dev * 5 > fabs( avg ) && fabs( avg ) > 3 ) if( dev * 5 > fabs( avg ) && fabs( avg ) > 3 )
vips_warn( "VipsMeasure", vips_warn( class->nickname,
_( "patch %d x %d, band %d: " _( "patch %d x %d, band %d: "
"avg = %g, sdev = %g" ), "avg = %g, sdev = %g" ),
i, j, avg, dev ); i, j, avg, dev );

View File

@ -72,13 +72,14 @@ G_DEFINE_TYPE( VipsRemainder, vips_remainder, VIPS_TYPE_BINARY );
static int static int
vips_remainder_build( VipsObject *object ) vips_remainder_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsBinary *binary = (VipsBinary *) object; VipsBinary *binary = (VipsBinary *) object;
if( binary->left && if( binary->left &&
vips_check_noncomplex( "VipsRemainder", binary->left ) ) vips_check_noncomplex( class->nickname, binary->left ) )
return( -1 ); return( -1 );
if( binary->right && if( binary->right &&
vips_check_noncomplex( "VipsRemainder", binary->right ) ) vips_check_noncomplex( class->nickname, binary->right ) )
return( -1 ); return( -1 );
if( VIPS_OBJECT_CLASS( vips_remainder_parent_class )->build( object ) ) if( VIPS_OBJECT_CLASS( vips_remainder_parent_class )->build( object ) )
@ -239,11 +240,12 @@ G_DEFINE_TYPE( VipsRemainderConst,
static int static int
vips_remainder_const_build( VipsObject *object ) vips_remainder_const_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
VipsUnaryConst *uconst = (VipsUnaryConst *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object;
if( unary->in && if( unary->in &&
vips_check_noncomplex( "VipsRemainder", unary->in ) ) vips_check_noncomplex( class->nickname, unary->in ) )
return( -1 ); return( -1 );
if( unary->in ) if( unary->in )

View File

@ -108,6 +108,7 @@ enum {
static int static int
vips_stats_build( VipsObject *object ) vips_stats_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsStatistic *statistic = VIPS_STATISTIC( object ); VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsStats *stats = (VipsStats *) object; VipsStats *stats = (VipsStats *) object;
@ -118,7 +119,7 @@ vips_stats_build( VipsObject *object )
if( statistic->in ) { if( statistic->in ) {
int bands = vips_image_get_bands( 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 ); return( -1 );
g_object_set( object, g_object_set( object,

View File

@ -145,6 +145,7 @@ make_pixel( VipsObject *obj, int m, VipsBandFmt fmt, int n, double *p )
static int static int
vips_unary_const_build( VipsObject *object ) vips_unary_const_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object ); VipsArithmetic *arithmetic = VIPS_ARITHMETIC( object );
VipsUnary *unary = (VipsUnary *) object; VipsUnary *unary = (VipsUnary *) object;
VipsUnaryConst *uconst = (VipsUnaryConst *) object; VipsUnaryConst *uconst = (VipsUnaryConst *) object;
@ -160,7 +161,7 @@ vips_unary_const_build( VipsObject *object )
arithmetic->base_bands = uconst->n; arithmetic->base_bands = uconst->n;
if( unary->in && uconst->c ) { if( unary->in && uconst->c ) {
if( vips_check_vector( "VipsRelationalConst", if( vips_check_vector( class->nickname,
uconst->c->n, unary->in ) ) uconst->c->n, unary->in ) )
return( -1 ); return( -1 );
} }

View File

@ -136,10 +136,11 @@ vips_Lab2XYZ_line( VipsColour *colour, VipsPel *out, VipsPel **in, int width )
static int static int
vips_Lab2XYZ_build( VipsObject *object ) vips_Lab2XYZ_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsLab2XYZ *Lab2XYZ = (VipsLab2XYZ *) object; VipsLab2XYZ *Lab2XYZ = (VipsLab2XYZ *) object;
if( Lab2XYZ->temp ) { if( Lab2XYZ->temp ) {
if( vips_check_vector_length( "VipsLab2XYZ", if( vips_check_vector_length( class->nickname,
Lab2XYZ->temp->n, 3 ) ) Lab2XYZ->temp->n, 3 ) )
return( -1 ); return( -1 );
Lab2XYZ->X0 = ((double *) Lab2XYZ->temp->data)[0]; Lab2XYZ->X0 = ((double *) Lab2XYZ->temp->data)[0];

View File

@ -194,10 +194,11 @@ vips_col_XYZ2Lab( float X, float Y, float Z, float *L, float *a, float *b )
static int static int
vips_XYZ2Lab_build( VipsObject *object ) vips_XYZ2Lab_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsXYZ2Lab *XYZ2Lab = (VipsXYZ2Lab *) object; VipsXYZ2Lab *XYZ2Lab = (VipsXYZ2Lab *) object;
if( XYZ2Lab->temp ) { if( XYZ2Lab->temp ) {
if( vips_check_vector_length( "VipsXYZ2Lab", if( vips_check_vector_length( class->nickname,
XYZ2Lab->temp->n, 3 ) ) XYZ2Lab->temp->n, 3 ) )
return( -1 ); return( -1 );
XYZ2Lab->X0 = ((double *) XYZ2Lab->temp->data)[0]; XYZ2Lab->X0 = ((double *) XYZ2Lab->temp->data)[0];

View File

@ -113,6 +113,7 @@ vips_bandary_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
static int static int
vips_bandary_build( VipsObject *object ) vips_bandary_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsBandary *bandary = (VipsBandary *) object; VipsBandary *bandary = (VipsBandary *) object;
@ -124,16 +125,18 @@ vips_bandary_build( VipsObject *object )
return( -1 ); return( -1 );
if( bandary->n <= 0 ) { if( bandary->n <= 0 ) {
vips_error( "VipsBandary", "%s", _( "no input images" ) ); vips_error( class->nickname,
"%s", _( "no input images" ) );
return( -1 ); return( -1 );
} }
if( bandary->n > MAX_INPUT_IMAGES ) { 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 ); return( -1 );
} }
for( i = 0; i < bandary->n; i++ ) for( i = 0; i < bandary->n; i++ )
if( vips_image_pio_input( bandary->in[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 ); return( -1 );
format = (VipsImage **) vips_object_local_array( object, bandary->n ); format = (VipsImage **) vips_object_local_array( object, bandary->n );

View File

@ -120,8 +120,10 @@ vips_cast_preeval( VipsImage *image, VipsProgress *progress, VipsCast *cast )
static void static void
vips_cast_posteval( VipsImage *image, VipsProgress *progress, VipsCast *cast ) vips_cast_posteval( VipsImage *image, VipsProgress *progress, VipsCast *cast )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cast );
if( cast->overflow || cast->underflow ) if( cast->overflow || cast->underflow )
vips_warn( "VipsCast", vips_warn( class->nickname,
_( "%d underflows and %d overflows detected" ), _( "%d underflows and %d overflows detected" ),
cast->underflow, cast->overflow ); cast->underflow, cast->overflow );
} }
@ -422,6 +424,7 @@ vips_cast_gen( VipsRegion *or, void *vseq, void *a, void *b,
static int static int
vips_cast_build( VipsObject *object ) vips_cast_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsCast *cast = (VipsCast *) object; VipsCast *cast = (VipsCast *) object;
@ -433,7 +436,7 @@ vips_cast_build( VipsObject *object )
if( cast->in->BandFmt == cast->format ) if( cast->in->BandFmt == cast->format )
return( vips_image_write( cast->in, conversion->out ) ); 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 ) ) vips_image_pio_input( cast->in ) )
return( -1 ); return( -1 );

View File

@ -322,6 +322,7 @@ vips_embed_gen( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop )
static int static int
vips_embed_build( VipsObject *object ) vips_embed_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsEmbed *embed = (VipsEmbed *) object; VipsEmbed *embed = (VipsEmbed *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 7 ); 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 ) ) if( VIPS_OBJECT_CLASS( vips_embed_parent_class )->build( object ) )
return( -1 ); return( -1 );
/* nip can generate this quite often ... just copy. /* nip2 can generate this quite often ... just copy.
*/ */
if( embed->x == 0 && if( embed->x == 0 &&
embed->y == 0 && embed->y == 0 &&
@ -343,7 +344,7 @@ vips_embed_build( VipsObject *object )
return( -1 ); return( -1 );
if( !(embed->ink = vips__vector_to_ink( if( !(embed->ink = vips__vector_to_ink(
"VipsEmbed", embed->in, class->nickname, embed->in,
embed->background->data, embed->background->n )) ) embed->background->data, embed->background->n )) )
return( -1 ); return( -1 );
@ -456,7 +457,8 @@ vips_embed_build( VipsObject *object )
* and remove this test. * and remove this test.
*/ */
if( vips_rect_isempty( &embed->rsub ) ) { if( vips_rect_isempty( &embed->rsub ) ) {
vips_error( "VipsEmbed", "%s", _( "bad dimensions" ) ); vips_error( class->nickname,
"%s", _( "bad dimensions" ) );
return( -1 ); return( -1 );
} }

View File

@ -134,22 +134,24 @@ vips_extract_area_gen( VipsRegion *or, void *seq, void *a, void *b,
static int static int
vips_extract_area_build( VipsObject *object ) vips_extract_area_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsExtractArea *extract = (VipsExtractArea *) 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 ); return( -1 );
if( extract->left + extract->width > extract->in->Xsize || if( extract->left + extract->width > extract->in->Xsize ||
extract->top + extract->height > extract->in->Ysize || extract->top + extract->height > extract->in->Ysize ||
extract->left < 0 || extract->top < 0 || extract->left < 0 || extract->top < 0 ||
extract->width <= 0 || extract->height <= 0 ) { extract->width <= 0 || extract->height <= 0 ) {
vips_error( "VipsExtractArea", "%s", _( "bad extract area" ) ); vips_error( class->nickname, "%s", _( "bad extract area" ) );
return( -1 ); return( -1 );
} }
if( vips_image_pio_input( extract->in ) || if( vips_image_pio_input( extract->in ) ||
vips_check_coding_known( "VipsExtractArea", extract->in ) ) vips_check_coding_known( class->nickname, extract->in ) )
return( -1 ); return( -1 );
if( vips_image_copy_fields( conversion->out, extract->in ) ) if( vips_image_copy_fields( conversion->out, extract->in ) )
@ -308,6 +310,7 @@ vips_extract_band_buffer( VipsBandary *bandary,
static int static int
vips_extract_band_build( VipsObject *object ) vips_extract_band_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsBandary *bandary = (VipsBandary *) object; VipsBandary *bandary = (VipsBandary *) object;
VipsExtractBand *extract = (VipsExtractBand *) object; VipsExtractBand *extract = (VipsExtractBand *) object;
@ -317,7 +320,7 @@ vips_extract_band_build( VipsObject *object )
bandary->out_bands = extract->n; bandary->out_bands = extract->n;
if( extract->band + extract->n > extract->in->Bands ) { if( extract->band + extract->n > extract->in->Bands ) {
vips_error( "VipsExtractBand", vips_error( class->nickname,
"%s", _( "bad extract band" ) ); "%s", _( "bad extract band" ) );
return( -1 ); return( -1 );
} }

View File

@ -296,6 +296,7 @@ vips_flatten_gen( VipsRegion *or, void *vseq, void *a, void *b,
static int static int
vips_flatten_build( VipsObject *object ) vips_flatten_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsFlatten *flatten = (VipsFlatten *) object; VipsFlatten *flatten = (VipsFlatten *) object;
int i; int i;
@ -309,8 +310,8 @@ vips_flatten_build( VipsObject *object )
if( flatten->in->Bands == 1 ) if( flatten->in->Bands == 1 )
return( vips_image_write( flatten->in, conversion->out ) ); return( vips_image_write( flatten->in, conversion->out ) );
if( vips_check_uncoded( "VipsFlatten", flatten->in ) || if( vips_check_uncoded( class->nickname, flatten->in ) ||
vips_check_noncomplex( "VipsFlatten", flatten->in ) || vips_check_noncomplex( class->nickname, flatten->in ) ||
vips_image_pio_input( flatten->in ) ) vips_image_pio_input( flatten->in ) )
return( -1 ); return( -1 );
@ -340,7 +341,7 @@ vips_flatten_build( VipsObject *object )
/* Convert the background to the image's format. /* Convert the background to the image's format.
*/ */
if( !(flatten->ink = vips__vector_to_ink( if( !(flatten->ink = vips__vector_to_ink(
"VipsFlatten", conversion->out, class->nickname, conversion->out,
flatten->background->data, flatten->background->n )) ) flatten->background->data, flatten->background->n )) )
return( -1 ); return( -1 );

View File

@ -400,6 +400,7 @@ vips_ifthenelse_gen( VipsRegion *or, void *seq, void *client1, void *client2,
static int static int
vips_ifthenelse_build( VipsObject *object ) vips_ifthenelse_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsIfthenelse *ifthenelse = (VipsIfthenelse *) object; VipsIfthenelse *ifthenelse = (VipsIfthenelse *) object;
VipsGenerateFn generate_fn = ifthenelse->blend ? 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. /* 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 ) ) vips__sizealike_vec( band, size, 3 ) )
return( -1 ); return( -1 );

View File

@ -253,6 +253,7 @@ vips__vector_to_ink( const char *domain, VipsImage *im, double *vec, int n )
static int static int
vips_insert_build( VipsObject *object ) vips_insert_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = VIPS_CONVERSION( object ); VipsConversion *conversion = VIPS_CONVERSION( object );
VipsInsert *insert = (VipsInsert *) object; VipsInsert *insert = (VipsInsert *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 6 ); 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 ) || if( vips_image_pio_input( insert->main ) ||
vips_image_pio_input( insert->sub ) || vips_image_pio_input( insert->sub ) ||
vips_check_bands_1orn( "VipsInsert", vips_check_bands_1orn( class->nickname,
insert->main, insert->sub ) || insert->main, insert->sub ) ||
vips_check_coding_known( "VipsInsert", insert->main ) || vips_check_coding_known( class->nickname, insert->main ) ||
vips_check_coding_same( "VipsInsert", vips_check_coding_same( class->nickname,
insert->main, insert->sub ) ) insert->main, insert->sub ) )
return( -1 ); return( -1 );
/* Cast our input images up to a common format and bands. /* Cast our input images up to a common format and bands.
*/ */
if( vips__formatalike( insert->main, insert->sub, &t[0], &t[1] ) || 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 ); return( -1 );
insert->main_processed = t[2]; insert->main_processed = t[2];
insert->sub_processed = t[3]; insert->sub_processed = t[3];
@ -320,7 +321,7 @@ vips_insert_build( VipsObject *object )
conversion->out->Ysize = insert->rout.height; conversion->out->Ysize = insert->rout.height;
if( !(insert->ink = vips__vector_to_ink( if( !(insert->ink = vips__vector_to_ink(
"VipsInsert", conversion->out, class->nickname, conversion->out,
insert->background->data, insert->background->n )) ) insert->background->data, insert->background->n )) )
return( -1 ); return( -1 );

View File

@ -139,6 +139,7 @@ vips_recomb_gen( VipsRegion *or,
static int static int
vips_recomb_build( VipsObject *object ) vips_recomb_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsConversion *conversion = (VipsConversion *) object; VipsConversion *conversion = (VipsConversion *) object;
VipsRecomb *recomb = (VipsRecomb *) object; VipsRecomb *recomb = (VipsRecomb *) object;
VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 ); VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 );
@ -147,16 +148,16 @@ vips_recomb_build( VipsObject *object )
return( -1 ); return( -1 );
if( vips_image_pio_input( recomb->in ) || if( vips_image_pio_input( recomb->in ) ||
vips_check_uncoded( "VipsRecomb", recomb->in ) || vips_check_uncoded( class->nickname, recomb->in ) ||
vips_check_noncomplex( "VipsRecomb", recomb->in ) ) vips_check_noncomplex( class->nickname, recomb->in ) )
return( -1 ); return( -1 );
if( vips_image_pio_input( recomb->m ) || if( vips_image_pio_input( recomb->m ) ||
vips_check_uncoded( "VipsRecomb", recomb->m ) || vips_check_uncoded( class->nickname, recomb->m ) ||
vips_check_noncomplex( "VipsRecomb", recomb->m ) || vips_check_noncomplex( class->nickname, recomb->m ) ||
vips_check_mono( "VipsRecomb", recomb->m ) ) vips_check_mono( class->nickname, recomb->m ) )
return( -1 ); return( -1 );
if( recomb->in->Bands != recomb->m->Xsize ) { if( recomb->in->Bands != recomb->m->Xsize ) {
vips_error( "VipsRecomb", vips_error( class->nickname,
"%s", _( "bands in must equal matrix width" ) ); "%s", _( "bands in must equal matrix width" ) );
return( -1 ); return( -1 );
} }

View File

@ -111,6 +111,7 @@ vips_sequential_generate( VipsRegion *or,
void *seq, void *a, void *b, gboolean *stop ) void *seq, void *a, void *b, gboolean *stop )
{ {
VipsSequential *sequential = (VipsSequential *) b; VipsSequential *sequential = (VipsSequential *) b;
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( sequential );
VipsRect *r = &or->valid; VipsRect *r = &or->valid;
VipsRegion *ir = (VipsRegion *) seq; VipsRegion *ir = (VipsRegion *) seq;
@ -118,7 +119,7 @@ vips_sequential_generate( VipsRegion *or,
g_thread_self(), r->height, r->top ); g_thread_self(), r->height, r->top );
if( sequential->trace ) if( sequential->trace )
vips_diag( "VipsSequential", vips_diag( class->nickname,
"request for %d lines, starting at line %d", "request for %d lines, starting at line %d",
r->height, r->top ); r->height, r->top );

View File

@ -820,8 +820,9 @@ vips_foreign_load_generate( VipsRegion *or,
static int static int
vips_foreign_load_build( VipsObject *object ) vips_foreign_load_build( VipsObject *object )
{ {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
VipsForeignLoad *load = VIPS_FOREIGN_LOAD( 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; VipsForeignFlags flags;
@ -830,12 +831,12 @@ vips_foreign_load_build( VipsObject *object )
#endif /*DEBUG*/ #endif /*DEBUG*/
flags = 0; flags = 0;
if( class->get_flags ) if( fclass->get_flags )
flags |= class->get_flags( load ); flags |= fclass->get_flags( load );
if( (flags & VIPS_FOREIGN_PARTIAL) && if( (flags & VIPS_FOREIGN_PARTIAL) &&
(flags & VIPS_FOREIGN_SEQUENTIAL) ) { (flags & VIPS_FOREIGN_SEQUENTIAL) ) {
vips_warn( "VipsForeign", "%s", vips_warn( class->nickname, "%s",
_( "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL " _( "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL "
"both set -- using SEQUENTIAL" ) ); "both set -- using SEQUENTIAL" ) );
flags ^= VIPS_FOREIGN_PARTIAL; flags ^= VIPS_FOREIGN_PARTIAL;
@ -855,8 +856,8 @@ vips_foreign_load_build( VipsObject *object )
/* Read the header into @out. /* Read the header into @out.
*/ */
if( class->header && if( fclass->header &&
class->header( load ) ) fclass->header( load ) )
return( -1 ); return( -1 );
/* If there's no ->load() method then the header read has done /* 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 * Delay the load until the first pixel is requested by doing the work
* in the start function of the copy. * in the start function of the copy.
*/ */
if( class->load ) { if( fclass->load ) {
#ifdef DEBUG #ifdef DEBUG
printf( "vips_foreign_load_build: delaying read ...\n" ); printf( "vips_foreign_load_build: delaying read ...\n" );
#endif /*DEBUG*/ #endif /*DEBUG*/