From 562da3e5ab4e06fba6d8592e6db9cbe3e1db1a8f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 22 Nov 2019 17:13:20 +0000 Subject: [PATCH] rename new_from_filename as new_from_file So VipsStreami matches VipsImage. Same for new_to_filename. --- cplusplus/VStream.cpp | 8 ++++---- cplusplus/include/vips/VStream8.h | 4 ++-- libvips/deprecated/im_jpeg2vips.c | 2 +- libvips/deprecated/im_png2vips.c | 2 +- libvips/deprecated/im_tiff2vips.c | 6 +++--- libvips/deprecated/im_webp2vips.c | 4 ++-- libvips/foreign/jpegload.c | 6 +++--- libvips/foreign/jpegsave.c | 2 +- libvips/foreign/pngload.c | 8 ++++---- libvips/foreign/pngsave.c | 3 +-- libvips/foreign/ppmload.c | 4 ++-- libvips/foreign/ppmsave.c | 3 +-- libvips/foreign/radload.c | 6 +++--- libvips/foreign/radsave.c | 2 +- libvips/foreign/tiffload.c | 8 ++++---- libvips/foreign/vips2tiff.c | 2 +- libvips/foreign/webpload.c | 6 +++--- libvips/foreign/webpsave.c | 2 +- libvips/include/vips/stream.h | 4 ++-- libvips/iofuncs/image.c | 4 ++-- libvips/iofuncs/streami.c | 6 +++--- libvips/iofuncs/streamo.c | 10 +++++----- test/test_descriptors.c | 2 +- 23 files changed, 51 insertions(+), 53 deletions(-) diff --git a/cplusplus/VStream.cpp b/cplusplus/VStream.cpp index ee192a5f..82b1d3ea 100644 --- a/cplusplus/VStream.cpp +++ b/cplusplus/VStream.cpp @@ -58,11 +58,11 @@ VStreamI::new_from_descriptor( int descriptor ) } VStreamI -VStreamI::new_from_filename( const char *filename ) +VStreamI::new_from_file( const char *filename ) { VipsStreami *input; - if( !(input = vips_streami_new_from_filename( filename )) ) + if( !(input = vips_streami_new_from_file( filename )) ) throw VError(); VStreamI out( input ); @@ -137,11 +137,11 @@ VStreamO::new_to_descriptor( int descriptor ) } VStreamO -VStreamO::new_to_filename( const char *filename ) +VStreamO::new_to_file( const char *filename ) { VipsStreamo *output; - if( !(output = vips_streamo_new_to_filename( filename )) ) + if( !(output = vips_streamo_new_to_file( filename )) ) throw VError(); VStreamO out( output ); diff --git a/cplusplus/include/vips/VStream8.h b/cplusplus/include/vips/VStream8.h index 37a983ee..f8667b19 100644 --- a/cplusplus/include/vips/VStream8.h +++ b/cplusplus/include/vips/VStream8.h @@ -46,7 +46,7 @@ public: VStreamI new_from_descriptor( int descriptor ); static - VStreamI new_from_filename( const char *filename ); + VStreamI new_from_file( const char *filename ); static VStreamI new_from_blob( VipsBlob *blob ); @@ -78,7 +78,7 @@ public: VStreamO new_to_descriptor( int descriptor ); static - VStreamO new_to_filename( const char *filename ); + VStreamO new_to_file( const char *filename ); static VStreamO new_to_memory(); diff --git a/libvips/deprecated/im_jpeg2vips.c b/libvips/deprecated/im_jpeg2vips.c index 6244a6c3..a58d5d17 100644 --- a/libvips/deprecated/im_jpeg2vips.c +++ b/libvips/deprecated/im_jpeg2vips.c @@ -114,7 +114,7 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) { VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); if( vips__jpeg_read_stream( streami, out, header_only, shrink, fail_on_warn, FALSE ) ) { diff --git a/libvips/deprecated/im_png2vips.c b/libvips/deprecated/im_png2vips.c index 9f08e99f..f155b9a0 100644 --- a/libvips/deprecated/im_png2vips.c +++ b/libvips/deprecated/im_png2vips.c @@ -87,7 +87,7 @@ png2vips( const char *name, IMAGE *out, gboolean header_only ) VipsStreami *streami; int result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); if( header_only ) result = vips__png_header_stream( streami, out ); diff --git a/libvips/deprecated/im_tiff2vips.c b/libvips/deprecated/im_tiff2vips.c index 6bf2a5ee..9eb3fef9 100644 --- a/libvips/deprecated/im_tiff2vips.c +++ b/libvips/deprecated/im_tiff2vips.c @@ -59,7 +59,7 @@ im_istifftiled( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__istiff_stream( streami ); VIPS_UNREF( streami ); @@ -73,7 +73,7 @@ im_tiff_read_header( const char *filename, VipsImage *out, { VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); if( vips__tiff_read_header_stream( streami, out, page, n, autorotate ) ) { @@ -91,7 +91,7 @@ im_tiff_read( const char *filename, VipsImage *out, { VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); if( vips__tiff_read_stream( streami, out, page, n, autorotate ) ) { VIPS_UNREF( streami ); diff --git a/libvips/deprecated/im_webp2vips.c b/libvips/deprecated/im_webp2vips.c index fa6d4354..43a31633 100644 --- a/libvips/deprecated/im_webp2vips.c +++ b/libvips/deprecated/im_webp2vips.c @@ -55,7 +55,7 @@ webp2vips( const char *name, IMAGE *out, gboolean header_only ) VipsStreami *streami; int result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); if( header_only ) result = vips__webp_read_header_stream( streami, out, 0, 1, 1 ); @@ -84,7 +84,7 @@ vips__iswebp( const char *filename ) #ifdef HAVE_LIBWEBP VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__png_ispng_stream( streami ); VIPS_UNREF( streami ); diff --git a/libvips/foreign/jpegload.c b/libvips/foreign/jpegload.c index 27d4dba8..4dcfb259 100644 --- a/libvips/foreign/jpegload.c +++ b/libvips/foreign/jpegload.c @@ -245,7 +245,7 @@ vips_foreign_load_jpeg_file_is_a( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__isjpeg_stream( streami ); VIPS_UNREF( streami ); @@ -261,7 +261,7 @@ vips_foreign_load_jpeg_file_header( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__jpeg_read_stream( streami, load->out, TRUE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { @@ -281,7 +281,7 @@ vips_foreign_load_jpeg_file_load( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__jpeg_read_stream( streami, load->real, FALSE, jpeg->shrink, load->fail, jpeg->autorotate ) ) { diff --git a/libvips/foreign/jpegsave.c b/libvips/foreign/jpegsave.c index 54b58ee0..0ea3357f 100644 --- a/libvips/foreign/jpegsave.c +++ b/libvips/foreign/jpegsave.c @@ -305,7 +305,7 @@ vips_foreign_save_jpeg_file_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_file( file->filename )) ) return( -1 ); if( vips__jpeg_write_stream( save->ready, streamo, jpeg->Q, jpeg->profile, jpeg->optimize_coding, diff --git a/libvips/foreign/pngload.c b/libvips/foreign/pngload.c index 1352b997..df510cc6 100644 --- a/libvips/foreign/pngload.c +++ b/libvips/foreign/pngload.c @@ -156,7 +156,7 @@ vips_foreign_load_png_is_a( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__png_ispng_stream( streami ); VIPS_UNREF( streami ); @@ -170,7 +170,7 @@ vips_foreign_load_png_get_flags_filename( const char *filename ) VipsStreami *streami; VipsForeignFlags flags; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( 0 ); flags = 0; @@ -199,7 +199,7 @@ vips_foreign_load_png_header( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( png->filename )) ) + if( !(streami = vips_streami_new_from_file( png->filename )) ) return( -1 ); if( vips__png_header_stream( streami, load->out ) ) { VIPS_UNREF( streami ); @@ -217,7 +217,7 @@ vips_foreign_load_png_load( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( png->filename )) ) + if( !(streami = vips_streami_new_from_file( png->filename )) ) return( -1 ); if( vips__png_read_stream( streami, load->real, load->fail ) ) { VIPS_UNREF( streami ); diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index f3cb98cc..c508fe5d 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -260,8 +260,7 @@ vips_foreign_save_png_file_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(streamo = vips_streamo_new_to_filename( - png_file->filename )) ) + if( !(streamo = vips_streamo_new_to_file( png_file->filename )) ) return( -1 ); if( vips__png_write_stream( save->ready, streamo, png->compression, png->interlace, diff --git a/libvips/foreign/ppmload.c b/libvips/foreign/ppmload.c index 3744e7b4..b5dddf3a 100644 --- a/libvips/foreign/ppmload.c +++ b/libvips/foreign/ppmload.c @@ -656,7 +656,7 @@ vips_foreign_load_ppm_file_is_a( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips_foreign_load_ppm_is_a_stream( streami ); VIPS_UNREF( streami ); @@ -672,7 +672,7 @@ vips_foreign_load_ppm_file_build( VipsObject *object ) if( file->filename ) { if( !(ppm->streami = - vips_streami_new_from_filename( file->filename )) ) + vips_streami_new_from_file( file->filename )) ) return( -1 ); ppm->bufis = vips_bufis_new_from_streami( ppm->streami ); } diff --git a/libvips/foreign/ppmsave.c b/libvips/foreign/ppmsave.c index 99710e9e..c563d1cd 100644 --- a/libvips/foreign/ppmsave.c +++ b/libvips/foreign/ppmsave.c @@ -416,8 +416,7 @@ vips_foreign_save_ppm_file_build( VipsObject *object ) VipsForeignSavePpmFile *file = (VipsForeignSavePpmFile *) object; if( file->filename && - !(ppm->streamo = - vips_streamo_new_to_filename( file->filename )) ) + !(ppm->streamo = vips_streamo_new_to_file( file->filename )) ) return( -1 ); return( VIPS_OBJECT_CLASS( vips_foreign_save_ppm_file_parent_class )-> diff --git a/libvips/foreign/radload.c b/libvips/foreign/radload.c index 7c0a12d4..fac26339 100644 --- a/libvips/foreign/radload.c +++ b/libvips/foreign/radload.c @@ -164,7 +164,7 @@ vips_foreign_load_rad_is_a( const char *filename ) VipsStreami *streami; int result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( -1 ); result = vips__rad_israd( streami ); VIPS_UNREF( streami ); @@ -179,7 +179,7 @@ vips_foreign_load_rad_header( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( rad->filename )) ) + if( !(streami = vips_streami_new_from_file( rad->filename )) ) return( -1 ); if( vips__rad_header( streami, load->out ) ) { VIPS_UNREF( streami ); @@ -197,7 +197,7 @@ vips_foreign_load_rad_load( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( rad->filename )) ) + if( !(streami = vips_streami_new_from_file( rad->filename )) ) return( -1 ); if( vips__rad_load( streami, load->real ) ) { VIPS_UNREF( streami ); diff --git a/libvips/foreign/radsave.c b/libvips/foreign/radsave.c index 6a66659f..f90fa8dd 100644 --- a/libvips/foreign/radsave.c +++ b/libvips/foreign/radsave.c @@ -128,7 +128,7 @@ vips_foreign_save_rad_file_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_file( file->filename )) ) return( -1 ); if( vips__rad_save( save->ready, streamo ) ) { VIPS_UNREF( streamo ); diff --git a/libvips/foreign/tiffload.c b/libvips/foreign/tiffload.c index 6e8a40af..1c7f9c70 100644 --- a/libvips/foreign/tiffload.c +++ b/libvips/foreign/tiffload.c @@ -144,7 +144,7 @@ vips_foreign_load_tiff_file_is_a( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__istiff_stream( streami ); VIPS_UNREF( streami ); @@ -158,7 +158,7 @@ vips_foreign_load_tiff_file_get_flags_filename( const char *filename ) VipsStreami *streami; VipsForeignFlags flags; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( 0 ); flags = 0; @@ -189,7 +189,7 @@ vips_foreign_load_tiff_file_header( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__tiff_read_header_stream( streami, load->out, tiff->page, tiff->n, tiff->autorotate ) ) { @@ -209,7 +209,7 @@ vips_foreign_load_tiff_file_load( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__tiff_read_stream( streami, load->real, tiff->page, tiff->n, tiff->autorotate ) ) { diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 4785e7f4..c713140f 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1725,7 +1725,7 @@ wtiff_gather( Wtiff *wtiff ) if( layer->lname ) { if( !(streami = - vips_streami_new_from_filename( + vips_streami_new_from_file( layer->lname )) ) return( -1 ); } diff --git a/libvips/foreign/webpload.c b/libvips/foreign/webpload.c index e68bc5d1..e9a36d96 100644 --- a/libvips/foreign/webpload.c +++ b/libvips/foreign/webpload.c @@ -254,7 +254,7 @@ vips_foreign_load_webp_file_is_a( const char *filename ) VipsStreami *streami; gboolean result; - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( FALSE ); result = vips__iswebp_stream( streami ); VIPS_UNREF( streami ); @@ -277,7 +277,7 @@ vips_foreign_load_webp_file_header( VipsForeignLoad *load ) webp->shrink != 0 ) webp->scale = 1.0 / webp->shrink; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__webp_read_header_stream( streami, load->out, webp->page, webp->n, webp->scale ) ) { @@ -297,7 +297,7 @@ vips_foreign_load_webp_file_load( VipsForeignLoad *load ) VipsStreami *streami; - if( !(streami = vips_streami_new_from_filename( file->filename )) ) + if( !(streami = vips_streami_new_from_file( file->filename )) ) return( -1 ); if( vips__webp_read_stream( streami, load->real, webp->page, webp->n, webp->scale ) ) { diff --git a/libvips/foreign/webpsave.c b/libvips/foreign/webpsave.c index bed4afac..49f93081 100644 --- a/libvips/foreign/webpsave.c +++ b/libvips/foreign/webpsave.c @@ -309,7 +309,7 @@ vips_foreign_save_webp_file_build( VipsObject *object ) build( object ) ) return( -1 ); - if( !(streamo = vips_streamo_new_to_filename( file->filename )) ) + if( !(streamo = vips_streamo_new_to_file( file->filename )) ) return( -1 ); if( vips__webp_write_stream( save->ready, streamo, webp->Q, webp->lossless, webp->preset, diff --git a/libvips/include/vips/stream.h b/libvips/include/vips/stream.h index 066b11dc..b39c6c80 100644 --- a/libvips/include/vips/stream.h +++ b/libvips/include/vips/stream.h @@ -202,7 +202,7 @@ typedef struct _VipsStreamiClass { GType vips_streami_get_type( void ); VipsStreami *vips_streami_new_from_descriptor( int descriptor ); -VipsStreami *vips_streami_new_from_filename( const char *filename ); +VipsStreami *vips_streami_new_from_file( const char *filename ); VipsStreami *vips_streami_new_from_blob( VipsBlob *blob ); VipsStreami *vips_streami_new_from_memory( const void *data, size_t size ); VipsStreami *vips_streami_new_from_options( const char *options ); @@ -325,7 +325,7 @@ typedef struct _VipsStreamoClass { GType vips_streamo_get_type( void ); VipsStreamo *vips_streamo_new_to_descriptor( int descriptor ); -VipsStreamo *vips_streamo_new_to_filename( const char *filename ); +VipsStreamo *vips_streamo_new_to_file( const char *filename ); VipsStreamo *vips_streamo_new_to_memory( void ); int vips_streamo_write( VipsStreamo *streamo, const void *data, size_t length ); void vips_streamo_finish( VipsStreamo *streamo ); diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index d453e60c..a04beeba 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1921,7 +1921,7 @@ vips_image_new_from_file( const char *name, ... ) * * We need to hide any errors from this first phase. */ - if( !(streami = vips_streami_new_from_filename( filename )) ) + if( !(streami = vips_streami_new_from_file( filename )) ) return( NULL ); vips_error_freeze(); @@ -2678,7 +2678,7 @@ vips_image_write_to_file( VipsImage *image, const char *name, ... ) if( (operation_name = vips_foreign_find_save_stream( filename )) ) { VipsStreamo *streamo; - if( !(streamo = vips_streamo_new_to_filename( filename )) ) + if( !(streamo = vips_streamo_new_to_file( filename )) ) return( -1 ); va_start( ap, name ); diff --git a/libvips/iofuncs/streami.c b/libvips/iofuncs/streami.c index 446153ef..1ba9c6d7 100644 --- a/libvips/iofuncs/streami.c +++ b/libvips/iofuncs/streami.c @@ -363,7 +363,7 @@ vips_streami_new_from_descriptor( int descriptor ) } /** - * vips_streami_new_from_filename: + * vips_streami_new_from_file: * @descriptor: read from this filename * * Create an streami stream attached to a file. @@ -371,11 +371,11 @@ vips_streami_new_from_descriptor( int descriptor ) * Returns: a new #VipsStream */ VipsStreami * -vips_streami_new_from_filename( const char *filename ) +vips_streami_new_from_file( const char *filename ) { VipsStreami *streami; - VIPS_DEBUG_MSG( "vips_streami_new_from_filename: %s\n", + VIPS_DEBUG_MSG( "vips_streami_new_from_file: %s\n", filename ); streami = VIPS_STREAMI( g_object_new( VIPS_TYPE_STREAMI, diff --git a/libvips/iofuncs/streamo.c b/libvips/iofuncs/streamo.c index 274798f4..1c7394b0 100644 --- a/libvips/iofuncs/streamo.c +++ b/libvips/iofuncs/streamo.c @@ -209,7 +209,7 @@ vips_streamo_init( VipsStreamo *streamo ) * Create a stream attached to a file descriptor. * @descriptor is kept open until the #VipsStreamo is finalized. * - * See also: vips_streamo_new_to_filename(). + * See also: vips_streamo_new_to_file(). * * Returns: a new #VipsStreamo */ @@ -234,7 +234,7 @@ vips_streamo_new_to_descriptor( int descriptor ) } /** - * vips_streamo_new_to_filename: + * vips_streamo_new_to_file: * @filename: write to this file * * Create a stream attached to a file. @@ -242,11 +242,11 @@ vips_streamo_new_to_descriptor( int descriptor ) * Returns: a new #VipsStreamo */ VipsStreamo * -vips_streamo_new_to_filename( const char *filename ) +vips_streamo_new_to_file( const char *filename ) { VipsStreamo *streamo; - VIPS_DEBUG_MSG( "vips_streamo_new_to_filename: %s\n", + VIPS_DEBUG_MSG( "vips_streamo_new_to_file: %s\n", filename ); streamo = VIPS_STREAMO( g_object_new( VIPS_TYPE_STREAMO, @@ -267,7 +267,7 @@ vips_streamo_new_to_filename( const char *filename ) * Create a stream which will stream to a memory area. Read from @blob to get * memory. * - * See also: vips_streamo_new_to_filename(). + * See also: vips_streamo_new_to_file(). * * Returns: a new #VipsStream */ diff --git a/test/test_descriptors.c b/test/test_descriptors.c index 27950e6e..9ef919b5 100644 --- a/test/test_descriptors.c +++ b/test/test_descriptors.c @@ -57,7 +57,7 @@ main( int argc, char **argv ) /* Opening an image should read the header, then close the fd. */ printf( "** seq open ..\n" ); - if( !(streami = vips_streami_new_from_filename( argv[1] )) ) + if( !(streami = vips_streami_new_from_file( argv[1] )) ) vips_error_exit( NULL ); if( !(image = vips_image_new_from_stream( streami, "", "access", VIPS_ACCESS_SEQUENTIAL,