rename new_from_filename as new_from_file

So VipsStreami matches VipsImage. Same for new_to_filename.
This commit is contained in:
John Cupitt 2019-11-22 17:13:20 +00:00
parent c91cfc4050
commit 562da3e5ab
23 changed files with 51 additions and 53 deletions

View File

@ -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 );

View File

@ -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();

View File

@ -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 ) ) {

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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 ) ) {

View File

@ -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,

View File

@ -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 );

View File

@ -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,

View File

@ -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 );
}

View File

@ -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 )->

View File

@ -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 );

View File

@ -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 );

View File

@ -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 ) ) {

View File

@ -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 );
}

View File

@ -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 ) ) {

View File

@ -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,

View File

@ -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 );

View File

@ -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 );

View File

@ -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,

View File

@ -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
*/

View File

@ -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,