From 7608524f6144a804a89a1b89205e8d6d31579925 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 3 Sep 2014 14:32:55 +0100 Subject: [PATCH] fix up gtk-doc comments fewer warnings now, phew --- libvips/arithmetic/boolean.c | 14 +- libvips/arithmetic/deviate.c | 2 +- libvips/arithmetic/divide.c | 4 +- libvips/arithmetic/getpoint.c | 2 +- libvips/arithmetic/measure.c | 2 +- libvips/conversion/bandbool.c | 10 +- libvips/convolution/sharpen.c | 50 ++-- libvips/create/mask_butterworth.c | 2 +- libvips/create/mask_butterworth_band.c | 2 +- libvips/create/mask_butterworth_ring.c | 2 +- libvips/foreign/foreign.c | 318 ++++++++++++------------- libvips/include/vips/basic.h | 9 +- libvips/include/vips/conversion.h | 10 +- libvips/include/vips/error.h | 2 +- libvips/include/vips/foreign.h | 14 +- libvips/include/vips/header.h | 6 +- libvips/include/vips/image.h | 9 +- libvips/include/vips/interpolate.h | 4 +- libvips/include/vips/object.h | 50 ++-- libvips/include/vips/operation.h | 8 +- libvips/include/vips/vips.h | 3 + libvips/iofuncs/error.c | 10 +- libvips/iofuncs/header.c | 20 +- libvips/iofuncs/image.c | 34 +-- libvips/iofuncs/init.c | 15 ++ libvips/iofuncs/object.c | 4 +- libvips/iofuncs/type.c | 6 +- 27 files changed, 318 insertions(+), 294 deletions(-) diff --git a/libvips/arithmetic/boolean.c b/libvips/arithmetic/boolean.c index 9c749c83..12abca55 100644 --- a/libvips/arithmetic/boolean.c +++ b/libvips/arithmetic/boolean.c @@ -241,7 +241,7 @@ vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out, * @left: left-hand input #VipsImage * @right: right-hand input #VipsImage * @out: output #VipsImage - * @operation: boolean operation to perform + * @boolean: boolean operation to perform * @...: %NULL-terminated list of optional named arguments * * Perform various boolean operations on pairs of images. @@ -268,13 +268,13 @@ vips_booleanv( VipsImage *left, VipsImage *right, VipsImage **out, */ int vips_boolean( VipsImage *left, VipsImage *right, VipsImage **out, - VipsOperationBoolean operation, ... ) + VipsOperationBoolean boolean, ... ) { va_list ap; int result; - va_start( ap, operation ); - result = vips_booleanv( left, right, out, operation, ap ); + va_start( ap, boolean ); + result = vips_booleanv( left, right, out, boolean, ap ); va_end( ap ); return( result ); @@ -557,7 +557,7 @@ vips_boolean_constv( VipsImage *in, VipsImage **out, * vips_boolean_const: * @in: input image * @out: output image - * @operation: boolean operation to perform + * @boolean: boolean operation to perform * @c: array of constants * @n: number of constants in @c * @...: %NULL-terminated list of optional named arguments @@ -580,13 +580,13 @@ vips_boolean_constv( VipsImage *in, VipsImage **out, */ int vips_boolean_const( VipsImage *in, VipsImage **out, - VipsOperationBoolean operation, double *c, int n, ... ) + VipsOperationBoolean boolean, double *c, int n, ... ) { va_list ap; int result; va_start( ap, n ); - result = vips_boolean_constv( in, out, operation, c, n, ap ); + result = vips_boolean_constv( in, out, boolean, c, n, ap ); va_end( ap ); return( result ); diff --git a/libvips/arithmetic/deviate.c b/libvips/arithmetic/deviate.c index 2446eb39..2bf3e6ac 100644 --- a/libvips/arithmetic/deviate.c +++ b/libvips/arithmetic/deviate.c @@ -231,7 +231,7 @@ vips_deviate_init( VipsDeviate *deviate ) } /** - * vips_deviate(): + * vips_deviate: * @in: input #VipsImage * @out: output pixel standard deviation * @...: %NULL-terminated list of optional named arguments diff --git a/libvips/arithmetic/divide.c b/libvips/arithmetic/divide.c index 6242f53f..ee32f421 100644 --- a/libvips/arithmetic/divide.c +++ b/libvips/arithmetic/divide.c @@ -236,8 +236,8 @@ vips_divide_init( VipsDivide *divide ) /** * vips_divide: - * @in1: input image 1 - * @in2: input image 2 + * @left: input image + * @right: input image * @out: output image * @...: %NULL-terminated list of optional named arguments * diff --git a/libvips/arithmetic/getpoint.c b/libvips/arithmetic/getpoint.c index 5794a242..b3a55303 100644 --- a/libvips/arithmetic/getpoint.c +++ b/libvips/arithmetic/getpoint.c @@ -172,7 +172,7 @@ vips_getpoint_init( VipsGetpoint *getpoint ) /** * vips_getpoint: - * @image: image to read from + * @in: image to read from * @vector: array length=n: output pixel value here * @n: length of output vector * @x: position to read diff --git a/libvips/arithmetic/measure.c b/libvips/arithmetic/measure.c index e705114e..906bc525 100644 --- a/libvips/arithmetic/measure.c +++ b/libvips/arithmetic/measure.c @@ -259,7 +259,7 @@ vips_measure_init( VipsMeasure *measure ) /** * vips_measure: - * @im: image to measure + * @in: image to measure * @out: array of measurements * @h: patches across chart * @v: patches down chart diff --git a/libvips/conversion/bandbool.c b/libvips/conversion/bandbool.c index 09f77a9c..d5ebd9a9 100644 --- a/libvips/conversion/bandbool.c +++ b/libvips/conversion/bandbool.c @@ -239,9 +239,9 @@ vips_bandboolv( VipsImage *in, VipsImage **out, /** * vips_bandbool: - * @im: left-hand input #VipsImage + * @in: left-hand input #VipsImage * @out: output #VipsImage - * @operation: boolean operation to perform + * @boolean: boolean operation to perform * @...: %NULL-terminated list of optional named arguments * * Perform various boolean operations across the bands of an image. For @@ -265,13 +265,13 @@ vips_bandboolv( VipsImage *in, VipsImage **out, */ int vips_bandbool( VipsImage *in, VipsImage **out, - VipsOperationBoolean operation, ... ) + VipsOperationBoolean boolean, ... ) { va_list ap; int result; - va_start( ap, operation ); - result = vips_bandboolv( in, out, operation, ap ); + va_start( ap, boolean ); + result = vips_bandboolv( in, out, boolean, ap ); va_end( ap ); return( result ); diff --git a/libvips/convolution/sharpen.c b/libvips/convolution/sharpen.c index 5860b230..5f5fbef9 100644 --- a/libvips/convolution/sharpen.c +++ b/libvips/convolution/sharpen.c @@ -407,35 +407,35 @@ vips_sharpen_init( VipsSharpen *sharpen ) * The lookup table is formed like this: * * |[ - ^ - y2 |- - - - - ----------- - | / - | / slope m2 - | .../ - -x1 | ... | - -------------------...----------------------> - | ... | x1 - |... slope m1 - / | - / m2 | - / | - / | - / | - / | - ______/ _ _ _ _ _ _ | -y3 - | + * ^ + * y2 |- - - - - ----------- + * | / + * | / slope m2 + * | .../ + * -x1 | ... | + * -------------------...----------------------> + * | ... | x1 + * |... slope m1 + * / | + * / m2 | + * / | + * / | + * / | + * / | + * ______/ _ _ _ _ _ _ | -y3 + * | * ]| * * For printing, we recommend the following settings (the defaults): * * |[ - radius == 3 - x1 == 1.5 - y2 == 20 (don't brighten by more than 20 L*) - y3 == 50 (can darken by up to 50 L*) - - m1 == 1 (some sharpening in flat areas) - m2 == 2 (more sharpening in jaggy areas) + * radius == 3 + * x1 == 1.5 + * y2 == 20 (don't brighten by more than 20 L*) + * y3 == 50 (can darken by up to 50 L*) + * + * m1 == 1 (some sharpening in flat areas) + * m2 == 2 (more sharpening in jaggy areas) * ]| * * If you want more or less sharpening, we suggest you just change the m1 @@ -448,7 +448,7 @@ vips_sharpen_init( VipsSharpen *sharpen ) * pixels/mm). These figures refer to the image raster, not the half-tone * resolution. * - * See also: im_conv(). + * See also: vips_conv(). * * Returns: 0 on success, -1 on error. */ diff --git a/libvips/create/mask_butterworth.c b/libvips/create/mask_butterworth.c index 80ee1b23..3e6c7f0a 100644 --- a/libvips/create/mask_butterworth.c +++ b/libvips/create/mask_butterworth.c @@ -136,7 +136,7 @@ vips_mask_butterworth_init( VipsMaskButterworth *butterworth ) * smooth transition * positioned at @frequency_cutoff, where @frequency_cutoff is in * range 0 - 1. The shape of the curve is controlled by - * @order: higher values give a sharper transition. See Gonzalez and Wintz, + * @order --- higher values give a sharper transition. See Gonzalez and Wintz, * Digital Image Processing, 1987. * * See also: vips_mask_ideal(). diff --git a/libvips/create/mask_butterworth_band.c b/libvips/create/mask_butterworth_band.c index 0e9b7936..e29347d9 100644 --- a/libvips/create/mask_butterworth_band.c +++ b/libvips/create/mask_butterworth_band.c @@ -180,7 +180,7 @@ vips_mask_butterworth_band_init( * variable, smooth transition positioned at @frequency_cutoff_x, * @frequency_cutoff_y, of radius @radius. * The shape of the curve is controlled by - * @order: higher values give a sharper transition. See Gonzalez and Wintz, + * @order --- higher values give a sharper transition. See Gonzalez and Wintz, * Digital Image Processing, 1987. * * See also: vips_mask_ideal(). diff --git a/libvips/create/mask_butterworth_ring.c b/libvips/create/mask_butterworth_ring.c index 010ad14f..cd3e7ec9 100644 --- a/libvips/create/mask_butterworth_ring.c +++ b/libvips/create/mask_butterworth_ring.c @@ -141,7 +141,7 @@ vips_mask_butterworth_ring_init( * smooth transition * positioned at @frequency_cutoff of width @width, where @frequency_cutoff is * in the range 0 - 1. The shape of the curve is controlled by - * @order: higher values give a sharper transition. See Gonzalez and Wintz, + * @order --- higher values give a sharper transition. See Gonzalez and Wintz, * Digital Image Processing, 1987. * * See also: vips_mask_ideal(). diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 7f9fb065..a981f958 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -166,96 +166,96 @@ * calls to libpng. * * |[ -typedef struct _VipsForeignLoadPng { - VipsForeignLoad parent_object; - - char *filename; -} VipsForeignLoadPng; - -typedef VipsForeignLoadClass VipsForeignLoadPngClass; - -G_DEFINE_TYPE( VipsForeignLoadPng, vips_foreign_load_png, - VIPS_TYPE_FOREIGN_LOAD ); - -static VipsForeignFlags -vips_foreign_load_png_get_flags_filename( const char *filename ) -{ - VipsForeignFlags flags; - - flags = 0; - if( vips__png_isinterlaced( filename ) ) - flags = VIPS_FOREIGN_PARTIAL; - else - flags = VIPS_FOREIGN_SEQUENTIAL; - - return( flags ); -} - -static VipsForeignFlags -vips_foreign_load_png_get_flags( VipsForeignLoad *load ) -{ - VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - - return( vips_foreign_load_png_get_flags_filename( png->filename ) ); -} - -static int -vips_foreign_load_png_header( VipsForeignLoad *load ) -{ - VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - - if( vips__png_header( png->filename, load->out ) ) - return( -1 ); - - return( 0 ); -} - -static int -vips_foreign_load_png_load( VipsForeignLoad *load ) -{ - VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - - if( vips__png_read( png->filename, load->real ) ) - return( -1 ); - - return( 0 ); -} - -static void -vips_foreign_load_png_class_init( VipsForeignLoadPngClass *class ) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS( class ); - VipsObjectClass *object_class = (VipsObjectClass *) class; - VipsForeignClass *foreign_class = (VipsForeignClass *) class; - VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; - - gobject_class->set_property = vips_object_set_property; - gobject_class->get_property = vips_object_get_property; - - object_class->nickname = "pngload"; - object_class->description = _( "load png from file" ); - - foreign_class->suffs = vips__png_suffs; - - load_class->is_a = vips__png_ispng; - load_class->get_flags_filename = - vips_foreign_load_png_get_flags_filename; - load_class->get_flags = vips_foreign_load_png_get_flags; - load_class->header = vips_foreign_load_png_header; - load_class->load = vips_foreign_load_png_load; - - VIPS_ARG_STRING( class, "filename", 1, - _( "Filename" ), - _( "Filename to load from" ), - VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadPng, filename ), - NULL ); -} - -static void -vips_foreign_load_png_init( VipsForeignLoadPng *png ) -{ -} + * typedef struct _VipsForeignLoadPng { + * VipsForeignLoad parent_object; + * + * char *filename; + * } VipsForeignLoadPng; + * + * typedef VipsForeignLoadClass VipsForeignLoadPngClass; + * + * G_DEFINE_TYPE( VipsForeignLoadPng, vips_foreign_load_png, + * VIPS_TYPE_FOREIGN_LOAD ); + * + * static VipsForeignFlags + * vips_foreign_load_png_get_flags_filename( const char *filename ) + * { + * VipsForeignFlags flags; + * + * flags = 0; + * if( vips__png_isinterlaced( filename ) ) + * flags = VIPS_FOREIGN_PARTIAL; + * else + * flags = VIPS_FOREIGN_SEQUENTIAL; + * + * return( flags ); + * } + * + * static VipsForeignFlags + * vips_foreign_load_png_get_flags( VipsForeignLoad *load ) + * { + * VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; + * + * return( vips_foreign_load_png_get_flags_filename( png->filename ) ); + * } + * + * static int + * vips_foreign_load_png_header( VipsForeignLoad *load ) + * { + * VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; + * + * if( vips__png_header( png->filename, load->out ) ) + * return( -1 ); + * + * return( 0 ); + * } + * + * static int + * vips_foreign_load_png_load( VipsForeignLoad *load ) + * { + * VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; + * + * if( vips__png_read( png->filename, load->real ) ) + * return( -1 ); + * + * return( 0 ); + * } + * + * static void + * vips_foreign_load_png_class_init( VipsForeignLoadPngClass *class ) + * { + * GObjectClass *gobject_class = G_OBJECT_CLASS( class ); + * VipsObjectClass *object_class = (VipsObjectClass *) class; + * VipsForeignClass *foreign_class = (VipsForeignClass *) class; + * VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class; + * + * gobject_class->set_property = vips_object_set_property; + * gobject_class->get_property = vips_object_get_property; + * + * object_class->nickname = "pngload"; + * object_class->description = _( "load png from file" ); + * + * foreign_class->suffs = vips__png_suffs; + * + * load_class->is_a = vips__png_ispng; + * load_class->get_flags_filename = + * vips_foreign_load_png_get_flags_filename; + * load_class->get_flags = vips_foreign_load_png_get_flags; + * load_class->header = vips_foreign_load_png_header; + * load_class->load = vips_foreign_load_png_load; + * + * VIPS_ARG_STRING( class, "filename", 1, + * _( "Filename" ), + * _( "Filename to load from" ), + * VIPS_ARGUMENT_REQUIRED_INPUT, + * G_STRUCT_OFFSET( VipsForeignLoadPng, filename ), + * NULL ); + * } + * + * static void + * vips_foreign_load_png_init( VipsForeignLoadPng *png ) + * { + * } * ]| */ @@ -269,75 +269,75 @@ vips_foreign_load_png_init( VipsForeignLoadPng *png ) * to the actual save routines. * * |[ -typedef struct _VipsForeignSaveCsv { - VipsForeignSave parent_object; - - char *filename; - const char *separator; -} VipsForeignSaveCsv; - -typedef VipsForeignSaveClass VipsForeignSaveCsvClass; - -G_DEFINE_TYPE( VipsForeignSaveCsv, vips_foreign_save_csv, - VIPS_TYPE_FOREIGN_SAVE ); - -static int -vips_foreign_save_csv_build( VipsObject *object ) -{ - VipsForeignSave *save = (VipsForeignSave *) object; - VipsForeignSaveCsv *csv = (VipsForeignSaveCsv *) object; - - if( VIPS_OBJECT_CLASS( vips_foreign_save_csv_parent_class )-> - build( object ) ) - return( -1 ); - - if( vips__csv_write( save->ready, csv->filename, csv->separator ) ) - return( -1 ); - - return( 0 ); -} - -static void -vips_foreign_save_csv_class_init( VipsForeignSaveCsvClass *class ) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS( class ); - VipsObjectClass *object_class = (VipsObjectClass *) class; - VipsForeignClass *foreign_class = (VipsForeignClass *) class; - VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class; - - gobject_class->set_property = vips_object_set_property; - gobject_class->get_property = vips_object_get_property; - - object_class->nickname = "csvsave"; - object_class->description = _( "save image to csv file" ); - object_class->build = vips_foreign_save_csv_build; - - foreign_class->suffs = vips__foreign_csv_suffs; - - save_class->saveable = VIPS_SAVEABLE_MONO; - // no need to define ->format_table, we don't want the input - // cast for us - - VIPS_ARG_STRING( class, "filename", 1, - _( "Filename" ), - _( "Filename to save to" ), - VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveCsv, filename ), - NULL ); - - VIPS_ARG_STRING( class, "separator", 13, - _( "Separator" ), - _( "Separator characters" ), - VIPS_ARGUMENT_OPTIONAL_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveCsv, separator ), - "\t" ); -} - -static void -vips_foreign_save_csv_init( VipsForeignSaveCsv *csv ) -{ - csv->separator = g_strdup( "\t" ); -} + * typedef struct _VipsForeignSaveCsv { + * VipsForeignSave parent_object; + * + * char *filename; + * const char *separator; + * } VipsForeignSaveCsv; + * + * typedef VipsForeignSaveClass VipsForeignSaveCsvClass; + * + * G_DEFINE_TYPE( VipsForeignSaveCsv, vips_foreign_save_csv, + * VIPS_TYPE_FOREIGN_SAVE ); + * + * static int + * vips_foreign_save_csv_build( VipsObject *object ) + * { + * VipsForeignSave *save = (VipsForeignSave *) object; + * VipsForeignSaveCsv *csv = (VipsForeignSaveCsv *) object; + * + * if( VIPS_OBJECT_CLASS( vips_foreign_save_csv_parent_class )-> + * build( object ) ) + * return( -1 ); + * + * if( vips__csv_write( save->ready, csv->filename, csv->separator ) ) + * return( -1 ); + * + * return( 0 ); + * } + * + * static void + * vips_foreign_save_csv_class_init( VipsForeignSaveCsvClass *class ) + * { + * GObjectClass *gobject_class = G_OBJECT_CLASS( class ); + * VipsObjectClass *object_class = (VipsObjectClass *) class; + * VipsForeignClass *foreign_class = (VipsForeignClass *) class; + * VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class; + * + * gobject_class->set_property = vips_object_set_property; + * gobject_class->get_property = vips_object_get_property; + * + * object_class->nickname = "csvsave"; + * object_class->description = _( "save image to csv file" ); + * object_class->build = vips_foreign_save_csv_build; + * + * foreign_class->suffs = vips__foreign_csv_suffs; + * + * save_class->saveable = VIPS_SAVEABLE_MONO; + * // no need to define ->format_table, we don't want the input + * // cast for us + * + * VIPS_ARG_STRING( class, "filename", 1, + * _( "Filename" ), + * _( "Filename to save to" ), + * VIPS_ARGUMENT_REQUIRED_INPUT, + * G_STRUCT_OFFSET( VipsForeignSaveCsv, filename ), + * NULL ); + * + * VIPS_ARG_STRING( class, "separator", 13, + * _( "Separator" ), + * _( "Separator characters" ), + * VIPS_ARGUMENT_OPTIONAL_INPUT, + * G_STRUCT_OFFSET( VipsForeignSaveCsv, separator ), + * "\t" ); + * } + * + * static void + * vips_foreign_save_csv_init( VipsForeignSaveCsv *csv ) + * { + * csv->separator = g_strdup( "\t" ); + * } * ]| */ diff --git a/libvips/include/vips/basic.h b/libvips/include/vips/basic.h index 8c64c07e..633f4f31 100644 --- a/libvips/include/vips/basic.h +++ b/libvips/include/vips/basic.h @@ -52,9 +52,12 @@ typedef int (*VipsCallbackFn)( void *a, void *b ); /* Like GFunc, but return a value. */ -typedef void *(*VipsSListMap2Fn)( void *, void *, void * ); -typedef void *(*VipsSListMap4Fn)( void *, void *, void *, void *, void * ); -typedef void *(*VipsSListFold2Fn)( void *, void *, void *, void * ); +typedef void *(*VipsSListMap2Fn)( void *item, + void *a, void *b ); +typedef void *(*VipsSListMap4Fn)( void *item, + void *a, void *b, void *c, void *d ); +typedef void *(*VipsSListFold2Fn)( void *item, + void *a, void *b, void *c ); #ifdef __cplusplus } diff --git a/libvips/include/vips/conversion.h b/libvips/include/vips/conversion.h index 2d2f95b3..b2ab00d8 100644 --- a/libvips/include/vips/conversion.h +++ b/libvips/include/vips/conversion.h @@ -102,16 +102,16 @@ int vips_flip( VipsImage *in, VipsImage **out, VipsDirection direction, ... ) int vips_insert( VipsImage *main, VipsImage *sub, VipsImage **out, int x, int y, ... ) __attribute__((sentinel)); -int vips_join( VipsImage *main, VipsImage *sub, VipsImage **out, +int vips_join( VipsImage *in1, VipsImage *in2, VipsImage **out, VipsDirection direction, ... ) __attribute__((sentinel)); -int vips_extract_area( VipsImage *input, VipsImage **output, +int vips_extract_area( VipsImage *in, VipsImage **out, int left, int top, int width, int height, ... ) __attribute__((sentinel)); -int vips_crop( VipsImage *input, VipsImage **output, +int vips_crop( VipsImage *in, VipsImage **out, int left, int top, int width, int height, ... ) __attribute__((sentinel)); -int vips_extract_band( VipsImage *input, VipsImage **output, int band, ... ) +int vips_extract_band( VipsImage *in, VipsImage **out, int band, ... ) __attribute__((sentinel)); int vips_replicate( VipsImage *in, VipsImage **out, int across, int down, ... ) __attribute__((sentinel)); @@ -164,7 +164,7 @@ int vips_bandrank( VipsImage **in, VipsImage **out, int n, ... ) __attribute__((sentinel)); int vips_bandbool( VipsImage *in, VipsImage **out, - VipsOperationBoolean operation, ... ) + VipsOperationBoolean boolean, ... ) __attribute__((sentinel)); int vips_bandand( VipsImage *in, VipsImage **out, ... ) __attribute__((sentinel)); diff --git a/libvips/include/vips/error.h b/libvips/include/vips/error.h index ca8d8162..8c2074db 100644 --- a/libvips/include/vips/error.h +++ b/libvips/include/vips/error.h @@ -67,7 +67,7 @@ int vips_check_coding_noneorlabq( const char *domain, VipsImage *im ); int vips_check_coding_same( const char *domain, VipsImage *im1, VipsImage *im2 ); int vips_check_mono( const char *domain, VipsImage *im ); int vips_check_bands( const char *domain, VipsImage *im, int bands ); -int vips_check_bands_1or3( const char *domain, VipsImage *in ); +int vips_check_bands_1or3( const char *domain, VipsImage *im ); int vips_check_bands_atleast( const char *domain, VipsImage *im, int bands ); int vips_check_bands_1orn( const char *domain, VipsImage *im1, VipsImage *im2 ); int vips_check_bands_1orn_unary( const char *domain, VipsImage *im, int n ); diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 473c4e5e..b38cef2d 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -159,14 +159,14 @@ typedef struct _VipsForeignLoadClass { * this type. If you don't define this function, #VipsForeignLoad * will use @suffs instead. */ - gboolean (*is_a)( const char * ); + gboolean (*is_a)( const char *filename ); /* Is a buffer in this format. * * This function should return %TRUE if the buffer contains an image of * this type. */ - gboolean (*is_a_buffer)( void *, size_t ); + gboolean (*is_a_buffer)( void *data, size_t size ); /* Get the flags from a filename. * @@ -176,13 +176,13 @@ typedef struct _VipsForeignLoadClass { * * This operation is necessary for vips7 compatibility. */ - VipsForeignFlags (*get_flags_filename)( const char * ); + VipsForeignFlags (*get_flags_filename)( const char *filename ); /* Get the flags for this load operation. Images can be loaded from * (for example) memory areas rather than files, so you can't just use * @get_flags_filename(). */ - VipsForeignFlags (*get_flags)( VipsForeignLoad * ); + VipsForeignFlags (*get_flags)( VipsForeignLoad *load ); /* Do the minimum read we can. * @@ -197,7 +197,7 @@ typedef struct _VipsForeignLoadClass { * Return 0 for success, -1 for error, setting * vips_error(). */ - int (*header)( VipsForeignLoad * ); + int (*header)( VipsForeignLoad *load ); /* Read the whole image into @real. The pixels will get copied to @out * later. @@ -208,7 +208,7 @@ typedef struct _VipsForeignLoadClass { * Return 0 for success, -1 for error, setting * vips_error(). */ - int (*load)( VipsForeignLoad * ); + int (*load)( VipsForeignLoad *load ); } VipsForeignLoadClass; GType vips_foreign_load_get_type( void ); @@ -496,7 +496,7 @@ typedef enum { VIPS_FOREIGN_DZ_CONTAINER_LAST } VipsForeignDzContainer; -int vips_dzsave( VipsImage *in, const char *basename, ... ) +int vips_dzsave( VipsImage *in, const char *name, ... ) __attribute__((sentinel)); #ifdef __cplusplus diff --git a/libvips/include/vips/header.h b/libvips/include/vips/header.h index f27f205d..2a7bdeb6 100644 --- a/libvips/include/vips/header.h +++ b/libvips/include/vips/header.h @@ -108,9 +108,9 @@ int vips_image_get_xoffset( const VipsImage *image ); int vips_image_get_yoffset( const VipsImage *image ); const char *vips_image_get_filename( const VipsImage *image ); const char *vips_image_get_mode( const VipsImage *image ); -double vips_image_get_scale( const VipsImage *array ); -double vips_image_get_offset( const VipsImage *array ); -void *vips_image_get_data( VipsImage *image ); +double vips_image_get_scale( const VipsImage *image ); +double vips_image_get_offset( const VipsImage *image ); +const void *vips_image_get_data( VipsImage *image ); void vips_image_init_fields( VipsImage *image, int xsize, int ysize, int bands, diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index ba829fd3..a0a66d69 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -428,15 +428,14 @@ void vips_image_set_delete_on_close( VipsImage *image, VipsImage *vips_image_new_temp_file( const char *format ); int vips_image_write( VipsImage *image, VipsImage *out ); -int vips_image_write_to_file( VipsImage *image, const char *filename, ... ) +int vips_image_write_to_file( VipsImage *image, const char *name, ... ) __attribute__((sentinel)); int vips_image_write_to_buffer( VipsImage *in, - const char *name, void **buf, size_t *len, ... ) + const char *suffix, void **buf, size_t *len, ... ) __attribute__((sentinel)); -int vips_image_write_to_memory( VipsImage *in, - void **buf_out, size_t *len_out ); +int vips_image_write_to_memory( VipsImage *in, void **buf, size_t *len ); -int vips_image_decode_predict( VipsImage *im, +int vips_image_decode_predict( VipsImage *in, int *bands, VipsBandFormat *format ); int vips_image_decode( VipsImage *in, VipsImage **out ); int vips_image_encode( VipsImage *in, VipsImage **out, VipsCoding coding ); diff --git a/libvips/include/vips/interpolate.h b/libvips/include/vips/interpolate.h index e3801fcc..a872fb89 100644 --- a/libvips/include/vips/interpolate.h +++ b/libvips/include/vips/interpolate.h @@ -74,7 +74,7 @@ typedef struct _VipsInterpolateClass { /* This interpolator needs a window this many pixels across and down. */ - int (*get_window_size)( VipsInterpolate * ); + int (*get_window_size)( VipsInterpolate *interpolate ); /* Or just set this if you want a constant. */ @@ -83,7 +83,7 @@ typedef struct _VipsInterpolateClass { /* Stencils are offset by this much. Default to window_size / 2 - 1 * (centering) if get_window_offset is NULL and window_offset is -1. */ - int (*get_window_offset)( VipsInterpolate * ); + int (*get_window_offset)( VipsInterpolate *interpolate ); int window_offset; } VipsInterpolateClass; diff --git a/libvips/include/vips/object.h b/libvips/include/vips/object.h index e94c7de8..371beae4 100644 --- a/libvips/include/vips/object.h +++ b/libvips/include/vips/object.h @@ -295,18 +295,21 @@ typedef struct _VipsArgumentInstance { */ typedef GHashTable VipsArgumentTable; -VipsArgumentInstance *vips__argument_get_instance( VipsArgumentClass *, - VipsObject * ); -VipsArgument *vips__argument_table_lookup( VipsArgumentTable *, - GParamSpec * ); +VipsArgumentInstance *vips__argument_get_instance( + VipsArgumentClass *argument_class, + VipsObject *object ); +VipsArgument *vips__argument_table_lookup( VipsArgumentTable *argument_class, + GParamSpec *pspec ); void vips__object_set_member( VipsObject *object, GParamSpec *pspec, GObject **member, GObject *argument ); -typedef void *(*VipsArgumentMapFn)( VipsObject *, GParamSpec *, - VipsArgumentClass *, VipsArgumentInstance *, void *a, void *b ); +typedef void *(*VipsArgumentMapFn)( VipsObject *object, GParamSpec *pspec, + VipsArgumentClass *argument_class, + VipsArgumentInstance *argument_instance, void *a, void *b ); void *vips_argument_map( VipsObject *object, VipsArgumentMapFn fn, void *a, void *b ); -typedef void *(*VipsArgumentClassMapFn)( VipsObjectClass *, GParamSpec *, - VipsArgumentClass *, void *a, void *b ); +typedef void *(*VipsArgumentClassMapFn)( VipsObjectClass *object_class, + GParamSpec *pspec, + VipsArgumentClass *argument_class, void *a, void *b ); void *vips_argument_class_map( VipsObjectClass *object_class, VipsArgumentClassMapFn fn, void *a, void *b ); gboolean vips_argument_class_needsstring( VipsArgumentClass *argument_class ); @@ -457,40 +460,40 @@ struct _VipsObjectClass { /* Try to print something about the class, handy for help displays. * Keep to one line. */ - void (*summary_class)( struct _VipsObjectClass *, VipsBuf * ); + void (*summary_class)( struct _VipsObjectClass *cls, VipsBuf *buf ); /* Try to print a one-line summary for the object, the user can see * this output via things like "header fred.tif", --vips-cache-trace, * etc. */ - void (*summary)( VipsObject *, VipsBuf * ); + void (*summary)( VipsObject *object, VipsBuf *buf ); /* Try to print everything about the object, handy for debugging. */ - void (*dump)( VipsObject *, VipsBuf * ); + void (*dump)( VipsObject *object, VipsBuf *buf ); /* Sanity-check the object. Print messages and stuff. * Handy for debugging. */ - void (*sanity)( VipsObject *, VipsBuf * ); + void (*sanity)( VipsObject *object, VipsBuf *buf ); /* Rewind. Save and restore any stuff that needs to survive a * dispose(). */ - void (*rewind)( VipsObject * ); + void (*rewind)( VipsObject *object ); /* Just before close, everything is still alive. */ - void (*preclose)( VipsObject * ); + void (*preclose)( VipsObject *object ); /* Close, time to free stuff. */ - void (*close)( VipsObject * ); + void (*close)( VipsObject *object ); /* Post-close, everything is dead, except the VipsObject pointer. * Useful for eg. deleting the file associated with a temp image. */ - void (*postclose)( VipsObject * ); + void (*postclose)( VipsObject *object ); /* The CLI interface. Implement these four to get CLI input and output * for your object. @@ -506,7 +509,7 @@ struct _VipsObjectClass { /* The inverse of ^^. Given an object, output what ->new_from_string() * would have been given to make that object. */ - void (*to_string)( VipsObject *, VipsBuf * ); + void (*to_string)( VipsObject *object, VipsBuf *buf ); /* Does this output arg need an arg from the command line? Image * output, for example, needs a filename to write to. @@ -582,8 +585,9 @@ gboolean vips_object_sanity( VipsObject *object ); GType vips_object_get_type( void ); -void vips_object_class_install_argument( VipsObjectClass *, GParamSpec *pspec, - VipsArgumentFlags flags, int priority, guint offset ); +void vips_object_class_install_argument( VipsObjectClass *cls, + GParamSpec *pspec, VipsArgumentFlags flags, + int priority, guint offset ); int vips_object_set_argument_from_string( VipsObject *object, const char *name, const char *value ); gboolean vips_object_argument_needsstring( VipsObject *object, @@ -592,7 +596,7 @@ int vips_object_get_argument_to_string( VipsObject *object, const char *name, const char *arg ); int vips_object_set_required( VipsObject *object, const char *value ); -typedef void *(*VipsObjectSetArguments)( VipsObject *, void *, void * ); +typedef void *(*VipsObjectSetArguments)( VipsObject *object, void *a, void *b ); VipsObject *vips_object_new( GType type, VipsObjectSetArguments set, void *a, void *b ); @@ -607,9 +611,9 @@ void vips_object_to_string( VipsObject *object, VipsBuf *buf ); void *vips_object_map( VipsSListMap2Fn fn, void *a, void *b ); -typedef void *(*VipsTypeMapFn)( GType, void * ); -typedef void *(*VipsTypeMap2Fn)( GType, void *, void * ); -typedef void *(*VipsClassMapFn)( VipsObjectClass *, void * ); +typedef void *(*VipsTypeMapFn)( GType type, void *a ); +typedef void *(*VipsTypeMap2Fn)( GType type, void *a, void *b ); +typedef void *(*VipsClassMapFn)( VipsObjectClass *cls, void *a ); void *vips_type_map( GType base, VipsTypeMap2Fn fn, void *a, void *b ); void *vips_type_map_all( GType base, VipsTypeMapFn fn, void *a ); int vips_type_depth( GType type ); diff --git a/libvips/include/vips/operation.h b/libvips/include/vips/operation.h index 6f72c4b0..d35ae1c9 100644 --- a/libvips/include/vips/operation.h +++ b/libvips/include/vips/operation.h @@ -60,7 +60,7 @@ typedef enum /*< flags >*/ { (G_TYPE_INSTANCE_GET_CLASS( (obj), \ VIPS_TYPE_OPERATION, VipsOperationClass )) -typedef gboolean (*VipsOperationBuildFn)( VipsObject * ); +typedef gboolean (*VipsOperationBuildFn)( VipsObject *object ); typedef struct _VipsOperation { VipsObject parent_instance; @@ -81,17 +81,17 @@ typedef struct _VipsOperationClass { /* Print the usage message. */ - void (*usage)( struct _VipsOperationClass *, VipsBuf * ); + void (*usage)( struct _VipsOperationClass *cls, VipsBuf *buf ); /* Return a set of operation flags. */ - VipsOperationFlags (*get_flags)( VipsOperation * ); + VipsOperationFlags (*get_flags)( VipsOperation *operation ); VipsOperationFlags flags; /* One of our input images has signalled "invalidate". The cache uses * VipsOperation::invalidate to drop dirty ops. */ - void (*invalidate)( VipsOperation * ); + void (*invalidate)( VipsOperation *operation ); } VipsOperationClass; GType vips_operation_get_type( void ); diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h index 31d4fe6e..94d7def7 100644 --- a/libvips/include/vips/vips.h +++ b/libvips/include/vips/vips.h @@ -182,8 +182,11 @@ int vips_init( const char *argv0 ); const char *vips_get_argv0( void ); void vips_shutdown( void ); void vips_thread_shutdown( void ); + GOptionGroup *vips_get_option_group( void ); +extern void vips_leak_set( gboolean leak ); + const char *vips_version_string( void ); int vips_version( int flag ); diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index 6092b507..ac3f4fc3 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -220,7 +220,7 @@ vips_verror( const char *domain, const char *fmt, va_list ap ) * vips_error: * @domain: the source of the error * @fmt: printf()-style format string for the error - * @Varargs: arguments to the format string + * @...: arguments to the format string * * Format the string in the style of printf() and append to the error buffer. * @@ -286,7 +286,7 @@ vips_verror_system( int err, const char *domain, const char *fmt, va_list ap ) * @err: the system error code * @domain: the source of the error * @fmt: printf()-style format string for the error - * @Varargs: arguments to the format string + * @...: arguments to the format string * * Format the string in the style of printf() and append to the error buffer. * Then create and append a localised message based on the system error code, @@ -403,7 +403,7 @@ vips_vinfo( const char *domain, const char *fmt, va_list ap ) * vips_info: * @domain: the source of the diagnostic message * @fmt: printf()-style format string for the message - * @Varargs: arguments to the format string + * @...: arguments to the format string * * Sends a formatted informational message to stderr if the --vips-info flag * has been given to the program or the environment variable IM_INFO has been @@ -459,7 +459,7 @@ vips_vwarn( const char *domain, const char *fmt, va_list ap ) * vips_warn: * @domain: the source of the warning message * @fmt: printf()-style format string for the message - * @Varargs: arguments to the format string + * @...: arguments to the format string * * Sends a formatted warning message to stderr. If you define the * environment variable IM_WARNING, these message are surpressed. @@ -481,7 +481,7 @@ vips_warn( const char *domain, const char *fmt, ... ) /** * vips_error_exit: * @fmt: printf()-style format string for the message - * @Varargs: arguments to the format string + * @...: arguments to the format string * * Sends a formatted error message to stderr, then sends the contents of the * error buffer, if any, then shuts down vips and terminates the program with diff --git a/libvips/iofuncs/header.c b/libvips/iofuncs/header.c index 197865cc..8707ace5 100644 --- a/libvips/iofuncs/header.c +++ b/libvips/iofuncs/header.c @@ -613,13 +613,13 @@ vips_image_get_mode( const VipsImage *image ) * Returns: the scale. */ double -vips_image_get_scale( const VipsImage *array ) +vips_image_get_scale( const VipsImage *image ) { double scale; scale = 1.0; - if( vips_image_get_typeof( array, "scale" ) ) - vips_image_get_double( array, "scale", &scale ); + if( vips_image_get_typeof( image, "scale" ) ) + vips_image_get_double( image, "scale", &scale ); return( scale ); } @@ -634,13 +634,13 @@ vips_image_get_scale( const VipsImage *array ) * Returns: the offset. */ double -vips_image_get_offset( const VipsImage *array ) +vips_image_get_offset( const VipsImage *image ) { double offset; offset = 0.0; - if( vips_image_get_typeof( array, "offset" ) ) - vips_image_get_double( array, "offset", &offset ); + if( vips_image_get_typeof( image, "offset" ) ) + vips_image_get_double( image, "offset", &offset ); return( offset ); } @@ -655,9 +655,9 @@ vips_image_get_offset( const VipsImage *array ) * * See also: vips_image_wio_input(). * - * Returns: a pointer to pixel data, if possible. + * Returns: (transfer none): a pointer to pixel data, if possible. */ -void * +const void * vips_image_get_data( VipsImage *image ) { if( vips_image_wio_input( image ) ) @@ -1017,7 +1017,7 @@ vips_image_map_fn( VipsMeta *meta, VipsImageMapFn fn, void *a ) /** * vips_image_map: * @image: image to map over - * @fn: function to call for each header field + * @fn: (scope call): function to call for each header field * @a: user data for function * * This function calls @fn for every header field, including every item of @@ -1028,7 +1028,7 @@ vips_image_map_fn( VipsMeta *meta, VipsImageMapFn fn, void *a ) * * See also: vips_image_get_typeof(), vips_image_get(). * - * Returns: %NULL on success, the failing pointer otherwise. + * Returns: (transfer none): %NULL on success, the failing pointer otherwise. */ void * vips_image_map( VipsImage *image, VipsImageMapFn fn, void *a ) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 6179dbab..59c953e0 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1793,7 +1793,6 @@ vips_filename_get_options( const char *vips_filename ) * * @access: hint #VipsAccess mode to loader * @disc: load via a temporary disc file - * @...: other arguments depend on the loader * * vips_image_new_from_file() opens @name for reading. It can load files * in many image formats, including VIPS, TIFF, PNG, JPEG, FITS, Matlab, @@ -1802,6 +1801,7 @@ vips_filename_get_options( const char *vips_filename ) * Load options may be appended to @filename as "[name=value,...]" or given as * a NULL-terminated list of name-value pairs at the end of the arguments. * Options given in the function call override options given in the filename. + * Many loaders add extra options, see vips_jpegload(), for example. * * vips_image_new_from_file() always returns immediately with the header * fields filled in. No pixels are actually read until you first access them. @@ -2313,34 +2313,34 @@ vips_image_write_to_file( VipsImage *image, const char *name, ... ) */ int vips_image_write_to_buffer( VipsImage *in, - const char *name, void **buf, size_t *len, + const char *suffix, void **buf, size_t *len, ... ) { - char suffix[VIPS_PATH_MAX]; + char filename[VIPS_PATH_MAX]; char option_string[VIPS_PATH_MAX]; const char *operation_name; - VipsArea *area; + VipsBlob *blob; va_list ap; int result; - vips__filename_split8( name, suffix, option_string ); - if( !(operation_name = vips_foreign_find_save_buffer( suffix )) ) + vips__filename_split8( suffix, filename, option_string ); + if( !(operation_name = vips_foreign_find_save_buffer( filename )) ) return( -1 ); va_start( ap, len ); result = vips_call_split_option_string( operation_name, option_string, - ap, in, &area ); + ap, in, &blob ); va_end( ap ); - if( area ) { + if( blob ) { if( buf ) { - *buf = area->data; - area->free_fn = NULL; + *buf = VIPS_AREA( blob )->data; + VIPS_AREA( blob )->free_fn = NULL; } if( len ) - *len = area->length; + *len = VIPS_AREA( blob )->length; - vips_area_unref( area ); + vips_area_unref( VIPS_AREA( blob ) ); } return( result ); @@ -2444,23 +2444,23 @@ vips_image_decode( VipsImage *in, VipsImage **out ) * See also: vips_image_decode(). */ int -vips_image_decode_predict( VipsImage *im, +vips_image_decode_predict( VipsImage *in, int *out_bands, VipsBandFormat *out_format ) { VipsBandFormat format; int bands; - if( im->Coding == VIPS_CODING_LABQ ) { + if( in->Coding == VIPS_CODING_LABQ ) { bands = 3; format = VIPS_FORMAT_FLOAT; } - else if( im->Coding == VIPS_CODING_RAD ) { + else if( in->Coding == VIPS_CODING_RAD ) { bands = 3; format = VIPS_FORMAT_FLOAT; } else { - bands = im->Bands; - format = im->BandFmt; + bands = in->Bands; + format = in->BandFmt; } if( out_bands ) diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 2026bdc7..31de246f 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -956,3 +956,18 @@ vips_version( int flag ) return( -1 ); } } + +/** + * vips_leak_set: + * @leak: turn leak checking on or off + * + * Turn on or off vips leak checking. See also --vips-leak and + * vips_get_option_group(). + * + * You should call this very early in your program. + */ +void +vips_leak_set( gboolean leak ) +{ + vips__leak = leak; +} diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 80f6f5da..d669f442 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -2441,11 +2441,11 @@ vips_object_to_string_optional( VipsObject *object, } /** - * vips_object_to_string: (skip) + * vips_object_to_string: * @object: object to stringify * @buf: write string here * - * The inverse of vips_object_new_from_string(): turn an object into eg. + * The inverse of vips_object_new_from_string(): turn @object into eg. * "VipsInterpolateSnohalo1(blur=.333333)". */ void diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index e083b2bc..b21a47b9 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -80,7 +80,7 @@ /** * vips_thing_new: - * @n: + * @i: * * Returns: (transfer full): a new #VipsThing. */ @@ -1025,7 +1025,7 @@ vips_array_image_new( const VipsImage **array, int n ) * * Fetch an image array from a #VipsArrayImage. Useful for language bindings. * - * Returns: (array length=n): (transfer none): array of #VipsImage + * Returns: (array length=n) (transfer none): array of #VipsImage */ VipsImage ** vips_array_image_get( VipsArrayImage *array, int *n ) @@ -1127,7 +1127,7 @@ vips_value_set_save_string( GValue *value, const char *str ) * vips_value_set_save_stringf: * @value: (out): GValue to set * @fmt: printf()-style format string - * @Varargs: arguments to printf()-formatted @fmt + * @...: arguments to printf()-formatted @fmt * * Generates a string and copies it into @value. */