oops, better filename set on foreign load

we were setting the filename in the wrong place
This commit is contained in:
John Cupitt 2014-06-10 13:46:05 +01:00
parent 72dc2e6371
commit c85dd26627
28 changed files with 39 additions and 22 deletions

9
TODO
View File

@ -1,3 +1,12 @@
- ban libgsf-1 1.14.26 and earlier
- mark VipsForeign and VipsWrap7 as deprecated, if they're not
don't display them in vips list classes
- can we use postbuild elsewhere? look at use of "preclose" / "written", etc. - can we use postbuild elsewhere? look at use of "preclose" / "written", etc.

View File

@ -591,8 +591,6 @@ vips__analyze_read( const char *filename, VipsImage *out )
} }
g_object_unref( x ); g_object_unref( x );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }

View File

@ -84,6 +84,8 @@ vips_foreign_load_analyze_header( VipsForeignLoad *load )
if( vips__analyze_read_header( analyze->filename, load->out ) ) if( vips__analyze_read_header( analyze->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, analyze->filename );
return( 0 ); return( 0 );
} }

View File

@ -348,7 +348,6 @@ vips__csv_read( const char *filename, VipsImage *out,
return( -1 ); return( -1 );
} }
fclose( fp ); fclose( fp );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }
@ -366,7 +365,6 @@ vips__csv_read_header( const char *filename, VipsImage *out,
return( -1 ); return( -1 );
} }
fclose( fp ); fclose( fp );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }
@ -708,7 +706,6 @@ vips__matrix_read( const char *filename )
return( NULL ); return( NULL );
out = vips__matrix_read_file( fp ); out = vips__matrix_read_file( fp );
fclose( fp ); fclose( fp );
VIPS_SETSTR( out->filename, filename );
return( out ); return( out );
} }

View File

@ -92,6 +92,8 @@ vips_foreign_load_csv_header( VipsForeignLoad *load )
csv->skip, csv->lines, csv->whitespace, csv->separator ) ) csv->skip, csv->lines, csv->whitespace, csv->separator ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, csv->filename );
return( 0 ); return( 0 );
} }

View File

@ -168,7 +168,6 @@ vips_fits_new_read( const char *filename, VipsImage *out, int band_select )
return( NULL ); return( NULL );
fits->filename = vips_strdup( NULL, filename ); fits->filename = vips_strdup( NULL, filename );
VIPS_SETSTR( out->filename, filename );
fits->image = out; fits->image = out;
fits->fptr = NULL; fits->fptr = NULL;
fits->lock = NULL; fits->lock = NULL;

View File

@ -74,6 +74,8 @@ vips_foreign_load_fits_header( VipsForeignLoad *load )
if( vips__fits_read_header( fits->filename, load->out ) ) if( vips__fits_read_header( fits->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, fits->filename );
return( 0 ); return( 0 );
} }

View File

@ -250,7 +250,6 @@ static int
readjpeg_file( ReadJpeg *jpeg, const char *filename ) readjpeg_file( ReadJpeg *jpeg, const char *filename )
{ {
jpeg->filename = g_strdup( filename ); jpeg->filename = g_strdup( filename );
VIPS_SETSTR( jpeg->out->filename, filename );
if( !(jpeg->eman.fp = vips__file_open_read( filename, NULL, FALSE )) ) if( !(jpeg->eman.fp = vips__file_open_read( filename, NULL, FALSE )) )
return( -1 ); return( -1 );
jpeg_stdio_src( &jpeg->cinfo, jpeg->eman.fp ); jpeg_stdio_src( &jpeg->cinfo, jpeg->eman.fp );

View File

@ -192,6 +192,8 @@ vips_foreign_load_jpeg_file_header( VipsForeignLoad *load )
TRUE, jpeg->shrink, jpeg->fail, FALSE ) ) TRUE, jpeg->shrink, jpeg->fail, FALSE ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, file->filename );
return( 0 ); return( 0 );
} }

