From 9b3d0819946319c1a3f63099049b66f26f9c3ed7 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 27 Oct 2010 15:49:57 +0000 Subject: [PATCH] oops, init status --- TODO | 4 ++++ libvips/format/fits.c | 10 +++++++++- libvips/iofuncs/im_open.c | 24 ++++-------------------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/TODO b/TODO index 4fd3dd3d..a6e44a70 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,10 @@ - are we triggering im_fits2vips() in each thread?? argh, try tracing + + + + - maybe im_draw_smudge() is too slow :-( also, we had a sanity failure with it, argh diff --git a/libvips/format/fits.c b/libvips/format/fits.c index aee29049..aaf0ebb5 100644 --- a/libvips/format/fits.c +++ b/libvips/format/fits.c @@ -2,6 +2,8 @@ * * 26/10/10 * - from matlab.c + * 27/10/10 + * - oops, forgot to init status in close */ /* @@ -81,6 +83,8 @@ read_destroy( Read *read ) if( read->fptr ) { int status; + status = 0; + if( fits_close_file( read->fptr, &status ) ) read_error( status ); @@ -326,7 +330,7 @@ im_fits2vips( const char *filename, IMAGE *out ) Read *read; #ifdef DEBUG - printf( "fits2vips: reading \"%s\"\n", filename ); + printf( "im_fits2vips: reading \"%s\"\n", filename ); #endif /*DEBUG*/ if( !(read = read_new( filename, out )) ) @@ -348,6 +352,10 @@ isfits( const char *filename ) fitsfile *fptr; int status; +#ifdef DEBUG + printf( "isfits: testing \"%s\"\n", filename ); +#endif /*DEBUG*/ + status = 0; if( fits_open_image( &fptr, filename, READONLY, &status ) ) { diff --git a/libvips/iofuncs/im_open.c b/libvips/iofuncs/im_open.c index 90451695..ace1fa41 100644 --- a/libvips/iofuncs/im_open.c +++ b/libvips/iofuncs/im_open.c @@ -98,6 +98,8 @@ Modified: * - write to non-vips formats with a "written" callback * 29/7/10 * - disc open threshold stuff, open to disc mode + * 27/10/10 + * - oops, guess_size was unnecessary */ /* @@ -241,24 +243,6 @@ lazy_new( IMAGE *out, VipsFormatClass *format, gboolean disc ) return( lazy ); } -static size_t -guess_size( VipsFormatClass *format, const char *filename ) -{ - IMAGE *im; - size_t size; - - if( !(im = im_open( "header", "p" )) ) - return( 0 ); - if( format->header( filename, im ) ) { - im_close( im ); - return( 0 ); - } - size = IM_IMAGE_SIZEOF_LINE( im ) * im->Ysize; - im_close( im ); - - return( size ); -} - typedef struct { const char unit; int multiplier; @@ -345,9 +329,9 @@ lazy_image( Lazy *lazy ) disc_threshold() && !(vips_format_get_flags( lazy->format, lazy->out->filename ) & VIPS_FORMAT_PARTIAL) ) { - size_t size; + size_t size = IM_IMAGE_SIZEOF_LINE( lazy->out ) * + lazy->out->Ysize; - size = guess_size( lazy->format, lazy->out->filename ); if( size > disc_threshold() ) { if( !(im = im__open_temp( "%s.v" )) ) return( NULL );