small fixes

small fixes and we now pass all tests
This commit is contained in:
John Cupitt 2011-03-11 13:53:59 +00:00
parent 939ce4fd51
commit e17435c105
5 changed files with 39 additions and 20 deletions

6
TODO
View File

@ -1,9 +1,3 @@
- on rewind, we junk filename, argh
I guess we need to save and restore it
- tools/others/sines.c and friends can go

View File

@ -214,9 +214,9 @@ int im_add_callback( VipsImage *im,
#define im_add_preclose_callback( IM, FN, A, B ) \
im_add_callback( IM, "preclose", FN, A, B )
#define im_add_evalstart_callback( IM, FN, A, B ) \
im_add_callback( IM, "evalstart", FN, A, B )
im_add_callback( IM, "preeval", FN, A, B )
#define im_add_evalend_callback( IM, FN, A, B ) \
im_add_callback( IM, "evalend", FN, A, B )
im_add_callback( IM, "posteval", FN, A, B )
#define im_add_eval_callback( IM, FN, A, B ) \
im_add_callback( IM, "eval", FN, A, B )
#define im_add_invalidate_callback( IM, FN, A, B ) \

View File

@ -794,7 +794,7 @@ vips_attach_save( VipsImage *image, int (*save_fn)(), const char *filename )
*/
static int
vips_image_evalstart_cb( VipsImage *image, VipsProgress *progress, int *last )
vips_image_preeval_cb( VipsImage *image, VipsProgress *progress, int *last )
{
int tile_width;
int tile_height;
@ -830,7 +830,7 @@ vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
}
static int
vips_image_evalend_cb( VipsImage *image, VipsProgress *progress )
vips_image_posteval_cb( VipsImage *image, VipsProgress *progress )
{
/* Spaces at end help to erase the %complete message we overwrite.
*/
@ -852,12 +852,12 @@ vips_image_add_progress( VipsImage *image )
*/
int *last = VIPS_NEW( image, int );
g_signal_connect( image, "evalstart",
G_CALLBACK( vips_image_evalstart_cb ), last );
g_signal_connect( image, "preeval",
G_CALLBACK( vips_image_preeval_cb ), last );
g_signal_connect( image, "eval",
G_CALLBACK( vips_image_eval_cb ), last );
g_signal_connect( image, "evalend",
G_CALLBACK( vips_image_evalend_cb ), NULL );
g_signal_connect( image, "posteval",
G_CALLBACK( vips_image_posteval_cb ), NULL );
}
}
@ -1289,6 +1289,12 @@ vips_image_get_filename( VipsImage *image )
return( image->filename );
}
const char *
vips_image_get_mode( VipsImage *image )
{
return( image->mode );
}
size_t
vips_image_size( VipsImage *image )
{
@ -1451,6 +1457,20 @@ vips_image_set_kill( VipsImage *image, gboolean kill )
image->kill = kill;
}
/* Make a name for a filename-less image. Use immediately, don'#t free the
* result.
*/
static const char *
vips_image_temp_name( void )
{
static int serial = 0;
static char name[256];
im_snprintf( name, 256, "temp-%d", serial++ );
return( name );
}
/**
* vips_image_new:
* @mode: mode to open with
@ -1483,6 +1503,7 @@ vips_image_new( const char *mode )
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
g_object_set( image,
"filename", vips_image_temp_name(),
"mode", mode,
NULL );
if( vips_object_build( VIPS_OBJECT( image ) ) ) {
@ -1657,8 +1678,9 @@ vips_image_new_from_memory( void *buffer,
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
g_object_set( image,
"foreign_buffer", buffer,
"filename", vips_image_temp_name(),
"mode", "m",
"foreign_buffer", buffer,
"width", xsize,
"height", ysize,
"bands", bands,

View File

@ -194,8 +194,6 @@ vips_object_rewind( VipsObject *object )
static void
vips_argument_instance_free( VipsArgumentInstance *argument_instance )
{
printf( "vips_argument_instance_free\n" );
if( argument_instance->destroy_id ) {
g_signal_handler_disconnect( argument_instance->object,
argument_instance->destroy_id );
@ -384,10 +382,10 @@ vips_object_dispose_argument( VipsObject *object, GParamSpec *pspec,
void *a, void *b )
{
#ifdef DEBUG
#endif /*DEBUG*/
printf( "vips_object_dispose_argument: " );
vips_object_print( object );
printf( ".%s\n", pspec->name );
#endif /*DEBUG*/
g_assert( ((VipsArgument *) argument_class)->pspec == pspec );
g_assert( ((VipsArgument *) argument_instance)->pspec == pspec );
@ -420,9 +418,9 @@ vips_object_dispose( GObject *gobject )
VipsObject *object = VIPS_OBJECT( gobject );
#ifdef DEBUG
#endif /*DEBUG*/
printf( "vips_object_dispose: " );
vips_object_print( object );
#endif /*DEBUG*/
/* Our subclasses should have already called this. Run it again, just
* in case.
@ -812,9 +810,9 @@ static void
vips_object_real_rewind( VipsObject *object )
{
#ifdef DEBUG
#endif /*DEBUG*/
printf( "vips_object_rewind\n" );
vips_object_print( object );
#endif /*DEBUG*/
g_object_run_dispose( G_OBJECT( object ) );

View File

@ -68,6 +68,11 @@
#define DEBUG_LEAK
*/
/* Need to disable these sometimes.
*/
#undef DEBUG_FATAL
#undef DEBUG_LEAK
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/