diff --git a/TODO b/TODO index 70efef29..607175e2 100644 --- a/TODO +++ b/TODO @@ -4,7 +4,6 @@ foreign/vipsload.c uses vips_image_new_from_file() ... instead it should use the _mode thing - - likewise, vips_image_write_to_file() should take options. Implement in terms of vips_foreign_save()? @@ -13,6 +12,9 @@ see vips_foreign_load_buffer() for API +- do we still need all the vips_image_build() machinery? can't we just use + the foreign system? + diff --git a/libvips/foreign/vipsload.c b/libvips/foreign/vipsload.c index 2b1c4ea9..4a73d5f3 100644 --- a/libvips/foreign/vipsload.c +++ b/libvips/foreign/vipsload.c @@ -91,9 +91,7 @@ vips_foreign_load_vips_header( VipsForeignLoad *load ) VipsImage *out; VipsImage *out2; - vips_image_new_mode( filename, "r" ) ); - - if( !(out2 = vips_image_new_from_file( vips->filename )) ) + if( !(out2 = vips_image_new_mode( vips->filename, "r" ) ) return( -1 ); /* Remove the @out that's there now. diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index 507db029..d80f2881 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -417,7 +417,8 @@ void vips_image_set_kill( VipsImage *image, gboolean kill ); VipsImage *vips_image_new( void ); VipsImage *vips_image_new_mode( const char *filename, const char *mode ); VipsImage *vips_image_new_buffer( void ); -VipsImage *vips_image_new_from_file( const char *filename ); +VipsImage *vips_image_new_from_file( const char *filename, ... ) + __attribute__((sentinel)); VipsImage *vips_image_new_from_file_raw( const char *filename, int xsize, int ysize, int bands, guint64 offset ); VipsImage *vips_image_new_from_memory( void *buffer, @@ -428,7 +429,8 @@ void vips_image_set_delete_on_close( VipsImage *image, gboolean delete_on_close ); VipsImage *vips_image_new_temp_file( const char *format ); int vips_image_write( VipsImage *image, VipsImage *out ); -int vips_image_write_to_file( VipsImage *image, const char *filename ); +int vips_image_write_to_file( VipsImage *image, const char *filename, ... ) + __attribute__((sentinel)); int vips_image_decode_predict( VipsImage *im, int *bands, VipsBandFormat *format ); diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index 6ce54362..6092b507 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -90,7 +90,7 @@ * |[ * IMAGE *im; * - * if( !(im = vips_image_new_from_file( filename )) ) + * if( !(im = vips_image_new_from_file( filename, NULL )) ) * // vips_image_new_from_file() will set a message, we don't need to * return( -1 ); * diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index fac3bcc5..9fd7e998 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1016,7 +1016,7 @@ vips_image_class_init( VipsImageClass *class ) gobject_class->get_property = vips_object_get_property; vobject_class->new_from_string = vips_image_new_from_file_object; - vobject_class->to_string = vips_image_to_string;; + vobject_class->to_string = vips_image_to_string; vobject_class->output_needs_arg = TRUE; vobject_class->output_to_arg = vips_image_write_object; diff --git a/libvips/iofuncs/system.c b/libvips/iofuncs/system.c index ec3df1ce..f37d1fb0 100644 --- a/libvips/iofuncs/system.c +++ b/libvips/iofuncs/system.c @@ -221,7 +221,8 @@ vips_system_build( VipsObject *object ) if( system->out_name ) { VipsImage *out; - if( !(out = vips_image_new_from_file( system->out_name )) ) + if( !(out = vips_image_new_from_file( system->out_name, + NULL )) ) return( -1 ); vips_image_set_delete_on_close( out, TRUE ); g_object_set( system, "out", out, NULL ); diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index d8073f3e..390cbb77 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -799,7 +799,8 @@ transform_g_string_array_image( const GValue *src_value, GValue *dest_value ) str = g_value_dup_string( src_value ); for( i = 0, p = str; (q = vips_break_token( p, " " )); i++, p = q ) - if( !(array[i] = G_OBJECT( vips_image_new_from_file( p ) )) ) { + if( !(array[i] = G_OBJECT( vips_image_new_from_file( p, + NULL ) )) ) { /* Set the dest to length zero to indicate error. */ vips_value_set_array_object( dest_value, 0 );