View File

@ -158,7 +158,6 @@ read_new( const char *filename, VipsImage *im, gboolean all_frames )
if( !(read = VIPS_NEW( im, Read )) ) if( !(read = VIPS_NEW( im, Read )) )
return( NULL ); return( NULL );
read->filename = g_strdup( filename ); read->filename = g_strdup( filename );
VIPS_SETSTR( im->filename, filename );
read->all_frames = all_frames; read->all_frames = all_frames;
read->im = im; read->im = im;
read->image = NULL; read->image = NULL;

View File

@ -116,6 +116,8 @@ vips_foreign_load_magick_header( VipsForeignLoad *load )
load->out, magick->all_frames ) ) load->out, magick->all_frames ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, magick->filename );
return( 0 ); return( 0 );
} }

View File

@ -99,7 +99,6 @@ read_new( const char *filename, VipsImage *out )
return( NULL ); return( NULL );
read->filename = vips_strdup( NULL, filename ); read->filename = vips_strdup( NULL, filename );
VIPS_SETSTR( out->filename, filename );
read->out = out; read->out = out;
read->mat = NULL; read->mat = NULL;
read->var = NULL; read->var = NULL;

View File

@ -90,6 +90,8 @@ vips_foreign_load_mat_header( VipsForeignLoad *load )
if( vips__mat_header( mat->filename, load->out ) ) if( vips__mat_header( mat->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, mat->filename );
return( 0 ); return( 0 );
} }

View File

@ -99,6 +99,8 @@ vips_foreign_load_matrix_header( VipsForeignLoad *load )
vips_image_set_double( load->out, "scale", scale ); vips_image_set_double( load->out, "scale", scale );
vips_image_set_double( load->out, "offset", offset ); vips_image_set_double( load->out, "offset", offset );
VIPS_SETSTR( load->out->filename, matrix->filename );
return( 0 ); return( 0 );
} }

View File

@ -137,7 +137,6 @@ read_new( const char *filename, VipsImage *out )
if( !(read = VIPS_NEW( NULL, Read )) ) if( !(read = VIPS_NEW( NULL, Read )) )
return( NULL ); return( NULL );
read->filename = vips_strdup( NULL, filename ); read->filename = vips_strdup( NULL, filename );
VIPS_SETSTR( out->filename, filename );
read->out = out; read->out = out;
read->tiles = NULL; read->tiles = NULL;
read->lines = NULL; read->lines = NULL;

View File

@ -95,6 +95,8 @@ vips_foreign_load_openexr_header( VipsForeignLoad *load )
if( vips__openexr_read_header( openexr->filename, load->out ) ) if( vips__openexr_read_header( openexr->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, openexr->filename );
return( 0 ); return( 0 );
} }

View File

@ -285,7 +285,6 @@ readslide_new( const char *filename, VipsImage *out,
vips_image_init_fields( out, w, h, 4, VIPS_FORMAT_UCHAR, vips_image_init_fields( out, w, h, 4, VIPS_FORMAT_UCHAR,
VIPS_CODING_NONE, VIPS_INTERPRETATION_RGB, 1.0, 1.0 ); VIPS_CODING_NONE, VIPS_INTERPRETATION_RGB, 1.0, 1.0 );
VIPS_SETSTR( out->filename, filename );
for( properties = openslide_get_property_names( rslide->osr ); for( properties = openslide_get_property_names( rslide->osr );
*properties != NULL; properties++ ) *properties != NULL; properties++ )

View File

@ -112,6 +112,8 @@ vips_foreign_load_openslide_header( VipsForeignLoad *load )
openslide->level, openslide->associated ) ) openslide->level, openslide->associated ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, openslide->filename );
return( 0 ); return( 0 );
} }

View File

