From 252996e3ff8e95441cb69e653012209aa1e5eac6 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 30 Dec 2019 12:48:20 +0000 Subject: [PATCH] make check passes after stream -> source rename --- libvips/deprecated/im_png2vips.c | 4 +- libvips/deprecated/im_tiff2vips.c | 6 +-- libvips/deprecated/im_webp2vips.c | 2 +- libvips/foreign/foreign.c | 24 +++++------ libvips/foreign/pforeign.h | 18 ++++---- libvips/foreign/pngload.c | 64 ++++++++++++++--------------- libvips/foreign/pngsave.c | 42 +++++++++---------- libvips/foreign/ppmload.c | 10 ++--- libvips/foreign/ppmsave.c | 2 +- libvips/foreign/radload.c | 50 +++++++++++------------ libvips/foreign/radsave.c | 36 ++++++++-------- libvips/foreign/svgload.c | 56 ++++++++++++------------- libvips/foreign/tiff.c | 40 +++++++++--------- libvips/foreign/tiff.h | 2 +- libvips/foreign/tiff2vips.c | 20 ++++----- libvips/foreign/tiffload.c | 68 +++++++++++++++---------------- libvips/foreign/vips2tiff.c | 2 +- libvips/foreign/vipspng.c | 20 ++++----- test/test_descriptors.sh | 10 ++--- 19 files changed, 238 insertions(+), 238 deletions(-) diff --git a/libvips/deprecated/im_png2vips.c b/libvips/deprecated/im_png2vips.c index a417acf5..fab7f3dc 100644 --- a/libvips/deprecated/im_png2vips.c +++ b/libvips/deprecated/im_png2vips.c @@ -90,9 +90,9 @@ png2vips( const char *name, IMAGE *out, gboolean header_only ) if( !(source = vips_source_new_from_file( filename )) ) return( -1 ); if( header_only ) - result = vips__png_header_stream( source, out ); + result = vips__png_header_source( source, out ); else - result = vips__png_read_stream( source, out, TRUE ); + result = vips__png_read_source( source, out, TRUE ); VIPS_UNREF( source ); if( result ) diff --git a/libvips/deprecated/im_tiff2vips.c b/libvips/deprecated/im_tiff2vips.c index dd7496cb..1ce3f43d 100644 --- a/libvips/deprecated/im_tiff2vips.c +++ b/libvips/deprecated/im_tiff2vips.c @@ -61,7 +61,7 @@ im_istifftiled( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( FALSE ); - result = vips__istiff_stream( source ); + result = vips__istiff_source( source ); VIPS_UNREF( source ); return( result ); @@ -75,7 +75,7 @@ im_tiff_read_header( const char *filename, VipsImage *out, if( !(source = vips_source_new_from_file( filename )) ) return( -1 ); - if( vips__tiff_read_header_stream( source, + if( vips__tiff_read_header_source( source, out, page, n, autorotate ) ) { VIPS_UNREF( source ); return( -1 ); @@ -93,7 +93,7 @@ im_tiff_read( const char *filename, VipsImage *out, if( !(source = vips_source_new_from_file( filename )) ) return( -1 ); - if( vips__tiff_read_stream( source, out, page, n, autorotate ) ) { + if( vips__tiff_read_source( source, out, page, n, autorotate ) ) { VIPS_UNREF( source ); return( -1 ); } diff --git a/libvips/deprecated/im_webp2vips.c b/libvips/deprecated/im_webp2vips.c index e84e54b7..ee5c0dcc 100644 --- a/libvips/deprecated/im_webp2vips.c +++ b/libvips/deprecated/im_webp2vips.c @@ -86,7 +86,7 @@ vips__iswebp( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( FALSE ); - result = vips__png_ispng_stream( source ); + result = vips__iswebp_stream( source ); VIPS_UNREF( source ); #else /*!HAVE_LIBWEBP*/ result = -1; diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 9effa6dc..4ab17ebf 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -2006,10 +2006,10 @@ vips_foreign_operation_init( void ) { extern GType vips_foreign_load_rad_file_get_type( void ); extern GType vips_foreign_load_rad_buffer_get_type( void ); - extern GType vips_foreign_load_rad_stream_get_type( void ); + extern GType vips_foreign_load_rad_source_get_type( void ); extern GType vips_foreign_save_rad_file_get_type( void ); extern GType vips_foreign_save_rad_buffer_get_type( void ); - extern GType vips_foreign_save_rad_stream_get_type( void ); + extern GType vips_foreign_save_rad_target_get_type( void ); extern GType vips_foreign_load_mat_get_type( void ); @@ -2018,10 +2018,10 @@ vips_foreign_operation_init( void ) extern GType vips_foreign_load_png_file_get_type( void ); extern GType vips_foreign_load_png_buffer_get_type( void ); - extern GType vips_foreign_load_png_stream_get_type( void ); + extern GType vips_foreign_load_png_source_get_type( void ); extern GType vips_foreign_save_png_file_get_type( void ); extern GType vips_foreign_save_png_buffer_get_type( void ); - extern GType vips_foreign_save_png_stream_get_type( void ); + extern GType vips_foreign_save_png_target_get_type( void ); extern GType vips_foreign_load_csv_get_type( void ); extern GType vips_foreign_save_csv_get_type( void ); @@ -2049,7 +2049,7 @@ vips_foreign_operation_init( void ) extern GType vips_foreign_load_tiff_file_get_type( void ); extern GType vips_foreign_load_tiff_buffer_get_type( void ); - extern GType vips_foreign_load_tiff_stream_get_type( void ); + extern GType vips_foreign_load_tiff_source_get_type( void ); extern GType vips_foreign_save_tiff_file_get_type( void ); extern GType vips_foreign_save_tiff_buffer_get_type( void ); @@ -2084,7 +2084,7 @@ vips_foreign_operation_init( void ) extern GType vips_foreign_load_svg_get_type( void ); extern GType vips_foreign_load_svg_file_get_type( void ); extern GType vips_foreign_load_svg_buffer_get_type( void ); - extern GType vips_foreign_load_svg_stream_get_type( void ); + extern GType vips_foreign_load_svg_source_get_type( void ); extern GType vips_foreign_load_heif_get_type( void ); extern GType vips_foreign_load_heif_file_get_type( void ); @@ -2123,10 +2123,10 @@ vips_foreign_operation_init( void ) #ifdef HAVE_RADIANCE vips_foreign_load_rad_file_get_type(); vips_foreign_load_rad_buffer_get_type(); - vips_foreign_load_rad_stream_get_type(); + vips_foreign_load_rad_source_get_type(); vips_foreign_save_rad_file_get_type(); vips_foreign_save_rad_buffer_get_type(); - vips_foreign_save_rad_stream_get_type(); + vips_foreign_save_rad_target_get_type(); #endif /*HAVE_RADIANCE*/ #ifdef HAVE_POPPLER @@ -2145,7 +2145,7 @@ vips_foreign_operation_init( void ) vips_foreign_load_svg_get_type(); vips_foreign_load_svg_file_get_type(); vips_foreign_load_svg_buffer_get_type(); - vips_foreign_load_svg_stream_get_type(); + vips_foreign_load_svg_source_get_type(); #endif /*HAVE_RSVG*/ #ifdef HAVE_GIFLIB @@ -2162,10 +2162,10 @@ vips_foreign_operation_init( void ) #ifdef HAVE_PNG vips_foreign_load_png_file_get_type(); vips_foreign_load_png_buffer_get_type(); - vips_foreign_load_png_stream_get_type(); + vips_foreign_load_png_source_get_type(); vips_foreign_save_png_file_get_type(); vips_foreign_save_png_buffer_get_type(); - vips_foreign_save_png_stream_get_type(); + vips_foreign_save_png_target_get_type(); #endif /*HAVE_PNG*/ #ifdef HAVE_MATIO @@ -2194,7 +2194,7 @@ vips_foreign_operation_init( void ) #ifdef HAVE_TIFF vips_foreign_load_tiff_file_get_type(); vips_foreign_load_tiff_buffer_get_type(); - vips_foreign_load_tiff_stream_get_type(); + vips_foreign_load_tiff_source_get_type(); vips_foreign_save_tiff_file_get_type(); vips_foreign_save_tiff_buffer_get_type(); #endif /*HAVE_TIFF*/ diff --git a/libvips/foreign/pforeign.h b/libvips/foreign/pforeign.h index dff66b95..702c6278 100644 --- a/libvips/foreign/pforeign.h +++ b/libvips/foreign/pforeign.h @@ -79,11 +79,11 @@ int vips__tiff_write_buf( VipsImage *in, VipsRegionShrink region_shrink, int level, gboolean lossless ); -gboolean vips__istiff_stream( VipsSource *source ); -gboolean vips__istifftiled_stream( VipsSource *source ); -int vips__tiff_read_header_stream( VipsSource *source, VipsImage *out, +gboolean vips__istiff_source( VipsSource *source ); +gboolean vips__istifftiled_source( VipsSource *source ); +int vips__tiff_read_header_source( VipsSource *source, VipsImage *out, int page, int n, gboolean autorotate ); -int vips__tiff_read_stream( VipsSource *source, VipsImage *out, +int vips__tiff_read_source( VipsSource *source, VipsImage *out, int page, int n, gboolean autorotate ); extern const char *vips__foreign_tiff_suffs[]; @@ -168,14 +168,14 @@ int vips__jpeg_read_source( VipsSource *source, VipsImage *out, gboolean header_only, int shrink, int fail, gboolean autorotate ); int vips__isjpeg_source( VipsSource *source ); -int vips__png_ispng_stream( VipsSource *source ); -int vips__png_header_stream( VipsSource *source, VipsImage *out ); -int vips__png_read_stream( VipsSource *source, VipsImage *out, +int vips__png_ispng_source( VipsSource *source ); +int vips__png_header_source( VipsSource *source, VipsImage *out ); +int vips__png_read_source( VipsSource *source, VipsImage *out, gboolean fail ); -gboolean vips__png_isinterlaced_stream( VipsSource *source ); +gboolean vips__png_isinterlaced_source( VipsSource *source ); extern const char *vips__png_suffs[]; -int vips__png_write_stream( VipsImage *in, VipsTarget *target, +int vips__png_write_target( VipsImage *in, VipsTarget *target, int compress, int interlace, const char *profile, VipsForeignPngFilter filter, gboolean strip, gboolean palette, int colours, int Q, double dither ); diff --git a/libvips/foreign/pngload.c b/libvips/foreign/pngload.c index d222dbe7..f2b034e8 100644 --- a/libvips/foreign/pngload.c +++ b/libvips/foreign/pngload.c @@ -78,12 +78,12 @@ vips_foreign_load_png_dispose( GObject *gobject ) } static VipsForeignFlags -vips_foreign_load_png_get_flags_stream( VipsSource *source ) +vips_foreign_load_png_get_flags_source( VipsSource *source ) { VipsForeignFlags flags; flags = 0; - if( vips__png_isinterlaced_stream( source ) ) + if( vips__png_isinterlaced_source( source ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; @@ -96,7 +96,7 @@ vips_foreign_load_png_get_flags( VipsForeignLoad *load ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - return( vips_foreign_load_png_get_flags_stream( png->source ) ); + return( vips_foreign_load_png_get_flags_source( png->source ) ); } static VipsForeignFlags @@ -107,7 +107,7 @@ vips_foreign_load_png_get_flags_filename( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( 0 ); - flags = vips_foreign_load_png_get_flags_stream( source ); + flags = vips_foreign_load_png_get_flags_source( source ); VIPS_UNREF( source ); return( flags ); @@ -118,7 +118,7 @@ vips_foreign_load_png_header( VipsForeignLoad *load ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - if( vips__png_header_stream( png->source, load->out ) ) + if( vips__png_header_source( png->source, load->out ) ) return( -1 ); return( 0 ); @@ -129,7 +129,7 @@ vips_foreign_load_png_load( VipsForeignLoad *load ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - if( vips__png_read_stream( png->source, load->real, load->fail ) ) + if( vips__png_read_source( png->source, load->real, load->fail ) ) return( -1 ); return( 0 ); @@ -165,32 +165,32 @@ vips_foreign_load_png_init( VipsForeignLoadPng *png ) { } -typedef struct _VipsForeignLoadPngStream { +typedef struct _VipsForeignLoadPngSource { VipsForeignLoadPng parent_object; - /* Load from a stream. + /* Load from a source. */ VipsSource *source; -} VipsForeignLoadPngStream; +} VipsForeignLoadPngSource; -typedef VipsForeignLoadPngClass VipsForeignLoadPngStreamClass; +typedef VipsForeignLoadPngClass VipsForeignLoadPngSourceClass; -G_DEFINE_TYPE( VipsForeignLoadPngStream, vips_foreign_load_png_stream, +G_DEFINE_TYPE( VipsForeignLoadPngSource, vips_foreign_load_png_source, vips_foreign_load_png_get_type() ); static int -vips_foreign_load_png_stream_build( VipsObject *object ) +vips_foreign_load_png_source_build( VipsObject *object ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) object; - VipsForeignLoadPngStream *stream = (VipsForeignLoadPngStream *) object; + VipsForeignLoadPngSource *source = (VipsForeignLoadPngSource *) object; - if( stream->source ) { - png->source = stream->source; + if( source->source ) { + png->source = source->source; g_object_ref( png->source ); } - if( VIPS_OBJECT_CLASS( vips_foreign_load_png_stream_parent_class )-> + if( VIPS_OBJECT_CLASS( vips_foreign_load_png_source_parent_class )-> build( object ) ) return( -1 ); @@ -198,13 +198,13 @@ vips_foreign_load_png_stream_build( VipsObject *object ) } static gboolean -vips_foreign_load_png_stream_is_a_source( VipsSource *source ) +vips_foreign_load_png_source_is_a_source( VipsSource *source ) { - return( vips__png_ispng_stream( source ) ); + return( vips__png_ispng_source( source ) ); } static void -vips_foreign_load_png_stream_class_init( VipsForeignLoadPngStreamClass *class ) +vips_foreign_load_png_source_class_init( VipsForeignLoadPngSourceClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -213,23 +213,23 @@ vips_foreign_load_png_stream_class_init( VipsForeignLoadPngStreamClass *class ) gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "pngload_stream"; - object_class->description = _( "load png from stream" ); - object_class->build = vips_foreign_load_png_stream_build; + object_class->nickname = "pngload_source"; + object_class->description = _( "load png from source" ); + object_class->build = vips_foreign_load_png_source_build; - load_class->is_a_source = vips_foreign_load_png_stream_is_a_source; + load_class->is_a_source = vips_foreign_load_png_source_is_a_source; VIPS_ARG_OBJECT( class, "source", 1, - _( "Streami" ), - _( "Stream to load from" ), + _( "Source" ), + _( "Source to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadPngStream, source ), + G_STRUCT_OFFSET( VipsForeignLoadPngSource, source ), VIPS_TYPE_SOURCE ); } static void -vips_foreign_load_png_stream_init( VipsForeignLoadPngStream *stream ) +vips_foreign_load_png_source_init( VipsForeignLoadPngSource *source ) { } @@ -272,7 +272,7 @@ vips_foreign_load_png_file_is_a( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( FALSE ); - result = vips_foreign_load_png_stream_is_a_source( source ); + result = vips_foreign_load_png_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -351,7 +351,7 @@ vips_foreign_load_png_buffer_is_a_buffer( const void *buf, size_t len ) if( !(source = vips_source_new_from_memory( buf, len )) ) return( FALSE ); - result = vips_foreign_load_png_stream_is_a_source( source ); + result = vips_foreign_load_png_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -456,11 +456,11 @@ vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_pngload_source: - * @source: stream to load from + * @source: source to load from * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * - * Exactly as vips_pngload(), but read from a stream. + * Exactly as vips_pngload(), but read from a source. * * See also: vips_pngload(). * @@ -473,7 +473,7 @@ vips_pngload_source( VipsSource *source, VipsImage **out, ... ) int result; va_start( ap, out ); - result = vips_call_split( "pngload_stream", ap, source, out ); + result = vips_call_split( "pngload_source", ap, source, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index dd32cae3..2af92e39 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -179,29 +179,29 @@ vips_foreign_save_png_init( VipsForeignSavePng *png ) png->dither = 1.0; } -typedef struct _VipsForeignSavePngStream { +typedef struct _VipsForeignSavePngTarget { VipsForeignSavePng parent_object; VipsTarget *target; -} VipsForeignSavePngStream; +} VipsForeignSavePngTarget; -typedef VipsForeignSavePngClass VipsForeignSavePngStreamClass; +typedef VipsForeignSavePngClass VipsForeignSavePngTargetClass; -G_DEFINE_TYPE( VipsForeignSavePngStream, vips_foreign_save_png_stream, +G_DEFINE_TYPE( VipsForeignSavePngTarget, vips_foreign_save_png_target, vips_foreign_save_png_get_type() ); static int -vips_foreign_save_png_stream_build( VipsObject *object ) +vips_foreign_save_png_target_build( VipsObject *object ) { VipsForeignSave *save = (VipsForeignSave *) object; VipsForeignSavePng *png = (VipsForeignSavePng *) object; - VipsForeignSavePngStream *stream = (VipsForeignSavePngStream *) object; + VipsForeignSavePngTarget *target = (VipsForeignSavePngTarget *) object; - if( VIPS_OBJECT_CLASS( vips_foreign_save_png_stream_parent_class )-> + if( VIPS_OBJECT_CLASS( vips_foreign_save_png_target_parent_class )-> build( object ) ) return( -1 ); - if( vips__png_write_stream( save->ready, stream->target, + if( vips__png_write_target( save->ready, target->target, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) return( -1 ); @@ -210,7 +210,7 @@ vips_foreign_save_png_stream_build( VipsObject *object ) } static void -vips_foreign_save_png_stream_class_init( VipsForeignSavePngStreamClass *class ) +vips_foreign_save_png_target_class_init( VipsForeignSavePngTargetClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -218,21 +218,21 @@ vips_foreign_save_png_stream_class_init( VipsForeignSavePngStreamClass *class ) gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "pngsave_stream"; - object_class->description = _( "save image to png stream" ); - object_class->build = vips_foreign_save_png_stream_build; + object_class->nickname = "pngsave_target"; + object_class->description = _( "save image to target as PNG" ); + object_class->build = vips_foreign_save_png_target_build; VIPS_ARG_OBJECT( class, "target", 1, - _( "Streamo" ), - _( "Stream to save to" ), + _( "Target" ), + _( "Target to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSavePngStream, target ), + G_STRUCT_OFFSET( VipsForeignSavePngTarget, target ), VIPS_TYPE_TARGET ); } static void -vips_foreign_save_png_stream_init( VipsForeignSavePngStream *stream ) +vips_foreign_save_png_target_init( VipsForeignSavePngTarget *target ) { } @@ -262,7 +262,7 @@ vips_foreign_save_png_file_build( VipsObject *object ) if( !(target = vips_target_new_to_file( png_file->filename )) ) return( -1 ); - if( vips__png_write_stream( save->ready, target, + if( vips__png_write_target( save->ready, target, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) { @@ -328,7 +328,7 @@ vips_foreign_save_png_buffer_build( VipsObject *object ) if( !(target = vips_target_new_to_memory()) ) return( -1 ); - if( vips__png_write_stream( save->ready, target, + if( vips__png_write_target( save->ready, target, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) { @@ -500,7 +500,7 @@ vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) /** * vips_pngsave_target: (method) * @in: image to save - * @target: save image to this stream + * @target: save image to this target * @...: %NULL-terminated list of optional named arguments * * Optional arguments: @@ -514,7 +514,7 @@ vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * * @Q: quality for 8bpp quantisation (does not exceed @colours) * * @dither: amount of dithering for 8bpp quantization * - * As vips_pngsave(), but save to a stream. + * As vips_pngsave(), but save to a target. * * See also: vips_pngsave(), vips_image_write_to_target(). * @@ -527,7 +527,7 @@ vips_pngsave_target( VipsImage *in, VipsTarget *target, ... ) int result; va_start( ap, target ); - result = vips_call_split( "pngsave_stream", ap, in, target ); + result = vips_call_split( "pngsave_target", ap, in, target ); va_end( ap ); return( result ); diff --git a/libvips/foreign/ppmload.c b/libvips/foreign/ppmload.c index c18a5002..262cc897 100644 --- a/libvips/foreign/ppmload.c +++ b/libvips/foreign/ppmload.c @@ -32,8 +32,8 @@ * 29/7/19 Kyle-Kyle * - fix a loop with malformed ppm * 13/11/19 - * - redone with streams - * - sequential load, plus mmap for filename streams + * - redone with source/target + * - sequential load, plus mmap for filename sources * - faster plus lower memory use */ @@ -88,7 +88,7 @@ typedef struct _VipsForeignLoadPpm { VipsForeignLoad parent_object; - /* The stream we load from, and the buffered wrapper for it. + /* The source we load from, and the buffered wrapper for it. */ VipsSource *source; VipsBufis *bufis; @@ -191,7 +191,7 @@ vips_foreign_load_ppm_dispose( GObject *gobject ) dispose( gobject ); } -/* Scan the stream header into our class. +/* Scan the header into our class. */ static int vips_foreign_load_ppm_parse_header( VipsForeignLoadPpm *ppm ) @@ -562,7 +562,7 @@ vips_foreign_load_ppm_load( VipsForeignLoad *load ) vips_foreign_load_ppm_parse_header( ppm ) ) return( 0 ); - /* If the stream is mappable and this is a binary file, we can map it. + /* If the source is mappable and this is a binary file, we can map it. */ if( vips_source_is_mappable( ppm->source ) && !ppm->ascii && diff --git a/libvips/foreign/ppmsave.c b/libvips/foreign/ppmsave.c index a3e32144..25f59a29 100644 --- a/libvips/foreign/ppmsave.c +++ b/libvips/foreign/ppmsave.c @@ -3,7 +3,7 @@ * 2/12/11 * - wrap a class around the ppm writer * 13/11/19 - * - redone with streams + * - redone with targets */ /* diff --git a/libvips/foreign/radload.c b/libvips/foreign/radload.c index f56e62e1..7180f77c 100644 --- a/libvips/foreign/radload.c +++ b/libvips/foreign/radload.c @@ -141,32 +141,32 @@ vips_foreign_load_rad_init( VipsForeignLoadRad *rad ) { } -typedef struct _VipsForeignLoadRadStream { +typedef struct _VipsForeignLoadRadSource { VipsForeignLoadRad parent_object; - /* Load from a stream. + /* Load from a source. */ VipsSource *source; -} VipsForeignLoadRadStream; +} VipsForeignLoadRadSource; -typedef VipsForeignLoadRadClass VipsForeignLoadRadStreamClass; +typedef VipsForeignLoadRadClass VipsForeignLoadRadSourceClass; -G_DEFINE_TYPE( VipsForeignLoadRadStream, vips_foreign_load_rad_stream, +G_DEFINE_TYPE( VipsForeignLoadRadSource, vips_foreign_load_rad_source, vips_foreign_load_rad_get_type() ); static int -vips_foreign_load_rad_stream_build( VipsObject *object ) +vips_foreign_load_rad_source_build( VipsObject *object ) { VipsForeignLoadRad *rad = (VipsForeignLoadRad *) object; - VipsForeignLoadRadStream *stream = (VipsForeignLoadRadStream *) object; + VipsForeignLoadRadSource *source = (VipsForeignLoadRadSource *) object; - if( stream->source ) { - rad->source = stream->source; + if( source->source ) { + rad->source = source->source; g_object_ref( rad->source ); } - if( VIPS_OBJECT_CLASS( vips_foreign_load_rad_stream_parent_class )-> + if( VIPS_OBJECT_CLASS( vips_foreign_load_rad_source_parent_class )-> build( object ) ) return( -1 ); @@ -174,13 +174,13 @@ vips_foreign_load_rad_stream_build( VipsObject *object ) } static gboolean -vips_foreign_load_rad_stream_is_a_source( VipsSource *source ) +vips_foreign_load_rad_source_is_a_source( VipsSource *source ) { return( vips__rad_israd( source ) ); } static void -vips_foreign_load_rad_stream_class_init( VipsForeignLoadRadStreamClass *class ) +vips_foreign_load_rad_source_class_init( VipsForeignLoadRadSourceClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -189,23 +189,23 @@ vips_foreign_load_rad_stream_class_init( VipsForeignLoadRadStreamClass *class ) gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "radload_stream"; - object_class->description = _( "load rad from stream" ); - object_class->build = vips_foreign_load_rad_stream_build; + object_class->nickname = "radload_source"; + object_class->description = _( "load rad from source" ); + object_class->build = vips_foreign_load_rad_source_build; - load_class->is_a_source = vips_foreign_load_rad_stream_is_a_source; + load_class->is_a_source = vips_foreign_load_rad_source_is_a_source; VIPS_ARG_OBJECT( class, "source", 1, - _( "Streami" ), - _( "Stream to load from" ), + _( "Source" ), + _( "Source to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadRadStream, source ), + G_STRUCT_OFFSET( VipsForeignLoadRadSource, source ), VIPS_TYPE_SOURCE ); } static void -vips_foreign_load_rad_stream_init( VipsForeignLoadRadStream *stream ) +vips_foreign_load_rad_source_init( VipsForeignLoadRadSource *source ) { } @@ -248,7 +248,7 @@ vips_foreign_load_rad_file_is_a( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( -1 ); - result = vips_foreign_load_rad_stream_is_a_source( source ); + result = vips_foreign_load_rad_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -327,7 +327,7 @@ vips_foreign_load_rad_buffer_is_a_buffer( const void *buf, size_t len ) if( !(source = vips_source_new_from_memory( buf, len )) ) return( FALSE ); - result = vips_foreign_load_rad_stream_is_a_source( source ); + result = vips_foreign_load_rad_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -440,11 +440,11 @@ vips_radload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_radload_source: - * @source: stream to load from + * @source: source to load from * @out: (out): output image * @...: %NULL-terminated list of optional named arguments * - * Exactly as vips_radload(), but read from a stream. + * Exactly as vips_radload(), but read from a source. * * See also: vips_radload(). * @@ -457,7 +457,7 @@ vips_radload_source( VipsSource *source, VipsImage **out, ... ) int result; va_start( ap, out ); - result = vips_call_split( "radload_stream", ap, source, out ); + result = vips_call_split( "radload_source", ap, source, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/radsave.c b/libvips/foreign/radsave.c index 408fe6d2..bc65a6d0 100644 --- a/libvips/foreign/radsave.c +++ b/libvips/foreign/radsave.c @@ -165,35 +165,35 @@ vips_foreign_save_rad_file_init( VipsForeignSaveRadFile *file ) { } -typedef struct _VipsForeignSaveRadStream { +typedef struct _VipsForeignSaveRadTarget { VipsForeignSaveRad parent_object; VipsTarget *target; -} VipsForeignSaveRadStream; +} VipsForeignSaveRadTarget; -typedef VipsForeignSaveRadClass VipsForeignSaveRadStreamClass; +typedef VipsForeignSaveRadClass VipsForeignSaveRadTargetClass; -G_DEFINE_TYPE( VipsForeignSaveRadStream, vips_foreign_save_rad_stream, +G_DEFINE_TYPE( VipsForeignSaveRadTarget, vips_foreign_save_rad_target, vips_foreign_save_rad_get_type() ); static int -vips_foreign_save_rad_stream_build( VipsObject *object ) +vips_foreign_save_rad_target_build( VipsObject *object ) { VipsForeignSave *save = (VipsForeignSave *) object; - VipsForeignSaveRadStream *stream = (VipsForeignSaveRadStream *) object; + VipsForeignSaveRadTarget *target = (VipsForeignSaveRadTarget *) object; - if( VIPS_OBJECT_CLASS( vips_foreign_save_rad_stream_parent_class )-> + if( VIPS_OBJECT_CLASS( vips_foreign_save_rad_target_parent_class )-> build( object ) ) return( -1 ); - if( vips__rad_save( save->ready, stream->target ) ) + if( vips__rad_save( save->ready, target->target ) ) return( -1 ); return( 0 ); } static void -vips_foreign_save_rad_stream_class_init( VipsForeignSaveRadStreamClass *class ) +vips_foreign_save_rad_target_class_init( VipsForeignSaveRadTargetClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -201,21 +201,21 @@ vips_foreign_save_rad_stream_class_init( VipsForeignSaveRadStreamClass *class ) gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "radsave_stream"; - object_class->description = _( "save image to Radiance stream" ); - object_class->build = vips_foreign_save_rad_stream_build; + object_class->nickname = "radsave_target"; + object_class->description = _( "save image to Radiance target" ); + object_class->build = vips_foreign_save_rad_target_build; VIPS_ARG_OBJECT( class, "target", 1, - _( "Streamo" ), + _( "Target" ), _( "Stream to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveRadStream, target ), + G_STRUCT_OFFSET( VipsForeignSaveRadTarget, target ), VIPS_TYPE_TARGET ); } static void -vips_foreign_save_rad_stream_init( VipsForeignSaveRadStream *stream ) +vips_foreign_save_rad_target_init( VipsForeignSaveRadTarget *target ) { } @@ -362,10 +362,10 @@ vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) /** * vips_radsave_target: (method) * @in: image to save - * @target: save image to this stream + * @target: save image to this target * @...: %NULL-terminated list of optional named arguments * - * As vips_radsave(), but save to a stream. + * As vips_radsave(), but save to a target. * * See also: vips_radsave(). * @@ -378,7 +378,7 @@ vips_radsave_target( VipsImage *in, VipsTarget *target, ... ) int result; va_start( ap, target ); - result = vips_call_split( "radsave_stream", ap, in, target ); + result = vips_call_split( "radsave_target", ap, in, target ); va_end( ap ); return( result ); diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index 291f727b..bdbfe88a 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -752,22 +752,22 @@ vips_foreign_load_svg_init( VipsForeignLoadSvg *svg ) svg->cairo_scale = 1.0; } -typedef struct _VipsForeignLoadSvgStream { +typedef struct _VipsForeignLoadSvgSource { VipsForeignLoadSvg parent_object; - /* Load from a stream. + /* Load from a source. */ VipsSource *source; -} VipsForeignLoadSvgStream; +} VipsForeignLoadSvgSource; -typedef VipsForeignLoadClass VipsForeignLoadSvgStreamClass; +typedef VipsForeignLoadClass VipsForeignLoadSvgSourceClass; -G_DEFINE_TYPE( VipsForeignLoadSvgStream, vips_foreign_load_svg_stream, +G_DEFINE_TYPE( VipsForeignLoadSvgSource, vips_foreign_load_svg_source, vips_foreign_load_svg_get_type() ); gboolean -vips_foreign_load_svg_stream_is_a_source( VipsSource *source ) +vips_foreign_load_svg_source_is_a_source( VipsSource *source ) { unsigned char *data; size_t bytes_read; @@ -780,21 +780,21 @@ vips_foreign_load_svg_stream_is_a_source( VipsSource *source ) } static int -vips_foreign_load_svg_stream_header( VipsForeignLoad *load ) +vips_foreign_load_svg_source_header( VipsForeignLoad *load ) { VipsForeignLoadSvg *svg = (VipsForeignLoadSvg *) load; - VipsForeignLoadSvgStream *stream = - (VipsForeignLoadSvgStream *) load; + VipsForeignLoadSvgSource *source = + (VipsForeignLoadSvgSource *) load; RsvgHandleFlags flags = svg->unlimited ? RSVG_HANDLE_FLAG_UNLIMITED : 0; GError *error = NULL; GInputStream *gstream; - if( vips_source_rewind( stream->source ) ) + if( vips_source_rewind( source->source ) ) return( -1 ); - gstream = g_input_stream_new_from_vips( stream->source ); + gstream = g_input_stream_new_from_vips( source->source ); if( !(svg->page = rsvg_handle_new_from_stream_sync( gstream, NULL, flags, NULL, &error )) ) { g_object_unref( gstream ); @@ -807,20 +807,20 @@ vips_foreign_load_svg_stream_header( VipsForeignLoad *load ) } static int -vips_foreign_load_svg_stream_load( VipsForeignLoad *load ) +vips_foreign_load_svg_source_load( VipsForeignLoad *load ) { - VipsForeignLoadSvgStream *stream = (VipsForeignLoadSvgStream *) load; + VipsForeignLoadSvgSource *source = (VipsForeignLoadSvgSource *) load; - if( vips_source_rewind( stream->source ) || + if( vips_source_rewind( source->source ) || vips_foreign_load_svg_load( load ) || - vips_source_decode( stream->source ) ) + vips_source_decode( source->source ) ) return( -1 ); return( 0 ); } static void -vips_foreign_load_svg_stream_class_init( VipsForeignLoadSvgStreamClass *class ) +vips_foreign_load_svg_source_class_init( VipsForeignLoadSvgSourceClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -829,24 +829,24 @@ vips_foreign_load_svg_stream_class_init( VipsForeignLoadSvgStreamClass *class ) gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "svgload_stream"; - object_class->description = _( "load svg from stream" ); + object_class->nickname = "svgload_source"; + object_class->description = _( "load svg from source" ); - load_class->is_a_source = vips_foreign_load_svg_stream_is_a_source; - load_class->header = vips_foreign_load_svg_stream_header; - load_class->load = vips_foreign_load_svg_stream_load; + load_class->is_a_source = vips_foreign_load_svg_source_is_a_source; + load_class->header = vips_foreign_load_svg_source_header; + load_class->load = vips_foreign_load_svg_source_load; VIPS_ARG_OBJECT( class, "source", 1, - _( "Streami" ), - _( "Stream to load from" ), + _( "Source" ), + _( "Source to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadSvgStream, source ), + G_STRUCT_OFFSET( VipsForeignLoadSvgSource, source ), VIPS_TYPE_SOURCE ); } static void -vips_foreign_load_svg_stream_init( VipsForeignLoadSvgStream *stream ) +vips_foreign_load_svg_source_init( VipsForeignLoadSvgSource *source ) { } @@ -1101,11 +1101,11 @@ vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_svgload_source: - * @source: stream to load from + * @source: source to load from * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * - * Exactly as vips_svgload(), but read from a stream. + * Exactly as vips_svgload(), but read from a source. * * See also: vips_svgload(). * @@ -1118,7 +1118,7 @@ vips_svgload_source( VipsSource *source, VipsImage **out, ... ) int result; va_start( ap, out ); - result = vips_call_split( "svgload_stream", ap, source, out ); + result = vips_call_split( "svgload_source", ap, source, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/tiff.c b/libvips/foreign/tiff.c index 0da48a9b..b325dae2 100644 --- a/libvips/foreign/tiff.c +++ b/libvips/foreign/tiff.c @@ -132,11 +132,11 @@ vips__tiff_openout( const char *path, gboolean bigtiff ) return( tif ); } -/* TIFF input from a vips stream. +/* TIFF input from a vips source. */ static tsize_t -openin_stream_read( thandle_t st, tdata_t data, tsize_t size ) +openin_source_read( thandle_t st, tdata_t data, tsize_t size ) { VipsSource *source = VIPS_SOURCE( st ); @@ -144,7 +144,7 @@ openin_stream_read( thandle_t st, tdata_t data, tsize_t size ) } static tsize_t -openin_stream_write( thandle_t st, tdata_t buffer, tsize_t size ) +openin_source_write( thandle_t st, tdata_t buffer, tsize_t size ) { g_assert_not_reached(); @@ -152,7 +152,7 @@ openin_stream_write( thandle_t st, tdata_t buffer, tsize_t size ) } static toff_t -openin_stream_seek( thandle_t st, toff_t position, int whence ) +openin_source_seek( thandle_t st, toff_t position, int whence ) { VipsSource *source = VIPS_SOURCE( st ); @@ -160,7 +160,7 @@ openin_stream_seek( thandle_t st, toff_t position, int whence ) } static int -openin_stream_close( thandle_t st ) +openin_source_close( thandle_t st ) { VipsSource *source = VIPS_SOURCE( st ); @@ -170,7 +170,7 @@ openin_stream_close( thandle_t st ) } static toff_t -openin_stream_length( thandle_t st ) +openin_source_length( thandle_t st ) { VipsSource *source = VIPS_SOURCE( st ); @@ -181,7 +181,7 @@ openin_stream_length( thandle_t st ) } static int -openin_stream_map( thandle_t st, tdata_t *start, toff_t *len ) +openin_source_map( thandle_t st, tdata_t *start, toff_t *len ) { g_assert_not_reached(); @@ -189,7 +189,7 @@ openin_stream_map( thandle_t st, tdata_t *start, toff_t *len ) } static void -openin_stream_unmap( thandle_t st, tdata_t start, toff_t len ) +openin_source_unmap( thandle_t st, tdata_t start, toff_t len ) { g_assert_not_reached(); @@ -197,28 +197,28 @@ openin_stream_unmap( thandle_t st, tdata_t start, toff_t len ) } TIFF * -vips__tiff_openin_stream( VipsSource *source ) +vips__tiff_openin_source( VipsSource *source ) { TIFF *tiff; #ifdef DEBUG - printf( "vips__tiff_openin_stream:\n" ); + printf( "vips__tiff_openin_source:\n" ); #endif /*DEBUG*/ if( vips_source_rewind( source ) ) return( NULL ); - if( !(tiff = TIFFClientOpen( "stream input", "rm", + if( !(tiff = TIFFClientOpen( "source input", "rm", (thandle_t) source, - openin_stream_read, - openin_stream_write, - openin_stream_seek, - openin_stream_close, - openin_stream_length, - openin_stream_map, - openin_stream_unmap )) ) { - vips_error( "vips__tiff_openin_stream", "%s", - _( "unable to open stream for input" ) ); + openin_source_read, + openin_source_write, + openin_source_seek, + openin_source_close, + openin_source_length, + openin_source_map, + openin_source_unmap )) ) { + vips_error( "vips__tiff_openin_source", "%s", + _( "unable to open source for input" ) ); return( NULL ); } diff --git a/libvips/foreign/tiff.h b/libvips/foreign/tiff.h index bf68b4bd..56ff149c 100644 --- a/libvips/foreign/tiff.h +++ b/libvips/foreign/tiff.h @@ -37,7 +37,7 @@ extern "C" { #endif /*__cplusplus*/ -TIFF *vips__tiff_openin_stream( VipsSource *source ); +TIFF *vips__tiff_openin_source( VipsSource *source ); TIFF *vips__tiff_openout( const char *path, gboolean bigtiff ); TIFF *vips__tiff_openout_buffer( VipsImage *image, diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index e86e34a0..8cb72646 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -190,7 +190,7 @@ * - istiff reads the first directory rather than just testing the magic * number, so it ignores more TIFF-like, but not TIFF images * 17/10/19 - * - switch to stream input + * - switch to source input * 18/11/19 * - support ASSOCALPHA in any alpha band */ @@ -558,7 +558,7 @@ rtiff_new( VipsSource *source, VipsImage *out, return( NULL ); } - if( !(rtiff->tiff = vips__tiff_openin_stream( source )) ) + if( !(rtiff->tiff = vips__tiff_openin_source( source )) ) return( NULL ); return( rtiff ); @@ -2463,14 +2463,14 @@ vips__tiff_read_header_orientation( Rtiff *rtiff, VipsImage *out ) typedef gboolean (*TiffPropertyFn)( TIFF *tif ); static gboolean -vips__testtiff_stream( VipsSource *source, TiffPropertyFn fn ) +vips__testtiff_source( VipsSource *source, TiffPropertyFn fn ) { TIFF *tif; gboolean property; vips__tiff_init(); - if( !(tif = vips__tiff_openin_stream( source )) ) { + if( !(tif = vips__tiff_openin_source( source )) ) { vips_error_clear(); return( FALSE ); } @@ -2483,19 +2483,19 @@ vips__testtiff_stream( VipsSource *source, TiffPropertyFn fn ) } gboolean -vips__istiff_stream( VipsSource *source ) +vips__istiff_source( VipsSource *source ) { - return( vips__testtiff_stream( source, NULL ) ); + return( vips__testtiff_source( source, NULL ) ); } gboolean -vips__istifftiled_stream( VipsSource *source ) +vips__istifftiled_source( VipsSource *source ) { - return( vips__testtiff_stream( source, TIFFIsTiled ) ); + return( vips__testtiff_source( source, TIFFIsTiled ) ); } int -vips__tiff_read_header_stream( VipsSource *source, VipsImage *out, +vips__tiff_read_header_source( VipsSource *source, VipsImage *out, int page, int n, gboolean autorotate ) { Rtiff *rtiff; @@ -2520,7 +2520,7 @@ vips__tiff_read_header_stream( VipsSource *source, VipsImage *out, } int -vips__tiff_read_stream( VipsSource *source, VipsImage *out, +vips__tiff_read_source( VipsSource *source, VipsImage *out, int page, int n, gboolean autorotate ) { Rtiff *rtiff; diff --git a/libvips/foreign/tiffload.c b/libvips/foreign/tiffload.c index b6ff8b93..70950410 100644 --- a/libvips/foreign/tiffload.c +++ b/libvips/foreign/tiffload.c @@ -92,12 +92,12 @@ vips_foreign_load_tiff_dispose( GObject *gobject ) } static VipsForeignFlags -vips_foreign_load_tiff_get_flags_stream( VipsSource *source ) +vips_foreign_load_tiff_get_flags_source( VipsSource *source ) { VipsForeignFlags flags; flags = 0; - if( vips__istifftiled_stream( source ) ) + if( vips__istifftiled_source( source ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; @@ -113,7 +113,7 @@ vips_foreign_load_tiff_get_flags_filename( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( 0 ); - flags = vips_foreign_load_tiff_get_flags_stream( source ); + flags = vips_foreign_load_tiff_get_flags_source( source ); VIPS_UNREF( source ); return( flags ); @@ -124,7 +124,7 @@ vips_foreign_load_tiff_get_flags( VipsForeignLoad *load ) { VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; - return( vips_foreign_load_tiff_get_flags_stream( tiff->source ) ); + return( vips_foreign_load_tiff_get_flags_source( tiff->source ) ); } static int @@ -132,7 +132,7 @@ vips_foreign_load_tiff_header( VipsForeignLoad *load ) { VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; - if( vips__tiff_read_header_stream( tiff->source, load->out, + if( vips__tiff_read_header_source( tiff->source, load->out, tiff->page, tiff->n, tiff->autorotate ) ) return( -1 ); @@ -144,7 +144,7 @@ vips_foreign_load_tiff_load( VipsForeignLoad *load ) { VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; - if( vips__tiff_read_stream( tiff->source, load->real, + if( vips__tiff_read_source( tiff->source, load->real, tiff->page, tiff->n, tiff->autorotate ) ) return( -1 ); @@ -212,33 +212,33 @@ vips_foreign_load_tiff_init( VipsForeignLoadTiff *tiff ) tiff->n = 1; } -typedef struct _VipsForeignLoadTiffStream { +typedef struct _VipsForeignLoadTiffSource { VipsForeignLoadTiff parent_object; - /* Load from a stream. + /* Load from a source. */ VipsSource *source; -} VipsForeignLoadTiffStream; +} VipsForeignLoadTiffSource; -typedef VipsForeignLoadTiffClass VipsForeignLoadTiffStreamClass; +typedef VipsForeignLoadTiffClass VipsForeignLoadTiffSourceClass; -G_DEFINE_TYPE( VipsForeignLoadTiffStream, vips_foreign_load_tiff_stream, +G_DEFINE_TYPE( VipsForeignLoadTiffSource, vips_foreign_load_tiff_source, vips_foreign_load_tiff_get_type() ); static int -vips_foreign_load_tiff_stream_build( VipsObject *object ) +vips_foreign_load_tiff_source_build( VipsObject *object ) { VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) object; - VipsForeignLoadTiffStream *stream = - (VipsForeignLoadTiffStream *) object; + VipsForeignLoadTiffSource *source = + (VipsForeignLoadTiffSource *) object; - if( stream->source ) { - tiff->source = stream->source; + if( source->source ) { + tiff->source = source->source; g_object_ref( tiff->source ); } - if( VIPS_OBJECT_CLASS( vips_foreign_load_tiff_stream_parent_class )-> + if( VIPS_OBJECT_CLASS( vips_foreign_load_tiff_source_parent_class )-> build( object ) ) return( -1 ); @@ -246,14 +246,14 @@ vips_foreign_load_tiff_stream_build( VipsObject *object ) } static gboolean -vips_foreign_load_tiff_stream_is_a_source( VipsSource *source ) +vips_foreign_load_tiff_source_is_a_source( VipsSource *source ) { - return( vips__istiff_stream( source ) ); + return( vips__istiff_source( source ) ); } static void -vips_foreign_load_tiff_stream_class_init( - VipsForeignLoadTiffStreamClass *class ) +vips_foreign_load_tiff_source_class_init( + VipsForeignLoadTiffSourceClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; @@ -262,23 +262,23 @@ vips_foreign_load_tiff_stream_class_init( gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; - object_class->nickname = "tiffload_stream"; - object_class->description = _( "load tiff from stream" ); - object_class->build = vips_foreign_load_tiff_stream_build; + object_class->nickname = "tiffload_source"; + object_class->description = _( "load tiff from source" ); + object_class->build = vips_foreign_load_tiff_source_build; - load_class->is_a_source = vips_foreign_load_tiff_stream_is_a_source; + load_class->is_a_source = vips_foreign_load_tiff_source_is_a_source; VIPS_ARG_OBJECT( class, "source", 1, - _( "Streami" ), - _( "Stream to load from" ), + _( "Source" ), + _( "Source to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadTiffStream, source ), + G_STRUCT_OFFSET( VipsForeignLoadTiffSource, source ), VIPS_TYPE_SOURCE ); } static void -vips_foreign_load_tiff_stream_init( VipsForeignLoadTiffStream *stream ) +vips_foreign_load_tiff_source_init( VipsForeignLoadTiffSource *source ) { } @@ -322,7 +322,7 @@ vips_foreign_load_tiff_file_is_a( const char *filename ) if( !(source = vips_source_new_from_file( filename )) ) return( FALSE ); - result = vips_foreign_load_tiff_stream_is_a_source( source ); + result = vips_foreign_load_tiff_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -404,7 +404,7 @@ vips_foreign_load_tiff_buffer_is_a_buffer( const void *buf, size_t len ) if( !(source = vips_source_new_from_memory( buf, len )) ) return( FALSE ); - result = vips_foreign_load_tiff_stream_is_a_source( source ); + result = vips_foreign_load_tiff_source_is_a_source( source ); VIPS_UNREF( source ); return( result ); @@ -548,7 +548,7 @@ vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_tiffload_source: - * @source: stream to load + * @source: source to load * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * @@ -559,7 +559,7 @@ vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... ) * * @autorotate: %gboolean, use orientation tag to rotate the image * during load * - * Exactly as vips_tiffload(), but read from a stream. + * Exactly as vips_tiffload(), but read from a source. * * See also: vips_tiffload(). * @@ -572,7 +572,7 @@ vips_tiffload_source( VipsSource *source, VipsImage **out, ... ) int result; va_start( ap, out ); - result = vips_call_split( "tiffload_stream", ap, source, out ); + result = vips_call_split( "tiffload_source", ap, source, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index cf2eddc8..c7afbc7f 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1781,7 +1781,7 @@ wtiff_gather( Wtiff *wtiff ) return( -1 ); } - if( !(in = vips__tiff_openin_stream( source )) ) { + if( !(in = vips__tiff_openin_source( source )) ) { VIPS_UNREF( source ); return( -1 ); } diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index 12f27ed0..a9005adc 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -76,7 +76,7 @@ * 7/10/19 * - restart after minimise * 14/10/19 - * - revise for stream IO + * - revise for connection IO */ /* @@ -213,12 +213,12 @@ read_minimise_cb( VipsImage *image, Read *read ) } static void -vips_png_read_stream( png_structp pPng, png_bytep data, png_size_t length ) +vips_png_read_source( png_structp pPng, png_bytep data, png_size_t length ) { Read *read = png_get_io_ptr( pPng ); #ifdef DEBUG - printf( "vips_png_read_stream: read %zd bytes\n", length ); + printf( "vips_png_read_source: read %zd bytes\n", length ); #endif /*DEBUG*/ /* libpng makes many small reads, which hurts performance if you do a @@ -292,7 +292,7 @@ read_new( VipsSource *source, VipsImage *out, gboolean fail ) if( vips_source_rewind( source ) ) return( NULL ); - png_set_read_fn( read->pPng, read, vips_png_read_stream ); + png_set_read_fn( read->pPng, read, vips_png_read_source ); /* Catch PNG errors from png_read_info() etc. */ @@ -694,7 +694,7 @@ png2vips_image( Read *read, VipsImage *out ) } gboolean -vips__png_ispng_stream( VipsSource *source ) +vips__png_ispng_source( VipsSource *source ) { const unsigned char *p; @@ -706,7 +706,7 @@ vips__png_ispng_stream( VipsSource *source ) } int -vips__png_header_stream( VipsSource *source, VipsImage *out ) +vips__png_header_source( VipsSource *source, VipsImage *out ) { Read *read; @@ -720,7 +720,7 @@ vips__png_header_stream( VipsSource *source, VipsImage *out ) } int -vips__png_read_stream( VipsSource *source, VipsImage *out, gboolean fail ) +vips__png_read_source( VipsSource *source, VipsImage *out, gboolean fail ) { Read *read; @@ -736,7 +736,7 @@ vips__png_read_stream( VipsSource *source, VipsImage *out, gboolean fail ) * served partially from there. Non-interlaced PNGs may be read sequentially. */ gboolean -vips__png_isinterlaced_stream( VipsSource *source ) +vips__png_isinterlaced_source( VipsSource *source ) { VipsImage *image; Read *read; @@ -1169,7 +1169,7 @@ write_vips( Write *write, } int -vips__png_write_stream( VipsImage *in, VipsTarget *target, +vips__png_write_target( VipsImage *in, VipsTarget *target, int compression, int interlace, const char *profile, VipsForeignPngFilter filter, gboolean strip, gboolean palette, int colours, int Q, double dither ) @@ -1184,7 +1184,7 @@ vips__png_write_stream( VipsImage *in, VipsTarget *target, colours, Q, dither ) ) { write_finish( write ); vips_error( "vips2png", - "%s", _( "unable to write to stream" ) ); + "%s", _( "unable to write to target" ) ); return( -1 ); } diff --git a/test/test_descriptors.sh b/test/test_descriptors.sh index 94a54868..8e0df7cc 100755 --- a/test/test_descriptors.sh +++ b/test/test_descriptors.sh @@ -10,23 +10,23 @@ set -e . ./variables.sh -if test_supported jpegload_stream; then +if test_supported jpegload_source; then ./test_descriptors $image fi -if test_supported pngload_stream; then +if test_supported pngload_source; then ./test_descriptors $test_images/sample.png fi -if test_supported tiffload_stream; then +if test_supported tiffload_source; then ./test_descriptors $test_images/sample.tif fi -if test_supported radload_stream; then +if test_supported radload_source; then ./test_descriptors $test_images/sample.hdr fi -if test_supported svgload_stream; then +if test_supported svgload_source; then ./test_descriptors $test_images/logo.svg fi