diff --git a/.gitignore b/.gitignore index 3893c230..1093c54a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ scan +compile po/*.pot test-driver vips-*.tar.gz diff --git a/libvips/arithmetic/max.c b/libvips/arithmetic/max.c index 1ed2ca3b..199817d6 100644 --- a/libvips/arithmetic/max.c +++ b/libvips/arithmetic/max.c @@ -106,14 +106,14 @@ typedef struct _VipsMax { /* The single max. Can be unset if, for example, the whole image is * NaN. */ - double max; + double out; int x; int y; /* And the positions and values we found as VipsArrays for returning * to our caller. */ - VipsArrayDouble *max_array; + VipsArrayDouble *out_array; VipsArrayInt *x_array; VipsArrayInt *y_array; @@ -425,7 +425,7 @@ vips_max_class_init( VipsMaxClass *class ) _( "Output" ), _( "Output value" ), VIPS_ARGUMENT_REQUIRED_OUTPUT, - G_STRUCT_OFFSET( VipsMax, max ), + G_STRUCT_OFFSET( VipsMax, out ), -INFINITY, INFINITY, 0.0 ); VIPS_ARG_INT( class, "x", 2, @@ -453,7 +453,7 @@ vips_max_class_init( VipsMaxClass *class ) _( "Output array" ), _( "Array of output values" ), VIPS_ARGUMENT_OPTIONAL_OUTPUT, - G_STRUCT_OFFSET( VipsMax, max_array ), + G_STRUCT_OFFSET( VipsMax, out_array ), VIPS_TYPE_ARRAY_DOUBLE ); VIPS_ARG_BOXED( class, "x_array", 7, diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index 7295778f..4c3d0b93 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -601,17 +601,18 @@ static void transform_array_int_g_string( const GValue *src_value, GValue *dest_value ) { int n; - int *array = vips_value_get_array_int( src_value, &n ); + int *array; char txt[1024]; VipsBuf buf = VIPS_BUF_STATIC( txt ); int i; - for( i = 0; i < n; i++ ) - /* Use space as a separator since ',' may be a decimal point - * in this locale. - */ - vips_buf_appendf( &buf, "%d ", array[i] ); + if( (array = vips_value_get_array_int( src_value, &n )) ) + for( i = 0; i < n; i++ ) + /* Use space as a separator since ',' may be a + * decimal point in this locale. + */ + vips_buf_appendf( &buf, "%d ", array[i] ); g_value_set_string( dest_value, vips_buf_all( &buf ) ); } @@ -689,17 +690,18 @@ static void transform_array_double_g_string( const GValue *src_value, GValue *dest_value ) { int n; - double *array = vips_value_get_array_double( src_value, &n ); + double *array; char txt[1024]; VipsBuf buf = VIPS_BUF_STATIC( txt ); int i; - for( i = 0; i < n; i++ ) - /* Use space as a separator since ',' may be a decimal point - * in this locale. - */ - vips_buf_appendf( &buf, "%g ", array[i] ); + if( (array = vips_value_get_array_double( src_value, &n )) ) + for( i = 0; i < n; i++ ) + /* Use space as a separator since ',' may be a decimal + * point in this locale. + */ + vips_buf_appendf( &buf, "%g ", array[i] ); g_value_set_string( dest_value, vips_buf_all( &buf ) ); } @@ -1063,7 +1065,8 @@ vips_value_get_array( const GValue *value, * vips_*_get_type(). */ - area = g_value_get_boxed( value ); + if( !(area = g_value_get_boxed( value )) ) + return( NULL ); if( n ) *n = area->n; if( type )