diff --git a/ChangeLog b/ChangeLog index f8ef4db3..033e8824 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ - C API supports optional output args - switch back to int-valued operations - fix up VipsPool +- add the operation cache +- fallback vips_init() 10/8/11 started 7.26.3 - don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this diff --git a/TODO b/TODO index ff1c1b29..a63c5a09 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,4 @@ -- cache - - -- im_init_world() fallback is not working - - need to go back to multiple ifs in object.c +- cache work ... see notes in file diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h index 9106c0a8..edb098a2 100644 --- a/libvips/include/vips/vips.h +++ b/libvips/include/vips/vips.h @@ -149,6 +149,7 @@ extern "C" { const char *vips_get_argv0( void ); int vips_init( const char *argv0 ); +void vips_check_init( void ); GOptionGroup *vips_get_option_group( void ); const char *vips_version_string( void ); diff --git a/libvips/iofuncs/cache.c b/libvips/iofuncs/cache.c index 85b31fe9..7f336803 100644 --- a/libvips/iofuncs/cache.c +++ b/libvips/iofuncs/cache.c @@ -44,8 +44,8 @@ */ /* - */ #define VIPS_DEBUG + */ #ifdef HAVE_CONFIG_H #include diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 9eaf9306..9c8789a2 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -299,6 +299,8 @@ vips_image_new_from_file_object( const char *string ) { VipsImage *image; + vips_check_init(); + /* We mustn't _build() the object here, so we can't just call * vips_image_new_from_file(). */ @@ -1409,6 +1411,8 @@ vips_image_new( void ) { VipsImage *image; + vips_check_init(); + image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) ); g_object_set( image, "filename", vips_image_temp_name(), @@ -1562,6 +1566,8 @@ vips_image_new_mode( const char *filename, const char *mode ) { VipsImage *image; + vips_check_init(); + image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) ); g_object_set( image, "filename", filename, @@ -1616,6 +1622,8 @@ vips_image_new_from_file_raw( const char *filename, { VipsImage *image; + vips_check_init(); + image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) ); g_object_set( image, "filename", filename, @@ -1655,6 +1663,8 @@ vips_image_new_from_memory( void *buffer, { VipsImage *image; + vips_check_init(); + image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) ); g_object_set( image, "filename", vips_image_temp_name(), diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index b35c57e1..94f058e5 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -262,8 +262,11 @@ vips_init( const char *argv0 ) return( 0 ); } -const char * -vips__gettext( const char *msgid ) +/* Call this before vips stuff that uses stuff we need to have inited. + * Fallback initialisation. + */ +void +vips_check_init( void ) { /* Pass in a nonsense name for argv0 ... this init path is only here * for old programs which are missing an vips_init() call. We need @@ -271,6 +274,12 @@ vips__gettext( const char *msgid ) */ if( vips_init( "giant_banana" ) ) vips_error_clear(); +} + +const char * +vips__gettext( const char *msgid ) +{ + vips_check_init(); return( dgettext( GETTEXT_PACKAGE, msgid ) ); } @@ -278,8 +287,7 @@ vips__gettext( const char *msgid ) const char * vips__ngettext( const char *msgid, const char *plural, unsigned long int n ) { - if( vips_init( "giant_banana" ) ) - vips_error_clear(); + vips_check_init(); return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) ); } diff --git a/libvips/iofuncs/pool.c b/libvips/iofuncs/pool.c index 069dacda..1f422703 100644 --- a/libvips/iofuncs/pool.c +++ b/libvips/iofuncs/pool.c @@ -175,6 +175,8 @@ vips_pool_new( const char *name ) { VipsPool *pool; + vips_check_init(); + pool = VIPS_POOL( g_object_new( VIPS_TYPE_POOL, NULL ) ); pool->name = name;