This commit is contained in:
John Cupitt 2011-12-02 09:10:11 +00:00
parent 89a65c81d2
commit 30ec51699d
3 changed files with 39 additions and 13 deletions

15
TODO
View File

@ -1,7 +1,18 @@
- test load/save jpeg buffer
- try:
leaktest
$ vips copy x.jpg x.v
operation cache is printed twice ... once in atexit?
jpegload is not added
operation object print is unhelpful, we want a list of args, not a usage
message
- "header fred.tif" does not work, since header uses im_open() which uses
VipsForeign

View File

@ -46,8 +46,8 @@
*/
/*
#define VIPS_DEBUG
*/
#define VIPS_DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@ -409,6 +409,22 @@ vips_cache_init( void )
}
}
#ifdef VIPS_DEBUG
static void
vips_cache_print( void )
{
if( vips_cache_table ) {
GHashTableIter iter;
gpointer key, value;
printf( "Operation cache:\n" );
g_hash_table_iter_init( &iter, vips_cache_table );
while( g_hash_table_iter_next( &iter, &key, &value ) )
vips_object_print( VIPS_OBJECT( key ) );
}
}
#endif /*VIPS_DEBUG*/
static void *
vips_object_unref_arg( VipsObject *object,
GParamSpec *pspec,
@ -467,6 +483,10 @@ void
vips_cache_drop_all( void )
{
if( vips_cache_table ) {
#ifdef VIPS_DEBUG
vips_cache_print();
#endif /*VIPS_DEBUG*/
/* We can't modify the hash in the callback from
* g_hash_table_foreach() and friends. Repeatedly drop the
* first item instead.
@ -579,7 +599,7 @@ vips_cache_operation_build( VipsOperation **operation )
{
VipsOperation *hit;
VIPS_DEBUG_MSG( "vips_operation_build_cache: %p\n", *object );
VIPS_DEBUG_MSG( "vips_cache_operation_build: %p\n", *operation );
vips_cache_init();

View File

@ -93,14 +93,9 @@ static GOptionEntry main_option[] = {
/* A non-fatal error. Print the vips error buffer and continue.
*/
static void
print_error( const char *fmt, ... )
print_error( void )
{
va_list ap;
va_start( ap, fmt );
vfprintf( stderr, fmt, ap );
va_end( ap );
fprintf( stderr, "\n%s", im_error_buffer() );
fprintf( stderr, "%s: %s", g_get_prgname(), im_error_buffer() );
im_error_clear();
}
@ -252,13 +247,13 @@ main( int argc, char *argv[] )
IMAGE *im;
if( !(im = im_open( argv[i], "r" )) ) {
print_error( "%s: unable to open", argv[i] );
print_error();
result = 1;
}
if( im &&
print_header( im, argc > 2 ) ) {
print_error( "%s: unable to print header", argv[i] );
print_error();
result = 1;
}