From 0c28fc71d6a06db01c086496dd583a6749bc610b Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 24 May 2016 07:55:30 +0100 Subject: [PATCH] fix radsave oop, suffix was being set ono the base class --- ChangeLog | 1 + libvips/foreign/radiance.c | 5 +++-- libvips/foreign/radsave.c | 13 ++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 015e2746..64b4a1e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ - restore BandFmt on unpremultiply in vipsthumbnail - better python detection and build [Felix Bünemann] - max-alpha defaults to 65535 for RGB16/GREY16 +- added radsave_buffer [Henri Chain] 18/5/16 started 8.3.2 - more robust vips image reading diff --git a/libvips/foreign/radiance.c b/libvips/foreign/radiance.c index e6d97da0..15ec3abe 100644 --- a/libvips/foreign/radiance.c +++ b/libvips/foreign/radiance.c @@ -1311,9 +1311,10 @@ vips__rad_save( VipsImage *in, const char *filename ) return( -1 ); write->filename = vips_strdup( NULL, filename ); - write->fout = vips__file_open_write( filename, FALSE ); + write->fout = vips__file_open_write( filename, FALSE ); - if( !write->filename || !write->fout || + if( !write->filename || + !write->fout || vips2rad_put_header( write ) || vips2rad_put_data( write ) ) { write_destroy_file( write ); diff --git a/libvips/foreign/radsave.c b/libvips/foreign/radsave.c index 7a4d0871..e6b54412 100644 --- a/libvips/foreign/radsave.c +++ b/libvips/foreign/radsave.c @@ -87,7 +87,6 @@ vips_foreign_save_rad_class_init( VipsForeignSaveRadClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; - VipsForeignClass *foreign_class = (VipsForeignClass *) class; VipsForeignSaveClass *save_class = (VipsForeignSaveClass *) class; gobject_class->set_property = vips_object_set_property; @@ -96,8 +95,6 @@ vips_foreign_save_rad_class_init( VipsForeignSaveRadClass *class ) object_class->nickname = "radsave_base"; object_class->description = _( "save Radiance" ); - foreign_class->suffs = vips__rad_suffs; - save_class->saveable = VIPS_SAVEABLE_RGB; save_class->format_table = vips_foreign_save_rad_format_table; save_class->coding[VIPS_CODING_NONE] = FALSE; @@ -125,13 +122,13 @@ static int vips_foreign_save_rad_file_build( VipsObject *object ) { VipsForeignSave *save = (VipsForeignSave *) object; - VipsForeignSaveRadFile *rad_file = (VipsForeignSaveRadFile *) object; + VipsForeignSaveRadFile *file = (VipsForeignSaveRadFile *) object; if( VIPS_OBJECT_CLASS( vips_foreign_save_rad_file_parent_class )-> build( object ) ) return( -1 ); - if( vips__rad_save( save->ready, rad_file->filename ) ) + if( vips__rad_save( save->ready, file->filename ) ) return( -1 ); return( 0 ); @@ -142,10 +139,13 @@ vips_foreign_save_rad_file_class_init( VipsForeignSaveRadFileClass *class ) { GObjectClass *gobject_class = G_OBJECT_CLASS( class ); VipsObjectClass *object_class = (VipsObjectClass *) class; + VipsForeignClass *foreign_class = (VipsForeignClass *) class; gobject_class->set_property = vips_object_set_property; gobject_class->get_property = vips_object_get_property; + foreign_class->suffs = vips__rad_suffs; + object_class->nickname = "radsave"; object_class->description = _( "save image to Radiance file" ); object_class->build = vips_foreign_save_rad_file_build; @@ -260,7 +260,6 @@ vips_radsave( VipsImage *in, const char *filename, ... ) * @len: return output length here * @...: %NULL-terminated list of optional named arguments * - * * As vips_radsave(), but save to a memory buffer. * * The address of the buffer is returned in @obuf, the length of the buffer in @@ -297,4 +296,4 @@ vips_radsave_buffer( VipsImage *in, void **buf, size_t *len, ... ) } return( result ); -} \ No newline at end of file +}