From f5a4f41edf03157a69d3d63c8a9a06823f71b3c7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 11 Nov 2019 09:09:34 +0000 Subject: [PATCH] rename VipsStream* variables The convention is now: VipStreami *streami; We had `input` in many places, a left-over from the old VipStreamInput name. --- libvips/deprecated/im_jpeg2vips.c | 10 ++-- libvips/deprecated/im_png2vips.c | 10 ++-- libvips/deprecated/im_tiff2vips.c | 29 +++++----- libvips/deprecated/im_webp2vips.c | 18 +++--- libvips/foreign/jpeg2vips.c | 44 ++++++++------- libvips/foreign/jpegload.c | 68 +++++++++++------------ libvips/foreign/jpegsave.c | 52 ++++++++--------- libvips/foreign/pforeign.h | 2 +- libvips/foreign/pngload.c | 92 +++++++++++++++---------------- libvips/foreign/pngsave.c | 40 +++++++------- libvips/foreign/radiance.c | 38 ++++++------- libvips/foreign/radload.c | 46 ++++++++-------- libvips/foreign/radsave.c | 40 +++++++------- libvips/foreign/svgload.c | 26 ++++----- libvips/foreign/tiff.c | 24 ++++---- libvips/foreign/tiff.h | 3 +- libvips/foreign/tiff2vips.c | 42 +++++++------- libvips/foreign/tiffload.c | 92 +++++++++++++++---------------- libvips/foreign/vips2jpeg.c | 16 +++--- libvips/foreign/vips2tiff.c | 12 ++-- libvips/foreign/vips2webp.c | 6 +- libvips/foreign/vipspng.c | 60 ++++++++++---------- libvips/foreign/webp2vips.c | 26 ++++----- libvips/foreign/webpload.c | 74 ++++++++++++------------- libvips/foreign/webpsave.c | 50 ++++++++--------- libvips/include/vips/foreign.h | 2 +- libvips/iofuncs/image.c | 17 +++--- libvips/iofuncs/object.c | 28 +++++----- libvips/resample/thumbnail.c | 30 +++++----- 29 files changed, 500 insertions(+), 497 deletions(-) diff --git a/libvips/deprecated/im_jpeg2vips.c b/libvips/deprecated/im_jpeg2vips.c index 2faae670..6244a6c3 100644 --- a/libvips/deprecated/im_jpeg2vips.c +++ b/libvips/deprecated/im_jpeg2vips.c @@ -112,16 +112,16 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) #ifdef HAVE_JPEG { - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( -1 ); - if( vips__jpeg_read_stream( input, out, + if( vips__jpeg_read_stream( streami, out, header_only, shrink, fail_on_warn, FALSE ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); } #else vips_error( "im_jpeg2vips", diff --git a/libvips/deprecated/im_png2vips.c b/libvips/deprecated/im_png2vips.c index ee9366ea..9f08e99f 100644 --- a/libvips/deprecated/im_png2vips.c +++ b/libvips/deprecated/im_png2vips.c @@ -84,16 +84,16 @@ png2vips( const char *name, IMAGE *out, gboolean header_only ) #ifdef HAVE_PNG { - VipsStreami *input; + VipsStreami *streami; int result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( -1 ); if( header_only ) - result = vips__png_header_stream( input, out ); + result = vips__png_header_stream( streami, out ); else - result = vips__png_read_stream( input, out, TRUE ); - VIPS_UNREF( input ); + result = vips__png_read_stream( streami, out, TRUE ); + VIPS_UNREF( streami ); if( result ) return( result ); diff --git a/libvips/deprecated/im_tiff2vips.c b/libvips/deprecated/im_tiff2vips.c index d0bde098..6bf2a5ee 100644 --- a/libvips/deprecated/im_tiff2vips.c +++ b/libvips/deprecated/im_tiff2vips.c @@ -56,13 +56,13 @@ static gboolean im_istifftiled( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__istiff_stream( input ); - VIPS_UNREF( input ); + result = vips__istiff_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -71,15 +71,16 @@ static int im_tiff_read_header( const char *filename, VipsImage *out, int page, int n, gboolean autorotate ) { - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( -1 ); - if( vips__tiff_read_header_stream( input, out, page, n, autorotate ) ) { - VIPS_UNREF( input ); + if( vips__tiff_read_header_stream( streami, + out, page, n, autorotate ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -88,15 +89,15 @@ static int im_tiff_read( const char *filename, VipsImage *out, int page, int n, gboolean autorotate ) { - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( -1 ); - if( vips__tiff_read_stream( input, out, page, n, autorotate ) ) { - VIPS_UNREF( input ); + if( vips__tiff_read_stream( streami, out, page, n, autorotate ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } diff --git a/libvips/deprecated/im_webp2vips.c b/libvips/deprecated/im_webp2vips.c index 5dca11da..fa6d4354 100644 --- a/libvips/deprecated/im_webp2vips.c +++ b/libvips/deprecated/im_webp2vips.c @@ -52,16 +52,16 @@ webp2vips( const char *name, IMAGE *out, gboolean header_only ) #ifdef HAVE_LIBWEBP { - VipsStreami *input; + VipsStreami *streami; int result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( -1 ); if( header_only ) - result = vips__webp_read_header_stream( input, out, 0, 1, 1 ); + result = vips__webp_read_header_stream( streami, out, 0, 1, 1 ); else - result = vips__webp_read_stream( input, out, 0, 1, 1 ); - VIPS_UNREF( input ); + result = vips__webp_read_stream( streami, out, 0, 1, 1 ); + VIPS_UNREF( streami ); if( result ) return( result ); @@ -82,12 +82,12 @@ vips__iswebp( const char *filename ) gboolean result; #ifdef HAVE_LIBWEBP - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__png_ispng_stream( input ); - VIPS_UNREF( input ); + result = vips__png_ispng_stream( streami ); + VIPS_UNREF( streami ); #else /*!HAVE_LIBWEBP*/ result = -1; #endif /*HAVE_LIBWEBP*/ diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 048cec3a..9ead2dac 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -193,7 +193,7 @@ typedef struct _ReadJpeg { /* The stream we read from. */ - VipsStreami *input; + VipsStreami *streami; } ReadJpeg; @@ -208,7 +208,7 @@ typedef struct { /* Private stuff during read. */ - VipsStreami *input; + VipsStreami *streami; unsigned char buf[STREAM_BUFFER_SIZE]; } Source; @@ -238,7 +238,7 @@ stream_fill_input_buffer( j_decompress_ptr cinfo ) size_t read; - if( (read = vips_streami_read( src->input, + if( (read = vips_streami_read( src->streami, src->buf, STREAM_BUFFER_SIZE )) > 0 ) { src->pub.next_input_byte = src->buf; src->pub.bytes_in_buffer = read; @@ -277,11 +277,11 @@ readjpeg_open_input( ReadJpeg *jpeg ) { j_decompress_ptr cinfo = &jpeg->cinfo; - if( jpeg->input && + if( jpeg->streami && !cinfo->src ) { Source *src; - if( vips_streami_rewind( jpeg->input ) ) + if( vips_streami_rewind( jpeg->streami ) ) return( -1 ); cinfo->src = (struct jpeg_source_mgr *) @@ -290,7 +290,7 @@ readjpeg_open_input( ReadJpeg *jpeg ) sizeof( Source ) ); src = (Source *) cinfo->src; - src->input = jpeg->input; + src->streami = jpeg->streami; src->pub.init_source = stream_init_source; src->pub.fill_input_buffer = stream_fill_input_buffer; src->pub.resync_to_restart = jpeg_resync_to_restart; @@ -326,7 +326,7 @@ readjpeg_free( ReadJpeg *jpeg ) */ jpeg_destroy_decompress( &jpeg->cinfo ); - VIPS_UNREF( jpeg->input ); + VIPS_UNREF( jpeg->streami ); return( 0 ); } @@ -338,13 +338,13 @@ readjpeg_close_cb( VipsObject *object, ReadJpeg *jpeg ) } static void -input_minimise_cb( VipsImage *image, VipsStreami *input ) +readjpeg_minimise_cb( VipsImage *image, ReadJpeg *jpeg ) { - vips_streami_minimise( input ); + vips_streami_minimise( jpeg->streami ); } static ReadJpeg * -readjpeg_new( VipsStreami *input, VipsImage *out, +readjpeg_new( VipsStreami *streami, VipsImage *out, int shrink, gboolean fail, gboolean autorotate ) { ReadJpeg *jpeg; @@ -352,8 +352,8 @@ readjpeg_new( VipsStreami *input, VipsImage *out, if( !(jpeg = VIPS_NEW( out, ReadJpeg )) ) return( NULL ); - jpeg->input = input; - g_object_ref( input ); + jpeg->streami = streami; + g_object_ref( streami ); jpeg->shrink = shrink; jpeg->fail = fail; jpeg->cinfo.err = jpeg_std_error( &jpeg->eman.pub ); @@ -379,7 +379,7 @@ readjpeg_new( VipsStreami *input, VipsImage *out, g_signal_connect( out, "close", G_CALLBACK( readjpeg_close_cb ), jpeg ); g_signal_connect( out, "minimise", - G_CALLBACK( input_minimise_cb ), input ); + G_CALLBACK( readjpeg_minimise_cb ), jpeg ); return( jpeg ); } @@ -559,7 +559,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out ) xres, yres ); VIPS_SETSTR( out->filename, - vips_stream_filename( VIPS_STREAM( jpeg->input ) ) ); + vips_stream_filename( VIPS_STREAM( jpeg->streami ) ) ); vips_image_pipelinev( out, VIPS_DEMAND_STYLE_FATSTRIP, NULL ); @@ -959,12 +959,12 @@ vips__jpeg_read( ReadJpeg *jpeg, VipsImage *out, gboolean header_only ) } int -vips__jpeg_read_stream( VipsStreami *input, VipsImage *out, +vips__jpeg_read_stream( VipsStreami *streami, VipsImage *out, gboolean header_only, int shrink, int fail, gboolean autorotate ) { ReadJpeg *jpeg; - if( !(jpeg = readjpeg_new( input, out, shrink, fail, autorotate )) ) + if( !(jpeg = readjpeg_new( streami, out, shrink, fail, autorotate )) ) return( -1 ); if( setjmp( jpeg->eman.jmp ) ) @@ -975,19 +975,21 @@ vips__jpeg_read_stream( VipsStreami *input, VipsImage *out, return( -1 ); if( header_only ) - vips_streami_minimise( input ); - else if( vips_streami_decode( input ) ) - return( -1 ); + vips_streami_minimise( streami ); + else { + if( vips_streami_decode( streami ) ) + return( -1 ); + } return( 0 ); } int -vips__isjpeg_stream( VipsStreami *input ) +vips__isjpeg_stream( VipsStreami *streami ) { const unsigned char *p; - if( (p = vips_streami_sniff( input, 2 )) && + if( (p = vips_streami_sniff( streami, 2 )) && p[0] == 0xff && p[1] == 0xd8 ) return( 1 ); diff --git a/libvips/foreign/jpegload.c b/libvips/foreign/jpegload.c index eedfdaf0..2c2593cb 100644 --- a/libvips/foreign/jpegload.c +++ b/libvips/foreign/jpegload.c @@ -153,7 +153,7 @@ vips_foreign_load_jpeg_init( VipsForeignLoadJpeg *jpeg ) typedef struct _VipsForeignLoadJpegStream { VipsForeignLoadJpeg parent_object; - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadJpegStream; @@ -168,7 +168,7 @@ vips_foreign_load_jpeg_stream_header( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegStream *stream = (VipsForeignLoadJpegStream *) load; - if( vips__jpeg_read_stream( stream->input, + if( vips__jpeg_read_stream( stream->streami, load->out, TRUE, jpeg->shrink, load->fail, jpeg->autorotate ) ) return( -1 ); @@ -181,7 +181,7 @@ vips_foreign_load_jpeg_stream_load( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegStream *stream = (VipsForeignLoadJpegStream *) load; - if( vips__jpeg_read_stream( stream->input, + if( vips__jpeg_read_stream( stream->streami, load->real, FALSE, jpeg->shrink, load->fail, jpeg->autorotate ) ) return( -1 ); @@ -190,9 +190,9 @@ vips_foreign_load_jpeg_stream_load( VipsForeignLoad *load ) } static gboolean -vips_foreign_load_jpeg_stream_is_a( VipsStreami *input ) +vips_foreign_load_jpeg_stream_is_a( VipsStreami *streami ) { - return( vips__isjpeg_stream( input ) ); + return( vips__isjpeg_stream( streami ) ); } static void @@ -217,7 +217,7 @@ vips_foreign_load_jpeg_stream_class_init( _( "Input" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadJpegStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadJpegStream, streami ), VIPS_TYPE_STREAMI ); } @@ -242,13 +242,13 @@ G_DEFINE_TYPE( VipsForeignLoadJpegFile, vips_foreign_load_jpeg_file, static gboolean vips_foreign_load_jpeg_file_is_a( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__isjpeg_stream( input ); - VIPS_UNREF( input ); + result = vips__isjpeg_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -259,16 +259,16 @@ vips_foreign_load_jpeg_file_header( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegFile *file = (VipsForeignLoadJpegFile *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__jpeg_read_stream( input, load->out, + if( vips__jpeg_read_stream( streami, load->out, TRUE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -279,16 +279,16 @@ vips_foreign_load_jpeg_file_load( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegFile *file = (VipsForeignLoadJpegFile *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__jpeg_read_stream( input, load->real, + if( vips__jpeg_read_stream( streami, load->real, FALSE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -345,13 +345,13 @@ G_DEFINE_TYPE( VipsForeignLoadJpegBuffer, vips_foreign_load_jpeg_buffer, static gboolean vips_foreign_load_jpeg_buffer_is_a_buffer( const void *buf, size_t len ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_memory( buf, len )) ) + if( !(streami = vips_streami_new_from_memory( buf, len )) ) return( FALSE ); - result = vips__isjpeg_stream( input ); - VIPS_UNREF( input ); + result = vips__isjpeg_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -362,16 +362,16 @@ vips_foreign_load_jpeg_buffer_header( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegBuffer *buffer = (VipsForeignLoadJpegBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_blob( buffer->blob )) ) + if( !(streami = vips_streami_new_from_blob( buffer->blob )) ) return( -1 ); - if( vips__jpeg_read_stream( input, load->out, + if( vips__jpeg_read_stream( streami, load->out, TRUE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -382,16 +382,16 @@ vips_foreign_load_jpeg_buffer_load( VipsForeignLoad *load ) VipsForeignLoadJpeg *jpeg = (VipsForeignLoadJpeg *) load; VipsForeignLoadJpegBuffer *buffer = (VipsForeignLoadJpegBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_blob( buffer->blob )) ) + if( !(streami = vips_streami_new_from_blob( buffer->blob )) ) return( -1 ); - if( vips__jpeg_read_stream( input, load->real, + if( vips__jpeg_read_stream( streami, load->real, FALSE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } diff --git a/libvips/foreign/jpegsave.c b/libvips/foreign/jpegsave.c index 2b01b981..54b58ee0 100644 --- a/libvips/foreign/jpegsave.c +++ b/libvips/foreign/jpegsave.c @@ -219,7 +219,7 @@ vips_foreign_save_jpeg_init( VipsForeignSaveJpeg *jpeg ) typedef struct _VipsForeignSaveJpegStream { VipsForeignSaveJpeg parent_object; - VipsStreamo *output; + VipsStreamo *streamo; } VipsForeignSaveJpegStream; @@ -240,7 +240,7 @@ vips_foreign_save_jpeg_stream_build( VipsObject *object ) build( object ) ) return( -1 ); - if( vips__jpeg_write_stream( save->ready, stream->output, + if( vips__jpeg_write_stream( save->ready, stream->streamo, jpeg->Q, jpeg->profile, jpeg->optimize_coding, jpeg->interlace, save->strip, jpeg->no_subsample, jpeg->trellis_quant, jpeg->overshoot_deringing, @@ -264,11 +264,11 @@ vips_foreign_save_jpeg_stream_class_init( object_class->description = _( "save image to jpeg stream" ); object_class->build = vips_foreign_save_jpeg_stream_build; - VIPS_ARG_OBJECT( class, "output", 1, - _( "Output" ), + VIPS_ARG_OBJECT( class, "streamo", 1, + _( "Streamo" ), _( "Stream to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveJpegStream, output ), + G_STRUCT_OFFSET( VipsForeignSaveJpegStream, streamo ), VIPS_TYPE_STREAMO ); } @@ -299,23 +299,23 @@ vips_foreign_save_jpeg_file_build( VipsObject *object ) VipsForeignSaveJpeg *jpeg = (VipsForeignSaveJpeg *) object; VipsForeignSaveJpegFile *file = (VipsForeignSaveJpegFile *) object; - VipsStreamo *output; + VipsStreamo *streamo; if( VIPS_OBJECT_CLASS( vips_foreign_save_jpeg_file_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) return( -1 ); - if( vips__jpeg_write_stream( save->ready, output, + if( vips__jpeg_write_stream( save->ready, streamo, jpeg->Q, jpeg->profile, jpeg->optimize_coding, jpeg->interlace, save->strip, jpeg->no_subsample, jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans, jpeg->quant_table ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -367,30 +367,30 @@ vips_foreign_save_jpeg_buffer_build( VipsObject *object ) VipsForeignSaveJpeg *jpeg = (VipsForeignSaveJpeg *) object; VipsForeignSaveJpegBuffer *file = (VipsForeignSaveJpegBuffer *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; if( VIPS_OBJECT_CLASS( vips_foreign_save_jpeg_buffer_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__jpeg_write_stream( save->ready, output, + if( vips__jpeg_write_stream( save->ready, streamo, jpeg->Q, jpeg->profile, jpeg->optimize_coding, jpeg->interlace, save->strip, jpeg->no_subsample, jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans, jpeg->quant_table ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); g_object_set( file, "buffer", blob, NULL ); vips_area_unref( VIPS_AREA( blob ) ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -438,7 +438,7 @@ vips_foreign_save_jpeg_mime_build( VipsObject *object ) VipsForeignSave *save = (VipsForeignSave *) object; VipsForeignSaveJpeg *jpeg = (VipsForeignSaveJpeg *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; const unsigned char *obuf; size_t olen; @@ -447,19 +447,19 @@ vips_foreign_save_jpeg_mime_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__jpeg_write_stream( save->ready, output, + if( vips__jpeg_write_stream( save->ready, streamo, jpeg->Q, jpeg->profile, jpeg->optimize_coding, jpeg->interlace, save->strip, jpeg->no_subsample, jpeg->trellis_quant, jpeg->overshoot_deringing, jpeg->optimize_scans, jpeg->quant_table ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); obuf = vips_blob_get( blob, &olen ); printf( "Content-length: %zu\r\n", olen ); @@ -470,7 +470,7 @@ vips_foreign_save_jpeg_mime_build( VipsObject *object ) vips_area_unref( VIPS_AREA( blob ) ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -612,7 +612,7 @@ vips_jpegsave( VipsImage *in, const char *filename, ... ) /** * vips_jpegsave_stream: (method) * @in: image to save - * @output: save image to this stream + * @streamo: save image to this stream * @...: %NULL-terminated list of optional named arguments * * Optional arguments: @@ -635,13 +635,13 @@ vips_jpegsave( VipsImage *in, const char *filename, ... ) * Returns: 0 on success, -1 on error. */ int -vips_jpegsave_stream( VipsImage *in, VipsStreamo *output, ... ) +vips_jpegsave_stream( VipsImage *in, VipsStreamo *streamo, ... ) { va_list ap; int result; - va_start( ap, output ); - result = vips_call_split( "jpegsave_stream", ap, in, output ); + va_start( ap, streamo ); + result = vips_call_split( "jpegsave_stream", ap, in, streamo ); va_end( ap ); return( result ); diff --git a/libvips/foreign/pforeign.h b/libvips/foreign/pforeign.h index 4d022784..fdfac85b 100644 --- a/libvips/foreign/pforeign.h +++ b/libvips/foreign/pforeign.h @@ -156,7 +156,7 @@ int vips__rad_israd( VipsStreami *streami ); int vips__rad_header( VipsStreami *streami, VipsImage *out ); int vips__rad_load( VipsStreami *streami, VipsImage *out ); -int vips__rad_save( VipsImage *in, VipsStreamo *output ); +int vips__rad_save( VipsImage *in, VipsStreamo *streamo ); extern const char *vips__rad_suffs[]; diff --git a/libvips/foreign/pngload.c b/libvips/foreign/pngload.c index 09909686..1352b997 100644 --- a/libvips/foreign/pngload.c +++ b/libvips/foreign/pngload.c @@ -57,7 +57,7 @@ typedef struct _VipsForeignLoadPngStream { /* Load from a stream. */ - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadPngStream; @@ -74,7 +74,7 @@ vips_foreign_load_png_stream_get_flags( VipsForeignLoad *load ) VipsForeignFlags flags; flags = 0; - if( vips__png_isinterlaced_stream( stream->input ) ) + if( vips__png_isinterlaced_stream( stream->streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; @@ -87,7 +87,7 @@ vips_foreign_load_png_stream_header( VipsForeignLoad *load ) { VipsForeignLoadPngStream *stream = (VipsForeignLoadPngStream *) load; - if( vips__png_header_stream( stream->input, load->out ) ) + if( vips__png_header_stream( stream->streami, load->out ) ) return( -1 ); return( 0 ); @@ -98,7 +98,7 @@ vips_foreign_load_png_stream_load( VipsForeignLoad *load ) { VipsForeignLoadPngStream *stream = (VipsForeignLoadPngStream *) load; - if( vips__png_read_stream( stream->input, load->real, load->fail ) ) + if( vips__png_read_stream( stream->streami, load->real, load->fail ) ) return( -1 ); return( 0 ); @@ -122,11 +122,11 @@ vips_foreign_load_png_stream_class_init( VipsForeignLoadPngStreamClass *class ) load_class->header = vips_foreign_load_png_stream_header; load_class->load = vips_foreign_load_png_stream_load; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadPngStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadPngStream, streami ), VIPS_TYPE_STREAMI ); } @@ -153,13 +153,13 @@ G_DEFINE_TYPE( VipsForeignLoadPng, vips_foreign_load_png, static gboolean vips_foreign_load_png_is_a( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__png_ispng_stream( input ); - VIPS_UNREF( input ); + result = vips__png_ispng_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -167,19 +167,19 @@ vips_foreign_load_png_is_a( const char *filename ) static VipsForeignFlags vips_foreign_load_png_get_flags_filename( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; VipsForeignFlags flags; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( 0 ); flags = 0; - if( vips__png_isinterlaced_stream( input ) ) + if( vips__png_isinterlaced_stream( streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( flags ); } @@ -197,15 +197,15 @@ vips_foreign_load_png_header( VipsForeignLoad *load ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( png->filename )) ) + if( !(streami = vips_streami_new_from_filename( png->filename )) ) return( -1 ); - if( vips__png_header_stream( input, load->out ) ) { - VIPS_UNREF( input ); + if( vips__png_header_stream( streami, load->out ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -215,15 +215,15 @@ vips_foreign_load_png_load( VipsForeignLoad *load ) { VipsForeignLoadPng *png = (VipsForeignLoadPng *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( png->filename )) ) + if( !(streami = vips_streami_new_from_filename( png->filename )) ) return( -1 ); - if( vips__png_read_stream( input, load->real, load->fail ) ) { - VIPS_UNREF( input ); + if( vips__png_read_stream( streami, load->real, load->fail ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -285,13 +285,13 @@ G_DEFINE_TYPE( VipsForeignLoadPngBuffer, vips_foreign_load_png_buffer, static gboolean vips_foreign_load_png_buffer_is_a_buffer( const void *buf, size_t len ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_memory( buf, len )) ) + if( !(streami = vips_streami_new_from_memory( buf, len )) ) return( FALSE ); - result = vips__png_ispng_stream( input ); - VIPS_UNREF( input ); + result = vips__png_ispng_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -301,20 +301,20 @@ vips_foreign_load_png_buffer_get_flags( VipsForeignLoad *load ) { VipsForeignLoadPngBuffer *buffer = (VipsForeignLoadPngBuffer *) load; - VipsStreami *input; + VipsStreami *streami; VipsForeignFlags flags; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( 0 ); flags = 0; - if( vips__png_isinterlaced_stream( input ) ) + if( vips__png_isinterlaced_stream( streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( flags ); } @@ -324,16 +324,16 @@ vips_foreign_load_png_buffer_header( VipsForeignLoad *load ) { VipsForeignLoadPngBuffer *buffer = (VipsForeignLoadPngBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( -1 ); - if( vips__png_header_stream( input, load->out ) ) { - VIPS_UNREF( input ); + if( vips__png_header_stream( streami, load->out ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -343,16 +343,16 @@ vips_foreign_load_png_buffer_load( VipsForeignLoad *load ) { VipsForeignLoadPngBuffer *buffer = (VipsForeignLoadPngBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( -1 ); - if( vips__png_read_stream( input, load->real, load->fail ) ) { - VIPS_UNREF( input ); + if( vips__png_read_stream( streami, load->real, load->fail ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -458,7 +458,7 @@ vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_pngload_stream: - * @input: stream to load from + * @streami: stream to load from * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * @@ -469,13 +469,13 @@ vips_pngload_buffer( void *buf, size_t len, VipsImage **out, ... ) * Returns: 0 on success, -1 on error. */ int -vips_pngload_stream( VipsStreami *input, VipsImage **out, ... ) +vips_pngload_stream( VipsStreami *streami, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); - result = vips_call_split( "pngload_stream", ap, input, out ); + result = vips_call_split( "pngload_stream", ap, streami, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index 5e00b2cf..f3cb98cc 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -182,7 +182,7 @@ vips_foreign_save_png_init( VipsForeignSavePng *png ) typedef struct _VipsForeignSavePngStream { VipsForeignSavePng parent_object; - VipsStreamo *output; + VipsStreamo *streamo; } VipsForeignSavePngStream; typedef VipsForeignSavePngClass VipsForeignSavePngStreamClass; @@ -201,7 +201,7 @@ vips_foreign_save_png_stream_build( VipsObject *object ) build( object ) ) return( -1 ); - if( vips__png_write_stream( save->ready, stream->output, + if( vips__png_write_stream( save->ready, stream->streamo, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) return( -1 ); @@ -222,11 +222,11 @@ vips_foreign_save_png_stream_class_init( VipsForeignSavePngStreamClass *class ) object_class->description = _( "save image to png stream" ); object_class->build = vips_foreign_save_png_stream_build; - VIPS_ARG_OBJECT( class, "output", 1, - _( "Output" ), + VIPS_ARG_OBJECT( class, "streamo", 1, + _( "Streamo" ), _( "Stream to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSavePngStream, output ), + G_STRUCT_OFFSET( VipsForeignSavePngStream, streamo ), VIPS_TYPE_STREAMO ); } @@ -254,23 +254,23 @@ vips_foreign_save_png_file_build( VipsObject *object ) VipsForeignSavePng *png = (VipsForeignSavePng *) object; VipsForeignSavePngFile *png_file = (VipsForeignSavePngFile *) object; - VipsStreamo *output; + VipsStreamo *streamo; if( VIPS_OBJECT_CLASS( vips_foreign_save_png_file_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_filename( + if( !(streamo = vips_streamo_new_to_filename( png_file->filename )) ) return( -1 ); - if( vips__png_write_stream( save->ready, output, + if( vips__png_write_stream( save->ready, streamo, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -319,29 +319,29 @@ vips_foreign_save_png_buffer_build( VipsObject *object ) VipsForeignSavePng *png = (VipsForeignSavePng *) object; VipsForeignSavePngBuffer *buffer = (VipsForeignSavePngBuffer *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; if( VIPS_OBJECT_CLASS( vips_foreign_save_png_buffer_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__png_write_stream( save->ready, output, + if( vips__png_write_stream( save->ready, streamo, png->compression, png->interlace, png->profile, png->filter, save->strip, png->palette, png->colours, png->Q, png->dither ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); g_object_set( buffer, "buffer", blob, NULL ); vips_area_unref( VIPS_AREA( blob ) ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -501,7 +501,7 @@ vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) /** * vips_pngsave_stream: (method) * @in: image to save - * @output: save image to this stream + * @streamo: save image to this stream * @...: %NULL-terminated list of optional named arguments * * Optional arguments: @@ -522,13 +522,13 @@ vips_pngsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * Returns: 0 on success, -1 on error. */ int -vips_pngsave_stream( VipsImage *in, VipsStreamo *output, ... ) +vips_pngsave_stream( VipsImage *in, VipsStreamo *streamo, ... ) { va_list ap; int result; - va_start( ap, output ); - result = vips_call_split( "pngsave_stream", ap, in, output ); + va_start( ap, streamo ); + result = vips_call_split( "pngsave_stream", ap, in, streamo ); va_end( ap ); return( result ); diff --git a/libvips/foreign/radiance.c b/libvips/foreign/radiance.c index 257c46de..c6bcca02 100644 --- a/libvips/foreign/radiance.c +++ b/libvips/foreign/radiance.c @@ -977,7 +977,7 @@ vips__rad_load( VipsStreami *streami, VipsImage *out ) */ typedef struct { VipsImage *in; - VipsStreamo *output; + VipsStreamo *streamo; char format[256]; double expos; @@ -992,13 +992,13 @@ static void write_destroy( Write *write ) { VIPS_FREE( write->line ); - VIPS_UNREF( write->output ); + VIPS_UNREF( write->streamo ); vips_free( write ); } static Write * -write_new( VipsImage *in, VipsStreamo *output ) +write_new( VipsImage *in, VipsStreamo *streamo ) { Write *write; int i; @@ -1007,8 +1007,8 @@ write_new( VipsImage *in, VipsStreamo *output ) return( NULL ); write->in = in; - write->output = output; - g_object_ref( output ); + write->streamo = streamo; + g_object_ref( streamo ); strcpy( write->format, COLRFMT ); write->expos = 1.0; @@ -1082,25 +1082,25 @@ vips2rad_put_header( Write *write ) { vips2rad_make_header( write ); - vips_streamo_writef( write->output, "#?RADIANCE\n" ); - vips_streamo_writef( write->output, "%s%s\n", FMTSTR, write->format ); - vips_streamo_writef( write->output, "%s%e\n", EXPOSSTR, write->expos ); - vips_streamo_writef( write->output, + vips_streamo_writef( write->streamo, "#?RADIANCE\n" ); + vips_streamo_writef( write->streamo, "%s%s\n", FMTSTR, write->format ); + vips_streamo_writef( write->streamo, "%s%e\n", EXPOSSTR, write->expos ); + vips_streamo_writef( write->streamo, "%s %f %f %f\n", COLCORSTR, write->colcor[RED], write->colcor[GRN], write->colcor[BLU] ); - vips_streamo_writef( write->output, + vips_streamo_writef( write->streamo, "SOFTWARE=vips %s\n", vips_version_string() ); - vips_streamo_writef( write->output, + vips_streamo_writef( write->streamo, "%s%f\n", ASPECTSTR, write->aspect ); - vips_streamo_writef( write->output, + vips_streamo_writef( write->streamo, "%s %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\n", PRIMARYSTR, write->prims[RED][CIEX], write->prims[RED][CIEY], write->prims[GRN][CIEX], write->prims[GRN][CIEY], write->prims[BLU][CIEX], write->prims[BLU][CIEY], write->prims[WHT][CIEX], write->prims[WHT][CIEY] ); - vips_streamo_writef( write->output, "\n" ); - vips_streamo_writef( write->output, + vips_streamo_writef( write->streamo, "\n" ); + vips_streamo_writef( write->streamo, "%s", resolu2str( resolu_buf, &write->rs ) ); return( 0 ); @@ -1115,7 +1115,7 @@ scanline_write( Write *write, COLR *scanline, int width ) width > MAXELEN ) { /* Too large or small for RLE ... do a simple write. */ - if( vips_streamo_write( write->output, + if( vips_streamo_write( write->streamo, scanline, sizeof( COLR ) * width ) ) return( -1 ); } @@ -1126,7 +1126,7 @@ scanline_write( Write *write, COLR *scanline, int width ) */ rle_scanline_write( scanline, width, write->line, &length ); - if( vips_streamo_write( write->output, write->line, length ) ) + if( vips_streamo_write( write->streamo, write->line, length ) ) return( -1 ); } @@ -1159,7 +1159,7 @@ vips2rad_put_data( Write *write ) } int -vips__rad_save( VipsImage *in, VipsStreamo *output ) +vips__rad_save( VipsImage *in, VipsStreamo *streamo ) { Write *write; @@ -1170,7 +1170,7 @@ vips__rad_save( VipsImage *in, VipsStreamo *output ) if( vips_image_pio_input( in ) || vips_check_coding_rad( "vips2rad", in ) ) return( -1 ); - if( !(write = write_new( in, output )) ) + if( !(write = write_new( in, streamo )) ) return( -1 ); if( vips2rad_put_header( write ) || @@ -1179,7 +1179,7 @@ vips__rad_save( VipsImage *in, VipsStreamo *output ) return( -1 ); } - vips_streamo_finish( output ); + vips_streamo_finish( streamo ); write_destroy( write ); diff --git a/libvips/foreign/radload.c b/libvips/foreign/radload.c index c1542c2e..7c0a12d4 100644 --- a/libvips/foreign/radload.c +++ b/libvips/foreign/radload.c @@ -57,7 +57,7 @@ typedef struct _VipsForeignLoadRadStream { /* Load from a stream. */ - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadRadStream; @@ -79,7 +79,7 @@ vips_foreign_load_rad_stream_header( VipsForeignLoad *load ) { VipsForeignLoadRadStream *stream = (VipsForeignLoadRadStream *) load; - if( vips__rad_header( stream->input, load->out ) ) + if( vips__rad_header( stream->streami, load->out ) ) return( -1 ); return( 0 ); @@ -90,7 +90,7 @@ vips_foreign_load_rad_stream_load( VipsForeignLoad *load ) { VipsForeignLoadRadStream *stream = (VipsForeignLoadRadStream *) load; - if( vips__rad_load( stream->input, load->real ) ) + if( vips__rad_load( stream->streami, load->real ) ) return( -1 ); return( 0 ); @@ -114,11 +114,11 @@ vips_foreign_load_rad_stream_class_init( VipsForeignLoadRadStreamClass *class ) load_class->header = vips_foreign_load_rad_stream_header; load_class->load = vips_foreign_load_rad_stream_load; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadRadStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadRadStream, streami ), VIPS_TYPE_STREAMI ); } @@ -265,13 +265,13 @@ G_DEFINE_TYPE( VipsForeignLoadRadBuffer, vips_foreign_load_rad_buffer, static gboolean vips_foreign_load_rad_buffer_is_a_buffer( const void *buf, size_t len ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_memory( buf, len )) ) + if( !(streami = vips_streami_new_from_memory( buf, len )) ) return( FALSE ); - result = vips__rad_israd( input ); - VIPS_UNREF( input ); + result = vips__rad_israd( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -289,16 +289,16 @@ vips_foreign_load_rad_buffer_header( VipsForeignLoad *load ) { VipsForeignLoadRadBuffer *buffer = (VipsForeignLoadRadBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( -1 ); - if( vips__rad_header( input, load->out ) ) { - VIPS_UNREF( input ); + if( vips__rad_header( streami, load->out ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -308,16 +308,16 @@ vips_foreign_load_rad_buffer_load( VipsForeignLoad *load ) { VipsForeignLoadRadBuffer *buffer = (VipsForeignLoadRadBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( -1 ); - if( vips__rad_load( input, load->real ) ) { - VIPS_UNREF( input ); + if( vips__rad_load( streami, load->real ) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -431,7 +431,7 @@ vips_radload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_radload_stream: - * @input: stream to load from + * @streami: stream to load from * @out: (out): output image * @...: %NULL-terminated list of optional named arguments * @@ -442,13 +442,13 @@ vips_radload_buffer( void *buf, size_t len, VipsImage **out, ... ) * Returns: 0 on success, -1 on error. */ int -vips_radload_stream( VipsStreami *input, VipsImage **out, ... ) +vips_radload_stream( VipsStreami *streami, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); - result = vips_call_split( "radload_stream", ap, input, out ); + result = vips_call_split( "radload_stream", ap, streami, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/radsave.c b/libvips/foreign/radsave.c index 40345b84..6a66659f 100644 --- a/libvips/foreign/radsave.c +++ b/libvips/foreign/radsave.c @@ -122,19 +122,19 @@ vips_foreign_save_rad_file_build( VipsObject *object ) VipsForeignSave *save = (VipsForeignSave *) object; VipsForeignSaveRadFile *file = (VipsForeignSaveRadFile *) object; - VipsStreamo *output; + VipsStreamo *streamo; if( VIPS_OBJECT_CLASS( vips_foreign_save_rad_file_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) return( -1 ); - if( vips__rad_save( save->ready, output ) ) { - VIPS_UNREF( output ); + if( vips__rad_save( save->ready, streamo ) ) { + VIPS_UNREF( streamo ); return( -1 ); } - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -168,7 +168,7 @@ vips_foreign_save_rad_file_init( VipsForeignSaveRadFile *file ) typedef struct _VipsForeignSaveRadStream { VipsForeignSaveRad parent_object; - VipsStreamo *output; + VipsStreamo *streamo; } VipsForeignSaveRadStream; typedef VipsForeignSaveRadClass VipsForeignSaveRadStreamClass; @@ -186,7 +186,7 @@ vips_foreign_save_rad_stream_build( VipsObject *object ) build( object ) ) return( -1 ); - if( vips__rad_save( save->ready, stream->output ) ) + if( vips__rad_save( save->ready, stream->streamo ) ) return( -1 ); return( 0 ); @@ -205,11 +205,11 @@ vips_foreign_save_rad_stream_class_init( VipsForeignSaveRadStreamClass *class ) object_class->description = _( "save image to Radiance stream" ); object_class->build = vips_foreign_save_rad_stream_build; - VIPS_ARG_OBJECT( class, "output", 1, - _( "Output" ), + VIPS_ARG_OBJECT( class, "streamo", 1, + _( "Streamo" ), _( "Stream to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveRadStream, output ), + G_STRUCT_OFFSET( VipsForeignSaveRadStream, streamo ), VIPS_TYPE_STREAMO ); } @@ -235,26 +235,26 @@ vips_foreign_save_rad_buffer_build( VipsObject *object ) { VipsForeignSave *save = (VipsForeignSave *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; if( VIPS_OBJECT_CLASS( vips_foreign_save_rad_buffer_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__rad_save( save->ready, output ) ) { - VIPS_UNREF( output ); + if( vips__rad_save( save->ready, streamo ) ) { + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); g_object_set( save, "buffer", blob, NULL ); vips_area_unref( VIPS_AREA( blob ) ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -362,7 +362,7 @@ vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) /** * vips_radsave_stream: (method) * @in: image to save - * @output: save image to this stream + * @streamo: save image to this stream * @...: %NULL-terminated list of optional named arguments * * As vips_radsave(), but save to a stream. @@ -372,13 +372,13 @@ vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) * Returns: 0 on success, -1 on error. */ int -vips_radsave_stream( VipsImage *in, VipsStreamo *output, ... ) +vips_radsave_stream( VipsImage *in, VipsStreamo *streamo, ... ) { va_list ap; int result; - va_start( ap, output ); - result = vips_call_split( "radsave_stream", ap, in, output ); + va_start( ap, streamo ); + result = vips_call_split( "radsave_stream", ap, in, streamo ); va_end( ap ); return( result ); diff --git a/libvips/foreign/svgload.c b/libvips/foreign/svgload.c index 10bd57bf..6e1b3819 100644 --- a/libvips/foreign/svgload.c +++ b/libvips/foreign/svgload.c @@ -461,7 +461,7 @@ typedef struct _VipsForeignLoadSvgStream { /* Load from a stream. */ - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadSvgStream; @@ -471,12 +471,12 @@ G_DEFINE_TYPE( VipsForeignLoadSvgStream, vips_foreign_load_svg_stream, vips_foreign_load_svg_get_type() ); gboolean -vips_foreign_load_svg_stream_is_a( VipsStreami *input ) +vips_foreign_load_svg_stream_is_a( VipsStreami *streami ) { unsigned char *data; size_t bytes_read; - if( (bytes_read = vips_streami_sniff_at_most( input, + if( (bytes_read = vips_streami_sniff_at_most( streami, &data, SVG_HEADER_SIZE )) <= 0 ) return( FALSE ); @@ -495,10 +495,10 @@ vips_foreign_load_svg_stream_header( VipsForeignLoad *load ) GInputStream *gstream; - if( vips_streami_rewind( stream->input ) ) + if( vips_streami_rewind( stream->streami ) ) return( -1 ); - gstream = g_input_stream_new_from_vips( stream->input ); + gstream = g_input_stream_new_from_vips( stream->streami ); if( !(svg->page = rsvg_handle_new_from_stream_sync( gstream, NULL, flags, NULL, &error )) ) { g_object_unref( gstream ); @@ -515,9 +515,9 @@ vips_foreign_load_svg_stream_load( VipsForeignLoad *load ) { VipsForeignLoadSvgStream *stream = (VipsForeignLoadSvgStream *) load; - if( vips_streami_rewind( stream->input ) || + if( vips_streami_rewind( stream->streami ) || vips_foreign_load_svg_load( load ) || - vips_streami_decode( stream->input ) ) + vips_streami_decode( stream->streami ) ) return( -1 ); return( 0 ); @@ -540,11 +540,11 @@ vips_foreign_load_svg_stream_class_init( VipsForeignLoadSvgStreamClass *class ) load_class->header = vips_foreign_load_svg_stream_header; load_class->load = vips_foreign_load_svg_stream_load; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadSvgStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadSvgStream, streami ), VIPS_TYPE_STREAMI ); } @@ -805,7 +805,7 @@ vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_svgload_stream: - * @input: stream to load from + * @streami: stream to load from * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * @@ -816,13 +816,13 @@ vips_svgload_buffer( void *buf, size_t len, VipsImage **out, ... ) * Returns: 0 on success, -1 on error. */ int -vips_svgload_stream( VipsStreami *input, VipsImage **out, ... ) +vips_svgload_stream( VipsStreami *streami, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); - result = vips_call_split( "svgload_stream", ap, input, out ); + result = vips_call_split( "svgload_stream", ap, streami, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/tiff.c b/libvips/foreign/tiff.c index 479e705c..32336026 100644 --- a/libvips/foreign/tiff.c +++ b/libvips/foreign/tiff.c @@ -138,9 +138,9 @@ vips__tiff_openout( const char *path, gboolean bigtiff ) static tsize_t openin_stream_read( thandle_t st, tdata_t data, tsize_t size ) { - VipsStreami *input = VIPS_STREAMI( st ); + VipsStreami *streami = VIPS_STREAMI( st ); - return( vips_streami_read( input, data, size ) ); + return( vips_streami_read( streami, data, size ) ); } static tsize_t @@ -154,17 +154,17 @@ 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 ) { - VipsStreami *input = VIPS_STREAMI( st ); + VipsStreami *streami = VIPS_STREAMI( st ); - return( vips_streami_seek( input, position, whence ) ); + return( vips_streami_seek( streami, position, whence ) ); } static int openin_stream_close( thandle_t st ) { - VipsStreami *input = VIPS_STREAMI( st ); + VipsStreami *streami = VIPS_STREAMI( st ); - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -172,12 +172,12 @@ openin_stream_close( thandle_t st ) static toff_t openin_stream_size( thandle_t st ) { - VipsStreami *input = VIPS_STREAMI( st ); + VipsStreami *streami = VIPS_STREAMI( st ); /* libtiff will use this to get file size if tags like StripByteCounts * are missing. */ - return( vips_streami_size( input ) ); + return( vips_streami_size( streami ) ); } static int @@ -197,7 +197,7 @@ openin_stream_unmap( thandle_t st, tdata_t start, toff_t len ) } TIFF * -vips__tiff_openin_stream( VipsStreami *input ) +vips__tiff_openin_stream( VipsStreami *streami ) { TIFF *tiff; @@ -205,11 +205,11 @@ vips__tiff_openin_stream( VipsStreami *input ) printf( "vips__tiff_openin_stream:\n" ); #endif /*DEBUG*/ - if( vips_streami_rewind( input ) ) + if( vips_streami_rewind( streami ) ) return( NULL ); if( !(tiff = TIFFClientOpen( "stream input", "rm", - (thandle_t) input, + (thandle_t) streami, openin_stream_read, openin_stream_write, openin_stream_seek, @@ -224,7 +224,7 @@ vips__tiff_openin_stream( VipsStreami *input ) /* Unreffed on close(), see above. */ - g_object_ref( input ); + g_object_ref( streami ); return( tiff ); } diff --git a/libvips/foreign/tiff.h b/libvips/foreign/tiff.h index b78c816b..a309d485 100644 --- a/libvips/foreign/tiff.h +++ b/libvips/foreign/tiff.h @@ -37,13 +37,12 @@ extern "C" { #endif /*__cplusplus*/ -TIFF *vips__tiff_openin_stream( VipsStreami *input ); +TIFF *vips__tiff_openin_stream( VipsStreami *streami ); TIFF *vips__tiff_openout( const char *path, gboolean bigtiff ); TIFF *vips__tiff_openout_buffer( VipsImage *image, gboolean bigtiff, void **out_data, size_t *out_length ); - #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index e3f72fa8..e42fef91 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -300,7 +300,7 @@ typedef void (*scanline_process_fn)( struct _Rtiff *, typedef struct _Rtiff { /* Parameters. */ - VipsStreami *input; + VipsStreami *streami; VipsImage *out; int page; int n; @@ -488,7 +488,7 @@ static void rtiff_free( Rtiff *rtiff ) { VIPS_FREEF( TIFFClose, rtiff->tiff ); - VIPS_UNREF( rtiff->input ); + VIPS_UNREF( rtiff->streami ); } static void @@ -500,12 +500,12 @@ rtiff_close_cb( VipsObject *object, Rtiff *rtiff ) static void rtiff_minimise_cb( VipsImage *image, Rtiff *rtiff ) { - if( rtiff->input ) - vips_streami_minimise( rtiff->input ); + if( rtiff->streami ) + vips_streami_minimise( rtiff->streami ); } static Rtiff * -rtiff_new( VipsStreami *input, VipsImage *out, +rtiff_new( VipsStreami *streami, VipsImage *out, int page, int n, gboolean autorotate ) { Rtiff *rtiff; @@ -513,8 +513,8 @@ rtiff_new( VipsStreami *input, VipsImage *out, if( !(rtiff = VIPS_NEW( out, Rtiff )) ) return( NULL ); - g_object_ref( input ); - rtiff->input = input; + g_object_ref( streami ); + rtiff->streami = streami; rtiff->out = out; rtiff->page = page; rtiff->n = n; @@ -551,7 +551,7 @@ rtiff_new( VipsStreami *input, VipsImage *out, return( NULL ); } - if( !(rtiff->tiff = vips__tiff_openin_stream( input )) ) + if( !(rtiff->tiff = vips__tiff_openin_stream( streami )) ) return( NULL ); return( rtiff ); @@ -1369,7 +1369,7 @@ rtiff_set_header( Rtiff *rtiff, VipsImage *out ) out->Ysize = rtiff->header.height * rtiff->n; VIPS_SETSTR( out->filename, - vips_stream_filename( VIPS_STREAM( rtiff->input ) ) ); + vips_stream_filename( VIPS_STREAM( rtiff->streami ) ) ); if( rtiff->n > 1 ) vips_image_set_int( out, @@ -2383,14 +2383,14 @@ vips__tiff_read_header_orientation( Rtiff *rtiff, VipsImage *out ) typedef gboolean (*TiffPropertyFn)( TIFF *tif ); static gboolean -vips__testtiff_stream( VipsStreami *input, TiffPropertyFn fn ) +vips__testtiff_stream( VipsStreami *streami, TiffPropertyFn fn ) { TIFF *tif; gboolean property; vips__tiff_init(); - if( !(tif = vips__tiff_openin_stream( input )) ) { + if( !(tif = vips__tiff_openin_stream( streami )) ) { vips_error_clear(); return( FALSE ); } @@ -2403,26 +2403,26 @@ vips__testtiff_stream( VipsStreami *input, TiffPropertyFn fn ) } gboolean -vips__istiff_stream( VipsStreami *input ) +vips__istiff_stream( VipsStreami *streami ) { - return( vips__testtiff_stream( input, NULL ) ); + return( vips__testtiff_stream( streami, NULL ) ); } gboolean -vips__istifftiled_stream( VipsStreami *input ) +vips__istifftiled_stream( VipsStreami *streami ) { - return( vips__testtiff_stream( input, TIFFIsTiled ) ); + return( vips__testtiff_stream( streami, TIFFIsTiled ) ); } int -vips__tiff_read_header_stream( VipsStreami *input, VipsImage *out, +vips__tiff_read_header_stream( VipsStreami *streami, VipsImage *out, int page, int n, gboolean autorotate ) { Rtiff *rtiff; vips__tiff_init(); - if( !(rtiff = rtiff_new( input, out, page, n, autorotate )) || + if( !(rtiff = rtiff_new( streami, out, page, n, autorotate )) || rtiff_header_read_all( rtiff ) ) return( -1 ); @@ -2434,13 +2434,13 @@ vips__tiff_read_header_stream( VipsStreami *input, VipsImage *out, /* We never call vips_streami_decode() since we need to be able to * seek() the whole way through the file. Just minimise instead, */ - vips_streami_minimise( input ); + vips_streami_minimise( streami ); return( 0 ); } int -vips__tiff_read_stream( VipsStreami *input, VipsImage *out, +vips__tiff_read_stream( VipsStreami *streami, VipsImage *out, int page, int n, gboolean autorotate ) { Rtiff *rtiff; @@ -2452,7 +2452,7 @@ vips__tiff_read_stream( VipsStreami *input, VipsImage *out, vips__tiff_init(); - if( !(rtiff = rtiff_new( input, out, page, n, autorotate )) || + if( !(rtiff = rtiff_new( streami, out, page, n, autorotate )) || rtiff_header_read_all( rtiff ) ) return( -1 ); @@ -2468,7 +2468,7 @@ vips__tiff_read_stream( VipsStreami *input, VipsImage *out, /* We never call vips_streami_decode() since we need to be able to * seek() the whole way through the file. Just minimise instead, */ - vips_streami_minimise( input ); + vips_streami_minimise( streami ); return( 0 ); } diff --git a/libvips/foreign/tiffload.c b/libvips/foreign/tiffload.c index 78c0fd36..6e8a40af 100644 --- a/libvips/foreign/tiffload.c +++ b/libvips/foreign/tiffload.c @@ -141,13 +141,13 @@ G_DEFINE_TYPE( VipsForeignLoadTiffFile, vips_foreign_load_tiff_file, static gboolean vips_foreign_load_tiff_file_is_a( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__istiff_stream( input ); - VIPS_UNREF( input ); + result = vips__istiff_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -155,19 +155,19 @@ vips_foreign_load_tiff_file_is_a( const char *filename ) static VipsForeignFlags vips_foreign_load_tiff_file_get_flags_filename( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; VipsForeignFlags flags; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( 0 ); flags = 0; - if( vips__istifftiled_stream( input ) ) + if( vips__istifftiled_stream( streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( flags ); } @@ -187,16 +187,16 @@ vips_foreign_load_tiff_file_header( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffFile *file = (VipsForeignLoadTiffFile *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__tiff_read_header_stream( input, load->out, + if( vips__tiff_read_header_stream( streami, load->out, tiff->page, tiff->n, tiff->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -207,16 +207,16 @@ vips_foreign_load_tiff_file_load( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffFile *file = (VipsForeignLoadTiffFile *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__tiff_read_stream( input, load->real, + if( vips__tiff_read_stream( streami, load->real, tiff->page, tiff->n, tiff->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -280,13 +280,13 @@ G_DEFINE_TYPE( VipsForeignLoadTiffBuffer, vips_foreign_load_tiff_buffer, static gboolean vips_foreign_load_tiff_buffer_is_a_buffer( const void *buf, size_t len ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_memory( buf, len )) ) + if( !(streami = vips_streami_new_from_memory( buf, len )) ) return( FALSE ); - result = vips__istiff_stream( input ); - VIPS_UNREF( input ); + result = vips__istiff_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -296,18 +296,18 @@ vips_foreign_load_tiff_buffer_get_flags( VipsForeignLoad *load ) { VipsForeignLoadTiffBuffer *buffer = (VipsForeignLoadTiffBuffer *) load; - VipsStreami *input; + VipsStreami *streami; VipsForeignFlags flags; - if( !(input = vips_streami_new_from_memory( + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( FALSE ); flags = 0; - if( vips__istifftiled_stream( input ) ) + if( vips__istifftiled_stream( streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( flags ); } @@ -318,17 +318,17 @@ vips_foreign_load_tiff_buffer_header( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffBuffer *buffer = (VipsForeignLoadTiffBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( FALSE ); - if( vips__tiff_read_header_stream( input, load->out, + if( vips__tiff_read_header_stream( streami, load->out, tiff->page, tiff->n, tiff->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -339,17 +339,17 @@ vips_foreign_load_tiff_buffer_load( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffBuffer *buffer = (VipsForeignLoadTiffBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( FALSE ); - if( vips__tiff_read_stream( input, load->real, + if( vips__tiff_read_stream( streami, load->real, tiff->page, tiff->n, tiff->autorotate ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -391,7 +391,7 @@ typedef struct _VipsForeignLoadTiffStream { /* Load from a stream. */ - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadTiffStream; @@ -408,7 +408,7 @@ vips_foreign_load_tiff_stream_get_flags( VipsForeignLoad *load ) VipsForeignFlags flags; flags = 0; - if( vips__istifftiled_stream( stream->input ) ) + if( vips__istifftiled_stream( stream->streami ) ) flags |= VIPS_FOREIGN_PARTIAL; else flags |= VIPS_FOREIGN_SEQUENTIAL; @@ -422,7 +422,7 @@ vips_foreign_load_tiff_stream_header( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffStream *stream = (VipsForeignLoadTiffStream *) load; - if( vips__tiff_read_header_stream( stream->input, load->out, + if( vips__tiff_read_header_stream( stream->streami, load->out, tiff->page, tiff->n, tiff->autorotate ) ) return( -1 ); @@ -435,7 +435,7 @@ vips_foreign_load_tiff_stream_load( VipsForeignLoad *load ) VipsForeignLoadTiff *tiff = (VipsForeignLoadTiff *) load; VipsForeignLoadTiffStream *stream = (VipsForeignLoadTiffStream *) load; - if( vips__tiff_read_stream( stream->input, load->real, + if( vips__tiff_read_stream( stream->streami, load->real, tiff->page, tiff->n, tiff->autorotate ) ) return( -1 ); @@ -461,11 +461,11 @@ vips_foreign_load_tiff_stream_class_init( load_class->header = vips_foreign_load_tiff_stream_header; load_class->load = vips_foreign_load_tiff_stream_load; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadTiffStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadTiffStream, streami ), VIPS_TYPE_STREAMI ); } @@ -584,7 +584,7 @@ vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_tiffload_stream: - * @input: stream to load + * @streami: stream to load * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * @@ -602,13 +602,13 @@ vips_tiffload_buffer( void *buf, size_t len, VipsImage **out, ... ) * Returns: 0 on success, -1 on error. */ int -vips_tiffload_stream( VipsStreami *input, VipsImage **out, ... ) +vips_tiffload_stream( VipsStreami *streami, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); - result = vips_call_split( "tiffload_stream", ap, input, out ); + result = vips_call_split( "tiffload_stream", ap, streami, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/vips2jpeg.c b/libvips/foreign/vips2jpeg.c index 5bd1fbc5..35258dfe 100644 --- a/libvips/foreign/vips2jpeg.c +++ b/libvips/foreign/vips2jpeg.c @@ -693,7 +693,7 @@ typedef struct { /* Build the output area here. */ - VipsStreamo *output; + VipsStreamo *streamo; /* Our output buffer. */ @@ -708,7 +708,7 @@ empty_output_buffer( j_compress_ptr cinfo ) { Dest *dest = (Dest *) cinfo->dest; - if( vips_streamo_write( dest->output, + if( vips_streamo_write( dest->streamo, dest->buf, STREAM_BUFFER_SIZE ) ) ERREXIT( cinfo, JERR_FILE_WRITE ); @@ -736,17 +736,17 @@ term_destination( j_compress_ptr cinfo ) { Dest *dest = (Dest *) cinfo->dest; - if( vips_streamo_write( dest->output, + if( vips_streamo_write( dest->streamo, dest->buf, STREAM_BUFFER_SIZE - dest->pub.free_in_buffer ) ) ERREXIT( cinfo, JERR_FILE_WRITE ); - vips_streamo_finish( dest->output ); + vips_streamo_finish( dest->streamo ); } /* Set dest to one of our objects. */ static void -stream_dest( j_compress_ptr cinfo, VipsStreamo *output ) +stream_dest( j_compress_ptr cinfo, VipsStreamo *streamo ) { Dest *dest; @@ -761,11 +761,11 @@ stream_dest( j_compress_ptr cinfo, VipsStreamo *output ) dest->pub.init_destination = init_destination; dest->pub.empty_output_buffer = empty_output_buffer; dest->pub.term_destination = term_destination; - dest->output = output; + dest->streamo = streamo; } int -vips__jpeg_write_stream( VipsImage *in, VipsStreamo *output, +vips__jpeg_write_stream( VipsImage *in, VipsStreamo *streamo, int Q, const char *profile, gboolean optimize_coding, gboolean progressive, gboolean strip, gboolean no_subsample, gboolean trellis_quant, @@ -789,7 +789,7 @@ vips__jpeg_write_stream( VipsImage *in, VipsStreamo *output, /* Attach output. */ - stream_dest( &write->cinfo, output ); + stream_dest( &write->cinfo, streamo ); /* Convert! Write errors come back here as an error return. */ diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index f63b041f..7fc6bd95 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1713,7 +1713,7 @@ wtiff_gather( Wtiff *wtiff ) wtiff->layer->below ) for( layer = wtiff->layer->below; layer; layer = layer->below ) { - VipsStreami *input; + VipsStreami *streami; TIFF *in; #ifdef DEBUG @@ -1721,22 +1721,22 @@ wtiff_gather( Wtiff *wtiff ) #endif /*DEBUG*/ if( layer->lname ) { - if( !(input = + if( !(streami = vips_streami_new_from_filename( layer->lname )) ) return( -1 ); } else { - if( !(input = vips_streami_new_from_memory( + if( !(streami = vips_streami_new_from_memory( layer->buf, layer->len )) ) return( -1 ); } - if( !(in = vips__tiff_openin_stream( input )) ) { - VIPS_UNREF( input ); + if( !(in = vips__tiff_openin_stream( streami )) ) { + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); if( wtiff_copy_tiff( wtiff, wtiff->layer->tif, in ) ) { TIFFClose( in ); diff --git a/libvips/foreign/vips2webp.c b/libvips/foreign/vips2webp.c index 3f690fbf..53558656 100644 --- a/libvips/foreign/vips2webp.c +++ b/libvips/foreign/vips2webp.c @@ -510,7 +510,7 @@ vips_webp_add_metadata( VipsWebPWrite *write, VipsImage *image, gboolean strip ) } int -vips__webp_write_stream( VipsImage *image, VipsStreamo *output, +vips__webp_write_stream( VipsImage *image, VipsStreamo *streamo, int Q, gboolean lossless, VipsForeignWebpPreset preset, gboolean smart_subsample, gboolean near_lossless, int alpha_q, int reduction_effort, @@ -534,13 +534,13 @@ vips__webp_write_stream( VipsImage *image, VipsStreamo *output, return( -1 ); } - if( vips_streamo_write( output, + if( vips_streamo_write( streamo, write.memory_writer.mem, write.memory_writer.size ) ) { vips_webp_write_unset( &write ); return( -1 ); } - vips_streamo_finish( output ); + vips_streamo_finish( streamo ); vips_webp_write_unset( &write ); diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index f1cec563..5e81810a 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -173,7 +173,7 @@ typedef struct { png_infop pInfo; png_bytep *row_pointer; - VipsStreami *input; + VipsStreami *streami; /* read() to this buffer, copy to png as required. libpng does many * very small reads and we want to avoid a syscall for each one. @@ -195,7 +195,7 @@ read_destroy( Read *read ) if( read->pPng ) png_destroy_read_struct( &read->pPng, &read->pInfo, NULL ); - VIPS_UNREF( read->input ); + VIPS_UNREF( read->streami ); VIPS_FREE( read->row_pointer ); } @@ -208,8 +208,8 @@ read_close_cb( VipsImage *out, Read *read ) static void read_minimise_cb( VipsImage *image, Read *read ) { - if( read->input ) - vips_streami_minimise( read->input ); + if( read->streami ) + vips_streami_minimise( read->streami ); } static void @@ -230,7 +230,7 @@ vips_png_read_stream( png_structp pPng, png_bytep data, png_size_t length ) if( read->bytes_in_buffer <= 0 ) { ssize_t bytes_read; - bytes_read = vips_streami_read( read->input, + bytes_read = vips_streami_read( read->streami, read->input_buffer, INPUT_BUFFER_SIZE ); if( bytes_read <= 0 ) png_error( pPng, "not enough data" ); @@ -249,7 +249,7 @@ vips_png_read_stream( png_structp pPng, png_bytep data, png_size_t length ) } static Read * -read_new( VipsStreami *input, VipsImage *out, gboolean fail ) +read_new( VipsStreami *streami, VipsImage *out, gboolean fail ) { Read *read; @@ -263,8 +263,8 @@ read_new( VipsStreami *input, VipsImage *out, gboolean fail ) read->pPng = NULL; read->pInfo = NULL; read->row_pointer = NULL; - read->input = input; - g_object_ref( input ); + read->streami = streami; + g_object_ref( streami ); g_signal_connect( out, "close", G_CALLBACK( read_close_cb ), read ); @@ -290,7 +290,7 @@ read_new( VipsStreami *input, VipsImage *out, gboolean fail ) PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE ); #endif /*FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION*/ - if( vips_streami_rewind( input ) ) + if( vips_streami_rewind( streami ) ) return( NULL ); png_set_read_fn( read->pPng, read, vips_png_read_stream ); @@ -482,7 +482,7 @@ png2vips_header( Read *read, VipsImage *out ) Xres, Yres ); VIPS_SETSTR( out->filename, - vips_stream_filename( VIPS_STREAM( read->input ) ) ); + vips_stream_filename( VIPS_STREAM( read->streami ) ) ); /* Uninterlaced images will be read in seq mode. Interlaced images are * read via a huge memory buffer. @@ -694,11 +694,11 @@ png2vips_image( Read *read, VipsImage *out ) } gboolean -vips__png_ispng_stream( VipsStreami *input ) +vips__png_ispng_stream( VipsStreami *streami ) { const unsigned char *p; - if( (p = vips_streami_sniff( input, 8 )) && + if( (p = vips_streami_sniff( streami, 8 )) && !png_sig_cmp( (png_bytep) p, 0, 8 ) ) return( TRUE ); @@ -706,27 +706,27 @@ vips__png_ispng_stream( VipsStreami *input ) } int -vips__png_header_stream( VipsStreami *input, VipsImage *out ) +vips__png_header_stream( VipsStreami *streami, VipsImage *out ) { Read *read; - if( !(read = read_new( input, out, TRUE )) || + if( !(read = read_new( streami, out, TRUE )) || png2vips_header( read, out ) ) return( -1 ); - vips_streami_minimise( input ); + vips_streami_minimise( streami ); return( 0 ); } int -vips__png_read_stream( VipsStreami *input, VipsImage *out, gboolean fail ) +vips__png_read_stream( VipsStreami *streami, VipsImage *out, gboolean fail ) { Read *read; - if( !(read = read_new( input, out, fail )) || + if( !(read = read_new( streami, out, fail )) || png2vips_image( read, out ) || - vips_streami_decode( input ) ) + vips_streami_decode( streami ) ) return( -1 ); return( 0 ); @@ -736,7 +736,7 @@ vips__png_read_stream( VipsStreami *input, VipsImage *out, gboolean fail ) * served partially from there. Non-interlaced PNGs may be read sequentially. */ gboolean -vips__png_isinterlaced_stream( VipsStreami *input ) +vips__png_isinterlaced_stream( VipsStreami *streami ) { VipsImage *image; Read *read; @@ -744,7 +744,7 @@ vips__png_isinterlaced_stream( VipsStreami *input ) image = vips_image_new(); - if( !(read = read_new( input, image, TRUE )) ) { + if( !(read = read_new( streami, image, TRUE )) ) { g_object_unref( image ); return( -1 ); } @@ -762,7 +762,7 @@ typedef struct { VipsImage *in; VipsImage *memory; - VipsStreamo *output; + VipsStreamo *streamo; png_structp pPng; png_infop pInfo; @@ -773,9 +773,9 @@ static void write_finish( Write *write ) { VIPS_UNREF( write->memory ); - if( write->output ) - vips_streamo_finish( write->output ); - VIPS_UNREF( write->output ); + if( write->streamo ) + vips_streamo_finish( write->streamo ); + VIPS_UNREF( write->streamo ); if( write->pPng ) png_destroy_write_struct( &write->pPng, &write->pInfo ); } @@ -791,12 +791,12 @@ user_write_data( png_structp pPng, png_bytep data, png_size_t length ) { Write *write = (Write *) png_get_io_ptr( pPng ); - if( vips_streamo_write( write->output, data, length ) ) + if( vips_streamo_write( write->streamo, data, length ) ) png_error( pPng, "not enough data" ); } static Write * -write_new( VipsImage *in, VipsStreamo *output ) +write_new( VipsImage *in, VipsStreamo *streamo ) { Write *write; @@ -805,8 +805,8 @@ write_new( VipsImage *in, VipsStreamo *output ) memset( write, 0, sizeof( Write ) ); write->in = in; write->memory = NULL; - write->output = output; - g_object_ref( output ); + write->streamo = streamo; + g_object_ref( streamo ); g_signal_connect( in, "close", G_CALLBACK( write_destroy ), write ); @@ -1169,14 +1169,14 @@ write_vips( Write *write, } int -vips__png_write_stream( VipsImage *in, VipsStreamo *output, +vips__png_write_stream( VipsImage *in, VipsStreamo *streamo, int compression, int interlace, const char *profile, VipsForeignPngFilter filter, gboolean strip, gboolean palette, int colours, int Q, double dither ) { Write *write; - if( !(write = write_new( in, output )) ) + if( !(write = write_new( in, streamo )) ) return( -1 ); if( write_vips( write, diff --git a/libvips/foreign/webp2vips.c b/libvips/foreign/webp2vips.c index 2c0fa996..ac4a6230 100644 --- a/libvips/foreign/webp2vips.c +++ b/libvips/foreign/webp2vips.c @@ -81,7 +81,7 @@ /* What we track during a read. */ typedef struct { - VipsStreami *input; + VipsStreami *streami; /* The data we load, as a webp object. */ @@ -311,13 +311,13 @@ vips_image_paint_image( VipsImage *frame, } int -vips__iswebp_stream( VipsStreami *input ) +vips__iswebp_stream( VipsStreami *streami ) { const unsigned char *p; /* WebP is "RIFF xxxx WEBP" at the start, so we need 12 bytes. */ - if( (p = vips_streami_sniff( input, 12 )) && + if( (p = vips_streami_sniff( streami, 12 )) && vips_isprefix( "RIFF", (char *) p ) && vips_isprefix( "WEBP", (char *) p + 8 ) ) return( 1 ); @@ -333,7 +333,7 @@ read_free( Read *read ) VIPS_FREEF( WebPDemuxDelete, read->demux ); WebPFreeDecBuffer( &read->config.output ); - VIPS_UNREF( read->input ); + VIPS_UNREF( read->streami ); VIPS_FREE( read->delays ); VIPS_FREE( read ); @@ -341,15 +341,15 @@ read_free( Read *read ) } static Read * -read_new( VipsStreami *input, int page, int n, double scale ) +read_new( VipsStreami *streami, int page, int n, double scale ) { Read *read; if( !(read = VIPS_NEW( NULL, Read )) ) return( NULL ); - read->input = input; - g_object_ref( input ); + read->streami = streami; + g_object_ref( streami ); read->page = page; read->n = n; read->scale = scale; @@ -364,7 +364,7 @@ read_new( VipsStreami *input, int page, int n, double scale ) read->config.output.is_external_memory = 1; if( !(read->data.bytes = - vips_streami_map( input, &read->data.size )) ) { + vips_streami_map( streami, &read->data.size )) ) { read_free( read ); return( NULL ); } @@ -541,7 +541,7 @@ read_header( Read *read, VipsImage *out ) 1.0, 1.0 ); vips_image_pipelinev( out, VIPS_DEMAND_STYLE_THINSTRIP, NULL ); VIPS_SETSTR( out->filename, - vips_stream_filename( VIPS_STREAM( read->input ) ) ); + vips_stream_filename( VIPS_STREAM( read->streami ) ) ); if( !WebPDemuxGetFrame( read->demux, 1, &read->iter ) ) { vips_error( "webp", @@ -754,12 +754,12 @@ read_image( Read *read, VipsImage *out ) } int -vips__webp_read_header_stream( VipsStreami *input, VipsImage *out, +vips__webp_read_header_stream( VipsStreami *streami, VipsImage *out, int page, int n, double scale ) { Read *read; - if( !(read = read_new( input, page, n, scale )) ) + if( !(read = read_new( streami, page, n, scale )) ) return( -1 ); if( read_header( read, out ) ) { @@ -773,12 +773,12 @@ vips__webp_read_header_stream( VipsStreami *input, VipsImage *out, } int -vips__webp_read_stream( VipsStreami *input, VipsImage *out, +vips__webp_read_stream( VipsStreami *streami, VipsImage *out, int page, int n, double scale ) { Read *read; - if( !(read = read_new( input, page, n, scale )) ) + if( !(read = read_new( streami, page, n, scale )) ) return( -1 ); if( read_image( read, out ) ) { diff --git a/libvips/foreign/webpload.c b/libvips/foreign/webpload.c index 6e330bdf..e68bc5d1 100644 --- a/libvips/foreign/webpload.c +++ b/libvips/foreign/webpload.c @@ -156,7 +156,7 @@ vips_foreign_load_webp_init( VipsForeignLoadWebp *webp ) typedef struct _VipsForeignLoadWebpStream { VipsForeignLoadWebp parent_object; - VipsStreami *input; + VipsStreami *streami; } VipsForeignLoadWebpStream; @@ -171,7 +171,7 @@ vips_foreign_load_webp_stream_header( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpStream *stream = (VipsForeignLoadWebpStream *) load; - if( vips__webp_read_header_stream( stream->input, load->out, + if( vips__webp_read_header_stream( stream->streami, load->out, webp->page, webp->n, webp->scale ) ) return( -1 ); @@ -184,7 +184,7 @@ vips_foreign_load_webp_stream_load( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpStream *stream = (VipsForeignLoadWebpStream *) load; - if( vips__webp_read_stream( stream->input, load->real, + if( vips__webp_read_stream( stream->streami, load->real, webp->page, webp->n, webp->scale ) ) return( -1 ); @@ -214,11 +214,11 @@ vips_foreign_load_webp_stream_class_init( load_class->header = vips_foreign_load_webp_stream_header; load_class->load = vips_foreign_load_webp_stream_load; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignLoadWebpStream, input ), + G_STRUCT_OFFSET( VipsForeignLoadWebpStream, streami ), VIPS_TYPE_STREAMI ); } @@ -251,13 +251,13 @@ vips_foreign_load_webp_file_get_flags_filename( const char *filename ) static gboolean vips_foreign_load_webp_file_is_a( const char *filename ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_filename( filename )) ) return( FALSE ); - result = vips__iswebp_stream( input ); - VIPS_UNREF( input ); + result = vips__iswebp_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -268,7 +268,7 @@ vips_foreign_load_webp_file_header( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpFile *file = (VipsForeignLoadWebpFile *) load; - VipsStreami *input; + VipsStreami *streami; /* BC for the old API. */ @@ -277,14 +277,14 @@ vips_foreign_load_webp_file_header( VipsForeignLoad *load ) webp->shrink != 0 ) webp->scale = 1.0 / webp->shrink; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__webp_read_header_stream( input, load->out, + if( vips__webp_read_header_stream( streami, load->out, webp->page, webp->n, webp->scale ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -295,16 +295,16 @@ vips_foreign_load_webp_file_load( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpFile *file = (VipsForeignLoadWebpFile *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_filename( file->filename )) ) return( -1 ); - if( vips__webp_read_stream( input, load->real, + if( vips__webp_read_stream( streami, load->real, webp->page, webp->n, webp->scale ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -363,13 +363,13 @@ G_DEFINE_TYPE( VipsForeignLoadWebpBuffer, vips_foreign_load_webp_buffer, static gboolean vips_foreign_load_webp_buffer_is_a_buffer( const void *buf, size_t len ) { - VipsStreami *input; + VipsStreami *streami; gboolean result; - if( !(input = vips_streami_new_from_memory( buf, len )) ) + if( !(streami = vips_streami_new_from_memory( buf, len )) ) return( FALSE ); - result = vips__iswebp_stream( input ); - VIPS_UNREF( input ); + result = vips__iswebp_stream( streami ); + VIPS_UNREF( streami ); return( result ); } @@ -380,17 +380,17 @@ vips_foreign_load_webp_buffer_header( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpBuffer *buffer = (VipsForeignLoadWebpBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( FALSE ); - if( vips__webp_read_header_stream( input, load->out, + if( vips__webp_read_header_stream( streami, load->out, webp->page, webp->n, webp->scale ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -401,17 +401,17 @@ vips_foreign_load_webp_buffer_load( VipsForeignLoad *load ) VipsForeignLoadWebp *webp = (VipsForeignLoadWebp *) load; VipsForeignLoadWebpBuffer *buffer = (VipsForeignLoadWebpBuffer *) load; - VipsStreami *input; + VipsStreami *streami; - if( !(input = vips_streami_new_from_memory( buffer->buf->data, + if( !(streami = vips_streami_new_from_memory( buffer->buf->data, buffer->buf->length )) ) return( FALSE ); - if( vips__webp_read_stream( input, load->real, + if( vips__webp_read_stream( streami, load->real, webp->page, webp->n, webp->scale ) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( 0 ); } @@ -542,7 +542,7 @@ vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... ) /** * vips_webpload_stream: - * @input: stream to load from + * @streami: stream to load from * @out: (out): image to write * @...: %NULL-terminated list of optional named arguments * @@ -559,13 +559,13 @@ vips_webpload_buffer( void *buf, size_t len, VipsImage **out, ... ) * Returns: 0 on success, -1 on error. */ int -vips_webpload_stream( VipsStreami *input, VipsImage **out, ... ) +vips_webpload_stream( VipsStreami *streami, VipsImage **out, ... ) { va_list ap; int result; va_start( ap, out ); - result = vips_call_split( "webpload_stream", ap, input, out ); + result = vips_call_split( "webpload_stream", ap, streami, out ); va_end( ap ); return( result ); diff --git a/libvips/foreign/webpsave.c b/libvips/foreign/webpsave.c index 16c964a8..bed4afac 100644 --- a/libvips/foreign/webpsave.c +++ b/libvips/foreign/webpsave.c @@ -222,7 +222,7 @@ vips_foreign_save_webp_init( VipsForeignSaveWebp *webp ) typedef struct _VipsForeignSaveWebpStream { VipsForeignSaveWebp parent_object; - VipsStreamo *output; + VipsStreamo *streamo; } VipsForeignSaveWebpStream; @@ -243,7 +243,7 @@ vips_foreign_save_webp_stream_build( VipsObject *object ) build( object ) ) return( -1 ); - if( vips__webp_write_stream( save->ready, stream->output, + if( vips__webp_write_stream( save->ready, stream->streamo, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, webp->alpha_q, webp->reduction_effort, @@ -268,11 +268,11 @@ vips_foreign_save_webp_stream_class_init( object_class->description = _( "save image to webp stream" ); object_class->build = vips_foreign_save_webp_stream_build; - VIPS_ARG_OBJECT( class, "output", 1, - _( "Output" ), + VIPS_ARG_OBJECT( class, "streamo", 1, + _( "streamo" ), _( "Stream to save to" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsForeignSaveWebpStream, output ), + G_STRUCT_OFFSET( VipsForeignSaveWebpStream, streamo ), VIPS_TYPE_STREAMO ); } @@ -303,24 +303,24 @@ vips_foreign_save_webp_file_build( VipsObject *object ) VipsForeignSaveWebp *webp = (VipsForeignSaveWebp *) object; VipsForeignSaveWebpFile *file = (VipsForeignSaveWebpFile *) object; - VipsStreamo *output; + VipsStreamo *streamo; if( VIPS_OBJECT_CLASS( vips_foreign_save_webp_file_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) return( -1 ); - if( vips__webp_write_stream( save->ready, output, + if( vips__webp_write_stream( save->ready, streamo, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, webp->alpha_q, webp->reduction_effort, webp->min_size, webp->kmin, webp->kmax, save->strip ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -373,27 +373,27 @@ vips_foreign_save_webp_buffer_build( VipsObject *object ) VipsForeignSaveWebpBuffer *buffer = (VipsForeignSaveWebpBuffer *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; if( VIPS_OBJECT_CLASS( vips_foreign_save_webp_buffer_parent_class )-> build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__webp_write_stream( save->ready, output, + if( vips__webp_write_stream( save->ready, streamo, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, webp->alpha_q, webp->reduction_effort, webp->min_size, webp->kmin, webp->kmax, save->strip ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); g_object_set( buffer, "buffer", blob, NULL ); vips_area_unref( VIPS_AREA( blob ) ); @@ -443,7 +443,7 @@ vips_foreign_save_webp_mime_build( VipsObject *object ) VipsForeignSave *save = (VipsForeignSave *) object; VipsForeignSaveWebp *webp = (VipsForeignSaveWebp *) object; - VipsStreamo *output; + VipsStreamo *streamo; VipsBlob *blob; void *data; size_t len; @@ -452,20 +452,20 @@ vips_foreign_save_webp_mime_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(output = vips_streamo_new_to_memory()) ) + if( !(streamo = vips_streamo_new_to_memory()) ) return( -1 ); - if( vips__webp_write_stream( save->ready, output, + if( vips__webp_write_stream( save->ready, streamo, webp->Q, webp->lossless, webp->preset, webp->smart_subsample, webp->near_lossless, webp->alpha_q, webp->reduction_effort, webp->min_size, webp->kmin, webp->kmax, save->strip ) ) { - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } - g_object_get( output, "blob", &blob, NULL ); + g_object_get( streamo, "blob", &blob, NULL ); data = VIPS_AREA( blob )->data; len = VIPS_AREA( blob )->length; vips_area_unref( VIPS_AREA( blob ) ); @@ -476,7 +476,7 @@ vips_foreign_save_webp_mime_build( VipsObject *object ) (void) fwrite( data, sizeof( char ), len, stdout ); fflush( stdout ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( 0 ); } @@ -671,7 +671,7 @@ vips_webpsave_mime( VipsImage *in, ... ) /** * vips_webpsave_stream: (method) * @in: image to save - * @output: save image to this stream + * @streamo: save image to this stream * @...: %NULL-terminated list of optional named arguments * * Optional arguments: @@ -695,13 +695,13 @@ vips_webpsave_mime( VipsImage *in, ... ) * Returns: 0 on success, -1 on error. */ int -vips_webpsave_stream( VipsImage *in, VipsStreamo *output, ... ) +vips_webpsave_stream( VipsImage *in, VipsStreamo *streamo, ... ) { va_list ap; int result; - va_start( ap, output ); - result = vips_call_split( "webpsave_stream", ap, in, output ); + va_start( ap, streamo ); + result = vips_call_split( "webpsave_stream", ap, in, streamo ); va_end( ap ); return( result ); diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 2c6d1719..f963fd56 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -580,7 +580,7 @@ int vips_radsave( VipsImage *in, const char *filename, ... ) __attribute__((sentinel)); int vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) __attribute__((sentinel)); -int vips_radsave_stream( VipsImage *in, VipsStreamo *output, ... ) +int vips_radsave_stream( VipsImage *in, VipsStreamo *streamo, ... ) __attribute__((sentinel)); int vips_pdfload( const char *filename, VipsImage **out, ... ) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 553d2a56..0a293e00 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -2166,7 +2166,7 @@ vips_image_new_from_buffer( const void *buf, size_t len, /** * vips_image_new_from_stream: (constructor) - * @input: (transfer none): stream to fetch image from + * @streami: (transfer none): stream to fetch image from * @option_string: set of extra options as a string * @...: %NULL-terminated list of optional named arguments * @@ -2182,7 +2182,8 @@ vips_image_new_from_buffer( const void *buf, size_t len, * Returns: (transfer full): the new #VipsImage, or %NULL on error. */ VipsImage * -vips_image_new_from_stream( VipsStreami *input, const char *option_string, ... ) +vips_image_new_from_stream( VipsStreami *streami, + const char *option_string, ... ) { const char *operation_name; va_list ap; @@ -2191,12 +2192,12 @@ vips_image_new_from_stream( VipsStreami *input, const char *option_string, ... ) vips_check_init(); - if( !(operation_name = vips_foreign_find_load_stream( input )) ) + if( !(operation_name = vips_foreign_find_load_stream( streami )) ) return( NULL ); va_start( ap, option_string ); result = vips_call_split_option_string( operation_name, - option_string, ap, input, &out ); + option_string, ap, streami, &out ); va_end( ap ); if( result ) @@ -2704,7 +2705,7 @@ vips_image_write_to_buffer( VipsImage *in, * vips_image_write_to_stream: (method) * @in: image to write * @suffix: format to write - * @output: stream to write to + * @streamo: stream to write to * @...: %NULL-terminated list of optional named arguments * * Writes @in to @output in format @suffix. @@ -2722,7 +2723,7 @@ vips_image_write_to_buffer( VipsImage *in, */ int vips_image_write_to_stream( VipsImage *in, - const char *suffix, VipsStreamo *output, ... ) + const char *suffix, VipsStreamo *streamo, ... ) { char filename[VIPS_PATH_MAX]; char option_string[VIPS_PATH_MAX]; @@ -2734,9 +2735,9 @@ vips_image_write_to_stream( VipsImage *in, if( !(operation_name = vips_foreign_find_save_stream( filename )) ) return( -1 ); - va_start( ap, output ); + va_start( ap, streamo ); result = vips_call_split_option_string( operation_name, option_string, - ap, in, output ); + ap, in, streamo ); va_end( ap ); if( result ) diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index c233eae3..1d12fe6d 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -1908,19 +1908,19 @@ vips_object_set_argument_from_string( VipsObject *object, vips__filename_split8( value, filename, option_string ); if( strcmp( "stdin", filename ) == 0 ) { - VipsStreami *input; + VipsStreami *streami; - if( !(input = + if( !(streami = vips_streami_new_from_descriptor( 0 )) ) return( -1 ); - if( !(out = vips_image_new_from_stream( input, + if( !(out = vips_image_new_from_stream( streami, option_string, "access", access, NULL )) ) { - VIPS_UNREF( input ); + VIPS_UNREF( streami ); return( -1 ); } - VIPS_UNREF( input ); + VIPS_UNREF( streami ); } else { if( !(out = vips_image_new_from_file( value, @@ -1938,23 +1938,23 @@ vips_object_set_argument_from_string( VipsObject *object, g_object_unref( out ); } else if( g_type_is_a( otype, VIPS_TYPE_STREAMI ) ) { - VipsStreami *input; + VipsStreami *streami; if( !value ) { vips_object_no_value( object, name ); return( -1 ); } - if( !(input = vips_streami_new_from_options( value )) ) + if( !(streami = vips_streami_new_from_options( value )) ) return( -1 ); g_value_init( &gvalue, VIPS_TYPE_STREAMI ); - g_value_set_object( &gvalue, input ); + g_value_set_object( &gvalue, streami ); /* Setting gvalue will have upped @out's count again, * go back to 1 so that gvalue has the only ref. */ - g_object_unref( input ); + g_object_unref( streami ); } else if( g_type_is_a( otype, VIPS_TYPE_ARRAY_IMAGE ) ) { /* We have to have a special case for this, we can't just rely @@ -2210,19 +2210,19 @@ vips_object_get_argument_to_string( VipsObject *object, vips__filename_split8( arg, filename, option_string ); if( vips_isprefix( ".", filename ) ) { - VipsStreamo *output; + VipsStreamo *streamo; - if( !(output = vips_streamo_new_to_descriptor( 1 )) ) + if( !(streamo = vips_streamo_new_to_descriptor( 1 )) ) return( -1 ); g_object_get( object, name, &in, NULL ); if( vips_image_write_to_stream( in, - arg, output, NULL ) ) { + arg, streamo, NULL ) ) { VIPS_UNREF( in ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); return( -1 ); } VIPS_UNREF( in ); - VIPS_UNREF( output ); + VIPS_UNREF( streamo ); } else { /* Pull out the image and write it. diff --git a/libvips/resample/thumbnail.c b/libvips/resample/thumbnail.c index ce3c7764..5b7bdddc 100644 --- a/libvips/resample/thumbnail.c +++ b/libvips/resample/thumbnail.c @@ -1254,7 +1254,7 @@ vips_thumbnail_buffer( void *buf, size_t len, VipsImage **out, int width, ... ) typedef struct _VipsThumbnailStream { VipsThumbnail parent_object; - VipsStreami *input; + VipsStreami *streami; char *option_string; } VipsThumbnailStream; @@ -1275,8 +1275,8 @@ vips_thumbnail_stream_get_info( VipsThumbnail *thumbnail ) g_info( "thumbnailing stream" ); if( !(thumbnail->loader = vips_foreign_find_load_stream( - stream->input )) || - !(image = vips_image_new_from_stream( stream->input, + stream->streami )) || + !(image = vips_image_new_from_stream( stream->streami, stream->option_string, NULL )) ) return( -1 ); @@ -1296,7 +1296,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ) { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, "shrink", (int) factor, @@ -1305,7 +1305,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) else if( vips_isprefix( "VipsForeignLoadOpenslide", thumbnail->loader ) ) { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, "level", (int) factor, @@ -1315,7 +1315,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) || vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, "scale", 1.0 / factor, @@ -1323,7 +1323,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) } else if( vips_isprefix( "VipsForeignLoadTiff", thumbnail->loader ) ) { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, "page", (int) factor, @@ -1331,7 +1331,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) } else if( vips_isprefix( "VipsForeignLoadHeif", thumbnail->loader ) ) { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, "thumbnail", (int) factor, @@ -1339,7 +1339,7 @@ vips_thumbnail_stream_open( VipsThumbnail *thumbnail, double factor ) } else { return( vips_image_new_from_stream( - stream->input, + stream->streami, stream->option_string, "access", VIPS_ACCESS_SEQUENTIAL, NULL ) ); @@ -1362,11 +1362,11 @@ vips_thumbnail_stream_class_init( VipsThumbnailClass *class ) thumbnail_class->get_info = vips_thumbnail_stream_get_info; thumbnail_class->open = vips_thumbnail_stream_open; - VIPS_ARG_OBJECT( class, "input", 1, - _( "Input" ), + VIPS_ARG_OBJECT( class, "streami", 1, + _( "Streami" ), _( "Stream to load from" ), VIPS_ARGUMENT_REQUIRED_INPUT, - G_STRUCT_OFFSET( VipsThumbnailStream, input ), + G_STRUCT_OFFSET( VipsThumbnailStream, streami ), VIPS_TYPE_STREAMI ); VIPS_ARG_STRING( class, "option_string", 20, @@ -1385,7 +1385,7 @@ vips_thumbnail_stream_init( VipsThumbnailStream *stream ) /** * vips_thumbnail_stream: - * @input: stream to thumbnail + * @streami: stream to thumbnail * @out: (out): output image * @width: target width in pixels * @...: %NULL-terminated list of optional named arguments @@ -1408,13 +1408,13 @@ vips_thumbnail_stream_init( VipsThumbnailStream *stream ) * Returns: 0 on success, -1 on error. */ int -vips_thumbnail_stream( VipsStreami *input, VipsImage **out, int width, ... ) +vips_thumbnail_stream( VipsStreami *streami, VipsImage **out, int width, ... ) { va_list ap; int result; va_start( ap, width ); - result = vips_call_split( "thumbnail_stream", ap, input, out, width ); + result = vips_call_split( "thumbnail_stream", ap, streami, out, width ); va_end( ap ); return( result );