@ -96,6 +96,8 @@ vips_foreign_load_png_header( VipsForeignLoad *load )
if( vips__png_header( png->filename, load->out ) ) if( vips__png_header( png->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, png->filename );
return( 0 ); return( 0 );
} }

View File

@ -445,8 +445,6 @@ vips__ppm_header( const char *filename, VipsImage *out )
fclose( fp ); fclose( fp );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }
@ -495,8 +493,6 @@ vips__ppm_load( const char *filename, VipsImage *out )
fclose( fp ); fclose( fp );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }

View File

@ -86,6 +86,8 @@ vips_foreign_load_ppm_header( VipsForeignLoad *load )
if( vips__ppm_header( ppm->filename, load->out ) ) if( vips__ppm_header( ppm->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, ppm->filename );
return( 0 ); return( 0 );
} }

View File

@ -925,7 +925,6 @@ read_new( const char *filename, VipsImage *out )
return( NULL ); return( NULL );
read->filename = vips_strdup( NULL, filename ); read->filename = vips_strdup( NULL, filename );
VIPS_SETSTR( out->filename, filename );
read->out = out; read->out = out;
read->fin = NULL; read->fin = NULL;
strcpy( read->format, COLRFMT ); strcpy( read->format, COLRFMT );

View File

@ -88,6 +88,8 @@ vips_foreign_load_rad_header( VipsForeignLoad *load )
if( vips__rad_header( rad->filename, load->out ) ) if( vips__rad_header( rad->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, rad->filename );
return( 0 ); return( 0 );
} }

View File

@ -1691,7 +1691,6 @@ readtiff_new_filename( const char *filename, VipsImage *out, int page,
return( NULL ); return( NULL );
rtiff->filename = vips_strdup( VIPS_OBJECT( out ), filename ); rtiff->filename = vips_strdup( VIPS_OBJECT( out ), filename );
VIPS_SETSTR( out->filename, filename );
/* No mmap --- no performance advantage with libtiff, and it burns up /* No mmap --- no performance advantage with libtiff, and it burns up
* our VM if the tiff file is large. * our VM if the tiff file is large.

View File

@ -145,6 +145,8 @@ vips_foreign_load_tiff_file_header( VipsForeignLoad *load )
if( vips__tiff_read_header( file->filename, load->out, tiff->page ) ) if( vips__tiff_read_header( file->filename, load->out, tiff->page ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, file->filename );
return( 0 ); return( 0 );
} }

View File

@ -202,7 +202,6 @@ read_new_filename( VipsImage *out, const char *name, gboolean readbehind )
return( NULL ); return( NULL );
read->name = vips_strdup( VIPS_OBJECT( out ), name ); read->name = vips_strdup( VIPS_OBJECT( out ), name );
VIPS_SETSTR( out->filename, name );
if( !(read->fp = vips__file_open_read( name, NULL, FALSE )) ) if( !(read->fp = vips__file_open_read( name, NULL, FALSE )) )
return( NULL ); return( NULL );

View File

@ -207,8 +207,6 @@ vips__webp_read_file_header( const char *filename, VipsImage *out )
read_free( read ); read_free( read );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }
@ -264,8 +262,6 @@ vips__webp_read_file( const char *filename, VipsImage *out )
read_free( read ); read_free( read );
VIPS_SETSTR( out->filename, filename );
return( 0 ); return( 0 );
} }

View File

@ -43,6 +43,8 @@
#ifdef HAVE_LIBWEBP #ifdef HAVE_LIBWEBP
#include <string.h>
#include <vips/vips.h> #include <vips/vips.h>
#include "webp.h" #include "webp.h"
@ -130,6 +132,8 @@ vips_foreign_load_webp_file_header( VipsForeignLoad *load )
if( vips__webp_read_file_header( file->filename, load->out ) ) if( vips__webp_read_file_header( file->filename, load->out ) )
return( -1 ); return( -1 );
VIPS_SETSTR( load->out->filename, file->filename );
return( 0 ); return( 0 );
} }